Skip to content

Commit e1e2d92

Browse files
committed
Modified processMcRec in correlatorDsHadrons task
1 parent 8d79be4 commit e1e2d92

File tree

1 file changed

+77
-55
lines changed

1 file changed

+77
-55
lines changed

PWGHF/HFC/TableProducer/correlatorDsHadrons.cxx

Lines changed: 77 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ struct HfCorrelatorDsHadrons {
240240
ConfigurableAxis binsPhi{"binsPhi", {64, -PIHalf, 3. * PIHalf}, "#it{#varphi}"};
241241
ConfigurableAxis binsMultiplicity{"binsMultiplicity", {200, 0., 800.}, "Multiplicity"};
242242
ConfigurableAxis binsMultFT0M{"binsMultFT0M", {600, 0., 6000.}, "Multiplicity as FT0M signal amplitude"};
243+
ConfigurableAxis binsPid{"binsPid", {24, -12., 12.}, "n #sigma"};
243244
ConfigurableAxis binsPosZ{"binsPosZ", {100, -10., 10.}, "primary vertex z coordinate"};
244245
ConfigurableAxis binsPoolBin{"binsPoolBin", {9, 0., 9.}, "PoolBin"};
245246

@@ -257,7 +258,7 @@ struct HfCorrelatorDsHadrons {
257258
AxisSpec const axisPosZ = {binsPosZ, "PosZ"};
258259
AxisSpec const axisPoolBin = {binsPoolBin, "PoolBin"};
259260
AxisSpec const axisStatus = {15, 0.5, 15.5, "Selection status"};
260-
const AxisSpec axisPid{20, -10.f, 10.f, "n #sigma"};
261+
AxisSpec const axisPid{binsPid, "n #sigma"};
261262

262263
// Histograms for data analysis
263264
registry.add("hCollisionPoolBin", "Ds candidates collision pool bin", {HistType::kTH1F, {axisPoolBin}});
@@ -283,15 +284,15 @@ struct HfCorrelatorDsHadrons {
283284
registry.add("hTpcTofNSigmaPreSelPidPion", "n sigma tpc and tof for pion hypothesis", {HistType::kTH3F, {{axisPid}, {axisPid}, {axisPtHadron}}});
284285
registry.add("hTpcTofNSigmaPreSelPidKaon", "n sigma tpc and tof for kaon hypothesis", {HistType::kTH3F, {{axisPid}, {axisPid}, {axisPtHadron}}});
285286
registry.add("hTpcTofNSigmaPreSelPidProton", "n sigma tpc and tof for proton hypothesis", {HistType::kTH3F, {{axisPid}, {axisPid}, {axisPtHadron}}});
286-
registry.add("hTpcTofNSigmaPreSelPidPionM2", "n sigma tpc and tof for pion hypothesis", {HistType::kTH3F, {{axisPid}, {axisPid}, {axisPtHadron}}});
287-
registry.add("hTpcTofNSigmaPreSelPidKaonM2", "n sigma tpc and tof for kaon hypothesis", {HistType::kTH3F, {{axisPid}, {axisPid}, {axisPtHadron}}});
288-
registry.add("hTpcTofNSigmaPreSelPidProtonM2", "n sigma tpc and tof for proton hypothesis", {HistType::kTH3F, {{axisPid}, {axisPid}, {axisPtHadron}}});
287+
registry.add("hTpcTofNSigmaPreSelCombPion", "n sigma tpc and tof combined for pion hypothesis", {HistType::kTH2F, {{axisPid}, {axisPtHadron}}});
288+
registry.add("hTpcTofNSigmaPreSelCombKaon", "n sigma tpc and tof combined for kaon hypothesis", {HistType::kTH2F, {{axisPid}, {axisPtHadron}}});
289+
registry.add("hTpcTofNSigmaPreSelCombProton", "n sigma tpc and tof combined for proton hypothesis", {HistType::kTH2F, {{axisPid}, {axisPtHadron}}});
289290
registry.add("hTpcTofNSigmaPidPion", "n sigma tpc and tof for pion hypothesis", {HistType::kTH3F, {{axisPid}, {axisPid}, {axisPtHadron}}});
290291
registry.add("hTpcTofNSigmaPidKaon", "n sigma tpc and tof for kaon hypothesis", {HistType::kTH3F, {{axisPid}, {axisPid}, {axisPtHadron}}});
291292
registry.add("hTpcTofNSigmaPidProton", "n sigma tpc and tof for proton hypothesis", {HistType::kTH3F, {{axisPid}, {axisPid}, {axisPtHadron}}});
292-
registry.add("hTpcTofNSigmaPidPionM2", "n sigma tpc and tof for pion hypothesis", {HistType::kTH3F, {{axisPid}, {axisPid}, {axisPtHadron}}});
293-
registry.add("hTpcTofNSigmaPidKaonM2", "n sigma tpc and tof for kaon hypothesis", {HistType::kTH3F, {{axisPid}, {axisPid}, {axisPtHadron}}});
294-
registry.add("hTpcTofNSigmaPidProtonM2", "n sigma tpc and tof for proton hypothesis", {HistType::kTH3F, {{axisPid}, {axisPid}, {axisPtHadron}}});
293+
registry.add("hTpcTofNSigmaCombPion", "n sigma tpc and tof combined for pion hypothesis", {HistType::kTH2F, {{axisPid}, {axisPtHadron}}});
294+
registry.add("hTpcTofNSigmaCombKaon", "n sigma tpc and tof combined for kaon hypothesis", {HistType::kTH2F, {{axisPid}, {axisPtHadron}}});
295+
registry.add("hTpcTofNSigmaCombProton", "n sigma tpc and tof combined for proton hypothesis", {HistType::kTH2F, {{axisPid}, {axisPtHadron}}});
295296
}
296297
}
297298
// Histograms for MC Reco analysis
@@ -317,6 +318,15 @@ struct HfCorrelatorDsHadrons {
317318
registry.add("hMassDsMcRecSig", "Ds signal candidates - MC Reco", {HistType::kTH2F, {{axisMassD}, {axisPtD}}});
318319
registry.add("hMassDsMcRecBkg", "Ds background candidates - MC Reco", {HistType::kTH2F, {{axisMassD}, {axisPtD}}});
319320
registry.add("hFakeTracksMcRec", "Fake tracks - MC Rec", {HistType::kTH1F, {axisPtHadron}});
321+
if (pidTrkApplied) {
322+
registry.add("hTpcTofNSigmaPidPionMc", "n sigma tpc and tof for pion hypothesis", {HistType::kTH2F, {{axisPid}, {axisPtHadron}}});
323+
registry.add("hTpcTofNSigmaPidKaonMc", "n sigma tpc and tof for kaon hypothesis", {HistType::kTH2F, {{axisPid}, {axisPtHadron}}});
324+
registry.add("hTpcTofNSigmaPidProtonMc", "n sigma tpc and tof for proton hypothesis", {HistType::kTH2F, {{axisPid}, {axisPtHadron}}});
325+
registry.add("hTpcTofNSigmaCombPionMc", "n sigma tpc and tof combined for pion hypothesis", {HistType::kTH2F, {{axisPid}, {axisPtHadron}}});
326+
registry.add("hTpcTofNSigmaCombKaonMc", "n sigma tpc and tof combined for kaon hypothesis", {HistType::kTH2F, {{axisPid}, {axisPtHadron}}});
327+
registry.add("hTpcTofNSigmaCombProtonMc", "n sigma tpc and tof combined for proton hypothesis", {HistType::kTH2F, {{axisPid}, {axisPtHadron}}});
328+
registry.add("hPtIdPartTruthMcVsPt", "correctly identified particles with MC match", {HistType::kTH1F, {axisPtHadron}});
329+
}
320330
}
321331
// Histograms for MC Gen analysis
322332
if (fillHistoMcGen) {
@@ -598,6 +608,12 @@ struct HfCorrelatorDsHadrons {
598608
if (!track.isGlobalTrackWoDCA()) {
599609
continue;
600610
}
611+
if (!track.has_mcParticle()) { // remove traks that don't have a corresponding generated track
612+
registry.fill(HIST("hFakeTracksMcRec"), track.pt());
613+
continue;
614+
}
615+
auto mcParticle = track.template mcParticle_as<aod::McParticles>();
616+
bool isPhysicalPrimary = false;
601617
// apply PID selection
602618
if (pidTrkApplied) {
603619
if (!passPIDSelection(track, trkPIDspecies, pidTPCMax, pidTOFMax, tofPIDThreshold, forceTOF)) {
@@ -606,35 +622,41 @@ struct HfCorrelatorDsHadrons {
606622
registry.fill(HIST("hTpcTofNSigmaPidPionMc"), o2::aod::pidutils::tpcNSigma(o2::track::PID::Pion, track), o2::aod::pidutils::tofNSigma(o2::track::PID::Pion, track), track.pt());
607623
registry.fill(HIST("hTpcTofNSigmaPidKaonMc"), o2::aod::pidutils::tpcNSigma(o2::track::PID::Kaon, track), o2::aod::pidutils::tofNSigma(o2::track::PID::Kaon, track), track.pt());
608624
registry.fill(HIST("hTpcTofNSigmaPidProtonMc"), o2::aod::pidutils::tpcNSigma(o2::track::PID::Proton, track), o2::aod::pidutils::tofNSigma(o2::track::PID::Proton, track), track.pt());
625+
registry.fill(HIST("hTpcTofNSigmaCombPionMc"), std::sqrt(std::pow(o2::aod::pidutils::tpcNSigma(o2::track::PID::Pion, track), 2) + std::pow(o2::aod::pidutils::tofNSigma(o2::track::PID::Pion, track), 2)), track.pt());
626+
registry.fill(HIST("hTpcTofNSigmaCombKaonMc"), std::sqrt(std::pow(o2::aod::pidutils::tpcNSigma(o2::track::PID::Kaon, track), 2) + std::pow(o2::aod::pidutils::tofNSigma(o2::track::PID::Kaon, track), 2)), track.pt());
627+
registry.fill(HIST("hTpcTofNSigmaCombProtonMc"), std::sqrt(std::pow(o2::aod::pidutils::tpcNSigma(o2::track::PID::Proton, track), 2) + std::pow(o2::aod::pidutils::tofNSigma(o2::track::PID::Proton, track), 2)), track.pt());
628+
// MC truth match
629+
if (trkPIDspecies->at(0) == o2::track::PID::Kaon && mcParticle.pdgCode() != kKPlus) {
630+
continue;
631+
}
632+
if (trkPIDspecies->at(0) == o2::track::PID::Pion && mcParticle.pdgCode() != kPiPlus) {
633+
continue;
634+
}
635+
if (trkPIDspecies->at(0) == o2::track::PID::Proton && mcParticle.pdgCode() != kProton) {
636+
continue;
637+
}
638+
// Physical primary requirement
639+
if (mcParticle.isPhysicalPrimary()) {
640+
registry.fill(HIST("hPtIdPartTruthMcVsPt"), track.pt()); // keep track pt instead of mcpartcicle pt (used in efficiency)
641+
}
609642
}
610-
bool isPhysicalPrimary = false;
611643
// DsToKKPi and DsToPiKK division
612644
if (isCorrectInvMassHypo && candidate.isSelDsToKKPi() >= selectionFlagDs) {
613-
if (track.has_mcParticle()) {
614-
auto mcParticle = track.template mcParticle_as<aod::McParticles>();
615-
if (trkPIDspecies->at(0) == o2::track::PID::Kaon && mcParticle.pdgCode() != kKPlus) {
616-
continue;
617-
}
618-
if (trkPIDspecies->at(0) == o2::track::PID::Pion && mcParticle.pdgCode() != kPiPlus) {
619-
continue;
620-
}
621-
if (trkPIDspecies->at(0) == o2::track::PID::Proton && mcParticle.pdgCode() != kProton) {
622-
continue;
623-
}
624-
entryDsHadronPair(getDeltaPhi(track.phi(), candidate.phi()),
625-
track.eta() - candidate.eta(),
626-
candidate.pt() * chargeDs,
627-
track.pt() * track.sign(),
628-
poolBin,
629-
collision.numContrib());
630-
entryDsHadronRecoInfo(HfHelper::invMassDsToKKPi(candidate), isDsSignal, isDecayChan);
631-
entryDsHadronMlInfo(outputMl[0], outputMl[2]);
632-
isPhysicalPrimary = mcParticle.isPhysicalPrimary();
633-
auto trackOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle, true);
634-
entryDsHadronGenInfo(isDsPrompt, isPhysicalPrimary, trackOrigin);
635-
} else {
636-
registry.fill(HIST("hFakeTracksMcRec"), track.pt());
637-
}
645+
// if (track.has_mcParticle()) {
646+
entryDsHadronPair(getDeltaPhi(track.phi(), candidate.phi()),
647+
track.eta() - candidate.eta(),
648+
candidate.pt() * chargeDs,
649+
track.pt() * track.sign(),
650+
poolBin,
651+
collision.numContrib());
652+
entryDsHadronRecoInfo(HfHelper::invMassDsToKKPi(candidate), isDsSignal, isDecayChan);
653+
entryDsHadronMlInfo(outputMl[0], outputMl[2]);
654+
isPhysicalPrimary = mcParticle.isPhysicalPrimary();
655+
auto trackOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle, true);
656+
entryDsHadronGenInfo(isDsPrompt, isPhysicalPrimary, trackOrigin);
657+
//} else {
658+
// registry.fill(HIST("hFakeTracksMcRec"), track.pt());
659+
//}
638660
// for secondary particle fraction estimation
639661
if (!isAlreadyFilledEvent) {
640662
registry.fill(HIST("hPtParticleAssocVsCandMcRec"), track.pt(), candidate.pt());
@@ -644,22 +666,22 @@ struct HfCorrelatorDsHadrons {
644666
}
645667
entryTrackRecoInfo(track.dcaXY(), track.dcaZ(), track.tpcNClsCrossedRows());
646668
} else if (isCorrectInvMassHypo && candidate.isSelDsToPiKK() >= selectionFlagDs) {
647-
if (track.has_mcParticle()) {
648-
auto mcParticle = track.template mcParticle_as<aod::McParticles>();
649-
entryDsHadronPair(getDeltaPhi(track.phi(), candidate.phi()),
650-
track.eta() - candidate.eta(),
651-
candidate.pt() * chargeDs,
652-
track.pt() * track.sign(),
653-
poolBin,
654-
collision.numContrib());
655-
entryDsHadronRecoInfo(HfHelper::invMassDsToPiKK(candidate), isDsSignal, isDecayChan);
656-
entryDsHadronMlInfo(outputMl[0], outputMl[2]);
657-
isPhysicalPrimary = mcParticle.isPhysicalPrimary();
658-
auto trackOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle, true);
659-
entryDsHadronGenInfo(isDsPrompt, isPhysicalPrimary, trackOrigin);
660-
} else {
661-
registry.fill(HIST("hFakeTracksMcRec"), track.pt());
662-
}
669+
// if (track.has_mcParticle()) {
670+
auto mcParticle = track.template mcParticle_as<aod::McParticles>();
671+
entryDsHadronPair(getDeltaPhi(track.phi(), candidate.phi()),
672+
track.eta() - candidate.eta(),
673+
candidate.pt() * chargeDs,
674+
track.pt() * track.sign(),
675+
poolBin,
676+
collision.numContrib());
677+
entryDsHadronRecoInfo(HfHelper::invMassDsToPiKK(candidate), isDsSignal, isDecayChan);
678+
entryDsHadronMlInfo(outputMl[0], outputMl[2]);
679+
isPhysicalPrimary = mcParticle.isPhysicalPrimary();
680+
auto trackOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle, true);
681+
entryDsHadronGenInfo(isDsPrompt, isPhysicalPrimary, trackOrigin);
682+
//} else {
683+
// registry.fill(HIST("hFakeTracksMcRec"), track.pt());
684+
//}
663685
// for secondary particle fraction estimation
664686
if (!isAlreadyFilledEvent) {
665687
registry.fill(HIST("hPtParticleAssocVsCandMcRec"), track.pt(), candidate.pt());
@@ -862,19 +884,19 @@ struct HfCorrelatorDsHadrons {
862884
registry.fill(HIST("hTpcTofNSigmaPreSelPidPion"), track.tpcNSigmaPi(), track.tofNSigmaPi(), track.pt());
863885
registry.fill(HIST("hTpcTofNSigmaPreSelPidKaon"), track.tpcNSigmaKa(), track.tofNSigmaKa(), track.pt());
864886
registry.fill(HIST("hTpcTofNSigmaPreSelPidProton"), track.tpcNSigmaPr(), track.tofNSigmaPr(), track.pt());
865-
registry.fill(HIST("hTpcTofNSigmaPreSelPidPionM2"), o2::aod::pidutils::tpcNSigma(o2::track::PID::Pion, track), o2::aod::pidutils::tofNSigma(o2::track::PID::Pion, track), track.pt());
866-
registry.fill(HIST("hTpcTofNSigmaPreSelPidKaonM2"), o2::aod::pidutils::tpcNSigma(o2::track::PID::Kaon, track), o2::aod::pidutils::tofNSigma(o2::track::PID::Kaon, track), track.pt());
867-
registry.fill(HIST("hTpcTofNSigmaPreSelPidProtonM2"), o2::aod::pidutils::tpcNSigma(o2::track::PID::Proton, track), o2::aod::pidutils::tofNSigma(o2::track::PID::Proton, track), track.pt());
887+
registry.fill(HIST("hTpcTofNSigmaPreSelCombPion"), std::sqrt(std::pow(o2::aod::pidutils::tpcNSigma(o2::track::PID::Pion, track), 2) + std::pow(o2::aod::pidutils::tofNSigma(o2::track::PID::Pion, track), 2)), track.pt());
888+
registry.fill(HIST("hTpcTofNSigmaPreSelCombKaon"), std::sqrt(std::pow(o2::aod::pidutils::tpcNSigma(o2::track::PID::Kaon, track), 2) + std::pow(o2::aod::pidutils::tofNSigma(o2::track::PID::Kaon, track), 2)), track.pt());
889+
registry.fill(HIST("hTpcTofNSigmaPreSelCombProton"), std::sqrt(std::pow(o2::aod::pidutils::tpcNSigma(o2::track::PID::Proton, track), 2) + std::pow(o2::aod::pidutils::tofNSigma(o2::track::PID::Proton, track), 2)), track.pt());
868890

869891
if (!passPIDSelection(track, trkPIDspecies, pidTPCMax, pidTOFMax, tofPIDThreshold, forceTOF)) {
870892
continue;
871893
}
872894
registry.fill(HIST("hTpcTofNSigmaPidPion"), track.tpcNSigmaPi(), track.tofNSigmaPi(), track.pt());
873895
registry.fill(HIST("hTpcTofNSigmaPidKaon"), track.tpcNSigmaKa(), track.tofNSigmaKa(), track.pt());
874896
registry.fill(HIST("hTpcTofNSigmaPidProton"), track.tpcNSigmaPr(), track.tofNSigmaPr(), track.pt());
875-
registry.fill(HIST("hTpcTofNSigmaPidPionM2"), o2::aod::pidutils::tpcNSigma(o2::track::PID::Pion, track), o2::aod::pidutils::tofNSigma(o2::track::PID::Pion, track), track.pt());
876-
registry.fill(HIST("hTpcTofNSigmaPidKaonM2"), o2::aod::pidutils::tpcNSigma(o2::track::PID::Kaon, track), o2::aod::pidutils::tofNSigma(o2::track::PID::Kaon, track), track.pt());
877-
registry.fill(HIST("hTpcTofNSigmaPidProtonM2"), o2::aod::pidutils::tpcNSigma(o2::track::PID::Proton, track), o2::aod::pidutils::tofNSigma(o2::track::PID::Proton, track), track.pt());
897+
registry.fill(HIST("hTpcTofNSigmaCombPion"), std::sqrt(std::pow(o2::aod::pidutils::tpcNSigma(o2::track::PID::Pion, track), 2) + std::pow(o2::aod::pidutils::tofNSigma(o2::track::PID::Pion, track), 2)), track.pt());
898+
registry.fill(HIST("hTpcTofNSigmaCombKaon"), std::sqrt(std::pow(o2::aod::pidutils::tpcNSigma(o2::track::PID::Kaon, track), 2) + std::pow(o2::aod::pidutils::tofNSigma(o2::track::PID::Kaon, track), 2)), track.pt());
899+
registry.fill(HIST("hTpcTofNSigmaCombProton"), std::sqrt(std::pow(o2::aod::pidutils::tpcNSigma(o2::track::PID::Proton, track), 2) + std::pow(o2::aod::pidutils::tofNSigma(o2::track::PID::Proton, track), 2)), track.pt());
878900
}
879901
assocTrackReduced(indexHfcReducedCollision, track.globalIndex(), track.phi(), track.eta(), track.pt() * track.sign());
880902
assocTrackSelInfo(indexHfcReducedCollision, track.tpcNClsCrossedRows(), track.itsClusterMap(), track.itsNCls(), track.dcaXY(), track.dcaZ());

0 commit comments

Comments
 (0)