Skip to content

Commit 6a8c6cd

Browse files
authored
[PWGEM/Dilepton] update treeCreatorElectronMLDDA.cxx (#11283)
1 parent d76ca62 commit 6a8c6cd

File tree

2 files changed

+73
-65
lines changed

2 files changed

+73
-65
lines changed

PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx

Lines changed: 72 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ using namespace o2::constants::physics;
5353
using MyCollisions = soa::Join<aod::Collisions, aod::EvSels>;
5454
using MyCollision = MyCollisions::iterator;
5555

56-
using MyTracks = soa::Join<aod::TracksIU, aod::TracksExtra, aod::TracksCovIU,
56+
using MyTracks = soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksCov,
5757
aod::pidTPCFullEl, aod::pidTPCFullMu, aod::pidTPCFullPi, aod::pidTPCFullKa, aod::pidTPCFullPr,
5858
aod::pidTOFFullEl, aod::pidTOFFullMu, aod::pidTOFFullPi, aod::pidTOFFullKa, aod::pidTOFFullPr, aod::pidTOFbeta>;
5959
using MyTrack = MyTracks::iterator;
@@ -98,12 +98,6 @@ struct TreeCreatorElectronMLDDA {
9898
{"V0/hTOFbeta_P_Ka", "TOF beta vs. p;p^{ITS-TPC} (GeV/c);TOF #beta", {HistType::kTH2F, {{500, 0, 5}, {220, 0, 1.1}}}},
9999
{"V0/hTOFbeta_P_Pr", "TOF beta vs. p;p^{ITS-TPC} (GeV/c);TOF #beta", {HistType::kTH2F, {{500, 0, 5}, {220, 0, 1.1}}}},
100100

101-
{"V0/hITSClusterSize_P_El", "mean ITS cluster size vs. p;p^{ITS-TPC} (GeV/c);<ITS cluster size> #times cos(#lambda)", {HistType::kTH2F, {{500, 0.f, 5.f}, {150, 0.0, 15}}}},
102-
{"V0/hITSClusterSize_P_Mu", "mean ITS cluster size vs. p;p^{ITS-TPC} (GeV/c);<ITS cluster size> #times cos(#lambda)", {HistType::kTH2F, {{500, 0.f, 5.f}, {150, 0.0, 15}}}},
103-
{"V0/hITSClusterSize_P_Pi", "mean ITS cluster size vs. p;p^{ITS-TPC} (GeV/c);<ITS cluster size> #times cos(#lambda)", {HistType::kTH2F, {{500, 0.f, 5.f}, {150, 0.0, 15}}}},
104-
{"V0/hITSClusterSize_P_Ka", "mean ITS cluster size vs. p;p^{ITS-TPC} (GeV/c);<ITS cluster size> #times cos(#lambda)", {HistType::kTH2F, {{500, 0.f, 5.f}, {150, 0.0, 15}}}},
105-
{"V0/hITSClusterSize_P_Pr", "mean ITS cluster size vs. p;p^{ITS-TPC} (GeV/c);<ITS cluster size> #times cos(#lambda)", {HistType::kTH2F, {{500, 0.f, 5.f}, {150, 0.0, 15}}}},
106-
107101
// {"PrimaryTrack/hTPCdEdx_P", "TPC dEdx vs. p;p^{ITS-TPC} (GeV/c);TPC dE/dx", {HistType::kTH2F, {{500, 0, 5}, {200, 0, 200}}}},
108102
// {"PrimaryTrack/hTOFbeta_P", "TOF beta vs. p;p^{ITS-TPC} (GeV/c);TOF #beta", {HistType::kTH2F, {{500, 0, 5}, {220, 0, 1.1}}}},
109103
// {"PrimaryTrack/hITSClusterSize_P", "mean ITS cluster size vs. p;p^{ITS-TPC} (GeV/c);<ITS cluster size> #times cos(#lambda)", {HistType::kTH2F, {{500, 0.f, 5.f}, {150, 0.0, 15}}}},
@@ -151,14 +145,17 @@ struct TreeCreatorElectronMLDDA {
151145
Configurable<double> d_bz_input{"d_bz_input", -999, "bz field, -999 is automatic"};
152146
Configurable<int> useMatCorrType{"useMatCorrType", 0, "0: none, 1: TGeo, 2: LUT"};
153147

154-
Configurable<float> downscaling_track{"downscaling_track", 1e-4, "down scaling factor to store track"};
148+
Configurable<float> downscaling_electron_primary{"downscaling_electron_primary", 1.1, "down scaling factor to store primary electron for validation"};
155149
Configurable<float> downscaling_electron{"downscaling_electron", 0.005, "down scaling factor to store electron"};
156150
Configurable<float> downscaling_pion{"downscaling_pion", 0.001, "down scaling factor to store pion"};
157151
Configurable<float> downscaling_kaon{"downscaling_kaon", 1.1, "down scaling factor to store kaon"};
158-
Configurable<float> downscaling_proton{"downscaling_proton", 0.01, "down scaling factor to store proton"};
159-
Configurable<bool> store_v0photons{"store_v0photons", true, "create training data from v0 photons"};
160-
Configurable<float> slope{"slope", 0.0185, "slope for m vs. phiv"};
161-
Configurable<float> intercept{"intercept", -0.0380, "intercept for m vs. phiv"};
152+
Configurable<float> downscaling_proton{"downscaling_proton", 0.005, "down scaling factor to store proton"};
153+
154+
Configurable<float> max_pin_for_downscaling_electron_primary{"max_pin_for_downscaling_electron_primary", 0.0, "max pin to apply down scaling factor to store primary electron for validation"};
155+
Configurable<float> max_pin_for_downscaling_electron{"max_pin_for_downscaling_electron", 2.0, "max pin to apply down scaling factor to store electron"};
156+
Configurable<float> max_pin_for_downscaling_pion{"max_pin_for_downscaling_pion", 2.0, "max pin to apply down scaling factor to store pion"};
157+
Configurable<float> max_pin_for_downscaling_kaon{"max_pin_for_downscaling_kaon", 0.0, "max pin to apply down scaling factor to store kaon"};
158+
Configurable<float> max_pin_for_downscaling_proton{"max_pin_for_downscaling_proton", 2.0, "max pin to apply down scaling factor to store proton"};
162159

163160
struct : ConfigurableGroup {
164161
std::string prefix = "trackcut_group";
@@ -216,6 +213,11 @@ struct TreeCreatorElectronMLDDA {
216213
Configurable<float> cfg_min_TOFNsigmaPr{"cfg_min_TOFNsigmaPr", -4, "min n sigma pr in TOF"};
217214
Configurable<float> cfg_max_TOFNsigmaPr{"cfg_max_TOFNsigmaPr", +4, "max n sigma pr in TOF"};
218215

216+
Configurable<float> cfg_min_TPCNsigmaEl_tight{"cfg_min_TPCNsigmaEl_tight", -2, "min n sigma e in TPC for pi0->eeg"};
217+
Configurable<float> cfg_max_TPCNsigmaEl_tight{"cfg_max_TPCNsigmaEl_tight", +2, "max n sigma e in TPC for pi0->eeg"};
218+
Configurable<float> cfg_min_TOFNsigmaEl_tight{"cfg_min_TOFNsigmaEl_tight", -2, "min n sigma e in TOF for pi0->eeg"};
219+
Configurable<float> cfg_max_TOFNsigmaEl_tight{"cfg_max_TOFNsigmaEl_tight", +2, "max n sigma e in TOF for pi0->eeg"};
220+
219221
Configurable<float> cfg_min_TPCNsigmaPi_tight{"cfg_min_TPCNsigmaPi_tight", -2, "min n sigma pi in TPC for Lambda and cascade"};
220222
Configurable<float> cfg_max_TPCNsigmaPi_tight{"cfg_max_TPCNsigmaPi_tight", +2, "max n sigma pi in TPC for Lambda and cascade"};
221223
Configurable<float> cfg_min_TPCNsigmaPr_tight{"cfg_min_TPCNsigmaPr_tight", -2, "min n sigma pr in TPC for cascade"};
@@ -245,6 +247,14 @@ struct TreeCreatorElectronMLDDA {
245247
Configurable<float> cfg_min_dcaxy_bachelor{"cfg_min_dcaxy_bachelor", 0.1, "min dca XY for bachelor in cm"};
246248
} cascadecuts;
247249

250+
struct : ConfigurableGroup {
251+
std::string prefix = "dalitzcut_group";
252+
Configurable<float> cfg_min_mass_ee{"cfg_min_mass_ee", 0.000, "min mass for ee from pi0 dalitz decay in GeV/c2"};
253+
Configurable<float> cfg_max_mass_ee{"cfg_max_mass_ee", 0.005, "max mass for ee from pi0 dalitz decay in GeV/c2"};
254+
Configurable<float> cfg_min_phiv_ee{"cfg_min_phiv_ee", 0.0, "min phiv for ee from pi0 dalitz decay in rad."};
255+
Configurable<float> cfg_max_phiv_ee{"cfg_max_phiv_ee", 2.0, "max phiv for ee from pi0 dalitz decay in rad."};
256+
} dalitzcuts;
257+
248258
int mRunNumber;
249259
float d_bz;
250260
Service<o2::ccdb::BasicCCDBManager> ccdb;
@@ -497,6 +507,14 @@ struct TreeCreatorElectronMLDDA {
497507
return is_Pr_TPC && is_Pr_TOF;
498508
}
499509

510+
template <typename TTrack>
511+
bool isElectronTight(TTrack const& track)
512+
{
513+
bool is_El_TPC = v0cuts.cfg_min_TPCNsigmaEl_tight < track.tpcNSigmaEl() && track.tpcNSigmaEl() < v0cuts.cfg_max_TPCNsigmaEl_tight;
514+
bool is_El_TOF = track.hasTOF() && (v0cuts.cfg_min_TOFNsigmaEl_tight < track.tofNSigmaEl() && track.tofNSigmaEl() < v0cuts.cfg_max_TOFNsigmaEl_tight); // TOFreq
515+
return is_El_TPC && is_El_TOF;
516+
}
517+
500518
template <typename TTrack>
501519
bool isPionTight(TTrack const& track)
502520
{
@@ -576,6 +594,8 @@ struct TreeCreatorElectronMLDDA {
576594
continue;
577595
}
578596

597+
// LOGF(info, "v0.globalIndex() = %d, v0.collisionId() = %d, v0.posTrackId() = %d, v0.negTrackId() = %d", v0.globalIndex(), v0.collisionId(), v0.posTrackId(), v0.negTrackId());
598+
579599
registry.fill(HIST("V0/hPCA"), v0.dcaV0daughters());
580600
registry.fill(HIST("V0/hCosPA"), v0.v0cosPA());
581601
registry.fill(HIST("V0/hAP"), v0.alpha(), v0.qtarm());
@@ -594,18 +614,18 @@ struct TreeCreatorElectronMLDDA {
594614
registry.fill(HIST("V0/hTOFbeta_P_Pi"), neg.p(), neg.beta());
595615
registry.fill(HIST("V0/hTPCdEdx_P_Pi"), pos.p(), pos.tpcSignal());
596616
registry.fill(HIST("V0/hTOFbeta_P_Pi"), pos.p(), pos.beta());
597-
if (dist01(engine) < downscaling_pion) {
617+
if (dist01(engine) < downscaling_pion && pos.tpcInnerParam() < max_pin_for_downscaling_pion) {
598618
fillTrackTable(collision, pos, static_cast<int>(o2::aod::pwgem::dilepton::PID_Label::kPion), static_cast<int>(o2::aod::pwgem::dilepton::Track_Type::kSecondary), false);
599619
}
600-
if (dist01(engine) < downscaling_pion) {
620+
if (dist01(engine) < downscaling_pion && neg.tpcInnerParam() < max_pin_for_downscaling_pion) {
601621
fillTrackTable(collision, neg, static_cast<int>(o2::aod::pwgem::dilepton::PID_Label::kPion), static_cast<int>(o2::aod::pwgem::dilepton::Track_Type::kSecondary), false);
602622
}
603623
}
604624
}
605625
if (isProton(pos) && isPionTight(neg)) {
606626
registry.fill(HIST("V0/hMassLambda"), v0.mLambda());
607627
if (v0cuts.cfg_min_mass_lambda < v0.mLambda() && v0.mLambda() < v0cuts.cfg_max_mass_lambda) {
608-
if (dist01(engine) < downscaling_proton) {
628+
if (dist01(engine) < downscaling_proton && pos.tpcInnerParam() < max_pin_for_downscaling_proton) {
609629
fillTrackTable(collision, pos, static_cast<int>(o2::aod::pwgem::dilepton::PID_Label::kProton), static_cast<int>(o2::aod::pwgem::dilepton::Track_Type::kSecondary), false);
610630
}
611631
registry.fill(HIST("V0/hTPCdEdx_P_Pr"), pos.p(), pos.tpcSignal());
@@ -615,22 +635,22 @@ struct TreeCreatorElectronMLDDA {
615635
if (isPionTight(pos) && isProton(neg)) {
616636
registry.fill(HIST("V0/hMassAntiLambda"), v0.mAntiLambda());
617637
if (v0cuts.cfg_min_mass_lambda < v0.mAntiLambda() && v0.mAntiLambda() < v0cuts.cfg_max_mass_lambda) {
618-
if (dist01(engine) < downscaling_proton) {
638+
if (dist01(engine) < downscaling_proton && neg.tpcInnerParam() < max_pin_for_downscaling_proton) {
619639
fillTrackTable(collision, neg, static_cast<int>(o2::aod::pwgem::dilepton::PID_Label::kProton), static_cast<int>(o2::aod::pwgem::dilepton::Track_Type::kSecondary), false);
620640
}
621641
registry.fill(HIST("V0/hTPCdEdx_P_Pr"), neg.p(), neg.tpcSignal());
622642
registry.fill(HIST("V0/hTOFbeta_P_Pr"), neg.p(), neg.beta());
623643
}
624644
}
625-
if (isElectron(pos) && isElectron(neg) && store_v0photons) {
626-
registry.fill(HIST("V0/hMassGamma"), v0.mGamma());
627-
registry.fill(HIST("V0/hXY_Gamma"), v0.x(), v0.y());
628-
registry.fill(HIST("V0/hMassGamma_Rxy"), v0.v0radius(), v0.mGamma());
645+
registry.fill(HIST("V0/hMassGamma"), v0.mGamma());
646+
registry.fill(HIST("V0/hXY_Gamma"), v0.x(), v0.y());
647+
registry.fill(HIST("V0/hMassGamma_Rxy"), v0.v0radius(), v0.mGamma());
648+
if (isElectron(pos) && isElectron(neg)) {
629649
if ((v0cuts.cfg_min_mass_photon < v0.mGamma() && v0.mGamma() < v0cuts.cfg_max_mass_photon)) {
630-
if (dist01(engine) < downscaling_electron) {
650+
if (dist01(engine) < downscaling_electron && pos.tpcInnerParam() < max_pin_for_downscaling_electron) {
631651
fillTrackTable(collision, pos, static_cast<int>(o2::aod::pwgem::dilepton::PID_Label::kElectron), static_cast<int>(o2::aod::pwgem::dilepton::Track_Type::kSecondary), false);
632652
}
633-
if (dist01(engine) < downscaling_electron) {
653+
if (dist01(engine) < downscaling_electron && neg.tpcInnerParam() < max_pin_for_downscaling_electron) {
634654
fillTrackTable(collision, neg, static_cast<int>(o2::aod::pwgem::dilepton::PID_Label::kElectron), static_cast<int>(o2::aod::pwgem::dilepton::Track_Type::kSecondary), false);
635655
}
636656
registry.fill(HIST("V0/hTPCdEdx_P_El"), neg.p(), neg.tpcSignal());
@@ -641,40 +661,6 @@ struct TreeCreatorElectronMLDDA {
641661
}
642662
} // end of v0 loop
643663

644-
if (!store_v0photons) {
645-
auto posTracks_per_coll = posTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache);
646-
auto negTracks_per_coll = negTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache);
647-
for (const auto& [pos, neg] : combinations(CombinationsFullIndexPolicy(posTracks_per_coll, negTracks_per_coll))) {
648-
if (!isSelectedTrack(collision, pos) || !isSelectedTrack(collision, neg)) {
649-
continue;
650-
}
651-
652-
if (!isElectron(pos) || !isElectron(neg)) {
653-
continue;
654-
}
655-
656-
ROOT::Math::PtEtaPhiMVector v1(neg.pt(), neg.eta(), neg.phi(), o2::constants::physics::MassElectron);
657-
ROOT::Math::PtEtaPhiMVector v2(pos.pt(), pos.eta(), pos.phi(), o2::constants::physics::MassElectron);
658-
ROOT::Math::PtEtaPhiMVector v12 = v1 + v2;
659-
float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(pos.px(), pos.py(), pos.pz(), neg.px(), neg.py(), neg.pz(), pos.sign(), neg.sign(), d_bz);
660-
registry.fill(HIST("hMvsPhiV"), phiv, v12.M());
661-
662-
if (v12.M() < slope * phiv + intercept) { // photon conversion is found.
663-
registry.fill(HIST("V0/hTPCdEdx_P_El"), neg.p(), neg.tpcSignal());
664-
registry.fill(HIST("V0/hTOFbeta_P_El"), neg.p(), neg.beta());
665-
registry.fill(HIST("V0/hTPCdEdx_P_El"), pos.p(), pos.tpcSignal());
666-
registry.fill(HIST("V0/hTOFbeta_P_El"), pos.p(), pos.beta());
667-
668-
if (dist01(engine) < downscaling_electron) {
669-
fillTrackTable(collision, neg, static_cast<int>(o2::aod::pwgem::dilepton::PID_Label::kElectron), static_cast<int>(o2::aod::pwgem::dilepton::Track_Type::kPrimary), false); // secondary in primary electron candidates
670-
}
671-
if (dist01(engine) < downscaling_electron) {
672-
fillTrackTable(collision, pos, static_cast<int>(o2::aod::pwgem::dilepton::PID_Label::kElectron), static_cast<int>(o2::aod::pwgem::dilepton::Track_Type::kPrimary), false); // secondary in primary electron candidates
673-
}
674-
}
675-
} // end of ULS pair loop
676-
}
677-
678664
auto cascades_coll = cascades.sliceBy(perCollision_cascade, collision.globalIndex());
679665
for (const auto& cascade : cascades_coll) {
680666
// Track casting
@@ -755,23 +741,45 @@ struct TreeCreatorElectronMLDDA {
755741
if (cascadecuts.cfg_min_mass_Omega < cascade.mOmega() && cascade.mOmega() < cascadecuts.cfg_max_mass_Omega) { // select Omega candidates
756742
registry.fill(HIST("V0/hTPCdEdx_P_Ka"), bachelor.p(), bachelor.tpcSignal());
757743
registry.fill(HIST("V0/hTOFbeta_P_Ka"), bachelor.p(), bachelor.beta());
758-
if (dist01(engine) < downscaling_kaon) {
744+
if (dist01(engine) < downscaling_kaon && bachelor.tpcInnerParam() < max_pin_for_downscaling_kaon) {
759745
fillTrackTable(collision, bachelor, static_cast<int>(o2::aod::pwgem::dilepton::PID_Label::kKaon), static_cast<int>(o2::aod::pwgem::dilepton::Track_Type::kPrimary), false);
760746
}
761747
}
762748
}
763749
} // end of cascade loop
764750

765-
const auto& tracks_coll = tracks.sliceBy(perCollision_track, collision.globalIndex());
766-
for (const auto& track : tracks_coll) {
767-
if (isSelectedTrack(collision, track) && (v0cuts.cfg_min_TPCNsigmaEl < track.tpcNSigmaEl() && track.tpcNSigmaEl() < v0cuts.cfg_max_TPCNsigmaEl)) {
768-
if (dist01(engine) < downscaling_track) {
769-
fillTrackTable(collision, track, static_cast<int>(o2::aod::pwgem::dilepton::PID_Label::kUnDef), static_cast<int>(o2::aod::pwgem::dilepton::Track_Type::kPrimary), true);
770-
}
751+
// for electron sample for validation
752+
auto posTracks_per_coll = posTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache);
753+
auto negTracks_per_coll = negTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache);
754+
for (const auto& [pos, neg] : combinations(CombinationsFullIndexPolicy(posTracks_per_coll, negTracks_per_coll))) {
755+
if (!isSelectedTrack(collision, pos) || !isSelectedTrack(collision, neg)) {
756+
continue;
771757
}
772-
} // end of track loop
758+
if (!isElectron(pos) || !isElectron(neg)) {
759+
continue;
760+
}
761+
762+
ROOT::Math::PtEtaPhiMVector v1(neg.pt(), neg.eta(), neg.phi(), o2::constants::physics::MassElectron);
763+
ROOT::Math::PtEtaPhiMVector v2(pos.pt(), pos.eta(), pos.phi(), o2::constants::physics::MassElectron);
764+
ROOT::Math::PtEtaPhiMVector v12 = v1 + v2;
765+
float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(pos.px(), pos.py(), pos.pz(), neg.px(), neg.py(), neg.pz(), pos.sign(), neg.sign(), d_bz);
766+
registry.fill(HIST("hMvsPhiV"), phiv, v12.M());
773767

768+
if ((dalitzcuts.cfg_min_mass_ee < v12.M() && v12.M() < dalitzcuts.cfg_max_mass_ee) && (dalitzcuts.cfg_min_phiv_ee < phiv && phiv < dalitzcuts.cfg_max_phiv_ee)) { // ee from pi0 dalitz decay is found.
769+
if (isElectronTight(pos) && isElectron(neg)) {
770+
if (dist01(engine) < downscaling_electron_primary && neg.tpcInnerParam() < max_pin_for_downscaling_electron_primary) {
771+
fillTrackTable(collision, neg, static_cast<int>(o2::aod::pwgem::dilepton::PID_Label::kElectron), static_cast<int>(o2::aod::pwgem::dilepton::Track_Type::kPrimary), true); // primary electron candidates
772+
}
773+
}
774+
if (isElectron(pos) && isElectronTight(neg)) {
775+
if (dist01(engine) < downscaling_electron_primary && pos.tpcInnerParam() < max_pin_for_downscaling_electron_primary) {
776+
fillTrackTable(collision, pos, static_cast<int>(o2::aod::pwgem::dilepton::PID_Label::kElectron), static_cast<int>(o2::aod::pwgem::dilepton::Track_Type::kPrimary), true); // primary electron candidates
777+
}
778+
}
779+
}
780+
} // end of ULS pair loop
774781
} // end of collision loop
782+
775783
stored_trackIds.clear();
776784
stored_trackIds.shrink_to_fit();
777785
} // end of process

PWGEM/Dilepton/Tasks/taggingHFE.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ struct taggingHFE {
339339
fRegistry.addClone("Dpm/electron/", "Dpm/kaon/"); // D+ -> K- pi+ e+ nu, Br = 0.0402 | D+ -> anti-K*(892)0 e+ nu, Br = 0.0540 // D+ -> anti-K0S e+ nu, Br = 0.0872
340340
fRegistry.addClone("Ds/electron/", "Ds/kaon/"); // Ds+ -> K0S e+ nu, Br = 0.0034 // Ds+ -> phi e+ nu, Br = 0.0239
341341

342-
fRegistry.add("Generated/D0/prompt/hs", "#eta correlation from charm hadron;p_{T,e} (GeV/c);p_{T,K} (GeV/c);#eta_{e};#eta_{K};", kTHnSparseF, {{100, 0, 10}, {100, 0, 10}, {100, -5, +5}, {100, -5, 5}}, false);
342+
fRegistry.add("Generated/D0/prompt/hs", "#eta correlation from charm hadron;p_{T,e} (GeV/c);p_{T,K} (GeV/c);#eta_{e};#eta_{K};", kTHnSparseF, {{100, 0, 10}, {100, 0, 10}, {200, -10, +10}, {200, -10, 10}}, false);
343343
fRegistry.addClone("Generated/D0/prompt/", "Generated/D0/nonprompt/");
344344
}
345345

0 commit comments

Comments
 (0)