From dc0373041e18877b331f28ce4c9d7bd4cfefde2c Mon Sep 17 00:00:00 2001 From: Fabio Catalano Date: Mon, 25 Aug 2025 11:36:39 +0200 Subject: [PATCH 1/7] Cleanup OmegaC task output --- PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx | 140 +++++++++-------------- 1 file changed, 54 insertions(+), 86 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx b/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx index a611d7e166a..11579d7cc18 100644 --- a/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx +++ b/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx @@ -52,10 +52,9 @@ namespace o2::aod { namespace ml { -// collision info -DECLARE_SOA_COLUMN(KfptPiFromOmegac, kfptPiFromOmegac, float); -DECLARE_SOA_COLUMN(KfptOmegac, kfptOmegac, float); DECLARE_SOA_COLUMN(InvMassCharmBaryon, invMassCharmBaryon, float); +DECLARE_SOA_COLUMN(KfptOmegac, kfptOmegac, float); +DECLARE_SOA_COLUMN(KfptPiFromOmegac, kfptPiFromOmegac, float); DECLARE_SOA_COLUMN(MlProbOmegac, mlProbOmegac, float); DECLARE_SOA_COLUMN(Cent, cent, float); } // namespace ml @@ -64,17 +63,13 @@ DECLARE_SOA_TABLE(HfKfOmegacML, "AOD", "HFKFOMEGACML", } // namespace o2::aod /// Omegac0 analysis task - struct HfTaskOmegac0ToOmegapi { - Produces kfCandMl; - // ML inference - Configurable applyMl{"applyMl", false, "Flag to apply ML selections"}; - Configurable fillCent{"fillCent", false, "Flag to fill centrality information"}; - Configurable fillTree{"fillTree", false, "Fill TTree for local analysis.(Enabled only with ML)"}; + Configurable selectionFlagOmegac0{"selectionFlagOmegac0", true, "Select Omegac0 candidates"}; - Configurable yCandGenMax{"yCandGenMax", 0.5, "max. gen particle rapidity"}; - Configurable yCandRecoMax{"yCandRecoMax", 0.8, "max. cand. rapidity"}; + Configurable yCandGenMax{"yCandGenMax", 0.5, "Max. gen particle rapidity"}; + Configurable yCandRecoMax{"yCandRecoMax", 0.8, "Max. cand. rapidity"}; + Configurable fillTree{"fillTree", false, "Fill tree for local analysis (enabled only with ML)"}; HfHelper hfHelper; SliceCache cache; @@ -84,7 +79,6 @@ struct HfTaskOmegac0ToOmegapi { using Omegac0Cands = soa::Filtered>; using Omegac0CandsKF = soa::Filtered>; using OmegaC0CandsMcKF = soa::Filtered>; - using Omegac0CandsMl = soa::Filtered>; using Omegac0CandsMlKF = soa::Filtered>; using Omegac0CandsMlMcKF = soa::Filtered>; @@ -99,23 +93,21 @@ struct HfTaskOmegac0ToOmegapi { Filter filterOmegaCToOmegaPiFlag = (aod::hf_track_index::hfflag & static_cast(BIT(aod::hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaPi))) != static_cast(0); Filter filterOmegaCMatchedRec = nabs(aod::hf_cand_xic0_omegac0::flagMcMatchRec) == static_cast(BIT(aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaPi)); Filter filterOmegaCMatchedGen = nabs(aod::hf_cand_xic0_omegac0::flagMcMatchGen) == static_cast(BIT(aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaPi)); + Preslice candOmegacKFPerCollision = aod::hf_cand_xic0_omegac0::collisionId; Preslice candOmegacKFMlPerCollision = aod::hf_cand_xic0_omegac0::collisionId; - PresliceUnsorted colPerMcCollision = aod::mccollisionlabel::mcCollisionId; - // ThnSparse for ML outputScores and Vars - ConfigurableAxis thnConfigAxisPromptScore{"thnConfigAxisPromptScore", {100, 0, 1}, "Prompt score bins"}; - ConfigurableAxis thnConfigAxisMass{"thnConfigAxisMass", {120, 2.4, 3.1}, "Cand. inv-mass bins"}; - ConfigurableAxis thnConfigAxisPtB{"thnConfigAxisPtB", {1000, 0, 100}, "Cand. beauty mother pTB bins"}; - ConfigurableAxis thnConfigAxisPt{"thnConfigAxisPt", {100, 0, 20}, "Cand. pT bins"}; - ConfigurableAxis thnConfigAxisY{"thnConfigAxisY", {20, -1, 1}, "Cand. rapidity bins"}; - ConfigurableAxis thnConfigAxisCent{"thnConfigAxisCent", {100, 0, 100}, "Centrality bins"}; - ConfigurableAxis thnConfigAxisPtPion{"thnConfigAxisPtPion", {100, 0, 10}, "PtPion from Omegac0 bins"}; - ConfigurableAxis thnConfigAxisOrigin{"thnConfigAxisOrigin", {3, -0.5, 2.5}, "Cand. origin type"}; - ConfigurableAxis thnConfigAxisMatchFlag{"thnConfigAxisMatchFlag", {15, -7.5, 7.5}, "Cand. MC Match Flag type"}; - ConfigurableAxis thnConfigAxisGenPtD{"thnConfigAxisGenPtD", {500, 0, 50}, "Gen Pt D"}; - ConfigurableAxis thnConfigAxisGenPtB{"thnConfigAxisGenPtB", {1000, 0, 100}, "Gen Pt B"}; + ConfigurableAxis thnConfigAxisPromptScore{"thnConfigAxisPromptScore", {100, 0, 1}, "Prompt score"}; + ConfigurableAxis thnConfigAxisMass{"thnConfigAxisMass", {700, 2.4, 3.1}, "Cand. inv. mass"}; + ConfigurableAxis thnConfigAxisPtB{"thnConfigAxisPtB", {500, 0, 50}, "Cand. beauty mother pT"}; + ConfigurableAxis thnConfigAxisPt{"thnConfigAxisPt", {500, 0, 50}, "Cand. pT"}; + ConfigurableAxis thnConfigAxisY{"thnConfigAxisY", {20, -1, 1}, "Cand. rapidity"}; + ConfigurableAxis thnConfigAxisCent{"thnConfigAxisCent", {100, 0, 100}, "Centrality"}; + ConfigurableAxis thnConfigAxisOrigin{"thnConfigAxisOrigin", {3, -0.5, 2.5}, "Cand. origin"}; + ConfigurableAxis thnConfigAxisMatchFlag{"thnConfigAxisMatchFlag", {15, -7.5, 7.5}, "Cand. MC match flag"}; + ConfigurableAxis thnConfigAxisGenPtD{"thnConfigAxisGenPtD", {500, 0, 50}, "Gen pT"}; + ConfigurableAxis thnConfigAxisGenPtB{"thnConfigAxisGenPtB", {500, 0, 50}, "Gen beauty mother pT"}; ConfigurableAxis thnConfigAxisNumPvContr{"thnConfigAxisNumPvContr", {200, -0.5, 199.5}, "Number of PV contributors"}; HistogramRegistry registry{"registry", {}}; @@ -140,44 +132,37 @@ struct HfTaskOmegac0ToOmegapi { const AxisSpec thnAxisPtB{thnConfigAxisPtB, "#it{p}_{T}^{B} (GeV/#it{c})"}; const AxisSpec thnAxisY{thnConfigAxisY, "y"}; const AxisSpec thnAxisOrigin{thnConfigAxisOrigin, "Origin"}; - const AxisSpec thnAxisMatchFlag{thnConfigAxisMatchFlag, "MatchFlag"}; + const AxisSpec thnAxisMatchFlag{thnConfigAxisMatchFlag, "MC match flag"}; const AxisSpec thnAxisGenPtD{thnConfigAxisGenPtD, "#it{p}_{T} (GeV/#it{c})"}; const AxisSpec thnAxisGenPtB{thnConfigAxisGenPtB, "#it{p}_{T}^{B} (GeV/#it{c})"}; const AxisSpec thnAxisNumPvContr{thnConfigAxisNumPvContr, "Number of PV contributors"}; + const AxisSpec thnAxisPromptScore{thnConfigAxisPromptScore, "BDT score prompt"}; + const AxisSpec thnAxisCent{thnConfigAxisCent, "Centrality"}; - if (doprocessMcWithKFParticle || doprocessMcWithKFParticleMl) { - std::vector axesAcc = {thnAxisGenPtD, thnAxisGenPtB, thnAxisY, thnAxisOrigin, thnAxisNumPvContr}; - registry.add("hSparseAcc", "Thn for generated Omega0 from charm and beauty", HistType::kTHnSparseD, axesAcc); - registry.get(HIST("hSparseAcc"))->Sumw2(); + std::vector axes = {thnAxisMass, thnAxisPt, thnAxisY}; + + if (doprocessDataWithKFParticleFT0C || doprocessDataWithKFParticleMlFT0C || doprocessDataWithKFParticleFT0M || doprocessDataWithKFParticleMlFT0M) { + axes.push_back(thnAxisCent); + axes.push_back(thnConfigAxisNumPvContr); } - std::vector axes = {thnAxisMass, thnAxisPt, thnAxisY}; if (doprocessMcWithKFParticle || doprocessMcWithKFParticleMl) { + std::vector axesMcGen = {thnAxisGenPtD, thnAxisGenPtB, thnAxisY, thnAxisOrigin, thnAxisNumPvContr}; + registry.add("hMcGen", "Thn for generated #Omega_{c}^{0} from charm and beauty", HistType::kTHnSparseD, axesMcGen); + registry.get(HIST("hMcGen"))->Sumw2(); + axes.push_back(thnAxisPtB); axes.push_back(thnAxisOrigin); axes.push_back(thnAxisMatchFlag); axes.push_back(thnAxisNumPvContr); } - if (applyMl) { - const AxisSpec thnAxisPromptScore{thnConfigAxisPromptScore, "BDT score prompt."}; - axes.insert(axes.begin(), thnAxisPromptScore); - registry.add("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsOmegac0Type", "Thn for Omegac0 candidates", HistType::kTHnSparseD, axes); - registry.get(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsOmegac0Type"))->Sumw2(); - } else { - registry.add("hMassVsPtVsPtBVsYVsOriginVsOmegac0Type", "Thn for Omegac0 candidates", HistType::kTHnSparseF, axes); - registry.get(HIST("hMassVsPtVsPtBVsYVsOriginVsOmegac0Type"))->Sumw2(); - } - if (fillCent) { - const AxisSpec thnAxisPromptScore{thnConfigAxisPromptScore, "BDT score prompt."}; - const AxisSpec thnAxisCent{thnConfigAxisCent, "Centrality."}; - const AxisSpec thnAxisPtPion{thnConfigAxisPtPion, "Pt of Pion from Omegac0."}; - std::vector axesWithBdtCent = {thnAxisPromptScore, thnAxisMass, thnAxisPt, thnAxisY, thnAxisCent, thnAxisPtPion, thnConfigAxisNumPvContr}; - std::vector axesWithCent = {thnAxisMass, thnAxisPt, thnAxisY, thnAxisCent, thnAxisPtPion, thnConfigAxisNumPvContr}; - registry.add("hBdtScoreVsMassVsPtVsYVsCentVsPtPion", "Thn for Omegac0 candidates with BDT&Cent&pTpi", HistType::kTHnSparseD, axesWithBdtCent); - registry.add("hMassVsPtVsYVsCentVsPtPion", "Thn for Omegac0 candidates with Cent&pTpi", HistType::kTHnSparseD, axesWithCent); - registry.get(HIST("hBdtScoreVsMassVsPtVsYVsCentVsPtPion"))->Sumw2(); - registry.get(HIST("hMassVsPtVsYVsCentVsPtPion"))->Sumw2(); + + if (doprocessDataWithKFParticleMl || doprocessDataWithKFParticleMlFT0C || doprocessDataWithKFParticleMlFT0M || doprocessMcWithKFParticleMl) { + axes.push_back(thnAxisPromptScore); } + + registry.add("hReco", "Thn for reco. #Omega_{c}^{0} candidates", HistType::kTHnSparseD, axes); + registry.get(HIST("hReco"))->Sumw2(); } /// Evaluate centrality/multiplicity percentile (centrality estimator is automatically selected based on the used table) @@ -196,14 +181,15 @@ struct HfTaskOmegac0ToOmegapi { if (!(candidate.resultSelections() == true || (candidate.resultSelections() == false && !selectionFlagOmegac0))) { continue; } + if (yCandRecoMax >= 0. && std::abs(candidate.kfRapOmegac()) > yCandRecoMax) { continue; } if constexpr (applyMl) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsOmegac0Type"), candidate.mlProbOmegac()[0], candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac()); + registry.fill(HIST("hReco"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac(), candidate.mlProbOmegac()[0]); } else { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsOmegac0Type"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac()); + registry.fill(HIST("hReco"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac()); } } } @@ -214,55 +200,37 @@ struct HfTaskOmegac0ToOmegapi { for (const auto& collision : collisions) { auto thisCollId = collision.globalIndex(); - auto groupedOmegacCandidates = applyMl - ? candidates.sliceBy(candOmegacKFMlPerCollision, thisCollId) - : candidates.sliceBy(candOmegacKFPerCollision, thisCollId); + auto groupedOmegacCandidates = applyMl ? candidates.sliceBy(candOmegacKFMlPerCollision, thisCollId) : candidates.sliceBy(candOmegacKFPerCollision, thisCollId); auto numPvContributors = collision.numContrib(); for (const auto& candidate : groupedOmegacCandidates) { if (!(candidate.resultSelections() == true || (candidate.resultSelections() == false && !selectionFlagOmegac0))) { continue; } + if (yCandRecoMax >= 0. && std::abs(candidate.kfRapOmegac()) > yCandRecoMax) { continue; } + float cent = evaluateCentralityColl(collision); + if constexpr (applyMl) { + registry.fill(HIST("hReco"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac(), + cent, numPvContributors, candidate.mlProbOmegac()[0]); if (fillTree) { - kfCandMl(candidate.invMassCharmBaryon(), - candidate.ptCharmBaryon(), - candidate.kfptPiFromOmegac(), - candidate.mlProbOmegac()[0], - cent); - } else { - registry.fill(HIST("hBdtScoreVsMassVsPtVsYVsCentVsPtPion"), - candidate.mlProbOmegac()[0], - candidate.invMassCharmBaryon(), - candidate.ptCharmBaryon(), - candidate.kfRapOmegac(), - cent, - candidate.kfptPiFromOmegac(), - numPvContributors); + kfCandMl(candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfptPiFromOmegac(), candidate.mlProbOmegac()[0], cent); } } else { - registry.fill(HIST("hMassVsPtVsYVsCentVsPtPion"), - candidate.invMassCharmBaryon(), - candidate.ptCharmBaryon(), - candidate.kfRapOmegac(), - cent, - candidate.kfptPiFromOmegac(), - numPvContributors); + registry.fill(HIST("hReco"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac(), + cent, numPvContributors); } } } } template - void processMc(const CandType& candidates, - Omegac0Gen const& mcParticles, - TracksMc const&, - CollType const& collisions, - aod::McCollisions const&) + void processMc(const CandType& candidates, Omegac0Gen const& mcParticles, TracksMc const&, + CollType const& collisions, aod::McCollisions const&) { // MC rec. for (const auto& candidate : candidates) { @@ -276,10 +244,10 @@ struct HfTaskOmegac0ToOmegapi { auto numPvContributors = candidate.template collision_as().numContrib(); if constexpr (applyMl) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsOmegac0Type"), candidate.mlProbOmegac()[0], candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac(), candidate.ptBhadMotherPart(), candidate.originMcRec(), candidate.flagMcMatchRec(), numPvContributors); + registry.fill(HIST("hReco"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac(), candidate.ptBhadMotherPart(), candidate.originMcRec(), candidate.flagMcMatchRec(), numPvContributors); } else { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsOmegac0Type"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac(), candidate.ptBhadMotherPart(), candidate.originMcRec(), candidate.flagMcMatchRec(), numPvContributors); + registry.fill(HIST("hReco"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac(), candidate.ptBhadMotherPart(), candidate.originMcRec(), candidate.flagMcMatchRec(), numPvContributors, candidate.mlProbOmegac()[0]); } } @@ -292,17 +260,17 @@ struct HfTaskOmegac0ToOmegapi { auto ptGen = particle.pt(); auto yGen = particle.rapidityCharmBaryonGen(); - unsigned maxNumContrib = 0; + int maxNumContrib = 0; const auto& recoCollsPerMcColl = collisions.sliceBy(colPerMcCollision, particle.mcCollision().globalIndex()); for (const auto& recCol : recoCollsPerMcColl) { maxNumContrib = recCol.numContrib() > maxNumContrib ? recCol.numContrib() : maxNumContrib; } if (particle.originMcGen() == RecoDecay::OriginType::Prompt) { - registry.fill(HIST("hSparseAcc"), ptGen, -1., yGen, RecoDecay::OriginType::Prompt, maxNumContrib); + registry.fill(HIST("hMcGen"), ptGen, -1., yGen, RecoDecay::OriginType::Prompt, maxNumContrib); } else { float ptGenB = mcParticles.rawIteratorAt(particle.idxBhadMotherPart()).pt(); - registry.fill(HIST("hSparseAcc"), ptGen, ptGenB, yGen, RecoDecay::OriginType::NonPrompt, maxNumContrib); + registry.fill(HIST("hMcGen"), ptGen, ptGenB, yGen, RecoDecay::OriginType::NonPrompt, maxNumContrib); } } } From bd4749c0a195dad9ef1ee2f524a32bd3ed85b0da Mon Sep 17 00:00:00 2001 From: Fabio Catalano Date: Mon, 25 Aug 2025 11:50:40 +0200 Subject: [PATCH 2/7] Do not allow run data and MC process functions together (now that the histograms changed) --- PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx b/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx index 11579d7cc18..430c0b5056b 100644 --- a/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx +++ b/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx @@ -113,18 +113,10 @@ struct HfTaskOmegac0ToOmegapi { void init(InitContext&) { - std::array doprocess{doprocessDataWithKFParticle, doprocessDataWithKFParticleMl, doprocessDataWithKFParticleFT0C, doprocessDataWithKFParticleMlFT0C, doprocessDataWithKFParticleFT0M, doprocessDataWithKFParticleMlFT0M}; - if (std::accumulate(doprocess.begin(), doprocess.end(), 0) > 1) { - LOGP(fatal, "At most one data process function should be enabled at a time."); - } - - std::array doprocessMc{doprocessMcWithKFParticle, doprocessMcWithKFParticleMl}; - if (std::accumulate(doprocessMc.begin(), doprocessMc.end(), 0) > 1) { - LOGP(fatal, "At most one MC process function should be enabled at a time."); - } - - if ((std::accumulate(doprocess.begin(), doprocess.end(), 0) + std::accumulate(doprocessMc.begin(), doprocessMc.end(), 0)) == 0) { - LOGP(fatal, "At least one process function should be enabled."); + std::array doprocess{doprocessDataWithKFParticle, doprocessDataWithKFParticleMl, doprocessDataWithKFParticleFT0C, doprocessDataWithKFParticleMlFT0C, + doprocessDataWithKFParticleFT0M, doprocessDataWithKFParticleMlFT0M, doprocessMcWithKFParticle, doprocessMcWithKFParticleMl}; + if ((std::accumulate(doprocess.begin(), doprocess.end(), 0)) != 1) { + LOGP(fatal, "One and only one process function should be enabled at a time."); } const AxisSpec thnAxisMass{thnConfigAxisMass, "inv. mass (#Omega#pi) (GeV/#it{c}^{2})"}; @@ -244,10 +236,10 @@ struct HfTaskOmegac0ToOmegapi { auto numPvContributors = candidate.template collision_as().numContrib(); if constexpr (applyMl) { - registry.fill(HIST("hReco"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac(), candidate.ptBhadMotherPart(), candidate.originMcRec(), candidate.flagMcMatchRec(), numPvContributors); + registry.fill(HIST("hReco"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac(), candidate.ptBhadMotherPart(), candidate.originMcRec(), candidate.flagMcMatchRec(), numPvContributors, candidate.mlProbOmegac()[0]); } else { - registry.fill(HIST("hReco"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac(), candidate.ptBhadMotherPart(), candidate.originMcRec(), candidate.flagMcMatchRec(), numPvContributors, candidate.mlProbOmegac()[0]); + registry.fill(HIST("hReco"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac(), candidate.ptBhadMotherPart(), candidate.originMcRec(), candidate.flagMcMatchRec(), numPvContributors); } } From 103a6c35e536253ca99c1b8ee6e711012d7c5f69 Mon Sep 17 00:00:00 2001 From: Fabio Catalano Date: Mon, 25 Aug 2025 14:58:06 +0200 Subject: [PATCH 3/7] Remove centrality from MC + cleanup table subscriptions --- PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx | 51 ++++++++---------------- 1 file changed, 16 insertions(+), 35 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx b/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx index 430c0b5056b..db0a859a803 100644 --- a/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx +++ b/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx @@ -146,7 +146,6 @@ struct HfTaskOmegac0ToOmegapi { axes.push_back(thnAxisPtB); axes.push_back(thnAxisOrigin); axes.push_back(thnAxisMatchFlag); - axes.push_back(thnAxisNumPvContr); } if (doprocessDataWithKFParticleMl || doprocessDataWithKFParticleMlFT0C || doprocessDataWithKFParticleMlFT0M || doprocessMcWithKFParticleMl) { @@ -166,8 +165,8 @@ struct HfTaskOmegac0ToOmegapi { return o2::hf_centrality::getCentralityColl(collision); } - template - void processData(const CandType& candidates, CollType const&) + template + void processData(const CandType& candidates) { for (const auto& candidate : candidates) { if (!(candidate.resultSelections() == true || (candidate.resultSelections() == false && !selectionFlagOmegac0))) { @@ -190,7 +189,6 @@ struct HfTaskOmegac0ToOmegapi { void processDataCent(const CandType& candidates, CollType const& collisions) { for (const auto& collision : collisions) { - auto thisCollId = collision.globalIndex(); auto groupedOmegacCandidates = applyMl ? candidates.sliceBy(candOmegacKFMlPerCollision, thisCollId) : candidates.sliceBy(candOmegacKFPerCollision, thisCollId); auto numPvContributors = collision.numContrib(); @@ -220,9 +218,8 @@ struct HfTaskOmegac0ToOmegapi { } } - template - void processMc(const CandType& candidates, Omegac0Gen const& mcParticles, TracksMc const&, - CollType const& collisions, aod::McCollisions const&) + template + void processMc(const CandType& candidates, Omegac0Gen const& mcParticles) { // MC rec. for (const auto& candidate : candidates) { @@ -233,13 +230,11 @@ struct HfTaskOmegac0ToOmegapi { continue; } - auto numPvContributors = candidate.template collision_as().numContrib(); - if constexpr (applyMl) { - registry.fill(HIST("hReco"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac(), candidate.ptBhadMotherPart(), candidate.originMcRec(), candidate.flagMcMatchRec(), numPvContributors, candidate.mlProbOmegac()[0]); + registry.fill(HIST("hReco"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac(), candidate.ptBhadMotherPart(), candidate.originMcRec(), candidate.flagMcMatchRec(), candidate.mlProbOmegac()[0]); } else { - registry.fill(HIST("hReco"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac(), candidate.ptBhadMotherPart(), candidate.originMcRec(), candidate.flagMcMatchRec(), numPvContributors); + registry.fill(HIST("hReco"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac(), candidate.ptBhadMotherPart(), candidate.originMcRec(), candidate.flagMcMatchRec()); } } @@ -252,32 +247,24 @@ struct HfTaskOmegac0ToOmegapi { auto ptGen = particle.pt(); auto yGen = particle.rapidityCharmBaryonGen(); - int maxNumContrib = 0; - const auto& recoCollsPerMcColl = collisions.sliceBy(colPerMcCollision, particle.mcCollision().globalIndex()); - for (const auto& recCol : recoCollsPerMcColl) { - maxNumContrib = recCol.numContrib() > maxNumContrib ? recCol.numContrib() : maxNumContrib; - } - if (particle.originMcGen() == RecoDecay::OriginType::Prompt) { - registry.fill(HIST("hMcGen"), ptGen, -1., yGen, RecoDecay::OriginType::Prompt, maxNumContrib); + registry.fill(HIST("hMcGen"), ptGen, -1., yGen, RecoDecay::OriginType::Prompt); } else { float ptGenB = mcParticles.rawIteratorAt(particle.idxBhadMotherPart()).pt(); - registry.fill(HIST("hMcGen"), ptGen, ptGenB, yGen, RecoDecay::OriginType::NonPrompt, maxNumContrib); + registry.fill(HIST("hMcGen"), ptGen, ptGenB, yGen, RecoDecay::OriginType::NonPrompt); } } } - void processDataWithKFParticle(Omegac0CandsKF const& candidates, - Collisions const& collisions) + void processDataWithKFParticle(Omegac0CandsKF const& candidates) { - processData(candidates, collisions); + processData(candidates); } PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataWithKFParticle, "process HfTaskOmegac0ToOmegapi with KFParticle", false); - void processDataWithKFParticleMl(Omegac0CandsMlKF const& candidates, - Collisions const& collisions) + void processDataWithKFParticleMl(Omegac0CandsMlKF const& candidates) { - processData(candidates, collisions); + processData(candidates); } PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataWithKFParticleMl, "process HfTaskOmegac0ToOmegapi with KFParticle and ML selections", false); @@ -310,22 +297,16 @@ struct HfTaskOmegac0ToOmegapi { PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataWithKFParticleMlFT0M, "process HfTaskOmegac0ToOmegapi with KFParticle and ML selections and with FT0M centrality", false); void processMcWithKFParticle(OmegaC0CandsMcKF const& omegaC0CandidatesMcKF, - Omegac0Gen const& mcParticles, - TracksMc const& tracks, - CollisionsWithMcLabels const& collisions, - aod::McCollisions const& mcCollisions) + Omegac0Gen const& mcParticles) { - processMc(omegaC0CandidatesMcKF, mcParticles, tracks, collisions, mcCollisions); + processMc(omegaC0CandidatesMcKF, mcParticles); } PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processMcWithKFParticle, "Process MC with KFParticle", false); void processMcWithKFParticleMl(Omegac0CandsMlMcKF const& omegac0CandidatesMlMcKF, - Omegac0Gen const& mcParticles, - TracksMc const& tracks, - CollisionsWithMcLabels const& collisions, - aod::McCollisions const& mcCollisions) + Omegac0Gen const& mcParticles) { - processMc(omegac0CandidatesMlMcKF, mcParticles, tracks, collisions, mcCollisions); + processMc(omegac0CandidatesMlMcKF, mcParticles); } PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processMcWithKFParticleMl, "Process MC with KFParticle and ML selections", false); }; From 38c40a72357b06acbf19df8f1cb264038f6c40bf Mon Sep 17 00:00:00 2001 From: Fabio Catalano Date: Mon, 25 Aug 2025 15:04:26 +0200 Subject: [PATCH 4/7] Cleanup process-function names --- PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx | 54 ++++++++++++------------ 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx b/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx index db0a859a803..3b573daa56f 100644 --- a/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx +++ b/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx @@ -113,8 +113,8 @@ struct HfTaskOmegac0ToOmegapi { void init(InitContext&) { - std::array doprocess{doprocessDataWithKFParticle, doprocessDataWithKFParticleMl, doprocessDataWithKFParticleFT0C, doprocessDataWithKFParticleMlFT0C, - doprocessDataWithKFParticleFT0M, doprocessDataWithKFParticleMlFT0M, doprocessMcWithKFParticle, doprocessMcWithKFParticleMl}; + std::array doprocess{doprocessDataKFParticle, doprocessDataKFParticleMl, doprocessDataKFParticleFT0C, doprocessDataKFParticleMlFT0C, + doprocessDataKFParticleFT0M, doprocessDataKFParticleMlFT0M, doprocessMcKFParticle, doprocessMcKFParticleMl}; if ((std::accumulate(doprocess.begin(), doprocess.end(), 0)) != 1) { LOGP(fatal, "One and only one process function should be enabled at a time."); } @@ -133,12 +133,12 @@ struct HfTaskOmegac0ToOmegapi { std::vector axes = {thnAxisMass, thnAxisPt, thnAxisY}; - if (doprocessDataWithKFParticleFT0C || doprocessDataWithKFParticleMlFT0C || doprocessDataWithKFParticleFT0M || doprocessDataWithKFParticleMlFT0M) { + if (doprocessDataKFParticleFT0C || doprocessDataKFParticleMlFT0C || doprocessDataKFParticleFT0M || doprocessDataKFParticleMlFT0M) { axes.push_back(thnAxisCent); axes.push_back(thnConfigAxisNumPvContr); } - if (doprocessMcWithKFParticle || doprocessMcWithKFParticleMl) { + if (doprocessMcKFParticle || doprocessMcKFParticleMl) { std::vector axesMcGen = {thnAxisGenPtD, thnAxisGenPtB, thnAxisY, thnAxisOrigin, thnAxisNumPvContr}; registry.add("hMcGen", "Thn for generated #Omega_{c}^{0} from charm and beauty", HistType::kTHnSparseD, axesMcGen); registry.get(HIST("hMcGen"))->Sumw2(); @@ -148,7 +148,7 @@ struct HfTaskOmegac0ToOmegapi { axes.push_back(thnAxisMatchFlag); } - if (doprocessDataWithKFParticleMl || doprocessDataWithKFParticleMlFT0C || doprocessDataWithKFParticleMlFT0M || doprocessMcWithKFParticleMl) { + if (doprocessDataKFParticleMl || doprocessDataKFParticleMlFT0C || doprocessDataKFParticleMlFT0M || doprocessMcKFParticleMl) { axes.push_back(thnAxisPromptScore); } @@ -256,59 +256,59 @@ struct HfTaskOmegac0ToOmegapi { } } - void processDataWithKFParticle(Omegac0CandsKF const& candidates) + void processDataKFParticle(Omegac0CandsKF const& candidates) { processData(candidates); } - PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataWithKFParticle, "process HfTaskOmegac0ToOmegapi with KFParticle", false); + PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataKFParticle, "process HfTaskOmegac0ToOmegapi with KFParticle", false); - void processDataWithKFParticleMl(Omegac0CandsMlKF const& candidates) + void processDataKFParticleMl(Omegac0CandsMlKF const& candidates) { processData(candidates); } - PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataWithKFParticleMl, "process HfTaskOmegac0ToOmegapi with KFParticle and ML selections", false); + PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataKFParticleMl, "process HfTaskOmegac0ToOmegapi with KFParticle and ML selections", false); - void processDataWithKFParticleFT0C(Omegac0CandsKF const& candidates, - CollisionsWithFT0C const& collisions) + void processDataKFParticleFT0C(Omegac0CandsKF const& candidates, + CollisionsWithFT0C const& collisions) { processDataCent(candidates, collisions); } - PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataWithKFParticleFT0C, "process HfTaskOmegac0ToOmegapi with KFParticle and with FT0C centrality", false); + PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataKFParticleFT0C, "process HfTaskOmegac0ToOmegapi with KFParticle and with FT0C centrality", false); - void processDataWithKFParticleMlFT0C(Omegac0CandsMlKF const& candidates, - CollisionsWithFT0C const& collisions) + void processDataKFParticleMlFT0C(Omegac0CandsMlKF const& candidates, + CollisionsWithFT0C const& collisions) { processDataCent(candidates, collisions); } - PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataWithKFParticleMlFT0C, "process HfTaskOmegac0ToOmegapi with KFParticle and ML selections and with FT0C centrality", false); + PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataKFParticleMlFT0C, "process HfTaskOmegac0ToOmegapi with KFParticle and ML selections and with FT0C centrality", false); - void processDataWithKFParticleFT0M(Omegac0CandsKF const& candidates, - CollisionsWithFT0M const& collisions) + void processDataKFParticleFT0M(Omegac0CandsKF const& candidates, + CollisionsWithFT0M const& collisions) { processDataCent(candidates, collisions); } - PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataWithKFParticleFT0M, "process HfTaskOmegac0ToOmegapi with KFParticle and with FT0M centrality", false); + PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataKFParticleFT0M, "process HfTaskOmegac0ToOmegapi with KFParticle and with FT0M centrality", false); - void processDataWithKFParticleMlFT0M(Omegac0CandsMlKF const& candidates, - CollisionsWithFT0M const& collisions) + void processDataKFParticleMlFT0M(Omegac0CandsMlKF const& candidates, + CollisionsWithFT0M const& collisions) { processDataCent(candidates, collisions); } - PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataWithKFParticleMlFT0M, "process HfTaskOmegac0ToOmegapi with KFParticle and ML selections and with FT0M centrality", false); + PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataKFParticleMlFT0M, "process HfTaskOmegac0ToOmegapi with KFParticle and ML selections and with FT0M centrality", false); - void processMcWithKFParticle(OmegaC0CandsMcKF const& omegaC0CandidatesMcKF, - Omegac0Gen const& mcParticles) + void processMcKFParticle(OmegaC0CandsMcKF const& omegaC0CandidatesMcKF, + Omegac0Gen const& mcParticles) { processMc(omegaC0CandidatesMcKF, mcParticles); } - PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processMcWithKFParticle, "Process MC with KFParticle", false); + PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processMcKFParticle, "Process MC with KFParticle", false); - void processMcWithKFParticleMl(Omegac0CandsMlMcKF const& omegac0CandidatesMlMcKF, - Omegac0Gen const& mcParticles) + void processMcKFParticleMl(Omegac0CandsMlMcKF const& omegac0CandidatesMlMcKF, + Omegac0Gen const& mcParticles) { processMc(omegac0CandidatesMlMcKF, mcParticles); } - PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processMcWithKFParticleMl, "Process MC with KFParticle and ML selections", false); + PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processMcKFParticleMl, "Process MC with KFParticle and ML selections", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From cf03ef2c3cc8db936ccaafc1b42536714dd5044f Mon Sep 17 00:00:00 2001 From: Fabio Catalano Date: Mon, 25 Aug 2025 16:48:41 +0200 Subject: [PATCH 5/7] Add MC histograms with centrality information --- PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx | 123 ++++++++++++++++++++--- 1 file changed, 107 insertions(+), 16 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx b/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx index 3b573daa56f..55a2d1f40f4 100644 --- a/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx +++ b/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx @@ -18,6 +18,7 @@ #include "PWGHF/Core/HfHelper.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGLF/DataModel/mcCentrality.h" #include "Common/Core/RecoDecay.h" #include "Common/DataModel/Centrality.h" @@ -74,7 +75,7 @@ struct HfTaskOmegac0ToOmegapi { HfHelper hfHelper; SliceCache cache; - using TracksMc = soa::Join; + // using TracksMc = soa::Join; using Omegac0Cands = soa::Filtered>; using Omegac0CandsKF = soa::Filtered>; @@ -90,6 +91,8 @@ struct HfTaskOmegac0ToOmegapi { using CollisionsWithFT0M = soa::Join; using CollisionsWithMcLabels = soa::Join; + using McCollisionsWithFT0M = soa::Join; + Filter filterOmegaCToOmegaPiFlag = (aod::hf_track_index::hfflag & static_cast(BIT(aod::hf_cand_casc_lf::DecayType2Prong::OmegaczeroToOmegaPi))) != static_cast(0); Filter filterOmegaCMatchedRec = nabs(aod::hf_cand_xic0_omegac0::flagMcMatchRec) == static_cast(BIT(aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaPi)); Filter filterOmegaCMatchedGen = nabs(aod::hf_cand_xic0_omegac0::flagMcMatchGen) == static_cast(BIT(aod::hf_cand_xic0_omegac0::DecayType::OmegaczeroToOmegaPi)); @@ -113,8 +116,9 @@ struct HfTaskOmegac0ToOmegapi { void init(InitContext&) { - std::array doprocess{doprocessDataKFParticle, doprocessDataKFParticleMl, doprocessDataKFParticleFT0C, doprocessDataKFParticleMlFT0C, - doprocessDataKFParticleFT0M, doprocessDataKFParticleMlFT0M, doprocessMcKFParticle, doprocessMcKFParticleMl}; + std::array doprocess{doprocessDataKFParticle, doprocessDataKFParticleMl, doprocessDataKFParticleFT0C, doprocessDataKFParticleMlFT0C, + doprocessDataKFParticleFT0M, doprocessDataKFParticleMlFT0M, doprocessMcKFParticle, doprocessMcKFParticleMl, + doprocessMcKFParticleFT0M, doprocessMcKFParticleMlFT0M}; if ((std::accumulate(doprocess.begin(), doprocess.end(), 0)) != 1) { LOGP(fatal, "One and only one process function should be enabled at a time."); } @@ -132,27 +136,34 @@ struct HfTaskOmegac0ToOmegapi { const AxisSpec thnAxisCent{thnConfigAxisCent, "Centrality"}; std::vector axes = {thnAxisMass, thnAxisPt, thnAxisY}; + std::vector axesMcGen = {thnAxisGenPtD, thnAxisGenPtB, thnAxisY, thnAxisOrigin}; - if (doprocessDataKFParticleFT0C || doprocessDataKFParticleMlFT0C || doprocessDataKFParticleFT0M || doprocessDataKFParticleMlFT0M) { + if (doprocessDataKFParticleFT0C || doprocessDataKFParticleMlFT0C || doprocessDataKFParticleFT0M || doprocessDataKFParticleMlFT0M || doprocessMcKFParticleFT0M || doprocessMcKFParticleMlFT0M) { axes.push_back(thnAxisCent); axes.push_back(thnConfigAxisNumPvContr); + axesMcGen.push_back(thnAxisCent); + axesMcGen.push_back(thnConfigAxisNumPvContr); } - if (doprocessMcKFParticle || doprocessMcKFParticleMl) { - std::vector axesMcGen = {thnAxisGenPtD, thnAxisGenPtB, thnAxisY, thnAxisOrigin, thnAxisNumPvContr}; - registry.add("hMcGen", "Thn for generated #Omega_{c}^{0} from charm and beauty", HistType::kTHnSparseD, axesMcGen); + if (doprocessMcKFParticle || doprocessMcKFParticleMl || doprocessMcKFParticleFT0M || doprocessMcKFParticleMlFT0M) { + registry.add("hMcGen", "Gen. #Omega_{c}^{0} from charm and beauty", HistType::kTHnSparseD, axesMcGen); registry.get(HIST("hMcGen"))->Sumw2(); + if (doprocessMcKFParticleFT0M || doprocessMcKFParticleMlFT0M) { + registry.add("hMcGenWithRecoColl", "Gen. #Omega_{c}^{0} from charm and beauty (associated to a reco collision)", HistType::kTHnSparseD, axesMcGen); + registry.get(HIST("hMcGenWithRecoColl"))->Sumw2(); + } + axes.push_back(thnAxisPtB); axes.push_back(thnAxisOrigin); axes.push_back(thnAxisMatchFlag); } - if (doprocessDataKFParticleMl || doprocessDataKFParticleMlFT0C || doprocessDataKFParticleMlFT0M || doprocessMcKFParticleMl) { + if (doprocessDataKFParticleMl || doprocessDataKFParticleMlFT0C || doprocessDataKFParticleMlFT0M || doprocessMcKFParticleMl || doprocessMcKFParticleMlFT0M) { axes.push_back(thnAxisPromptScore); } - registry.add("hReco", "Thn for reco. #Omega_{c}^{0} candidates", HistType::kTHnSparseD, axes); + registry.add("hReco", "Reco. #Omega_{c}^{0} candidates", HistType::kTHnSparseD, axes); registry.get(HIST("hReco"))->Sumw2(); } @@ -256,45 +267,107 @@ struct HfTaskOmegac0ToOmegapi { } } + template + void processMcCent(const CandType& candidates, Omegac0Gen const& mcParticles, + CollisionsWithMcLabels const& collisions, McCollisionWithCents const&) + { + // MC rec. + for (const auto& candidate : candidates) { + if (!(candidate.resultSelections() == true || (candidate.resultSelections() == false && !selectionFlagOmegac0))) { + continue; + } + if (yCandRecoMax >= 0. && std::abs(candidate.kfRapOmegac()) > yCandRecoMax) { + continue; + } + + auto collision = candidate.template collision_as(); + uint16_t numPvContributors = collision.numContrib(); + float mcCent = evaluateCentralityColl(collision.template mcCollision_as()); + + if constexpr (applyMl) { + registry.fill(HIST("hReco"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac(), mcCent, numPvContributors, candidate.ptBhadMotherPart(), candidate.originMcRec(), candidate.flagMcMatchRec(), candidate.mlProbOmegac()[0]); + + } else { + registry.fill(HIST("hReco"), candidate.invMassCharmBaryon(), candidate.ptCharmBaryon(), candidate.kfRapOmegac(), mcCent, numPvContributors, candidate.ptBhadMotherPart(), candidate.originMcRec(), candidate.flagMcMatchRec()); + } + } + + // MC gen. + for (const auto& particle : mcParticles) { + if (yCandGenMax >= 0. && std::abs(particle.rapidityCharmBaryonGen()) > yCandGenMax) { + continue; + } + + auto ptGen = particle.pt(); + auto yGen = particle.rapidityCharmBaryonGen(); + auto mcCollision = particle.template mcCollision_as(); + + int maxNumContrib = 0; + const auto& recoCollsPerMcColl = collisions.sliceBy(colPerMcCollision, mcCollision.globalIndex()); + for (const auto& recCol : recoCollsPerMcColl) { + maxNumContrib = recCol.numContrib() > maxNumContrib ? recCol.numContrib() : maxNumContrib; + } + + float mcCent = evaluateCentralityColl(mcCollision); + + if (particle.originMcGen() == RecoDecay::OriginType::Prompt) { + registry.fill(HIST("hMcGen"), ptGen, -1., yGen, RecoDecay::OriginType::Prompt, mcCent, maxNumContrib); + } else { + float ptGenB = mcParticles.rawIteratorAt(particle.idxBhadMotherPart()).pt(); + registry.fill(HIST("hMcGen"), ptGen, ptGenB, yGen, RecoDecay::OriginType::NonPrompt, mcCent, maxNumContrib); + } + + // fill sparse only for gen particles associated to a reconstructed collision + if (recoCollsPerMcColl.size() >= 1) { + if (particle.originMcGen() == RecoDecay::OriginType::Prompt) { + registry.fill(HIST("hMcGenWithRecoColl"), ptGen, -1., yGen, RecoDecay::OriginType::Prompt, mcCent, maxNumContrib); + } else { + float ptGenB = mcParticles.rawIteratorAt(particle.idxBhadMotherPart()).pt(); + registry.fill(HIST("hMcGenWithRecoColl"), ptGen, ptGenB, yGen, RecoDecay::OriginType::NonPrompt, mcCent, maxNumContrib); + } + } + } + } + void processDataKFParticle(Omegac0CandsKF const& candidates) { processData(candidates); } - PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataKFParticle, "process HfTaskOmegac0ToOmegapi with KFParticle", false); + PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataKFParticle, "process data with KFParticle", false); void processDataKFParticleMl(Omegac0CandsMlKF const& candidates) { processData(candidates); } - PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataKFParticleMl, "process HfTaskOmegac0ToOmegapi with KFParticle and ML selections", false); + PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataKFParticleMl, "process data with KFParticle, ML selections", false); void processDataKFParticleFT0C(Omegac0CandsKF const& candidates, CollisionsWithFT0C const& collisions) { processDataCent(candidates, collisions); } - PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataKFParticleFT0C, "process HfTaskOmegac0ToOmegapi with KFParticle and with FT0C centrality", false); + PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataKFParticleFT0C, "process data with KFParticle, FT0C centrality", false); void processDataKFParticleMlFT0C(Omegac0CandsMlKF const& candidates, CollisionsWithFT0C const& collisions) { processDataCent(candidates, collisions); } - PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataKFParticleMlFT0C, "process HfTaskOmegac0ToOmegapi with KFParticle and ML selections and with FT0C centrality", false); + PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataKFParticleMlFT0C, "process data with KFParticle, ML selections, FT0C centrality", false); void processDataKFParticleFT0M(Omegac0CandsKF const& candidates, CollisionsWithFT0M const& collisions) { processDataCent(candidates, collisions); } - PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataKFParticleFT0M, "process HfTaskOmegac0ToOmegapi with KFParticle and with FT0M centrality", false); + PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataKFParticleFT0M, "process data with KFParticle, FT0M centrality", false); void processDataKFParticleMlFT0M(Omegac0CandsMlKF const& candidates, CollisionsWithFT0M const& collisions) { processDataCent(candidates, collisions); } - PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataKFParticleMlFT0M, "process HfTaskOmegac0ToOmegapi with KFParticle and ML selections and with FT0M centrality", false); + PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processDataKFParticleMlFT0M, "process data with KFParticle, ML selections, FT0M centrality", false); void processMcKFParticle(OmegaC0CandsMcKF const& omegaC0CandidatesMcKF, Omegac0Gen const& mcParticles) @@ -308,7 +381,25 @@ struct HfTaskOmegac0ToOmegapi { { processMc(omegac0CandidatesMlMcKF, mcParticles); } - PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processMcKFParticleMl, "Process MC with KFParticle and ML selections", false); + PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processMcKFParticleMl, "Process MC with KFParticle, ML selections", false); + + void processMcKFParticleFT0M(OmegaC0CandsMcKF const& omegaC0CandidatesMcKF, + Omegac0Gen const& mcParticles, + CollisionsWithMcLabels const& collisions, + McCollisionsWithFT0M const& mcCollisions) + { + processMcCent(omegaC0CandidatesMcKF, mcParticles, collisions, mcCollisions); + } + PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processMcKFParticleFT0M, "Process MC with KFParticle, FT0M centrality (from MC)", false); + + void processMcKFParticleMlFT0M(Omegac0CandsMlMcKF const& omegac0CandidatesMlMcKF, + Omegac0Gen const& mcParticles, + CollisionsWithMcLabels const& collisions, + McCollisionsWithFT0M const& mcCollisions) + { + processMcCent(omegac0CandidatesMlMcKF, mcParticles, collisions, mcCollisions); + } + PROCESS_SWITCH(HfTaskOmegac0ToOmegapi, processMcKFParticleMlFT0M, "Process MC with KFParticle, ML selections, FT0M centrality (from MC)", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 2edec8e512c07f328c8d6c3e8c4bb50e5ae5dc1e Mon Sep 17 00:00:00 2001 From: Fabio Catalano Date: Tue, 26 Aug 2025 12:49:00 +0200 Subject: [PATCH 6/7] Monitor number of reco collisions per generated one --- PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx b/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx index 55a2d1f40f4..f983ca65d75 100644 --- a/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx +++ b/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx @@ -103,15 +103,13 @@ struct HfTaskOmegac0ToOmegapi { ConfigurableAxis thnConfigAxisPromptScore{"thnConfigAxisPromptScore", {100, 0, 1}, "Prompt score"}; ConfigurableAxis thnConfigAxisMass{"thnConfigAxisMass", {700, 2.4, 3.1}, "Cand. inv. mass"}; - ConfigurableAxis thnConfigAxisPtB{"thnConfigAxisPtB", {500, 0, 50}, "Cand. beauty mother pT"}; ConfigurableAxis thnConfigAxisPt{"thnConfigAxisPt", {500, 0, 50}, "Cand. pT"}; + ConfigurableAxis thnConfigAxisPtB{"thnConfigAxisPtB", {500, 0, 50}, "Cand. beauty mother pT"}; ConfigurableAxis thnConfigAxisY{"thnConfigAxisY", {20, -1, 1}, "Cand. rapidity"}; ConfigurableAxis thnConfigAxisCent{"thnConfigAxisCent", {100, 0, 100}, "Centrality"}; ConfigurableAxis thnConfigAxisOrigin{"thnConfigAxisOrigin", {3, -0.5, 2.5}, "Cand. origin"}; ConfigurableAxis thnConfigAxisMatchFlag{"thnConfigAxisMatchFlag", {15, -7.5, 7.5}, "Cand. MC match flag"}; - ConfigurableAxis thnConfigAxisGenPtD{"thnConfigAxisGenPtD", {500, 0, 50}, "Gen pT"}; - ConfigurableAxis thnConfigAxisGenPtB{"thnConfigAxisGenPtB", {500, 0, 50}, "Gen beauty mother pT"}; - ConfigurableAxis thnConfigAxisNumPvContr{"thnConfigAxisNumPvContr", {200, -0.5, 199.5}, "Number of PV contributors"}; + ConfigurableAxis thnConfigAxisNumPvContr{"thnConfigAxisNumPvContr", {200, -0.5, 199.5}, "PV contributors"}; HistogramRegistry registry{"registry", {}}; void init(InitContext&) @@ -129,14 +127,12 @@ struct HfTaskOmegac0ToOmegapi { const AxisSpec thnAxisY{thnConfigAxisY, "y"}; const AxisSpec thnAxisOrigin{thnConfigAxisOrigin, "Origin"}; const AxisSpec thnAxisMatchFlag{thnConfigAxisMatchFlag, "MC match flag"}; - const AxisSpec thnAxisGenPtD{thnConfigAxisGenPtD, "#it{p}_{T} (GeV/#it{c})"}; - const AxisSpec thnAxisGenPtB{thnConfigAxisGenPtB, "#it{p}_{T}^{B} (GeV/#it{c})"}; - const AxisSpec thnAxisNumPvContr{thnConfigAxisNumPvContr, "Number of PV contributors"}; + const AxisSpec thnAxisNumPvContr{thnConfigAxisNumPvContr, "PV contributors"}; const AxisSpec thnAxisPromptScore{thnConfigAxisPromptScore, "BDT score prompt"}; const AxisSpec thnAxisCent{thnConfigAxisCent, "Centrality"}; std::vector axes = {thnAxisMass, thnAxisPt, thnAxisY}; - std::vector axesMcGen = {thnAxisGenPtD, thnAxisGenPtB, thnAxisY, thnAxisOrigin}; + std::vector axesMcGen = {thnAxisPt, thnAxisPtB, thnAxisY, thnAxisOrigin}; if (doprocessDataKFParticleFT0C || doprocessDataKFParticleMlFT0C || doprocessDataKFParticleFT0M || doprocessDataKFParticleMlFT0M || doprocessMcKFParticleFT0M || doprocessMcKFParticleMlFT0M) { axes.push_back(thnAxisCent); @@ -151,6 +147,7 @@ struct HfTaskOmegac0ToOmegapi { if (doprocessMcKFParticleFT0M || doprocessMcKFParticleMlFT0M) { registry.add("hMcGenWithRecoColl", "Gen. #Omega_{c}^{0} from charm and beauty (associated to a reco collision)", HistType::kTHnSparseD, axesMcGen); + registry.add("hNumRecoCollPerMcColl", "Number of reco collisions associated to a mc collision;Num. reco. coll. per Mc coll.;", {HistType::kTH1D, {{10, -1.5, 8.5}}}); registry.get(HIST("hMcGenWithRecoColl"))->Sumw2(); } @@ -317,6 +314,8 @@ struct HfTaskOmegac0ToOmegapi { registry.fill(HIST("hMcGen"), ptGen, ptGenB, yGen, RecoDecay::OriginType::NonPrompt, mcCent, maxNumContrib); } + registry.fill(HIST("hNumRecoCollPerMcColl"), recoCollsPerMcColl.size()); + // fill sparse only for gen particles associated to a reconstructed collision if (recoCollsPerMcColl.size() >= 1) { if (particle.originMcGen() == RecoDecay::OriginType::Prompt) { From 144240c79b83f29f3a10b01a5abf7fe61e5b8be7 Mon Sep 17 00:00:00 2001 From: Fabio Catalano Date: Tue, 26 Aug 2025 17:35:47 +0200 Subject: [PATCH 7/7] Remove not needed definition --- PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx | 2 -- 1 file changed, 2 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx b/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx index f983ca65d75..e04ca9f6b04 100644 --- a/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx +++ b/PWGHF/D2H/Tasks/taskOmegac0ToOmegapi.cxx @@ -75,8 +75,6 @@ struct HfTaskOmegac0ToOmegapi { HfHelper hfHelper; SliceCache cache; - // using TracksMc = soa::Join; - using Omegac0Cands = soa::Filtered>; using Omegac0CandsKF = soa::Filtered>; using OmegaC0CandsMcKF = soa::Filtered>;