From 72c5c7f6307bcd2bbf9a0c7485ec5ba809065644 Mon Sep 17 00:00:00 2001 From: Prottay Das Date: Wed, 29 Apr 2026 19:05:45 +0200 Subject: [PATCH 1/2] updated code for correlating hadrons from different event compared to mixed phi --- PWGCF/Tasks/correlations.cxx | 56 +++++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/PWGCF/Tasks/correlations.cxx b/PWGCF/Tasks/correlations.cxx index 279765c3ae1..36e421126dd 100644 --- a/PWGCF/Tasks/correlations.cxx +++ b/PWGCF/Tasks/correlations.cxx @@ -62,6 +62,7 @@ #include #include #include +#include #include #include @@ -115,6 +116,7 @@ struct CorrelationTask { O2_DEFINE_CONFIGURABLE(cfgEfficiencyAssociated, std::string, "", "CCDB path to efficiency object for associated particles") O2_DEFINE_CONFIGURABLE(cfgNoMixedEvents, int, 5, "Number of mixed events per event") + O2_DEFINE_CONFIGURABLE(cfgRejectMixedPhiProngEvents, bool, true, "Reject associated hadrons from either mixed-phi prong event") O2_DEFINE_CONFIGURABLE(cfgVerbosity, int, 1, "Verbosity level (0 = major, 1 = per collision)") @@ -127,6 +129,9 @@ struct CorrelationTask { O2_DEFINE_CONFIGURABLE(cfgPtCentDepMLbkgSel, std::vector, {}, "Bkg ML selection") O2_DEFINE_CONFIGURABLE(cfgPtCentDepMLpromptSel, std::vector, {}, "Prompt ML selection") + std::unordered_map cfTrackToCFCollision; + bool rejectMixedPhiProngEventsNow = false; + ConfigurableAxis axisVertex{"axisVertex", {7, -7, 7}, "vertex axis for histograms"}; ConfigurableAxis axisDeltaPhi{"axisDeltaPhi", {72, -PIHalf, PIHalf * 3}, "delta phi axis for histograms"}; ConfigurableAxis axisDeltaEta{"axisDeltaEta", {40, -2, 2}, "delta eta axis for histograms"}; @@ -390,7 +395,7 @@ struct CorrelationTask { { for (const auto& track1 : tracks1) { if constexpr (std::experimental::is_detected::value && std::experimental::is_detected::value) { - if (cfgDecayParticleMask != 0 && (cfgDecayParticleMask & (1u << static_cast(track1.decay()))) == 0u) + if (cfgDecayParticleMask != 0 && (cfgDecayParticleMask & (1u << static_cast(track1.decay()))) == 0u) continue; if constexpr (std::experimental::is_detected::value) { if (!passMLScore(track1)) @@ -511,6 +516,8 @@ struct CorrelationTask { using HasPartDaugh0Id = decltype(std::declval().cfParticleDaugh0Id()); template using HasPartDaugh1Id = decltype(std::declval().cfParticleDaugh1Id()); + template + using HasCFCollisionId = decltype(std::declval().cfCollisionId()); template bool passOutlier(CollType const& collision) @@ -654,6 +661,29 @@ struct CorrelationTask { continue; } } + + if (rejectMixedPhiProngEventsNow && cfgRejectMixedPhiProngEvents) { + if constexpr (std::experimental::is_detected::value && + std::experimental::is_detected::value && + std::experimental::is_detected::value && + std::experimental::is_detected::value) { + + if (track1.decay() == aod::cf2prongtrack::PhiToKKPID3Mixed) { + auto pr0 = cfTrackToCFCollision.find(track1.cfTrackProng0Id()); + auto pr1 = cfTrackToCFCollision.find(track1.cfTrackProng1Id()); + + if (pr0 != cfTrackToCFCollision.end() && + pr1 != cfTrackToCFCollision.end()) { + const auto assocColl = track2.cfCollisionId(); + + if (assocColl == pr0->second || assocColl == pr1->second) { + continue; + } + } + } + } + } + if constexpr (std::experimental::is_detected::value) { // skip those that are specifically chosen to be triggers if (!cfgMcTriggerPDGs->empty() && std::find(cfgMcTriggerPDGs->begin(), cfgMcTriggerPDGs->end(), track2.pdgCode()) != cfgMcTriggerPDGs->end()) continue; // TODO: fix cases like MC D0-D0 @@ -783,15 +813,16 @@ struct CorrelationTask { } // ML selection // last param is the weight - if (cfgMassAxis && (doprocessSame2Prong2Prong || doprocessMixed2Prong2Prong || doprocessSame2Prong2ProngML || doprocessMixed2Prong2ProngML) && !(doprocessSame2ProngDerived || doprocessSame2ProngDerivedML || doprocessMixed2ProngDerived || doprocessMixed2ProngDerivedML)) { + if (cfgMassAxis && (doprocessSame2Prong2Prong || doprocessMixed2Prong2Prong || doprocessSame2Prong2ProngML || doprocessMixed2Prong2ProngML) && !(doprocessSame2ProngDerived || doprocessSame2ProngDerivedML || doprocessMixed2ProngDerived || doprocessMixed2ProngDerivedML || doprocessMixed2ProngDerivedMixedPhi)) { if constexpr (std::experimental::is_detected::value && std::experimental::is_detected::value) target->getPairHist()->Fill(step, track1.eta() - track2.eta(), track2.pt(), track1.pt(), multiplicity, deltaPhi, posZ, track2.invMass(), track1.invMass(), associatedWeight); else LOGF(fatal, "Can not fill mass axis without invMass column. \n no mass for two particles"); } else if (cfgMassAxis) { - if constexpr (std::experimental::is_detected::value) + if constexpr (std::experimental::is_detected::value) { + // LOGF(info, "Filling pair hist with mass: step %d, pt1 %f, pt2 %f, invMass %f", static_cast(step), track1.pt(), track2.pt(), track1.invMass()); target->getPairHist()->Fill(step, track1.eta() - track2.eta(), track2.pt(), track1.pt(), multiplicity, deltaPhi, posZ, track1.invMass(), associatedWeight); - else if constexpr (std::experimental::is_detected::value) { + } else if constexpr (std::experimental::is_detected::value) { // TParticlePDG *p = pdg->GetParticle(track1.pdgCode()); //TODO: get the mass for the PDG properly target->getPairHist()->Fill(step, track1.eta() - track2.eta(), track2.pt(), track1.pt(), multiplicity, deltaPhi, posZ, 1.8, associatedWeight); // p->Mass() } else { @@ -1071,6 +1102,23 @@ struct CorrelationTask { processMixedDerivedT(collisions, p2tracks, tracks); } PROCESS_SWITCH(CorrelationTask, processMixed2ProngDerived, "Process mixed events on derived data", false); + void processMixed2ProngDerivedMixedPhi(DerivedCollisions const& collisions, + DerivedTracks const& tracks, + soa::Filtered const& p2tracks) + { + cfTrackToCFCollision.clear(); + cfTrackToCFCollision.reserve(tracks.size()); + + for (const auto& trk : tracks) { + cfTrackToCFCollision.emplace(trk.globalIndex(), trk.cfCollisionId()); + } + + rejectMixedPhiProngEventsNow = true; + processMixedDerivedT(collisions, p2tracks, tracks); + rejectMixedPhiProngEventsNow = false; + } + + PROCESS_SWITCH(CorrelationTask, processMixed2ProngDerivedMixedPhi, "Process mixed events for mixed-phi triggers", false); void processMixed2ProngDerivedML(DerivedCollisions const& collisions, DerivedTracks const& tracks, soa::Filtered> const& p2tracks) { From 5b44f117a25dc9b1316116416ffa2d955400d3f0 Mon Sep 17 00:00:00 2001 From: Prottay Das Date: Wed, 29 Apr 2026 19:23:39 +0200 Subject: [PATCH 2/2] updated code for correlating hadrons from different event compared to mixed phi also removing commented lines --- PWGCF/Tasks/correlations.cxx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/PWGCF/Tasks/correlations.cxx b/PWGCF/Tasks/correlations.cxx index 36e421126dd..2887df61338 100644 --- a/PWGCF/Tasks/correlations.cxx +++ b/PWGCF/Tasks/correlations.cxx @@ -395,7 +395,7 @@ struct CorrelationTask { { for (const auto& track1 : tracks1) { if constexpr (std::experimental::is_detected::value && std::experimental::is_detected::value) { - if (cfgDecayParticleMask != 0 && (cfgDecayParticleMask & (1u << static_cast(track1.decay()))) == 0u) + if (cfgDecayParticleMask != 0 && (cfgDecayParticleMask & (1u << static_cast(track1.decay()))) == 0u) continue; if constexpr (std::experimental::is_detected::value) { if (!passMLScore(track1)) @@ -820,10 +820,8 @@ struct CorrelationTask { LOGF(fatal, "Can not fill mass axis without invMass column. \n no mass for two particles"); } else if (cfgMassAxis) { if constexpr (std::experimental::is_detected::value) { - // LOGF(info, "Filling pair hist with mass: step %d, pt1 %f, pt2 %f, invMass %f", static_cast(step), track1.pt(), track2.pt(), track1.invMass()); target->getPairHist()->Fill(step, track1.eta() - track2.eta(), track2.pt(), track1.pt(), multiplicity, deltaPhi, posZ, track1.invMass(), associatedWeight); } else if constexpr (std::experimental::is_detected::value) { - // TParticlePDG *p = pdg->GetParticle(track1.pdgCode()); //TODO: get the mass for the PDG properly target->getPairHist()->Fill(step, track1.eta() - track2.eta(), track2.pt(), track1.pt(), multiplicity, deltaPhi, posZ, 1.8, associatedWeight); // p->Mass() } else { LOGF(fatal, "Can not fill mass axis without invMass column. Disable cfgMassAxis.");