Skip to content

Commit af298e3

Browse files
committed
PWGEM/Dilepton: update treeCreatorElectronMLDDA.cxx
1 parent e9304f1 commit af298e3

File tree

2 files changed

+60
-58
lines changed

2 files changed

+60
-58
lines changed

PWGEM/Dilepton/TableProducer/treeCreatorElectronMLDDA.cxx

Lines changed: 59 additions & 57 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,11 @@ 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"};
162153

163154
struct : ConfigurableGroup {
164155
std::string prefix = "trackcut_group";
@@ -216,6 +207,11 @@ struct TreeCreatorElectronMLDDA {
216207
Configurable<float> cfg_min_TOFNsigmaPr{"cfg_min_TOFNsigmaPr", -4, "min n sigma pr in TOF"};
217208
Configurable<float> cfg_max_TOFNsigmaPr{"cfg_max_TOFNsigmaPr", +4, "max n sigma pr in TOF"};
218209

210+
Configurable<float> cfg_min_TPCNsigmaEl_tight{"cfg_min_TPCNsigmaEl_tight", -2, "min n sigma e in TPC for pi0->eeg"};
211+
Configurable<float> cfg_max_TPCNsigmaEl_tight{"cfg_max_TPCNsigmaEl_tight", +2, "max n sigma e in TPC for pi0->eeg"};
212+
Configurable<float> cfg_min_TOFNsigmaEl_tight{"cfg_min_TOFNsigmaEl_tight", -2, "min n sigma e in TOF for pi0->eeg"};
213+
Configurable<float> cfg_max_TOFNsigmaEl_tight{"cfg_max_TOFNsigmaEl_tight", +2, "max n sigma e in TOF for pi0->eeg"};
214+
219215
Configurable<float> cfg_min_TPCNsigmaPi_tight{"cfg_min_TPCNsigmaPi_tight", -2, "min n sigma pi in TPC for Lambda and cascade"};
220216
Configurable<float> cfg_max_TPCNsigmaPi_tight{"cfg_max_TPCNsigmaPi_tight", +2, "max n sigma pi in TPC for Lambda and cascade"};
221217
Configurable<float> cfg_min_TPCNsigmaPr_tight{"cfg_min_TPCNsigmaPr_tight", -2, "min n sigma pr in TPC for cascade"};
@@ -245,6 +241,14 @@ struct TreeCreatorElectronMLDDA {
245241
Configurable<float> cfg_min_dcaxy_bachelor{"cfg_min_dcaxy_bachelor", 0.1, "min dca XY for bachelor in cm"};
246242
} cascadecuts;
247243

244+
struct : ConfigurableGroup {
245+
std::string prefix = "dalitzcut_group";
246+
Configurable<float> cfg_min_mass_ee{"cfg_min_mass_ee", 0.000, "min mass for ee from pi0 dalitz decay in GeV/c2"};
247+
Configurable<float> cfg_max_mass_ee{"cfg_max_mass_ee", 0.005, "max mass for ee from pi0 dalitz decay in GeV/c2"};
248+
Configurable<float> cfg_min_phiv_ee{"cfg_min_phiv_ee", 0.0, "min phiv for ee from pi0 dalitz decay in rad."};
249+
Configurable<float> cfg_max_phiv_ee{"cfg_max_phiv_ee", 2.0, "max phiv for ee from pi0 dalitz decay in rad."};
250+
} dalitzcuts;
251+
248252
int mRunNumber;
249253
float d_bz;
250254
Service<o2::ccdb::BasicCCDBManager> ccdb;
@@ -497,6 +501,14 @@ struct TreeCreatorElectronMLDDA {
497501
return is_Pr_TPC && is_Pr_TOF;
498502
}
499503

504+
template <typename TTrack>
505+
bool isElectronTight(TTrack const& track)
506+
{
507+
bool is_El_TPC = v0cuts.cfg_min_TPCNsigmaEl_tight < track.tpcNSigmaEl() && track.tpcNSigmaEl() < v0cuts.cfg_max_TPCNsigmaEl_tight;
508+
bool is_El_TOF = track.hasTOF() && (v0cuts.cfg_min_TOFNsigmaEl_tight < track.tofNSigmaEl() && track.tofNSigmaEl() < v0cuts.cfg_max_TOFNsigmaEl_tight); // TOFreq
509+
return is_El_TPC && is_El_TOF;
510+
}
511+
500512
template <typename TTrack>
501513
bool isPionTight(TTrack const& track)
502514
{
@@ -576,6 +588,8 @@ struct TreeCreatorElectronMLDDA {
576588
continue;
577589
}
578590

591+
// LOGF(info, "v0.globalIndex() = %d, v0.collisionId() = %d, v0.posTrackId() = %d, v0.negTrackId() = %d", v0.globalIndex(), v0.collisionId(), v0.posTrackId(), v0.negTrackId());
592+
579593
registry.fill(HIST("V0/hPCA"), v0.dcaV0daughters());
580594
registry.fill(HIST("V0/hCosPA"), v0.v0cosPA());
581595
registry.fill(HIST("V0/hAP"), v0.alpha(), v0.qtarm());
@@ -622,10 +636,10 @@ struct TreeCreatorElectronMLDDA {
622636
registry.fill(HIST("V0/hTOFbeta_P_Pr"), neg.p(), neg.beta());
623637
}
624638
}
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());
639+
registry.fill(HIST("V0/hMassGamma"), v0.mGamma());
640+
registry.fill(HIST("V0/hXY_Gamma"), v0.x(), v0.y());
641+
registry.fill(HIST("V0/hMassGamma_Rxy"), v0.v0radius(), v0.mGamma());
642+
if (isElectron(pos) && isElectron(neg)) {
629643
if ((v0cuts.cfg_min_mass_photon < v0.mGamma() && v0.mGamma() < v0cuts.cfg_max_mass_photon)) {
630644
if (dist01(engine) < downscaling_electron) {
631645
fillTrackTable(collision, pos, static_cast<int>(o2::aod::pwgem::dilepton::PID_Label::kElectron), static_cast<int>(o2::aod::pwgem::dilepton::Track_Type::kSecondary), false);
@@ -641,40 +655,6 @@ struct TreeCreatorElectronMLDDA {
641655
}
642656
} // end of v0 loop
643657

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-
678658
auto cascades_coll = cascades.sliceBy(perCollision_cascade, collision.globalIndex());
679659
for (const auto& cascade : cascades_coll) {
680660
// Track casting
@@ -762,16 +742,38 @@ struct TreeCreatorElectronMLDDA {
762742
}
763743
} // end of cascade loop
764744

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-
}
745+
// for electron sample for validation
746+
auto posTracks_per_coll = posTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache);
747+
auto negTracks_per_coll = negTracks->sliceByCached(o2::aod::track::collisionId, collision.globalIndex(), cache);
748+
for (const auto& [pos, neg] : combinations(CombinationsFullIndexPolicy(posTracks_per_coll, negTracks_per_coll))) {
749+
if (!isSelectedTrack(collision, pos) || !isSelectedTrack(collision, neg)) {
750+
continue;
751+
}
752+
if (!isElectron(pos) || !isElectron(neg)) {
753+
continue;
771754
}
772-
} // end of track loop
773755

756+
ROOT::Math::PtEtaPhiMVector v1(neg.pt(), neg.eta(), neg.phi(), o2::constants::physics::MassElectron);
757+
ROOT::Math::PtEtaPhiMVector v2(pos.pt(), pos.eta(), pos.phi(), o2::constants::physics::MassElectron);
758+
ROOT::Math::PtEtaPhiMVector v12 = v1 + v2;
759+
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);
760+
registry.fill(HIST("hMvsPhiV"), phiv, v12.M());
761+
762+
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.
763+
if (isElectronTight(pos) && isElectron(neg)) {
764+
if (dist01(engine) < downscaling_electron_primary) {
765+
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
766+
}
767+
}
768+
if (isElectron(pos) && isElectronTight(neg)) {
769+
if (dist01(engine) < downscaling_electron_primary) {
770+
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
771+
}
772+
}
773+
}
774+
} // end of ULS pair loop
774775
} // end of collision loop
776+
775777
stored_trackIds.clear();
776778
stored_trackIds.shrink_to_fit();
777779
} // 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)