Skip to content

Commit 875e43a

Browse files
authored
[PWGEM/Dilepton] update taggingHFE.cxx (#15965)
1 parent ee6ab7d commit 875e43a

2 files changed

Lines changed: 93 additions & 14 deletions

File tree

PWGEM/Dilepton/DataModel/lmeeMLTables.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,40 @@ DECLARE_SOA_TABLE(EMFwdTrackErrsForML, "AOD", "EMFWDTRKERRML", //! Joinable with
192192
// iterators
193193
using EMFwdTrackErrForML = EMFwdTrackErrsForML::iterator;
194194

195+
// for SemiCharmTag at midrapidity, only electrons
196+
namespace emmllhpair
197+
{
198+
DECLARE_SOA_COLUMN(Signed1PtL, signed1PtL, float); //! signed1Pt of lepton
199+
DECLARE_SOA_COLUMN(EtaL, etaL, float); //! eta of lepton
200+
DECLARE_SOA_COLUMN(DcaL, dcaL, float); //! dca of lepton
201+
DECLARE_SOA_COLUMN(DcaLSigma, dcaLsigma, float); //! dca of lepton
202+
203+
DECLARE_SOA_COLUMN(Signed1PtH, signed1PtH, float); //! signed1Pt of hadron
204+
DECLARE_SOA_COLUMN(EtaH, etaH, float); //! eta of hadron
205+
DECLARE_SOA_COLUMN(DcaH, dcaH, float); //! dca of hadron
206+
DECLARE_SOA_COLUMN(DcaHSigma, dcaHsigma, float); //! dca resolution of hadron
207+
DECLARE_SOA_COLUMN(NSigmaKa, nSigmaKa, float); //! PID n sigma with respect to charged Kaon
208+
209+
DECLARE_SOA_COLUMN(Mass, mass, float); //! invariant mass of LH assuming kaon
210+
DECLARE_SOA_COLUMN(DcaLH, dcalh, float); //! DCA between lepton and hadron
211+
DECLARE_SOA_COLUMN(CosPA, cospa, float); //! flight direction of LH pair
212+
DECLARE_SOA_COLUMN(Lxyz, lxyz, float); //! decay length of LH pair
213+
DECLARE_SOA_COLUMN(LxyzSigma, lxyzSigma, float); //! decay length resolution of LH pair
214+
215+
DECLARE_SOA_COLUMN(PdgCodeH, pdgCodeH, int); //! pdg code of associated hadron
216+
DECLARE_SOA_COLUMN(PdgCodeHFH, pdgCodeHFH, int); //! pdg code of HF hadron
217+
} // namespace emmllhpair
218+
219+
DECLARE_SOA_TABLE(EMMLLHPairs, "AOD", "EMMLLHPAIR", //!
220+
o2::soa::Index<>, collision::NumContrib, evsel::NumTracksInTimeRange, evsel::SumAmpFT0CInTimeRange,
221+
emmllhpair::Signed1PtL, emmllhpair::EtaL, emmllhpair::DcaL, emmllhpair::DcaLSigma,
222+
emmllhpair::Signed1PtH, emmllhpair::EtaH, emmllhpair::DcaH, emmllhpair::DcaHSigma, emmllhpair::NSigmaKa,
223+
emmllhpair::Mass, emmllhpair::DcaLH, emmllhpair::CosPA, emmllhpair::Lxyz, emmllhpair::LxyzSigma,
224+
emmllhpair::PdgCodeH, emmllhpair::PdgCodeHFH);
225+
226+
// iterators
227+
using EMMLLHPair = EMMLLHPairs::iterator;
228+
195229
} // namespace o2::aod
196230

197231
#endif // PWGEM_DILEPTON_DATAMODEL_LMEEMLTABLES_H_

PWGEM/Dilepton/Tasks/taggingHFE.cxx

Lines changed: 59 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
/// \brief a task to study tagging e from charm hadron decays in MC
1414
/// \author daiki.sekihata@cern.ch
1515

16+
#include "PWGEM/Dilepton/DataModel/lmeeMLTables.h"
1617
#include "PWGEM/Dilepton/Utils/MCUtilities.h"
1718
#include "PWGEM/Dilepton/Utils/SemiCharmTag.h"
1819
#include "PWGLF/DataModel/LFStrangenessTables.h"
@@ -82,15 +83,7 @@ struct taggingHFE {
8283
using MyV0s = soa::Join<aod::V0Datas, aod::V0Covs>;
8384
using MyCascades = soa::Join<aod::CascDatas, aod::CascCovs>;
8485

85-
struct EBPair { // electron-baryon pair
86-
float mass{-999.f};
87-
float dca2legs{-999.f};
88-
float cospa{-999.f};
89-
float lxy{-999.f};
90-
float lz{-999.f};
91-
float ptepv{-999.f};
92-
float dca3dinsigma{-999.f};
93-
};
86+
Produces<aod::EMMLLHPairs> emmllhpair;
9487

9588
// Configurables
9689
Configurable<std::string> ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
@@ -124,8 +117,8 @@ struct taggingHFE {
124117
std::string prefix = "electronCut";
125118
Configurable<float> cfg_min_pt_track{"cfg_min_pt_track", 0.4, "min pT for single track"};
126119
Configurable<float> cfg_max_pt_track{"cfg_max_pt_track", 1e+10, "max pT for single track"};
127-
Configurable<float> cfg_min_eta_track{"cfg_min_eta_track", -0.5, "min eta for single track"};
128-
Configurable<float> cfg_max_eta_track{"cfg_max_eta_track", +0.5, "max eta for single track"};
120+
Configurable<float> cfg_min_eta_track{"cfg_min_eta_track", -0.8, "min eta for single track"};
121+
Configurable<float> cfg_max_eta_track{"cfg_max_eta_track", +0.8, "max eta for single track"};
129122
Configurable<float> cfg_min_cr2findable_ratio_tpc{"cfg_min_cr2findable_ratio_tpc", 0.8, "min. TPC Ncr/Nf ratio"};
130123
Configurable<float> cfg_max_frac_shared_clusters_tpc{"cfg_max_frac_shared_clusters_tpc", 0.7, "max fraction of shared clusters in TPC"};
131124
Configurable<int> cfg_min_ncrossedrows_tpc{"cfg_min_ncrossedrows_tpc", 80, "min ncrossed rows"};
@@ -658,9 +651,9 @@ struct taggingHFE {
658651
return false;
659652
}
660653

661-
if (!isKaon(track)) {
662-
return false;
663-
}
654+
// if (!isKaon(track)) {
655+
// return false;
656+
// }
664657

665658
return true;
666659
}
@@ -905,6 +898,20 @@ struct taggingHFE {
905898
}
906899
}
907900

901+
template <typename TTrack>
902+
float combinedNSigmaKa(TTrack const& track)
903+
{
904+
if (track.hasTOF()) {
905+
if (track.tpcNSigmaKa() > 0.f) {
906+
return std::sqrt((std::pow(track.tpcNSigmaKa(), 2) + std::pow(track.tofNSigmaKa(), 2)) / 2.);
907+
} else {
908+
return -1 * std::sqrt((std::pow(track.tpcNSigmaKa(), 2) + std::pow(track.tofNSigmaKa(), 2)) / 2.);
909+
}
910+
} else {
911+
return track.tpcNSigmaKa();
912+
}
913+
}
914+
908915
template <typename TMCParticle, typename TMCParticles>
909916
bool isSemiLeptonic(TMCParticle const& mcParticle, TMCParticles const& mcParticles, const int pdgLepton, const int pdgNeutrino, const int pdgStrHad)
910917
{
@@ -1123,7 +1130,10 @@ struct taggingHFE {
11231130
o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, leptonParCov, 2.f, matCorr, &mDcaInfoCov);
11241131
float dcaXY_lepton = mDcaInfoCov.getY();
11251132
float dcaZ_lepton = mDcaInfoCov.getZ();
1133+
float dca3D_lepton = std::hypot(dcaXY_lepton, dcaZ_lepton);
11261134
float dca3DinSigma_lepton = dca3DinSigmaOTF(dcaXY_lepton, dcaZ_lepton, leptonParCov.getSigmaY2(), leptonParCov.getSigmaZ2(), leptonParCov.getSigmaZY());
1135+
float sigma3D_lepton = dca3D_lepton / dca3DinSigma_lepton;
1136+
11271137
const auto& mcpos = pos.template mcParticle_as<aod::McParticles>();
11281138

11291139
// D0 -> e+ nu_e K-, br = 0.03538, ctau = 123.01 um, m = 1864 MeV/c2
@@ -1135,7 +1145,9 @@ struct taggingHFE {
11351145
o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov);
11361146
float dcaXY_kaon = mDcaInfoCov.getY();
11371147
float dcaZ_kaon = mDcaInfoCov.getZ();
1148+
float dca3D_kaon = std::hypot(dcaXY_kaon, dcaZ_kaon);
11381149
float dca3DinSigma_kaon = dca3DinSigmaOTF(dcaXY_kaon, dcaZ_kaon, trackParCov.getSigmaY2(), trackParCov.getSigmaZ2(), trackParCov.getSigmaZY());
1150+
float sigma3D_kaon = dca3D_kaon / dca3DinSigma_kaon;
11391151

11401152
if (positronId == kaonId) {
11411153
continue;
@@ -1162,6 +1174,20 @@ struct taggingHFE {
11621174
// const auto& mcD0 = mcParticles.rawIteratorAt(mcD0Id);
11631175
fRegistry.fill(HIST("MC/eKfromDpm/hs"), leptonParCov.getPt(), dca3DinSigma_lepton, trackParCov.getPt(), dca3DinSigma_kaon, eKpair.mass, eKpair.lxyz / eKpair.lxyzErr, eKpair.cospa, eKpair.dca2legs);
11641176
}
1177+
1178+
int mcMotherId = FindCommonMotherFrom2ProngsWithoutPDG(mcpos, mckaon);
1179+
int pdgCodeMother = 0;
1180+
if (mcMotherId > -1) {
1181+
auto mcMother = mcParticles.rawIteratorAt(mcMotherId);
1182+
pdgCodeMother = mcMother.pdgCode();
1183+
} else {
1184+
pdgCodeMother = 0;
1185+
}
1186+
emmllhpair(collision.numContrib(), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange(),
1187+
leptonParCov.getQ2Pt(), leptonParCov.getEta(), dca3D_lepton, sigma3D_lepton,
1188+
trackParCov.getQ2Pt(), trackParCov.getEta(), dca3D_kaon, sigma3D_kaon, combinedNSigmaKa(kaon),
1189+
eKpair.mass, eKpair.dca2legs, eKpair.cospa, eKpair.lxyz, eKpair.lxyzErr, mckaon.pdgCode(), pdgCodeMother);
1190+
11651191
} // end of kaon loop
11661192

11671193
// D+ -> e+ K0S nu_e
@@ -1300,7 +1326,10 @@ struct taggingHFE {
13001326
o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, leptonParCov, 2.f, matCorr, &mDcaInfoCov);
13011327
float dcaXY_lepton = mDcaInfoCov.getY();
13021328
float dcaZ_lepton = mDcaInfoCov.getZ();
1329+
float dca3D_lepton = std::hypot(dcaXY_lepton, dcaZ_lepton);
13031330
float dca3DinSigma_lepton = dca3DinSigmaOTF(dcaXY_lepton, dcaZ_lepton, leptonParCov.getSigmaY2(), leptonParCov.getSigmaZ2(), leptonParCov.getSigmaZY());
1331+
float sigma3D_lepton = dca3D_lepton / dca3DinSigma_lepton;
1332+
13041333
const auto& mcele = ele.template mcParticle_as<aod::McParticles>();
13051334

13061335
// D0bar -> e- anti-nu_e K+, br = 0.03538, ctau = 123.01 um, m = 1864 MeV/c2
@@ -1312,7 +1341,9 @@ struct taggingHFE {
13121341
o2::base::Propagator::Instance()->propagateToDCABxByBz(mVtx, trackParCov, 2.f, matCorr, &mDcaInfoCov);
13131342
float dcaXY_kaon = mDcaInfoCov.getY();
13141343
float dcaZ_kaon = mDcaInfoCov.getZ();
1344+
float dca3D_kaon = std::hypot(dcaXY_kaon, dcaZ_kaon);
13151345
float dca3DinSigma_kaon = dca3DinSigmaOTF(dcaXY_kaon, dcaZ_kaon, trackParCov.getSigmaY2(), trackParCov.getSigmaZ2(), trackParCov.getSigmaZY());
1346+
float sigma3D_kaon = dca3D_kaon / dca3DinSigma_kaon;
13161347

13171348
if (electronId == kaonId) {
13181349
continue;
@@ -1337,6 +1368,20 @@ struct taggingHFE {
13371368
// const auto& mcD0 = mcParticles.rawIteratorAt(mcD0Id);
13381369
fRegistry.fill(HIST("MC/eKfromDpm/hs"), leptonParCov.getPt(), dca3DinSigma_lepton, trackParCov.getPt(), dca3DinSigma_kaon, eKpair.mass, eKpair.lxyz / eKpair.lxyzErr, eKpair.cospa, eKpair.dca2legs);
13391370
}
1371+
1372+
int mcMotherId = FindCommonMotherFrom2ProngsWithoutPDG(mcele, mckaon);
1373+
int pdgCodeMother = 0;
1374+
if (mcMotherId > -1) {
1375+
auto mcMother = mcParticles.rawIteratorAt(mcMotherId);
1376+
pdgCodeMother = mcMother.pdgCode();
1377+
} else {
1378+
pdgCodeMother = 0;
1379+
}
1380+
emmllhpair(collision.numContrib(), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange(),
1381+
leptonParCov.getQ2Pt(), leptonParCov.getEta(), dca3D_lepton, sigma3D_lepton,
1382+
trackParCov.getQ2Pt(), trackParCov.getEta(), dca3D_kaon, sigma3D_kaon, combinedNSigmaKa(kaon),
1383+
eKpair.mass, eKpair.dca2legs, eKpair.cospa, eKpair.lxyz, eKpair.lxyzErr, mckaon.pdgCode(), pdgCodeMother);
1384+
13401385
} // end of kaon loop
13411386

13421387
// D- -> e0 anti-K0S anti-nu_e

0 commit comments

Comments
 (0)