From 2df512bc39eb5548072691324f3da44188ac29a3 Mon Sep 17 00:00:00 2001 From: scannito Date: Thu, 24 Sep 2026 16:24:06 +0200 Subject: [PATCH 1/6] Substituted boilerplate code with macros --- .../Strangeness/phiStrangeCorrelation.cxx | 281 ++++++------------ 1 file changed, 84 insertions(+), 197 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx b/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx index 3db46f77cd6..8ad32451cab 100644 --- a/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx +++ b/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx @@ -311,8 +311,22 @@ struct PhiStrangeCorrelation { SliceCache cache; struct : PresliceGroup { - Preslice phiCandDataPerCollision = aod::lf_selection_phi_candidate::collisionId; - // PresliceUnsorted phiCandMcRecoPerCollision = aod::lf_selection_phi_candidate::collisionId; +#define DEFINE_PRESLICE(PREF, TAB_PREF, COL_ID) \ + Preslice PREF##DataPerCollision = aod::COL_ID::collisionId; \ + Preslice PREF##McRecoPerCollision = aod::COL_ID::collisionId; + + // Trigger + DEFINE_PRESLICE(phiCand, Phimeson, lf_selection_phi_candidate) + + // Associated Strangeness + DEFINE_PRESLICE(k0s, K0sReduced, v0) + DEFINE_PRESLICE(lambda, LambdaReduced, v0) + DEFINE_PRESLICE(antiLambda, AntiLambdaReduced, v0) + DEFINE_PRESLICE(xi, XiReduced, cascade) + DEFINE_PRESLICE(omega, OmegaReduced, cascade) +#undef DEFINE_PRESLICE + + /*Preslice phiCandDataPerCollision = aod::lf_selection_phi_candidate::collisionId; Preslice phiCandMcRecoPerCollision = aod::lf_selection_phi_candidate::collisionId; Preslice k0sDataPerCollision = aod::v0::collisionId; @@ -328,7 +342,7 @@ struct PhiStrangeCorrelation { Preslice xiMcRecoPerCollision = aod::cascade::collisionId; Preslice omegaDataPerCollision = aod::cascade::collisionId; - Preslice omegaMcRecoPerCollision = aod::cascade::collisionId; + Preslice omegaMcRecoPerCollision = aod::cascade::collisionId;*/ Preslice pionTrackDataPerCollision = aod::track::collisionId; Preslice pionTrackMcRecoPerCollision = aod::track::collisionId; @@ -339,9 +353,6 @@ struct PhiStrangeCorrelation { // Necessary service to retrieve efficiency maps from CCDB Service ccdb{}; - // std::shared_ptr effMapPhi{}; - // std::array, kAssocPartSize> effMapsAssoc{}; - EffMapPtr effMapPhi; std::array effMapsAssoc{}; @@ -365,12 +376,13 @@ struct PhiStrangeCorrelation { struct MiniEvent { float multiplicity{}; std::vector phiParticles; - std::vector k0sParticles; + std::array, kAssocPartSize> assocParticles; + /*std::vector k0sParticles; std::vector lambdaParticles; std::vector antilambdaParticles; std::vector xiParticles; std::vector omegaParticles; - std::vector pionParticles; + std::vector pionParticles;*/ }; // Buffer for mixed event, organized as a vector of deques, one for each multiplicity bin, containing the past events with their particles of interest needed for mixing @@ -982,7 +994,40 @@ struct PhiStrangeCorrelation { } } - void processPhiK0SMEDataLike(SelCollisions const& collisions, +#define DO_PROCESS_SWITCH(CLASS, FUNC_NAME, DESC) \ + PROCESS_SWITCH(CLASS, FUNC_NAME, DESC, true) + +#define DEFINE_ME_PROCESSES(PART_NAME, PART_ENUM, TABLE_DATA, TABLE_MC) \ + void processPhi##PART_NAME##MEDataLike(SelCollisions const& collisions, \ + aod::PhimesonCandidatesData const& phiCandidates, \ + TABLE_DATA const& assocReduced, \ + aod::BCs const&) \ + { \ + processPhiAssocME(collisions, phiCandidates, assocReduced); \ + } \ + \ + DO_PROCESS_SWITCH(PhiStrangeCorrelation, processPhi##PART_NAME##MEDataLike, "Phi-" #PART_NAME " ME Data or MC w/o PDG"); \ + \ + void processPhi##PART_NAME##MEMCWithPDG(SimCollisions const& collisions, \ + aod::PhimesonCandidatesMcReco const& phiCandidates, \ + TABLE_MC const& assocReduced, \ + aod::BCs const&) \ + { \ + processPhiAssocME(collisions, phiCandidates, assocReduced); \ + } \ + \ + DO_PROCESS_SWITCH(PhiStrangeCorrelation, processPhi##PART_NAME##MEMCWithPDG, "Phi-" #PART_NAME " ME MC w/ PDG"); + + DEFINE_ME_PROCESSES(K0S, kK0S, aod::K0sReducedCandidatesData, aod::K0sReducedCandidatesMcReco) + DEFINE_ME_PROCESSES(Lambda, kLambda, aod::LambdaReducedCandidatesData, aod::LambdaReducedCandidatesMcReco) + DEFINE_ME_PROCESSES(AntiLambda, kAntiLambda, aod::AntiLambdaReducedCandidatesData, aod::AntiLambdaReducedCandidatesMcReco) + DEFINE_ME_PROCESSES(Xi, kXi, aod::XiReducedCandidatesData, aod::XiReducedCandidatesMcReco) + DEFINE_ME_PROCESSES(Omega, kOmega, aod::OmegaReducedCandidatesData, aod::OmegaReducedCandidatesMcReco) + DEFINE_ME_PROCESSES(Pion, kPion, aod::PionTracksData, aod::PionTracksMcReco) +#undef DEFINE_ME_PROCESSES +#undef DO_PROCESS_SWITCH + + /*void processPhiK0SMEDataLike(SelCollisions const& collisions, aod::PhimesonCandidatesData const& phiCandidates, aod::K0sReducedCandidatesData const& k0sReduced, aod::BCs const&) @@ -1100,7 +1145,7 @@ struct PhiStrangeCorrelation { processPhiAssocME(collisions, phiCandidates, pionTracks); } - PROCESS_SWITCH(PhiStrangeCorrelation, processPhiPionMEMCWithPDG, "Process function for Phi-Pion 2D Correlations in MC with PDG ME", true); + PROCESS_SWITCH(PhiStrangeCorrelation, processPhiPionMEMCWithPDG, "Process function for Phi-Pion 2D Correlations in MC with PDG ME", true);*/ void processParticleEfficiency(MCCollisions const& mcCollisions, SimCollisions const& collisions, @@ -1196,8 +1241,8 @@ struct PhiStrangeCorrelation { const auto mcParticlesThisMcColl = mcParticles.sliceBy(preslices.mcPartPerMcCollision, mcCollision.globalIndex()); for (const auto& mcParticle : mcParticlesThisMcColl) { - auto inYAcceptance = [&]() { - return std::abs(mcParticle.y()) <= yConfigs.cfgYAcceptance; + if (std::abs(mcParticle.y()) > yConfigs.cfgYAcceptance) { + continue; }; auto fillGenHistos = [&](auto h3Key, auto h4Key) { @@ -1215,28 +1260,12 @@ struct PhiStrangeCorrelation { fillGenHistos(h3Key, h4Key); }; - if (!inYAcceptance()) { - continue; - } - switch (std::abs(mcParticle.pdgCode())) { case o2::constants::physics::Pdg::kPhi: if (eventSelectionType == 0 && mcParticle.pt() >= minPtMcGenConfigs.minPhiPt) { fillGenHistos(HIST("phi/h3PhiMCGen"), HIST("phi/h4PhiMCGenAssocReco")); } break; - /*case PDG_t::kK0Short: - if (mcParticle.isPhysicalPrimary() && mcParticle.pt() >= minPtMcGenConfigs.v0SettingMinPt) - fillGenHistos(HIST("k0s/h3K0SMCGen"), HIST("k0s/h4K0SMCGenAssocReco")); - break; - case PDG_t::kXiMinus: - if (mcParticle.isPhysicalPrimary() && mcParticle.pt() >= minPtMcGenConfigs.cascadeSettingMinPt) - fillGenHistos(HIST("xi/h3XiMCGen"), HIST("xi/h4XiMCGenAssocReco")); - break; - case PDG_t::kPiPlus: - if (mcParticle.isPhysicalPrimary() && mcParticle.pt() >= minPtMcGenConfigs.cMinPionPtcut) - fillGenHistos(HIST("pi/h3PiMCGen"), HIST("pi/h4PiMCGenAssocReco")); - break;*/ case getPdgCode(): fillGenAssocSpecies.template operator()(HIST("k0s/h3K0SMCGen"), HIST("k0s/h4K0SMCGenAssocReco")); break; @@ -1264,205 +1293,68 @@ struct PhiStrangeCorrelation { PROCESS_SWITCH(PhiStrangeCorrelation, processParticleEfficiency, "Process function for Efficiency Computation for Particles of Interest", false); - /*void processMCGenClosureSE(MCCollisions::iterator const& mcCollision, aod::McParticles const& mcParticles) - { - float multiplicity = mcCollision.centFT0M(); - - std::vector phiIndices; - std::vector k0sIndices; - std::vector pionIndices; - std::vector> assocIndices; - - auto inYAcceptance = [&](const auto& mcParticle) { - return std::abs(mcParticle.y()) <= yConfigs.cfgYAcceptance; - }; - - for (const auto& mcParticle : mcParticles) { - if (!inYAcceptance(mcParticle)) - continue; - - switch (std::abs(mcParticle.pdgCode())) { - case o2::constants::physics::Pdg::kPhi: - if (eventSelectionType == 0 && mcParticle.pt() >= minPtMcGenConfigs.minPhiPt) - phiIndices.push_back(mcParticle.globalIndex()); - break; - case PDG_t::kK0Short: - if (mcParticle.isPhysicalPrimary() && mcParticle.pt() >= minPtMcGenConfigs.v0SettingMinPt) - k0sIndices.push_back(mcParticle.globalIndex()); - break; - case PDG_t::kPiPlus: - if (mcParticle.isPhysicalPrimary() && mcParticle.pt() >= minPtMcGenConfigs.cMinPionPtcut) - pionIndices.push_back(mcParticle.globalIndex()); - break; - default: - break; - } - } - - assocIndices.push_back(k0sIndices); - assocIndices.push_back(pionIndices); - - for (std::size_t iTrigg{0}; iTrigg < phiIndices.size(); ++iTrigg) { - auto& phiParticle = mcParticles.rawIteratorAt(phiIndices[iTrigg]); - - static_for<0, assocIndices.size() - 1>([&](auto i_idx) { - constexpr unsigned int Idx = i_idx.value; - - for (std::size_t iAssoc{0}; iAssoc < assocIndices[Idx].size(); ++iAssoc) { - auto& assocParticle = mcParticles.rawIteratorAt(assocIndices[Idx][iAssoc]); - - histos.fill(HIST("mcGenClosure/h5Phi") + HIST(AssocParticleLabels[Idx]) + HIST("ClosureGenSE"), multiplicity, phiParticle.pt(), assocParticle.pt(), phiParticle.y() - assocParticle.y(), getDeltaPhi(phiParticle.phi(), assocParticle.phi())); - } - }); - } - } - - PROCESS_SWITCH(PhiStrangeCorrelation, processMCGenClosureSE, "Process function for MC Gen Closure Test in SE", false); - - void processMCGenClosureME(MCCollisions::iterator const& mcCollision, aod::McParticles const& mcParticles) - { - float multiplicity = mcCollision.centFT0M(); - - std::vector phiParticles; - std::vector k0sParticles; - std::vector pionParticles; - - auto inYAcceptance = [&](const auto& mcParticle) { - return std::abs(mcParticle.y()) <= yConfigs.cfgYAcceptance; - }; - - for (const auto& mcParticle : mcParticles) { - if (!inYAcceptance(mcParticle)) - continue; - - switch (std::abs(mcParticle.pdgCode())) { - case o2::constants::physics::Pdg::kPhi: - if (eventSelectionType == 0 && mcParticle.pt() >= minPtMcGenConfigs.minPhiPt) - phiParticles.emplace_back(mcParticle.pt(), mcParticle.y(), mcParticle.phi()); - break; - case PDG_t::kK0Short: - if (mcParticle.isPhysicalPrimary() && mcParticle.pt() >= minPtMcGenConfigs.v0SettingMinPt) - k0sParticles.emplace_back(mcParticle.pt(), mcParticle.y(), mcParticle.phi()); - break; - case PDG_t::kPiPlus: - if (mcParticle.isPhysicalPrimary() && mcParticle.pt() >= minPtMcGenConfigs.cMinPionPtcut) - pionParticles.emplace_back(mcParticle.pt(), mcParticle.y(), mcParticle.phi()); - break; - default: - break; - } - } - - if (phiParticles.empty() && k0sParticles.empty() && pionParticles.empty()) - return; - - int multBin = getCentBin(multiplicity); - - // Loop over past events in the same multiplicity bin and fill histograms with all combinations of current phi particles and past K0S and pion particles - for (const auto& pastEvent : eventBuffer[multBin]) { - for (const auto& phiParticle : phiParticles) { - for (const auto& k0sParticle : pastEvent.k0sParticles) { - histos.fill(HIST("mcGenClosure/h5PhiK0SClosureGenME"), multiplicity, phiParticle.pt, k0sParticle.pt, phiParticle.y - k0sParticle.y, getDeltaPhi(phiParticle.phi, k0sParticle.phi)); - } - for (const auto& pionParticle : pastEvent.pionParticles) { - histos.fill(HIST("mcGenClosure/h5PhiPiClosureGenME"), multiplicity, phiParticle.pt, pionParticle.pt, phiParticle.y - pionParticle.y, getDeltaPhi(phiParticle.phi, pionParticle.phi)); - } - } - } - - // Add current event to buffer - MiniEvent currentEvent; - currentEvent.multiplicity = multiplicity; - currentEvent.phiParticles = std::move(phiParticles); - currentEvent.k0sParticles = std::move(k0sParticles); - currentEvent.pionParticles = std::move(pionParticles); - - eventBuffer[multBin].push_front(std::move(currentEvent)); - if (eventBuffer[multBin].size() > static_cast(cfgNoMixedEvents.value)) - eventBuffer[multBin].pop_back(); - } - - PROCESS_SWITCH(PhiStrangeCorrelation, processMCGenClosureME, "Process function for MC Gen Closure Test in ME", false);*/ - void processMCGenClosure(MCCollisions::iterator const& mcCollision, aod::McParticles const& mcParticles) { float multiplicity = mcCollision.centFT0M(); std::vector phiParticles; - std::vector k0sParticles; + std::array, kAssocPartSize> assocParticles; + /*std::vector k0sParticles; std::vector lambdaParticles; std::vector antilambdaParticles; std::vector xiParticles; std::vector omegaParticles; - std::vector pionParticles; + std::vector pionParticles;*/ // Preliminary loop to fill vectors of particles of interest for the current event, applying pt and y cuts for (const auto& mcParticle : mcParticles) { - auto inYAcceptance = [&]() { - return std::abs(mcParticle.y()) <= yConfigs.cfgYAcceptance; + if (std::abs(mcParticle.y()) > yConfigs.cfgYAcceptance) { + continue; }; - auto fillPartCollection = [&](auto& collection) { - if (!activeCorrelationTypes->at(PartType) || !isGenSpeciesValid(mcParticle, minPtMcGenConfigs.bypassPtCut.value)) { - return; + auto fillPartCollection = [&]() { + if (activeCorrelationTypes->at(PartType) && isGenSpeciesValid(mcParticle, minPtMcGenConfigs.bypassPtCut.value)) { + assocParticles[PartType].emplace_back(mcParticle.pt(), mcParticle.y(), mcParticle.phi()); } - - collection.emplace_back(mcParticle.pt(), mcParticle.y(), mcParticle.phi()); }; - if (!inYAcceptance()) { - continue; - } - switch (std::abs(mcParticle.pdgCode())) { case o2::constants::physics::Pdg::kPhi: if (eventSelectionType == 0 && (minPtMcGenConfigs.bypassPtCut || mcParticle.pt() >= minPtMcGenConfigs.minPhiPt)) { phiParticles.emplace_back(mcParticle.pt(), mcParticle.y(), mcParticle.phi()); } break; - /*case PDG_t::kK0Short: - if (mcParticle.isPhysicalPrimary() && (minPtMcGenConfigs.bypassPtCut || mcParticle.pt() >= minPtMcGenConfigs.v0SettingMinPt)) - k0sParticles.emplace_back(mcParticle.pt(), mcParticle.y(), mcParticle.phi()); - break; - case PDG_t::kXiMinus: - if (mcParticle.isPhysicalPrimary() && (minPtMcGenConfigs.bypassPtCut || mcParticle.pt() >= minPtMcGenConfigs.cascadeSettingMinPt)) - xiParticles.emplace_back(mcParticle.pt(), mcParticle.y(), mcParticle.phi()); - break; - case PDG_t::kPiPlus: - if (mcParticle.isPhysicalPrimary() && (minPtMcGenConfigs.bypassPtCut || mcParticle.pt() >= minPtMcGenConfigs.cMinPionPtcut)) - pionParticles.emplace_back(mcParticle.pt(), mcParticle.y(), mcParticle.phi()); - break;*/ case getPdgCode(): - fillPartCollection.template operator()(k0sParticles); + fillPartCollection.template operator()(); break; case getPdgCode(): - fillPartCollection.template operator()(lambdaParticles); + fillPartCollection.template operator()(); break; case getPdgCode(): - fillPartCollection.template operator()(antilambdaParticles); + fillPartCollection.template operator()(); break; case getPdgCode(): - fillPartCollection.template operator()(xiParticles); + fillPartCollection.template operator()(); break; case getPdgCode(): - fillPartCollection.template operator()(omegaParticles); + fillPartCollection.template operator()(); break; case getPdgCode(): - fillPartCollection.template operator()(pionParticles); + fillPartCollection.template operator()(); break; default: break; } } - const bool skipK0s = !activeCorrelationTypes->at(kK0S) || k0sParticles.empty(); - const bool skipLambda = !activeCorrelationTypes->at(kLambda) || lambdaParticles.empty(); - const bool skipAntiLambda = !activeCorrelationTypes->at(kAntiLambda) || antilambdaParticles.empty(); - const bool skipXi = !activeCorrelationTypes->at(kXi) || xiParticles.empty(); - const bool skipOmega = !activeCorrelationTypes->at(kOmega) || omegaParticles.empty(); - const bool skipPion = !activeCorrelationTypes->at(kPion) || pionParticles.empty(); + bool hasAnyAssoc = false; + for (size_t i = 0; i < kAssocPartSize; ++i) { + if (!assocParticles[i].empty()) { + hasAnyAssoc = true; + } + } - if (phiParticles.empty() && skipK0s && skipLambda && skipAntiLambda && skipXi && skipOmega && skipPion) { + if (phiParticles.empty() && !hasAnyAssoc) { return; } @@ -1472,9 +1364,6 @@ struct PhiStrangeCorrelation { } // Same Event Correlations - std::array*, kAssocPartSize> currentAssocParticles{&k0sParticles, &lambdaParticles, &antilambdaParticles, - &xiParticles, &omegaParticles, &pionParticles}; - for (const auto& phiParticle : phiParticles) { histos.fill(HIST("phi/h3PhiMCClosureGen"), multiplicity, phiParticle.pt, phiParticle.y); @@ -1484,7 +1373,7 @@ struct PhiStrangeCorrelation { return; } - for (const auto& assocParticle : *(currentAssocParticles[Idx])) { + for (const auto& assocParticle : assocParticles[Idx]) { histos.fill(HIST("phi") + HIST(AssocParticleLabels[Idx]) + HIST("/h5Phi") + HIST(AssocParticleLabels[Idx]) + HIST("ClosureMCGen"), multiplicity, phiParticle.pt, assocParticle.pt, phiParticle.y - assocParticle.y, @@ -1494,11 +1383,8 @@ struct PhiStrangeCorrelation { } // Mixed Event Correlations + // 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& pastEvent : eventBuffer[multBin]) { - std::array*, kAssocPartSize> pastAssocParticles{&pastEvent.k0sParticles, &pastEvent.lambdaParticles, &pastEvent.antilambdaParticles, - &pastEvent.xiParticles, &pastEvent.omegaParticles, &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 Idx = i_idx.value; @@ -1506,7 +1392,7 @@ struct PhiStrangeCorrelation { return; } - for (const auto& assocParticle : *(pastAssocParticles[Idx])) { + for (const auto& assocParticle : pastEvent.assocParticles[Idx]) { histos.fill(HIST("phi") + HIST(AssocParticleLabels[Idx]) + HIST("/h5Phi") + HIST(AssocParticleLabels[Idx]) + HIST("ClosureMCGenME"), multiplicity, phiParticle.pt, assocParticle.pt, phiParticle.y - assocParticle.y, @@ -1519,12 +1405,13 @@ struct PhiStrangeCorrelation { MiniEvent currentEvent; currentEvent.multiplicity = multiplicity; currentEvent.phiParticles = std::move(phiParticles); - currentEvent.k0sParticles = std::move(k0sParticles); + currentEvent.assocParticles = std::move(assocParticles); + /*currentEvent.k0sParticles = std::move(k0sParticles); currentEvent.lambdaParticles = std::move(lambdaParticles); currentEvent.antilambdaParticles = std::move(antilambdaParticles); currentEvent.xiParticles = std::move(xiParticles); currentEvent.omegaParticles = std::move(omegaParticles); - currentEvent.pionParticles = std::move(pionParticles); + currentEvent.pionParticles = std::move(pionParticles);*/ eventBuffer[multBin].push_front(std::move(currentEvent)); if (eventBuffer[multBin].size() > static_cast(cfgNoMixedEvents.value)) { From b7d4eab31d62a2464fe673d15e6e4bcc99419932 Mon Sep 17 00:00:00 2001 From: scannito Date: Thu, 24 Sep 2026 17:20:06 +0200 Subject: [PATCH 2/6] More boilerplate code removed --- .../Strangeness/phiStrangeCorrelation.cxx | 95 ++++++++++++++----- 1 file changed, 72 insertions(+), 23 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx b/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx index 8ad32451cab..10cd27e5e00 100644 --- a/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx +++ b/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx @@ -423,9 +423,57 @@ struct PhiStrangeCorrelation { AxisSpec binnedpTPiAxis{(std::vector)binspTPi, "#it{p}_{T} (GeV/#it{c})"}; AxisSpec binnedpTPiAxisExt{(std::vector)binspTPiExt, "#it{p}_{T} (GeV/#it{c})"}; + std::array massAxes = {massK0SAxis, massLambdaAxis, massLambdaAxis, massXiAxis, massOmegaAxis, nSigmaPiAxis}; + std::array binnedpTAxes = {binnedpTK0SAxis, binnedpTLambdaAxis, binnedpTLambdaAxis, binnedpTXiAxis, binnedpTOmegaAxis, binnedpTPiAxis}; + std::array binnedpTExtAxes = {binnedpTK0SAxisExt, binnedpTLambdaAxisExt, binnedpTLambdaAxisExt, binnedpTXiAxisExt, binnedpTOmegaAxisExt, binnedpTPiAxisExt}; + + std::array assocTitles = {"K0Short", "Lambda", "AntiLambda", "Xi", "Omega", "Pion"}; + std::array dirNames = {"k0s", "lambda", "antilambda", "xi", "omega", "pi"}; + histos.add("phi/h3PhiData", "Invariant mass of Phi in Data", kTH3F, {binnedmultAxis, binnedpTPhiAxis, massPhiAxis}); - histos.add("phiK0S/h6PhiK0SData", "Invariant mass of Phi vs Invariant mass of K0Short in Data", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTK0SAxis, deltayAxis, massPhiAxis, massK0SAxis}); + histos.add("phi/h4PhiMCReco", "Phi in MC Reco", kTHnSparseF, {vertexZAxis, binnedmultAxis, binnedpTPhiAxis, yAxis}); + histos.add("phi/h3PhiMCGen", "Phi in MC Gen", kTH3F, {binnedmultAxis, binnedpTPhiAxis, yAxis}); + histos.add("phi/h4PhiMCGenAssocReco", "Phi in MC Gen Assoc Reco", kTHnSparseF, {vertexZAxis, binnedmultAxis, binnedpTPhiAxis, yAxis}); + + histos.add("phi/h3PhiMCClosureGen", "Phi in MC Gen for MC Closure Test", kTH3F, {binnedmultAxis, binnedpTPhiAxisExt, yAxis}); + + for (size_t i = 0; i < kAssocPartSize; ++i) { + std::string pName(AssocParticleLabels[i]); + std::string pTitle = assocTitles[i]; + std::string dir = dirNames[i]; + + if (i == kPion) { + histos.add("phiPi/h6PhiPiTPCData", "Invariant mass of Phi vs nSigmaTPC of Pion in Data", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTAxes[i], deltayAxis, massPhiAxis, massAxes[i]}); + histos.add("phiPi/h6PhiPiTPCDataME", "Invariant mass of Phi vs nSigmaTPC of Pion in Data ME", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTAxes[i], deltayAxis, massPhiAxis, massAxes[i]}); + histos.add("phiPi/h6PhiPiTOFData", "Invariant mass of Phi vs nSigmaTOF of Pion in Data", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTAxes[i], deltayAxis, massPhiAxis, massAxes[i]}); + histos.add("phiPi/h6PhiPiTOFDataME", "Invariant mass of Phi vs nSigmaTOF of Pion in Data ME", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTAxes[i], deltayAxis, massPhiAxis, massAxes[i]}); + } else { + histos.add(fmt::format("phi{}/h6Phi{}Data", pName, pName).c_str(), fmt::format("Invariant mass of Phi vs Invariant mass of {} in Data", pTitle).c_str(), kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTAxes[i], deltayAxis, massPhiAxis, massAxes[i]}); + histos.add(fmt::format("phi{}/h6Phi{}DataME", pName, pName).c_str(), fmt::format("Invariant mass of Phi vs Invariant mass of {} in Data ME", pTitle).c_str(), kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTAxes[i], deltayAxis, massPhiAxis, massAxes[i]}); + } + + for (const auto& label : PhiMassRegionLabels) { + histos.add(fmt::format("phi{}/h5Phi{}Data{}", pName, pName, label).c_str(), fmt::format("Deltay vs deltaphi for Phi and {} in Data", pTitle).c_str(), kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTAxes[i], deltayAxis, deltaphiAxis}); + histos.add(fmt::format("phi{}/h5Phi{}DataME{}", pName, pName, label).c_str(), fmt::format("Deltay vs deltaphi for Phi and {} in Data ME", pTitle).c_str(), kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTAxes[i], deltayAxis, deltaphiAxis}); + } + + histos.add(fmt::format("{}/h4{}MCReco", dir, pName).c_str(), fmt::format("{} in MC Reco", pTitle).c_str(), kTHnSparseF, {vertexZAxis, binnedmultAxis, binnedpTAxes[i], yAxis}); + histos.add(fmt::format("{}/h3{}MCGen", dir, pName).c_str(), fmt::format("{} in MC Gen", pTitle).c_str(), kTH3F, {binnedmultAxis, binnedpTAxes[i], yAxis}); + histos.add(fmt::format("{}/h4{}MCGenAssocReco", dir, pName).c_str(), fmt::format("{} in MC Gen Assoc Reco", pTitle).c_str(), kTHnSparseF, {vertexZAxis, binnedmultAxis, binnedpTAxes[i], yAxis}); + + histos.add(fmt::format("phi{}/h5Phi{}ClosureMCGen", pName, pName).c_str(), fmt::format("Deltay vs deltaphi for Phi and {} in MCGen", pTitle).c_str(), kTHnSparseF, {binnedmultAxis, binnedpTPhiAxisExt, binnedpTExtAxes[i], deltayAxis, deltaphiAxis}); + histos.add(fmt::format("phi{}/h5Phi{}ClosureMCGenME", pName, pName).c_str(), fmt::format("Deltay vs deltaphi for Phi and {} in MCGen ME", pTitle).c_str(), kTHnSparseF, {binnedmultAxis, binnedpTPhiAxisExt, binnedpTExtAxes[i], deltayAxis, deltaphiAxis}); + } + + histos.add("event/hRecoMCMultiplicityPercent", "RecoMC Multiplicity Percentile", kTH1F, {binnedmultAxis}); + histos.add("event/h2RecoMCVertexZvsMult", "RecoMC Vertex Z vs Multiplicity Percentile", kTH2F, {vertexZAxis, binnedmultAxis}); + histos.add("event/hSplitVertexZ", "Split in z-vtx", kTH1F, {{100, -5.0f, 5.0f}}); + histos.add("event/hGenMCMultiplicityPercent", "Generated MC Multiplicity Percentile", kTH1F, {binnedmultAxis}); + histos.add("event/hGenMCAssocRecoMultiplicityPercent", "Generated MC associated Multiplicity Percentile", kTH1F, {binnedmultAxis}); + histos.add("event/h2GenMCAssocRecoVertexZvsMult", "Generated MC associated reco Vertex Z vs multiplicity", kTH2F, {vertexZAxis, binnedmultAxis}); + + /*histos.add("phiK0S/h6PhiK0SData", "Invariant mass of Phi vs Invariant mass of K0Short in Data", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTK0SAxis, deltayAxis, massPhiAxis, massK0SAxis}); histos.add("phiLambda/h6PhiLambdaData", "Invariant mass of Phi vs Invariant mass of Lambda in Data", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTLambdaAxis, deltayAxis, massPhiAxis, massLambdaAxis}); histos.add("phiXi/h6PhiXiData", "Invariant mass of Phi vs Invariant mass of Xi in Data", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTXiAxis, deltayAxis, massPhiAxis, massXiAxis}); histos.add("phiOmega/h6PhiOmegaData", "Invariant mass of Phi vs Invariant mass of Omega in Data", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTOmegaAxis, deltayAxis, massPhiAxis, massOmegaAxis}); @@ -437,9 +485,9 @@ struct PhiStrangeCorrelation { histos.add("phiXi/h6PhiXiDataME", "Invariant mass of Phi vs Invariant mass of Xi in Data ME", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTXiAxis, deltayAxis, massPhiAxis, massXiAxis}); histos.add("phiOmega/h6PhiOmegaDataME", "Invariant mass of Phi vs Invariant mass of Omega in Data ME", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTOmegaAxis, deltayAxis, massPhiAxis, massOmegaAxis}); histos.add("phiPi/h6PhiPiTPCDataME", "Invariant mass of Phi vs nSigmaTPC Pion in Data ME", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTPiAxis, deltayAxis, massPhiAxis, nSigmaPiAxis}); - histos.add("phiPi/h6PhiPiTOFDataME", "Invariant mass of Phi vs nSigmaTOF Pion in Data ME", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTPiAxis, deltayAxis, massPhiAxis, nSigmaPiAxis}); + histos.add("phiPi/h6PhiPiTOFDataME", "Invariant mass of Phi vs nSigmaTOF Pion in Data ME", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTPiAxis, deltayAxis, massPhiAxis, nSigmaPiAxis});*/ - for (const auto& label : PhiMassRegionLabels) { + /*for (const auto& label : PhiMassRegionLabels) { histos.add(fmt::format("phiK0S/h5PhiK0SData{}", label).c_str(), "Deltay vs deltaphi for Phi and K0Short in Data", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTK0SAxis, deltayAxis, deltaphiAxis}); histos.add(fmt::format("phiLambda/h5PhiLambdaData{}", label).c_str(), "Deltay vs deltaphi for Phi and Lambda in Data", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTLambdaAxis, deltayAxis, deltaphiAxis}); histos.add(fmt::format("phiXi/h5PhiXiData{}", label).c_str(), "Deltay vs deltaphi for Phi and Xi in Data", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTXiAxis, deltayAxis, deltaphiAxis}); @@ -451,20 +499,9 @@ struct PhiStrangeCorrelation { histos.add(fmt::format("phiXi/h5PhiXiDataME{}", label).c_str(), "Deltay vs deltaphi for Phi and Xi in Data ME", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTXiAxis, deltayAxis, deltaphiAxis}); histos.add(fmt::format("phiOmega/h5PhiOmegaDataME{}", label).c_str(), "Deltay vs deltaphi for Phi and Omega in Data ME", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTOmegaAxis, deltayAxis, deltaphiAxis}); histos.add(fmt::format("phiPi/h5PhiPiDataME{}", label).c_str(), "Deltay vs deltaphi for Phi and Pion in Data ME", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxis, binnedpTPiAxis, deltayAxis, deltaphiAxis}); - } + }*/ - histos.add("event/hRecoMCMultiplicityPercent", "RecoMC Multiplicity Percentile", kTH1F, {binnedmultAxis}); - histos.add("event/h2RecoMCVertexZvsMult", "RecoMC Vertex Z vs Multiplicity Percentile", kTH2F, {vertexZAxis, binnedmultAxis}); - histos.add("event/hSplitVertexZ", "Split in z-vtx", kTH1F, {{100, -5.0f, 5.0f}}); - histos.add("event/hGenMCMultiplicityPercent", "Generated MC Multiplicity Percentile", kTH1F, {binnedmultAxis}); - histos.add("event/hGenMCAssocRecoMultiplicityPercent", "Generated MC associated Multiplicity Percentile", kTH1F, {binnedmultAxis}); - histos.add("event/h2GenMCAssocRecoVertexZvsMult", "Generated MC associated reco Vertex Z vs multiplicity", kTH2F, {vertexZAxis, binnedmultAxis}); - - histos.add("phi/h4PhiMCReco", "Phi in MC Reco", kTHnSparseF, {vertexZAxis, binnedmultAxis, binnedpTPhiAxis, yAxis}); - histos.add("phi/h3PhiMCGen", "Phi in MC Gen", kTH3F, {binnedmultAxis, binnedpTPhiAxis, yAxis}); - histos.add("phi/h4PhiMCGenAssocReco", "Phi in MC Gen Assoc Reco", kTHnSparseF, {vertexZAxis, binnedmultAxis, binnedpTPhiAxis, yAxis}); - - histos.add("k0s/h4K0SMCReco", "K0S in MC Reco", kTHnSparseF, {vertexZAxis, binnedmultAxis, binnedpTK0SAxis, yAxis}); + /*histos.add("k0s/h4K0SMCReco", "K0S in MC Reco", kTHnSparseF, {vertexZAxis, binnedmultAxis, binnedpTK0SAxis, yAxis}); histos.add("k0s/h3K0SMCGen", "K0S in MC Gen", kTH3F, {binnedmultAxis, binnedpTK0SAxis, yAxis}); histos.add("k0s/h4K0SMCGenAssocReco", "K0S in MC Gen Assoc Reco", kTHnSparseF, {vertexZAxis, binnedmultAxis, binnedpTK0SAxis, yAxis}); @@ -486,11 +523,9 @@ struct PhiStrangeCorrelation { histos.add("pi/h4PiMCReco", "Pion in MC Reco", kTHnSparseF, {vertexZAxis, binnedmultAxis, binnedpTPiAxis, yAxis}); 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("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, binnedpTPhiAxisExt, yAxis}); - - histos.add("phiK0S/h5PhiK0SClosureMCGen", "Deltay vs deltaphi for Phi and K0Short in MCGen", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxisExt, binnedpTK0SAxisExt, deltayAxis, deltaphiAxis}); + /*histos.add("phiK0S/h5PhiK0SClosureMCGen", "Deltay vs deltaphi for Phi and K0Short in MCGen", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxisExt, binnedpTK0SAxisExt, deltayAxis, deltaphiAxis}); histos.add("phiLambda/h5PhiLambdaClosureMCGen", "Deltay vs deltaphi for Phi and Lambda in MCGen", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxisExt, binnedpTLambdaAxisExt, deltayAxis, deltaphiAxis}); histos.add("phiAntiLambda/h5PhiAntiLambdaClosureMCGen", "Deltay vs deltaphi for Phi and AntiLambda in MCGen", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxisExt, binnedpTLambdaAxisExt, deltayAxis, deltaphiAxis}); histos.add("phiXi/h5PhiXiClosureMCGen", "Deltay vs deltaphi for Phi and Xi in MCGen", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxisExt, binnedpTXiAxisExt, deltayAxis, deltaphiAxis}); @@ -502,7 +537,7 @@ struct PhiStrangeCorrelation { histos.add("phiAntiLambda/h5PhiAntiLambdaClosureMCGenME", "Deltay vs deltaphi for Phi and AntiLambda in MCGen ME", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxisExt, binnedpTLambdaAxisExt, deltayAxis, deltaphiAxis}); histos.add("phiXi/h5PhiXiClosureMCGenME", "Deltay vs deltaphi for Phi and Xi in MCGen ME", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxisExt, binnedpTXiAxisExt, deltayAxis, deltaphiAxis}); histos.add("phiOmega/h5PhiOmegaClosureMCGenME", "Deltay vs deltaphi for Phi and Omega in MCGen ME", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxisExt, binnedpTOmegaAxisExt, deltayAxis, deltaphiAxis}); - histos.add("phiPi/h5PhiPiClosureMCGenME", "Deltay vs deltaphi for Phi and Pion in MCGen ME", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxisExt, binnedpTPiAxisExt, deltayAxis, deltaphiAxis}); + histos.add("phiPi/h5PhiPiClosureMCGenME", "Deltay vs deltaphi for Phi and Pion in MCGen ME", kTHnSparseF, {binnedmultAxis, binnedpTPhiAxisExt, binnedpTPiAxisExt, deltayAxis, deltaphiAxis});*/ // Load efficiency maps from CCDB if (efficiencyConfigs.applyEfficiency) { @@ -795,12 +830,18 @@ struct PhiStrangeCorrelation { } else { customFillTHn(HIST("phiK0S/h6PhiK0SData"), weight, multiplicity, phiCand.pt(), assoc.pt(), phiCand.y() - assoc.y(), phiCand.m(), assoc.m()); } - } else if constexpr (PartType == kLambda || PartType == kAntiLambda) { + } else if constexpr (PartType == kLambda) { if constexpr (IsME) { customFillTHn(HIST("phiLambda/h6PhiLambdaDataME"), weight, multiplicity, phiCand.pt(), assoc.pt(), phiCand.y() - assoc.y(), phiCand.m(), assoc.m()); } else { customFillTHn(HIST("phiLambda/h6PhiLambdaData"), weight, multiplicity, phiCand.pt(), assoc.pt(), phiCand.y() - assoc.y(), phiCand.m(), assoc.m()); } + } else if constexpr (PartType == kAntiLambda) { + if constexpr (IsME) { + customFillTHn(HIST("phiAntiLambda/h6PhiAntiLambdaDataME"), weight, multiplicity, phiCand.pt(), assoc.pt(), phiCand.y() - assoc.y(), phiCand.m(), assoc.m()); + } else { + customFillTHn(HIST("phiAntiLambda/h6PhiAntiLambdaData"), weight, multiplicity, phiCand.pt(), assoc.pt(), phiCand.y() - assoc.y(), phiCand.m(), assoc.m()); + } } else if constexpr (PartType == kXi) { if constexpr (IsME) { customFillTHn(HIST("phiXi/h6PhiXiDataME"), weight, multiplicity, phiCand.pt(), assoc.pt(), phiCand.y() - assoc.y(), phiCand.m(), assoc.m()); @@ -834,7 +875,7 @@ struct PhiStrangeCorrelation { fillSignal = [&]() { customFillTHn(HIST("phiK0S/h5PhiK0SDataSignal"), weight, multiplicity, phiCand.pt(), assoc.pt(), phiCand.y() - assoc.y(), getDeltaPhi(phiCand.phi(), assoc.phi())); }; fillSideband = [&]() { customFillTHn(HIST("phiK0S/h5PhiK0SDataSideband"), weight, multiplicity, phiCand.pt(), assoc.pt(), phiCand.y() - assoc.y(), getDeltaPhi(phiCand.phi(), assoc.phi())); }; } - } else if constexpr (PartType == kLambda || PartType == kAntiLambda) { + } else if constexpr (PartType == kLambda) { if constexpr (IsME) { fillSignal = [&]() { customFillTHn(HIST("phiLambda/h5PhiLambdaDataMESignal"), weight, multiplicity, phiCand.pt(), assoc.pt(), phiCand.y() - assoc.y(), getDeltaPhi(phiCand.phi(), assoc.phi())); }; fillSideband = [&]() { customFillTHn(HIST("phiLambda/h5PhiLambdaDataMESideband"), weight, multiplicity, phiCand.pt(), assoc.pt(), phiCand.y() - assoc.y(), getDeltaPhi(phiCand.phi(), assoc.phi())); }; @@ -842,6 +883,14 @@ struct PhiStrangeCorrelation { fillSignal = [&]() { customFillTHn(HIST("phiLambda/h5PhiLambdaDataSignal"), weight, multiplicity, phiCand.pt(), assoc.pt(), phiCand.y() - assoc.y(), getDeltaPhi(phiCand.phi(), assoc.phi())); }; fillSideband = [&]() { customFillTHn(HIST("phiLambda/h5PhiLambdaDataSideband"), weight, multiplicity, phiCand.pt(), assoc.pt(), phiCand.y() - assoc.y(), getDeltaPhi(phiCand.phi(), assoc.phi())); }; } + } else if constexpr (PartType == kAntiLambda) { + if constexpr (IsME) { + fillSignal = [&]() { customFillTHn(HIST("phiAntiLambda/h5PhiAntiLambdaDataMESignal"), weight, multiplicity, phiCand.pt(), assoc.pt(), phiCand.y() - assoc.y(), getDeltaPhi(phiCand.phi(), assoc.phi())); }; + fillSideband = [&]() { customFillTHn(HIST("phiAntiLambda/h5PhiAntiLambdaDataMESideband"), weight, multiplicity, phiCand.pt(), assoc.pt(), phiCand.y() - assoc.y(), getDeltaPhi(phiCand.phi(), assoc.phi())); }; + } else { + fillSignal = [&]() { customFillTHn(HIST("phiAntiLambda/h5PhiAntiLambdaDataSignal"), weight, multiplicity, phiCand.pt(), assoc.pt(), phiCand.y() - assoc.y(), getDeltaPhi(phiCand.phi(), assoc.phi())); }; + fillSideband = [&]() { customFillTHn(HIST("phiAntiLambda/h5PhiAntiLambdaDataSideband"), weight, multiplicity, phiCand.pt(), assoc.pt(), phiCand.y() - assoc.y(), getDeltaPhi(phiCand.phi(), assoc.phi())); }; + } } else if constexpr (PartType == kXi) { if constexpr (IsME) { fillSignal = [&]() { customFillTHn(HIST("phiXi/h5PhiXiDataMESignal"), weight, multiplicity, phiCand.pt(), assoc.pt(), phiCand.y() - assoc.y(), getDeltaPhi(phiCand.phi(), assoc.phi())); }; From aaf15ffc4c700b7d21cafec76cde34264fec9f53 Mon Sep 17 00:00:00 2001 From: scannito Date: Fri, 25 Sep 2026 13:24:40 +0200 Subject: [PATCH 3/6] More macros for boilerplatecode --- .../Strangeness/phiStrangeCorrelation.cxx | 59 ++++++++++++++++--- 1 file changed, 52 insertions(+), 7 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx b/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx index 10cd27e5e00..f18e0e5c89d 100644 --- a/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx +++ b/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx @@ -546,9 +546,6 @@ struct PhiStrangeCorrelation { ccdb->setLocalObjectValidityChecking(); ccdb->setFatalWhenNull(false); - /*for (int i = 0; i < ParticleOfInterestSize; ++i) { - loadEfficiencyMapFromCCDB(static_cast(i)); - }*/ if (!efficiencyConfigs.perPeriodEfficiency) { loadEfficiencyMaps(); } @@ -823,8 +820,37 @@ struct PhiStrangeCorrelation { { const std::array, kPhiMassRegions> phiMassRegions = {phiConfigs.rangeMPhiSignal, phiConfigs.rangeMPhiSideband}; + float deltaY = phiCand.y() - assoc.y(); + float deltaPhi = getDeltaPhi(phiCand.phi(), assoc.phi()); + if (analysisMode == kMassvsMass) { - if constexpr (PartType == kK0S) { + +#define FILL_MASS_CASE(PART_ENUM, PART_STR) \ + if constexpr (PartType == PART_ENUM) { \ + if constexpr (IsME) { \ + customFillTHn(HIST("phi" PART_STR "/h6Phi" PART_STR "DataME"), weight, multiplicity, phiCand.pt(), assoc.pt(), deltaY, phiCand.m(), assoc.m()); \ + } else { \ + customFillTHn(HIST("phi" PART_STR "/h6Phi" PART_STR "Data"), weight, multiplicity, phiCand.pt(), assoc.pt(), deltaY, phiCand.m(), assoc.m()); \ + } \ + } + + FILL_MASS_CASE(kK0S, "K0S"); + FILL_MASS_CASE(kLambda, "Lambda"); + FILL_MASS_CASE(kAntiLambda, "AntiLambda"); + FILL_MASS_CASE(kXi, "Xi"); + FILL_MASS_CASE(kOmega, "Omega"); + if constexpr (PartType == kPion) { + if constexpr (IsME) { + customFillTHn(HIST("phiPi/h6PhiPiTPCDataME"), weight, multiplicity, phiCand.pt(), assoc.pt(), deltaY, phiCand.m(), assoc.nSigmaTPC()); + customFillTHn(HIST("phiPi/h6PhiPiTOFDataME"), weight, multiplicity, phiCand.pt(), assoc.pt(), deltaY, phiCand.m(), assoc.nSigmaTOF()); + } else { + customFillTHn(HIST("phiPi/h6PhiPiTPCData"), weight, multiplicity, phiCand.pt(), assoc.pt(), deltaY, phiCand.m(), assoc.nSigmaTPC()); + customFillTHn(HIST("phiPi/h6PhiPiTOFData"), weight, multiplicity, phiCand.pt(), assoc.pt(), deltaY, phiCand.m(), assoc.nSigmaTOF()); + } + } +#undef FILL_MASS_CASE + + /*if constexpr (PartType == kK0S) { if constexpr (IsME) { customFillTHn(HIST("phiK0S/h6PhiK0SDataME"), weight, multiplicity, phiCand.pt(), assoc.pt(), phiCand.y() - assoc.y(), phiCand.m(), assoc.m()); } else { @@ -862,12 +888,31 @@ struct PhiStrangeCorrelation { customFillTHn(HIST("phiPi/h6PhiPiTPCData"), weight, multiplicity, phiCand.pt(), assoc.pt(), phiCand.y() - assoc.y(), phiCand.m(), assoc.nSigmaTPC()); customFillTHn(HIST("phiPi/h6PhiPiTOFData"), weight, multiplicity, phiCand.pt(), assoc.pt(), phiCand.y() - assoc.y(), phiCand.m(), assoc.nSigmaTOF()); } - } + }*/ } else if (analysisMode == kDeltaYvsDeltaPhi) { std::function fillSignal; std::function fillSideband; - if constexpr (PartType == kK0S) { +#define FILL_DYDP_CASE(PART_ENUM, PART_STR) \ + if constexpr (PartType == PART_ENUM) { \ + if constexpr (IsME) { \ + fillSignal = [&]() { customFillTHn(HIST("phi" PART_STR "/h5Phi" PART_STR "DataMESignal"), weight, multiplicity, phiCand.pt(), assoc.pt(), deltaY, deltaPhi); }; \ + fillSideband = [&]() { customFillTHn(HIST("phi" PART_STR "/h5Phi" PART_STR "DataMESideband"), weight, multiplicity, phiCand.pt(), assoc.pt(), deltaY, deltaPhi); }; \ + } else { \ + fillSignal = [&]() { customFillTHn(HIST("phi" PART_STR "/h5Phi" PART_STR "DataSignal"), weight, multiplicity, phiCand.pt(), assoc.pt(), deltaY, deltaPhi); }; \ + fillSideband = [&]() { customFillTHn(HIST("phi" PART_STR "/h5Phi" PART_STR "DataSideband"), weight, multiplicity, phiCand.pt(), assoc.pt(), deltaY, deltaPhi); }; \ + } \ + } + + FILL_DYDP_CASE(kK0S, "K0S"); + FILL_DYDP_CASE(kLambda, "Lambda"); + FILL_DYDP_CASE(kAntiLambda, "AntiLambda"); + FILL_DYDP_CASE(kXi, "Xi"); + FILL_DYDP_CASE(kOmega, "Omega"); + FILL_DYDP_CASE(kPion, "Pi"); +#undef FILL_DYDP_CASE + + /*if constexpr (PartType == kK0S) { if constexpr (IsME) { fillSignal = [&]() { customFillTHn(HIST("phiK0S/h5PhiK0SDataMESignal"), weight, multiplicity, phiCand.pt(), assoc.pt(), phiCand.y() - assoc.y(), getDeltaPhi(phiCand.phi(), assoc.phi())); }; fillSideband = [&]() { customFillTHn(HIST("phiK0S/h5PhiK0SDataMESideband"), weight, multiplicity, phiCand.pt(), assoc.pt(), phiCand.y() - assoc.y(), getDeltaPhi(phiCand.phi(), assoc.phi())); }; @@ -915,7 +960,7 @@ struct PhiStrangeCorrelation { fillSignal = [&]() { customFillTHn(HIST("phiPi/h5PhiPiDataSignal"), weight, multiplicity, phiCand.pt(), assoc.pt(), phiCand.y() - assoc.y(), getDeltaPhi(phiCand.phi(), assoc.phi())); }; fillSideband = [&]() { customFillTHn(HIST("phiPi/h5PhiPiDataSideband"), weight, multiplicity, phiCand.pt(), assoc.pt(), phiCand.y() - assoc.y(), getDeltaPhi(phiCand.phi(), assoc.phi())); }; } - } + }*/ static_for<0, kPhiMassRegions - 1>([&](auto i_idx) { constexpr unsigned int Idx = i_idx.value; From 4235e1583138462d78f5df081e528f1c2b9025bc Mon Sep 17 00:00:00 2001 From: scannito Date: Fri, 25 Sep 2026 15:56:17 +0200 Subject: [PATCH 4/6] Renamed min pt configs in McGen --- .../Strangeness/phiStrangeCorrelation.cxx | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx b/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx index f18e0e5c89d..81b6ec46eb1 100644 --- a/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx +++ b/PWGLF/Tasks/Strangeness/phiStrangeCorrelation.cxx @@ -289,12 +289,12 @@ struct PhiStrangeCorrelation { // Configurables for minimum pt selection in McGen struct : ConfigurableGroup { - Configurable minPhiPt{"minPhiPt", 0.4f, "Minimum pT for Phi candidates"}; - Configurable v0SettingMinPt{"v0SettingMinPt", 0.1f, "V0 min pt"}; - Configurable lambdaSettingMinPt{"lambdaSettingMinPt", 0.2f, "Lambda min pt"}; - Configurable cascadeSettingMinPt{"cascadeSettingMinPt", 0.8f, "Cascade min pt"}; - Configurable omegaSettingMinPt{"omegaSettingMinPt", 0.8f, "Omega min pt"}; - Configurable cMinPionPtcut{"cMinPionPtcut", 0.2f, "Track minimum pt cut"}; + Configurable minPtPhi{"minPtPhi", 0.4f, "Minimum pT for Phi candidates"}; + Configurable minPtK0S{"minPtK0S", 0.1f, "Minimum pT for K0S candidates"}; + Configurable minPtLambda{"minPtLambda", 0.2f, "Minimum pT for Lambda candidates"}; + Configurable minPtXi{"minPtXi", 0.8f, "Minimum pT for Xi candidates"}; + Configurable minPtOmega{"minPtOmega", 0.8f, "Minimum pT for Omega candidates"}; + Configurable minPtPion{"minPtPion", 0.2f, "Minimum pT for Pion candidates"}; Configurable bypassPtCut{"bypassPtCut", false, "Bypass the minimum pt cut at MCGen level"}; } minPtMcGenConfigs; @@ -695,15 +695,15 @@ struct PhiStrangeCorrelation { float getMinGenPt() const { if constexpr (PartType == kK0S) { - return minPtMcGenConfigs.v0SettingMinPt.value; + return minPtMcGenConfigs.minPtK0S.value; } else if constexpr (PartType == kLambda || PartType == kAntiLambda) { - return minPtMcGenConfigs.lambdaSettingMinPt.value; + return minPtMcGenConfigs.minPtLambda.value; } else if constexpr (PartType == kXi) { - return minPtMcGenConfigs.cascadeSettingMinPt.value; + return minPtMcGenConfigs.minPtXi.value; } else if constexpr (PartType == kOmega) { - return minPtMcGenConfigs.omegaSettingMinPt.value; + return minPtMcGenConfigs.minPtOmega.value; } else if constexpr (PartType == kPion) { - return minPtMcGenConfigs.cMinPionPtcut.value; + return minPtMcGenConfigs.minPtPion.value; } else { static_assert(PartType == kK0S || PartType == kLambda || PartType == kAntiLambda || PartType == kXi || PartType == kOmega || PartType == kPion, @@ -1356,7 +1356,7 @@ struct PhiStrangeCorrelation { switch (std::abs(mcParticle.pdgCode())) { case o2::constants::physics::Pdg::kPhi: - if (eventSelectionType == 0 && mcParticle.pt() >= minPtMcGenConfigs.minPhiPt) { + if (eventSelectionType == 0 && mcParticle.pt() >= minPtMcGenConfigs.minPtPhi) { fillGenHistos(HIST("phi/h3PhiMCGen"), HIST("phi/h4PhiMCGenAssocReco")); } break; @@ -1414,7 +1414,7 @@ struct PhiStrangeCorrelation { switch (std::abs(mcParticle.pdgCode())) { case o2::constants::physics::Pdg::kPhi: - if (eventSelectionType == 0 && (minPtMcGenConfigs.bypassPtCut || mcParticle.pt() >= minPtMcGenConfigs.minPhiPt)) { + if (eventSelectionType == 0 && (minPtMcGenConfigs.bypassPtCut || mcParticle.pt() >= minPtMcGenConfigs.minPtPhi)) { phiParticles.emplace_back(mcParticle.pt(), mcParticle.y(), mcParticle.phi()); } break; From 1a1ebc4ba11099e4c5a7683da388bd1171fee5a3 Mon Sep 17 00:00:00 2001 From: scannito Date: Fri, 25 Sep 2026 16:02:16 +0200 Subject: [PATCH 5/6] Added necessary histograms for lambda feeddown --- .../Strangeness/phiStrangeCorrelator.cxx | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/PWGLF/TableProducer/Strangeness/phiStrangeCorrelator.cxx b/PWGLF/TableProducer/Strangeness/phiStrangeCorrelator.cxx index 907bfb71011..dc1f3407bdf 100644 --- a/PWGLF/TableProducer/Strangeness/phiStrangeCorrelator.cxx +++ b/PWGLF/TableProducer/Strangeness/phiStrangeCorrelator.cxx @@ -468,6 +468,8 @@ struct V0ReducedCandProducer { } lambdaConfigs; } v0Configs; + Configurable> binspTXi{"binspTXi", {0.8, 1.2, 1.6, 2.0, 2.5, 3.0, 4.0, 6.0}, "pT bin limits for Xi"}; + // Constants static constexpr double MassK0S = o2::constants::physics::MassK0Short; static constexpr double MassLambda = o2::constants::physics::MassLambda0; @@ -500,12 +502,16 @@ struct V0ReducedCandProducer { AxisSpec binnedmultAxis{(std::vector)binsMult, "centFT0M"}; AxisSpec binnedpTK0SAxis{(std::vector)v0Configs.k0sConfigs.binspTK0S, "#it{p}_{T} (GeV/#it{c})"}; AxisSpec binnedpTLambdaAxis{(std::vector)v0Configs.lambdaConfigs.binspTLambda, "#it{p}_{T} (GeV/#it{c})"}; + AxisSpec binnedpTXiAxis{(std::vector)binspTXi, "#it{p}_{T} (GeV/#it{c})"}; AxisSpec massK0SAxis = {200, 0.45f, 0.55f, "#it{M}_{inv} [GeV/#it{c}^{2}]"}; AxisSpec massLambdaAxis = {200, 1.08f, 1.15f, "#it{M}_{inv} [GeV/#it{c}^{2}]"}; histos.add("h3K0sCandidatesMass", "K^{0}_{S} candidate invariant mass", kTH3F, {binnedmultAxis, binnedpTK0SAxis, massK0SAxis}); histos.add("h3LambdaCandidatesMass", "#Lambda candidate invariant mass", kTH3F, {binnedmultAxis, binnedpTLambdaAxis, massLambdaAxis}); histos.add("h3AntiLambdaCandidatesMass", "#bar{#Lambda} candidate invariant mass", kTH3F, {binnedmultAxis, binnedpTLambdaAxis, massLambdaAxis}); + + histos.add("h2LambdaFromXi", "#Lambda from #Xi", kTH2F, {binnedpTLambdaAxis, binnedpTXiAxis}); + histos.add("h2AntiLambdaFromXi", "#bar{#Lambda} from #Xi", kTH2F, {binnedpTLambdaAxis, binnedpTXiAxis}); } template @@ -641,7 +647,31 @@ struct V0ReducedCandProducer { const auto& mcParticles = mcParticlesOpt->get(); const auto& v0McParticle = mcParticles.rawIteratorAt(v0.mcParticleId()); - if (v0McParticle.pdgCode() != getPdgCode() || !v0McParticle.isPhysicalPrimary()) { + // if (v0McParticle.pdgCode() != getPdgCode() || !v0McParticle.isPhysicalPrimary()) { + // return; + //} + if (v0McParticle.pdgCode() != getPdgCode()) { + return; + } + + if constexpr ((v0Type == kLambda || v0Type == kAntiLambda)) { + if (v0.has_mcMotherParticle()) { + auto v0McMotherParticle = mcParticles.rawIteratorAt(v0.mcMotherParticleId()); + if (std::abs(v0McMotherParticle.y()) <= v0Configs.yAcceptance) { + if constexpr (v0Type == kLambda) { + if (v0McMotherParticle.pdgCode() == PDG_t::kXiMinus || v0McMotherParticle.pdgCode() == o2::constants::physics::Pdg::kXi0) { + histos.fill(HIST("h2LambdaFromXi"), v0McParticle.pt(), v0McMotherParticle.pt()); + } + } else if constexpr (v0Type == kAntiLambda) { + if (v0McMotherParticle.pdgCode() == PDG_t::kXiPlusBar || v0McMotherParticle.pdgCode() == o2::constants::physics::Pdg::kXi0) { + histos.fill(HIST("h2AntiLambdaFromXi"), v0McParticle.pt(), v0McMotherParticle.pt()); + } + } + } + } + } + + if (!v0McParticle.isPhysicalPrimary()) { return; } From 49ae7a0a58c86d7a540d8ad7973c389db1f9a740 Mon Sep 17 00:00:00 2001 From: scannito Date: Fri, 25 Sep 2026 16:11:35 +0200 Subject: [PATCH 6/6] Fix pdg code --- PWGLF/TableProducer/Strangeness/phiStrangeCorrelator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGLF/TableProducer/Strangeness/phiStrangeCorrelator.cxx b/PWGLF/TableProducer/Strangeness/phiStrangeCorrelator.cxx index dc1f3407bdf..7d3fca0718b 100644 --- a/PWGLF/TableProducer/Strangeness/phiStrangeCorrelator.cxx +++ b/PWGLF/TableProducer/Strangeness/phiStrangeCorrelator.cxx @@ -663,7 +663,7 @@ struct V0ReducedCandProducer { histos.fill(HIST("h2LambdaFromXi"), v0McParticle.pt(), v0McMotherParticle.pt()); } } else if constexpr (v0Type == kAntiLambda) { - if (v0McMotherParticle.pdgCode() == PDG_t::kXiPlusBar || v0McMotherParticle.pdgCode() == o2::constants::physics::Pdg::kXi0) { + if (v0McMotherParticle.pdgCode() == PDG_t::kXiPlusBar || v0McMotherParticle.pdgCode() == -o2::constants::physics::Pdg::kXi0) { histos.fill(HIST("h2AntiLambdaFromXi"), v0McParticle.pt(), v0McMotherParticle.pt()); } }