From 84bf6aa3874e8907d5490329c07fc0eb569f1d47 Mon Sep 17 00:00:00 2001 From: scannito Date: Tue, 14 Apr 2026 15:53:49 +0200 Subject: [PATCH 1/5] Changes to accomodate online mult-integrated efficiency correction --- .../Strangeness/phiStrangeCorrelation.cxx | 208 ++++++++++++++---- 1 file changed, 169 insertions(+), 39 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx b/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx index 05074ea22df..d94889e5ad0 100644 --- a/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx +++ b/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx @@ -84,14 +84,19 @@ enum AnalysisMode { kDeltaYvsDeltaPhi }; -enum ParticleOfInterest { +enum AssociatedParticleType { + kK0S = 0, + kXi, + kPion, + kAssocPartSize +}; + +/*enum ParticleOfInterest { Phi = 0, K0S, Pion, - /*PionTPC, - PionTPCTOF*/ ParticleOfInterestSize -}; +};*/ /* #define LIST_OF_PARTICLES_OF_INTEREST \ @@ -121,7 +126,9 @@ static constexpr auto particleOfInterestLabels = std::to_array }); */ -struct BoundEfficiencyMap { +using EffMapPtr = std::variant, std::shared_ptr>; + +/*struct BoundEfficiencyMap { using CoordsTuple = std::tuple; const TH3* effMap; @@ -149,6 +156,58 @@ struct BoundEfficiencyMap { const auto& [x, y, z] = coords; return effMap->Interpolate(x, y, z); } +};*/ + +struct BoundEfficiencyMap { + using CoordsTuple = std::tuple; + + const EffMapPtr& effMap; + CoordsTuple coords; + + BoundEfficiencyMap(const EffMapPtr& effMap, float x, float y, float z) : effMap(effMap), coords(x, y, z) {} + BoundEfficiencyMap(const EffMapPtr& effMap, const CoordsTuple& coords) : effMap(effMap), coords(coords) {} + + float getBinEfficiency() const + { + return std::visit( + [this](auto&& mapPtr) -> float { + if (!mapPtr) + return 1.0f; + + const auto& [x, y, z] = coords; + + // Extract the actual histogram type (TH2 or TH3) held by the smart pointer + using HistoType = typename std::decay_t::element_type; + + // Compile-time branching: generates the exact correct function call + if constexpr (std::is_same_v) { + return mapPtr->GetBinContent(mapPtr->FindFixBin(y, z)); // 2D case only + } else { + return mapPtr->GetBinContent(mapPtr->FindFixBin(x, y, z)); // Full 3D case + } + }, + effMap); + } + + float interpolateEfficiency() const + { + return std::visit( + [this](auto&& mapPtr) -> float { + if (!mapPtr) + return 1.0f; + + const auto& [x, y, z] = coords; + + using HistoType = typename std::decay_t::element_type; + + if constexpr (std::is_same_v) { + return mapPtr->Interpolate(y, z); // Native 2D interpolation + } else { + return mapPtr->Interpolate(x, y, z); // Native 3D interpolation + } + }, + effMap); + } }; struct PhiStrangenessCorrelation { @@ -195,6 +254,12 @@ struct PhiStrangenessCorrelation { // Configurable on pion pT bins Configurable> binspTPi{"binspTPi", {0.2, 0.3, 0.4, 0.5, 0.6, 0.8, 1.0, 1.2, 1.5, 2.0, 3.0}, "pT bin limits for pions"}; + struct : ConfigurableGroup { + Configurable doK0SCorrelation{"doK0SCorrelation", true, "Enable Phi-K0S correlation"}; + Configurable doXiCorrelation{"doXiCorrelation", false, "Enable Phi-Xi correlation"}; + Configurable doPionCorrelation{"doPionCorrelation", true, "Enable Phi-Pion correlation"}; + } activeCorrelationConfigs; + // Configurables for delta y selection struct : ConfigurableGroup { Configurable nBinsY{"nBinsY", 20, "Number of bins in y axis"}; @@ -250,18 +315,22 @@ struct PhiStrangenessCorrelation { // Necessary service to retrieve efficiency maps from CCDB Service ccdb; - std::array, ParticleOfInterestSize> effMaps{}; + // std::shared_ptr effMapPhi{}; + // std::array, kAssocPartSize> effMapsAssoc{}; + + EffMapPtr effMapPhi{}; + std::array effMapsAssoc{}; // Binning policy and axes for mixed event - ConfigurableAxis axisVertexMixing{"axisVertexMixing", {20, -10, 10}, "Z vertex axis binning for mixing"}; - ConfigurableAxis axisCentralityMixing{"axisCentralityMixing", {20, 0, 100}, "Multiplicity percentil binning for mixing"}; + ConfigurableAxis axisVertexMixing{"axisVertexMixing", {10, -10.0f, 10.0f}, "Z vertex axis binning for mixing"}; + ConfigurableAxis axisCentralityMixing{"axisCentralityMixing", {VARIABLE_WIDTH, 0.0f, 1.0f, 5.0f, 10.0f, 15.0f, 20.0f, 30.0f, 40.0f, 50.0f, 70.0f, 100.0f}, "Multiplicity percentage binning for mixing"}; using BinningTypeVertexCent = ColumnBinningPolicy; BinningTypeVertexCent binningOnVertexAndCent{{axisVertexMixing, axisCentralityMixing}, true}; static constexpr std::array phiMassRegionLabels{"Signal", "Sideband"}; - static constexpr std::array particleOfInterestLabels{"Phi", "K0S", "Pion" /*"PionTPC", "PionTPCTOF"*/}; - static constexpr std::array assocParticleLabels{"K0S", "Pi"}; + // static constexpr std::array particleOfInterestLabels{"Phi", "K0S", "Pion" /*"PionTPC", "PionTPCTOF"*/}; + static constexpr std::array assocParticleLabels{"K0S", "Xi", "Pi"}; // Light structures to store only the necessary information for the correlation analysis at MCGen level struct MiniParticle { @@ -274,6 +343,7 @@ struct PhiStrangenessCorrelation { float multiplicity; std::vector phiParticles; std::vector k0sParticles; + std::vector xiParticles; std::vector pionParticles; }; @@ -348,21 +418,56 @@ struct PhiStrangenessCorrelation { ccdb->setLocalObjectValidityChecking(); ccdb->setFatalWhenNull(false); - for (int i = 0; i < ParticleOfInterestSize; ++i) { + /*for (int i = 0; i < ParticleOfInterestSize; ++i) { loadEfficiencyMapFromCCDB(static_cast(i)); - } + }*/ + loadEfficiencyMaps(); } eventBuffer.resize(binsMult->size() - 1); } - void loadEfficiencyMapFromCCDB(ParticleOfInterest poi) + void fetchSingleEfficiencyMapFromCCDB(EffMapPtr& effMap, std::string_view particleName) + { + std::string path = fmt::format("{}{}", ccdbEfficiencyPath.value, particleName); + + if (auto map3D = std::shared_ptr(ccdb->get(path))) { + effMap = map3D; + LOG(info) << "Efficiency map (TH3) for " << particleName << " loaded from CCDB"; + return; + } + + if (auto map2D = std::shared_ptr(ccdb->get(path))) { + effMap = map2D; + LOG(info) << "Efficiency map (TH2) for " << particleName << " loaded from CCDB"; + return; + } + + LOG(fatal) << "Could not load efficiency map (neither TH3 nor TH2) for " << particleName << " from CCDB!"; + } + + void loadEfficiencyMaps() + { + // Always load the Trigger (Phi) map + fetchSingleEfficiencyMapFromCCDB(effMapPhi, "Phi"); + + // Map the user configurations for the associated particles + bool doAssocCorrelations[kAssocPartSize] = {activeCorrelationConfigs.doK0SCorrelation, activeCorrelationConfigs.doXiCorrelation, activeCorrelationConfigs.doPionCorrelation}; + + // Only load the associated maps that are explicitly enabled + for (size_t i = 0; i < kAssocPartSize; ++i) { + if (doAssocCorrelations[i]) + fetchSingleEfficiencyMapFromCCDB(effMapsAssoc[i], assocParticleLabels[i]); + } + } + + /*void loadEfficiencyMapFromCCDB(ParticleOfInterest poi) { effMaps[poi] = std::shared_ptr(ccdb->get(fmt::format("{}{}", ccdbEfficiencyPath.value, particleOfInterestLabels[poi]))); if (!effMaps[poi]) LOG(fatal) << "Could not load efficiency map for " << particleOfInterestLabels[poi] << "!"; LOG(info) << "Efficiency map for " << particleOfInterestLabels[poi] << " loaded from CCDB"; - } + }*/ // Compute weight based on efficiencies template @@ -397,10 +502,14 @@ struct PhiStrangenessCorrelation { const std::array, 2> phiMassRegions = {phiConfigs.rangeMPhiSignal, phiConfigs.rangeMPhiSideband}; + bool doAssocCorrelations[kAssocPartSize] = {activeCorrelationConfigs.doK0SCorrelation, + activeCorrelationConfigs.doXiCorrelation, + activeCorrelationConfigs.doPionCorrelation}; + const bool applyK0sMassCut = (analysisMode == kDeltaYvsDeltaPhi) && k0sConfigs.selectK0sInSigRegion; const auto& [minMassK0s, maxMassK0s] = k0sConfigs.rangeMK0sSignal.value; auto isK0sValid = [&](const auto& k0s) { - return !applyK0sMassCut || k0s.inMassRegion(minMassK0s, maxMassK0s); + return (!applyEfficiency || k0s.pt() <= binspTK0S->back()) && (!applyK0sMassCut || k0s.inMassRegion(minMassK0s, maxMassK0s)); }; const bool applyPionNSigmaCut = (analysisMode == kDeltaYvsDeltaPhi) && pionConfigs.selectPionInSigRegion; @@ -409,33 +518,40 @@ struct PhiStrangenessCorrelation { const float& tofPIDThreshold = pionConfigs.tofPIDThreshold; auto isPionValid = [&](const auto& pion) { - return !applyPionNSigmaCut || pion.inNSigmaRegion(pidTPCMax, tofPIDThreshold, pidTOFMax); + return (!applyEfficiency || pion.pt() <= binspTPi->back()) && (!applyPionNSigmaCut || pion.inNSigmaRegion(pidTPCMax, tofPIDThreshold, pidTOFMax)); }; for (const auto& phiCand : phiCandidates) { - float weightPhi = computeWeight(BoundEfficiencyMap(effMaps[Phi], multiplicity, phiCand.pt(), phiCand.y())); + if (applyEfficiency && phiCand.pt() > binspTPhi->back()) + continue; + + float weightPhi = computeWeight(BoundEfficiencyMap(effMapPhi, multiplicity, phiCand.pt(), phiCand.y())); histos.fill(HIST("phi/h3PhiData"), multiplicity, phiCand.pt(), phiCand.m(), weightPhi); auto processCorrelations = [&](auto fillK0S, auto fillPion) { - // Loop over all reduced K0S candidates - for (const auto& k0s : k0sReduced) { - if (!isK0sValid(k0s)) - continue; + if (doAssocCorrelations[kK0S]) { + // Loop over all reduced K0S candidates + for (const auto& k0s : k0sReduced) { + if (!isK0sValid(k0s)) + continue; - float weightPhiK0S = computeWeight(BoundEfficiencyMap(effMaps[Phi], multiplicity, phiCand.pt(), phiCand.y()), - BoundEfficiencyMap(effMaps[K0S], multiplicity, k0s.pt(), k0s.y())); - fillK0S(k0s, weightPhiK0S); + float weightPhiK0S = computeWeight(BoundEfficiencyMap(effMapPhi, multiplicity, phiCand.pt(), phiCand.y()), + BoundEfficiencyMap(effMapsAssoc[kK0S], multiplicity, k0s.pt(), k0s.y())); + fillK0S(k0s, weightPhiK0S); + } } - // Loop over all primary pion candidates - for (const auto& pionTrack : pionTracks) { - if (!isPionValid(pionTrack)) - continue; + if (doAssocCorrelations[kPion]) { + // Loop over all primary pion candidates + for (const auto& pionTrack : pionTracks) { + if (!isPionValid(pionTrack)) + continue; - float weightPhiPion = computeWeight(BoundEfficiencyMap(effMaps[Phi], multiplicity, phiCand.pt(), phiCand.y()), - BoundEfficiencyMap(effMaps[Pion], multiplicity, pionTrack.pt(), pionTrack.y())); - fillPion(pionTrack, weightPhiPion); + float weightPhiPion = computeWeight(BoundEfficiencyMap(effMapPhi, multiplicity, phiCand.pt(), phiCand.y()), + BoundEfficiencyMap(effMapsAssoc[kPion], multiplicity, pionTrack.pt(), pionTrack.y())); + fillPion(pionTrack, weightPhiPion); + } } }; @@ -533,7 +649,7 @@ struct PhiStrangenessCorrelation { const auto& [minMassK0s, maxMassK0s] = k0sConfigs.rangeMK0sSignal.value; auto isK0sValid = [&](const auto& k0s) { - return !applyK0sMassCut || k0s.inMassRegion(minMassK0s, maxMassK0s); + return (!applyEfficiency || k0s.pt() <= binspTK0S->back()) && (!applyK0sMassCut || k0s.inMassRegion(minMassK0s, maxMassK0s)); }; auto tuplePhiK0S = std::make_tuple(phiCandidates, k0sReduced); @@ -544,12 +660,14 @@ struct PhiStrangenessCorrelation { float multiplicity = c1.centFT0M(); for (const auto& [phiCand, k0s] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(phiCands, k0sRed))) { + if (applyEfficiency && phiCand.pt() > binspTPhi->back()) + continue; if (!isK0sValid(k0s)) continue; auto processCorrelations = [&](auto fillK0S) { - float weightPhiK0S = computeWeight(BoundEfficiencyMap(effMaps[Phi], multiplicity, phiCand.pt(), phiCand.y()), - BoundEfficiencyMap(effMaps[K0S], multiplicity, k0s.pt(), k0s.y())); + float weightPhiK0S = computeWeight(BoundEfficiencyMap(effMapPhi, multiplicity, phiCand.pt(), phiCand.y()), + BoundEfficiencyMap(effMapsAssoc[kK0S], multiplicity, k0s.pt(), k0s.y())); fillK0S(k0s, weightPhiK0S); }; @@ -626,7 +744,7 @@ struct PhiStrangenessCorrelation { const float& tofPIDThreshold = pionConfigs.tofPIDThreshold; auto isPionValid = [&](const auto& pion) { - return !applyPionNSigmaCut || pion.inNSigmaRegion(pidTPCMax, tofPIDThreshold, pidTOFMax); + return (!applyEfficiency || pion.pt() <= binspTPi->back()) && (!applyPionNSigmaCut || pion.inNSigmaRegion(pidTPCMax, tofPIDThreshold, pidTOFMax)); }; auto tuplePhiPion = std::make_tuple(phiCandidates, pionTracks); @@ -637,12 +755,14 @@ struct PhiStrangenessCorrelation { float multiplicity = c1.centFT0M(); for (const auto& [phiCand, piTrack] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(phiCands, piTracks))) { + if (applyEfficiency && phiCand.pt() > binspTPhi->back()) + continue; if (!isPionValid(piTrack)) continue; auto processCorrelations = [&](auto fillPion) { - float weightPhiPion = computeWeight(BoundEfficiencyMap(effMaps[Phi], multiplicity, phiCand.pt(), phiCand.y()), - BoundEfficiencyMap(effMaps[Pion], multiplicity, piTrack.pt(), piTrack.y())); + float weightPhiPion = computeWeight(BoundEfficiencyMap(effMapPhi, multiplicity, phiCand.pt(), phiCand.y()), + BoundEfficiencyMap(effMapsAssoc[kPion], multiplicity, piTrack.pt(), piTrack.y())); fillPion(piTrack, weightPhiPion); }; @@ -961,6 +1081,7 @@ struct PhiStrangenessCorrelation { std::vector phiParticles; std::vector k0sParticles; + std::vector xiParticles; std::vector pionParticles; auto inYAcceptance = [&](const auto& mcParticle) { @@ -997,14 +1118,20 @@ struct PhiStrangenessCorrelation { if (multBin < 0) return; + bool doAssocCorrelations[kAssocPartSize] = {activeCorrelationConfigs.doK0SCorrelation, + activeCorrelationConfigs.doXiCorrelation, + activeCorrelationConfigs.doPionCorrelation}; + // Same Event Correlations - std::vector* currentAssocParticles[] = {&k0sParticles, &pionParticles}; + std::vector* currentAssocParticles[] = {&k0sParticles, &xiParticles, &pionParticles}; for (const auto& phiParticle : phiParticles) { histos.fill(HIST("phi/h3PhiMCGen"), multiplicity, phiParticle.pt, phiParticle.y); static_for<0, assocParticleLabels.size() - 1>([&](auto i_idx) { constexpr unsigned int i = i_idx.value; + if (!doAssocCorrelations[i]) + return; for (const auto& assocParticle : *(currentAssocParticles[i])) { histos.fill(HIST("phi") + HIST(assocParticleLabels[i]) + HIST("/h5Phi") + HIST(assocParticleLabels[i]) + HIST("ClosureMCGen"), @@ -1017,12 +1144,14 @@ struct PhiStrangenessCorrelation { // Mixed Event Correlations for (const auto& pastEvent : eventBuffer[multBin]) { - const std::vector* pastAssocParticles[] = {&pastEvent.k0sParticles, &pastEvent.pionParticles}; + const std::vector* pastAssocParticles[] = {&pastEvent.k0sParticles, &pastEvent.xiParticles, &pastEvent.pionParticles}; // Loop over past events in the same multiplicity bin and fill histograms with all combinations of current phi particles and past associated particles for (const auto& phiParticle : phiParticles) { static_for<0, assocParticleLabels.size() - 1>([&](auto i_idx) { constexpr unsigned int i = i_idx.value; + if (!doAssocCorrelations[i]) + return; for (const auto& assocParticle : *(pastAssocParticles[i])) { histos.fill(HIST("phi") + HIST(assocParticleLabels[i]) + HIST("/h5Phi") + HIST(assocParticleLabels[i]) + HIST("ClosureMCGenME"), @@ -1038,6 +1167,7 @@ struct PhiStrangenessCorrelation { currentEvent.multiplicity = multiplicity; currentEvent.phiParticles = std::move(phiParticles); currentEvent.k0sParticles = std::move(k0sParticles); + currentEvent.xiParticles = std::move(xiParticles); currentEvent.pionParticles = std::move(pionParticles); eventBuffer[multBin].push_front(std::move(currentEvent)); From eb65476c7696fa00cf3c2b1a114604ec3429f66d Mon Sep 17 00:00:00 2001 From: scannito Date: Tue, 14 Apr 2026 17:56:49 +0200 Subject: [PATCH 2/5] Add electron rejection --- PWGLF/DataModel/LFPhiStrangeCorrelationTables.h | 2 +- .../Strangeness/phiStrangeCorrelator.cxx | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/PWGLF/DataModel/LFPhiStrangeCorrelationTables.h b/PWGLF/DataModel/LFPhiStrangeCorrelationTables.h index aca738fe6f2..c37d60924e5 100644 --- a/PWGLF/DataModel/LFPhiStrangeCorrelationTables.h +++ b/PWGLF/DataModel/LFPhiStrangeCorrelationTables.h @@ -155,7 +155,7 @@ DECLARE_SOA_DYNAMIC_COLUMN(InNSigmaRegion, inNSigmaRegion, if (std::abs(nSigmaTPC) >= pidTPCMax) { return false; // TPC check failed } - if (pt >= tofPIDThreshold && hasTOF && std::abs(nSigmaTOF) >= pidTOFMax) { + if (hasTOF && std::abs(nSigmaTOF) >= pidTOFMax) { return false; // TOF check failed } return true; diff --git a/PWGLF/TableProducer/Strangeness/phiStrangeCorrelator.cxx b/PWGLF/TableProducer/Strangeness/phiStrangeCorrelator.cxx index b4f266b96b1..7035b015816 100644 --- a/PWGLF/TableProducer/Strangeness/phiStrangeCorrelator.cxx +++ b/PWGLF/TableProducer/Strangeness/phiStrangeCorrelator.cxx @@ -633,6 +633,22 @@ struct PionTrackProducer { template bool pidHypothesesRejection(const T& track) { + // Electron rejection + auto nSigmaTPCEl = aod::pidutils::tpcNSigma(o2::track::PID::Electron, track); + + if (nSigmaTPCEl > -3.0f && nSigmaTPCEl < 5.0f) { + auto nSigmaTPCPi = aod::pidutils::tpcNSigma(o2::track::PID::Pion, track); + auto nSigmaTPCKa = aod::pidutils::tpcNSigma(o2::track::PID::Kaon, track); + auto nSigmaTPCPr = aod::pidutils::tpcNSigma(o2::track::PID::Proton, track); + + if (std::abs(nSigmaTPCPi) > 3.0f && + std::abs(nSigmaTPCKa) > 3.0f && + std::abs(nSigmaTPCPr) > 3.0f) { + return false; + } + } + + // Other hadron species rejection for (size_t speciesIndex = 0; speciesIndex < trackConfigs.trkPIDspecies->size(); ++speciesIndex) { auto const& pid = trackConfigs.trkPIDspecies->at(speciesIndex); auto nSigmaTPC = aod::pidutils::tpcNSigma(pid, track); From 0c9de9cc82ec111a69c92a9aaf4196ac10059303 Mon Sep 17 00:00:00 2001 From: scannito Date: Tue, 14 Apr 2026 18:14:16 +0200 Subject: [PATCH 3/5] Table fix --- PWGLF/DataModel/LFPhiStrangeCorrelationTables.h | 12 +++++++----- PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx | 14 +++++++------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/PWGLF/DataModel/LFPhiStrangeCorrelationTables.h b/PWGLF/DataModel/LFPhiStrangeCorrelationTables.h index c37d60924e5..caaab7720b6 100644 --- a/PWGLF/DataModel/LFPhiStrangeCorrelationTables.h +++ b/PWGLF/DataModel/LFPhiStrangeCorrelationTables.h @@ -151,7 +151,7 @@ DECLARE_SOA_COLUMN(Phi, phi, float); DECLARE_SOA_COLUMN(HasTOF, hasTOF, bool); DECLARE_SOA_DYNAMIC_COLUMN(InNSigmaRegion, inNSigmaRegion, - [](float nSigmaTPC, float pt, bool hasTOF, float nSigmaTOF, float pidTPCMax, float tofPIDThreshold, float pidTOFMax) -> bool { + [](float nSigmaTPC, bool hasTOF, float nSigmaTOF, float pidTPCMax, float pidTOFMax) -> bool { if (std::abs(nSigmaTPC) >= pidTPCMax) { return false; // TPC check failed } @@ -171,8 +171,9 @@ DECLARE_SOA_TABLE(PionTracksData, "AOD", "PITRACKSDATA", lf_selection_pion_track::Y, lf_selection_pion_track::Phi, lf_selection_pion_track::HasTOF, - lf_selection_pion_track::InNSigmaRegion); + lf_selection_pion_track::InNSigmaRegion); DECLARE_SOA_TABLE(PionTracksMcReco, "AOD", "PITRACKSMCRECO", soa::Index<>, @@ -183,8 +184,9 @@ DECLARE_SOA_TABLE(PionTracksMcReco, "AOD", "PITRACKSMCRECO", lf_selection_pion_track::Y, lf_selection_pion_track::Phi, lf_selection_pion_track::HasTOF, - lf_selection_pion_track::InNSigmaRegion); + lf_selection_pion_track::InNSigmaRegion); } // namespace o2::aod #endif // PWGLF_DATAMODEL_LFPHISTRANGECORRELATIONTABLES_H_ diff --git a/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx b/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx index d94889e5ad0..02a55d69a6b 100644 --- a/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx +++ b/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx @@ -242,7 +242,7 @@ struct PhiStrangenessCorrelation { Configurable selectPionInSigRegion{"selectPionInSigRegion", true, "Select Pion candidates in signal region"}; Configurable pidTPCMax{"pidTPCMax", 2.0f, "Maximum nSigma TPC"}; Configurable pidTOFMax{"pidTOFMax", 2.0f, "Maximum nSigma TOF"}; - Configurable tofPIDThreshold{"tofPIDThreshold", 0.5f, "Minimum pT after which TOF PID is applicable"}; + // Configurable tofPIDThreshold{"tofPIDThreshold", 0.5f, "Minimum pT after which TOF PID is applicable"}; } pionConfigs; // Configurables on phi pT bins @@ -515,10 +515,10 @@ struct PhiStrangenessCorrelation { const bool applyPionNSigmaCut = (analysisMode == kDeltaYvsDeltaPhi) && pionConfigs.selectPionInSigRegion; const float& pidTPCMax = pionConfigs.pidTPCMax; const float& pidTOFMax = pionConfigs.pidTOFMax; - const float& tofPIDThreshold = pionConfigs.tofPIDThreshold; + // const float& tofPIDThreshold = pionConfigs.tofPIDThreshold; auto isPionValid = [&](const auto& pion) { - return (!applyEfficiency || pion.pt() <= binspTPi->back()) && (!applyPionNSigmaCut || pion.inNSigmaRegion(pidTPCMax, tofPIDThreshold, pidTOFMax)); + return (!applyEfficiency || pion.pt() <= binspTPi->back()) && (!applyPionNSigmaCut || pion.inNSigmaRegion(pidTPCMax, pidTOFMax)); }; for (const auto& phiCand : phiCandidates) { @@ -741,10 +741,10 @@ struct PhiStrangenessCorrelation { const bool applyPionNSigmaCut = (analysisMode == kDeltaYvsDeltaPhi) && pionConfigs.selectPionInSigRegion; const float& pidTPCMax = pionConfigs.pidTPCMax; const float& pidTOFMax = pionConfigs.pidTOFMax; - const float& tofPIDThreshold = pionConfigs.tofPIDThreshold; + // const float& tofPIDThreshold = pionConfigs.tofPIDThreshold; auto isPionValid = [&](const auto& pion) { - return (!applyEfficiency || pion.pt() <= binspTPi->back()) && (!applyPionNSigmaCut || pion.inNSigmaRegion(pidTPCMax, tofPIDThreshold, pidTOFMax)); + return (!applyEfficiency || pion.pt() <= binspTPi->back()) && (!applyPionNSigmaCut || pion.inNSigmaRegion(pidTPCMax, pidTOFMax)); }; auto tuplePhiPion = std::make_tuple(phiCandidates, pionTracks); @@ -835,10 +835,10 @@ struct PhiStrangenessCorrelation { const bool applyPionNSigmaCut = (analysisMode == kDeltaYvsDeltaPhi) && pionConfigs.selectPionInSigRegion; const float& pidTPCMax = pionConfigs.pidTPCMax; const float& pidTOFMax = pionConfigs.pidTOFMax; - const float& tofPIDThreshold = pionConfigs.tofPIDThreshold; + // const float& tofPIDThreshold = pionConfigs.tofPIDThreshold; auto isPionValid = [&](const auto& pion) { - return !applyPionNSigmaCut || pion.inNSigmaRegion(pidTPCMax, tofPIDThreshold, pidTOFMax); + return !applyPionNSigmaCut || pion.inNSigmaRegion(pidTPCMax, pidTOFMax); }; std::unordered_map> collsGrouped; From 865e9c51db9dc9ea0d422329b6c5292be69fb71a Mon Sep 17 00:00:00 2001 From: scannito Date: Tue, 14 Apr 2026 18:18:31 +0200 Subject: [PATCH 4/5] Added histo --- PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx b/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx index 02a55d69a6b..7d9cff381ca 100644 --- a/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx +++ b/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx @@ -405,6 +405,8 @@ struct PhiStrangenessCorrelation { histos.add("pi/h3PiMCGen", "Pion in MC Gen", kTH3F, {binnedmultAxis, binnedpTPiAxis, yAxis}); histos.add("pi/h4PiMCGenAssocReco", "Pion in MC Gen Assoc Reco", kTHnSparseF, {vertexZAxis, binnedmultAxis, binnedpTPiAxis, yAxis}); + histos.add("phi/h3PhiMCClosureGen", "Phi in MC Gen for MC Closure Test", kTH3F, {binnedmultAxis, binnedpTPhiAxis, yAxis}); + histos.add("phiK0S/h5PhiK0SClosureMCGen", "Deltay vs deltaphi for Phi and K0Short in MCGen", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTK0SAxis, deltayAxis, deltaphiAxis}); histos.add("phiPi/h5PhiPiClosureMCGen", "Deltay vs deltaphi for Phi and Pion in MCGen", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTPiAxis, deltayAxis, deltaphiAxis}); @@ -1126,7 +1128,7 @@ struct PhiStrangenessCorrelation { std::vector* currentAssocParticles[] = {&k0sParticles, &xiParticles, &pionParticles}; for (const auto& phiParticle : phiParticles) { - histos.fill(HIST("phi/h3PhiMCGen"), multiplicity, phiParticle.pt, phiParticle.y); + histos.fill(HIST("phi/h3PhiMCClosureGen"), multiplicity, phiParticle.pt, phiParticle.y); static_for<0, assocParticleLabels.size() - 1>([&](auto i_idx) { constexpr unsigned int i = i_idx.value; From 98d632da45a4c8bed39944f21e56ddb6fe826055 Mon Sep 17 00:00:00 2001 From: scannito Date: Tue, 14 Apr 2026 18:43:54 +0200 Subject: [PATCH 5/5] Fix Join tables --- .../Strangeness/phiStrangeCorrelator.cxx | 2 +- PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/PWGLF/TableProducer/Strangeness/phiStrangeCorrelator.cxx b/PWGLF/TableProducer/Strangeness/phiStrangeCorrelator.cxx index 7035b015816..a05e958377f 100644 --- a/PWGLF/TableProducer/Strangeness/phiStrangeCorrelator.cxx +++ b/PWGLF/TableProducer/Strangeness/phiStrangeCorrelator.cxx @@ -573,7 +573,7 @@ struct PionTrackProducer { using FilteredSimCollisions = soa::Filtered; // Defining the type of the tracks for data and MC - using FullTracks = soa::Join; + using FullTracks = soa::Join; using FullMCTracks = soa::Join; void init(InitContext&) diff --git a/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx b/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx index 7d9cff381ca..94c45348c36 100644 --- a/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx +++ b/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx @@ -72,6 +72,7 @@ #include #include #include +#include #include using namespace o2; @@ -511,7 +512,7 @@ struct PhiStrangenessCorrelation { const bool applyK0sMassCut = (analysisMode == kDeltaYvsDeltaPhi) && k0sConfigs.selectK0sInSigRegion; const auto& [minMassK0s, maxMassK0s] = k0sConfigs.rangeMK0sSignal.value; auto isK0sValid = [&](const auto& k0s) { - return (!applyEfficiency || k0s.pt() <= binspTK0S->back()) && (!applyK0sMassCut || k0s.inMassRegion(minMassK0s, maxMassK0s)); + return (!applyEfficiency || k0s.pt() < binspTK0S->back()) && (!applyK0sMassCut || k0s.inMassRegion(minMassK0s, maxMassK0s)); }; const bool applyPionNSigmaCut = (analysisMode == kDeltaYvsDeltaPhi) && pionConfigs.selectPionInSigRegion; @@ -520,11 +521,11 @@ struct PhiStrangenessCorrelation { // const float& tofPIDThreshold = pionConfigs.tofPIDThreshold; auto isPionValid = [&](const auto& pion) { - return (!applyEfficiency || pion.pt() <= binspTPi->back()) && (!applyPionNSigmaCut || pion.inNSigmaRegion(pidTPCMax, pidTOFMax)); + return (!applyEfficiency || pion.pt() < binspTPi->back()) && (!applyPionNSigmaCut || pion.inNSigmaRegion(pidTPCMax, pidTOFMax)); }; for (const auto& phiCand : phiCandidates) { - if (applyEfficiency && phiCand.pt() > binspTPhi->back()) + if (applyEfficiency && phiCand.pt() >= binspTPhi->back()) continue; float weightPhi = computeWeight(BoundEfficiencyMap(effMapPhi, multiplicity, phiCand.pt(), phiCand.y())); @@ -651,7 +652,7 @@ struct PhiStrangenessCorrelation { const auto& [minMassK0s, maxMassK0s] = k0sConfigs.rangeMK0sSignal.value; auto isK0sValid = [&](const auto& k0s) { - return (!applyEfficiency || k0s.pt() <= binspTK0S->back()) && (!applyK0sMassCut || k0s.inMassRegion(minMassK0s, maxMassK0s)); + return (!applyEfficiency || k0s.pt() < binspTK0S->back()) && (!applyK0sMassCut || k0s.inMassRegion(minMassK0s, maxMassK0s)); }; auto tuplePhiK0S = std::make_tuple(phiCandidates, k0sReduced); @@ -662,7 +663,7 @@ struct PhiStrangenessCorrelation { float multiplicity = c1.centFT0M(); for (const auto& [phiCand, k0s] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(phiCands, k0sRed))) { - if (applyEfficiency && phiCand.pt() > binspTPhi->back()) + if (applyEfficiency && phiCand.pt() >= binspTPhi->back()) continue; if (!isK0sValid(k0s)) continue; @@ -746,7 +747,7 @@ struct PhiStrangenessCorrelation { // const float& tofPIDThreshold = pionConfigs.tofPIDThreshold; auto isPionValid = [&](const auto& pion) { - return (!applyEfficiency || pion.pt() <= binspTPi->back()) && (!applyPionNSigmaCut || pion.inNSigmaRegion(pidTPCMax, pidTOFMax)); + return (!applyEfficiency || pion.pt() < binspTPi->back()) && (!applyPionNSigmaCut || pion.inNSigmaRegion(pidTPCMax, pidTOFMax)); }; auto tuplePhiPion = std::make_tuple(phiCandidates, pionTracks); @@ -757,7 +758,7 @@ struct PhiStrangenessCorrelation { float multiplicity = c1.centFT0M(); for (const auto& [phiCand, piTrack] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(phiCands, piTracks))) { - if (applyEfficiency && phiCand.pt() > binspTPhi->back()) + if (applyEfficiency && phiCand.pt() >= binspTPhi->back()) continue; if (!isPionValid(piTrack)) continue;