From 449fb9dd928f6f0cd4ff415079de540760050faa Mon Sep 17 00:00:00 2001 From: wuctlby Date: Mon, 13 Jan 2025 12:31:02 +0100 Subject: [PATCH 1/6] Add the axes of centrality and occupancy in thnsparse in taskD0 --- PWGHF/D2H/Tasks/taskD0.cxx | 327 ++++++++++++++++++++++++++++++------- 1 file changed, 269 insertions(+), 58 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskD0.cxx b/PWGHF/D2H/Tasks/taskD0.cxx index c4870213625..71f7f2cfeed 100644 --- a/PWGHF/D2H/Tasks/taskD0.cxx +++ b/PWGHF/D2H/Tasks/taskD0.cxx @@ -22,14 +22,19 @@ #include "Framework/HistogramRegistry.h" #include "Framework/runDataProcessing.h" +#include "PWGHF/Core/CentralityEstimation.h" #include "PWGHF/Core/HfHelper.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" +#include "PWGHF/Utils/utilsEvSelHf.h" +// #include "PWGHF/Utils/utilsAnalysis.h" using namespace o2; using namespace o2::analysis; using namespace o2::framework; using namespace o2::framework::expressions; +using namespace o2::hf_centrality; +using namespace o2::hf_occupancy; /// D0 analysis task namespace @@ -53,6 +58,10 @@ struct HfTaskD0 { Configurable selectionCand{"selectionCand", 1, "Selection Flag for conj. topol. selected candidates"}; Configurable selectionPid{"selectionPid", 1, "Selection Flag for reco PID candidates"}; Configurable> binsPt{"binsPt", std::vector{hf_cuts_d0_to_pi_k::vecBinsPt}, "pT bin limits"}; + Configurable centEstimator{"centEstimator", 0, "Centrality estimation (None: 0, FT0C: 2, FT0M: 3)"}; + Configurable occEstimator{"occEstimator", 0, "Occupancy estimation (None: 0, ITS: 1, FT0C: 2)"}; + Configurable storeCentrality{"storeCentrality", false, "Flag to store centrality information"}; + Configurable storeOccupancy{"storeOccupancy", false, "Flag to store occupancy information"}; // ML inference Configurable applyMl{"applyMl", false, "Flag to apply ML selections"}; @@ -69,6 +78,8 @@ struct HfTaskD0 { ConfigurableAxis thnConfigAxisGenPtD{"thnConfigAxisGenPtD", {500, 0, 50}, "Gen Pt D"}; ConfigurableAxis thnConfigAxisGenPtB{"thnConfigAxisGenPtB", {1000, 0, 100}, "Gen Pt B"}; ConfigurableAxis thnConfigAxisNumPvContr{"thnConfigAxisNumPvContr", {200, -0.5, 199.5}, "Number of PV contributors"}; + ConfigurableAxis thnConfigAxisCent{"thnConfigAxisCent", {110, 0., 110.}, ""}; + ConfigurableAxis thnConfigAxisOccupancy{"thnConfigAxisOccupancy", {14, 0, 14000}, "axis for centrality"}; HfHelper hfHelper; @@ -82,7 +93,9 @@ struct HfTaskD0 { using D0CandidatesMlKF = soa::Join; using D0CandidatesMlMcKF = soa::Join; - using CollisionsWithMcLabels = soa::Join; + using CollisionsCent = soa::Join; + using CollisionsWithMcLabels = soa::Join; + // using CollisionsWithMcLabels = soa::Join; //TODO: merge collisions with MC labels in this line PresliceUnsorted colPerMcCollision = aod::mccollisionlabel::mcCollisionId; SliceCache cache; @@ -230,35 +243,51 @@ struct HfTaskD0 { 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 thnAxisCent{thnConfigAxisCent, "Centrality"}; + const AxisSpec thnAxisOccupancy{thnConfigAxisOccupancy, "Occupancy"}; if (doprocessMcWithDCAFitterN || doprocessMcWithKFParticle || doprocessMcWithDCAFitterNMl || doprocessMcWithKFParticleMl) { - registry.add("hSparseAcc", "Thn for generated D0 from charm and beauty", HistType::kTHnSparseD, {thnAxisGenPtD, thnAxisGenPtB, thnAxisY, thnAxisOrigin, thnAxisNumPvContr}); + std::vector axesAcc = {thnAxisGenPtD, thnAxisGenPtB, thnAxisY, thnAxisOrigin, thnAxisNumPvContr}; + + if (storeCentrality) { + axesAcc.push_back(thnAxisCent); + } + if (storeOccupancy) { + axesAcc.push_back(thnAxisOccupancy); + } + + registry.add("hSparseAcc", "Thn for generated D0 from charm and beauty", HistType::kTHnSparseD, axesAcc); registry.get(HIST("hSparseAcc"))->Sumw2(); } + + std::vector axes = {thnAxisMass, thnAxisPt, thnAxisY, thnAxisCandType}; + if (doprocessMcWithDCAFitterN || doprocessMcWithKFParticle || doprocessMcWithDCAFitterNMl || doprocessMcWithKFParticleMl) { + axes.push_back(thnAxisPtB); + axes.push_back(thnAxisOrigin); + axes.push_back(thnAxisNumPvContr); + } if (applyMl) { const AxisSpec thnAxisBkgScore{thnConfigAxisBkgScore, "BDT score bkg."}; const AxisSpec thnAxisNonPromptScore{thnConfigAxisNonPromptScore, "BDT score non-prompt."}; const AxisSpec thnAxisPromptScore{thnConfigAxisPromptScore, "BDT score prompt."}; - if (doprocessMcWithDCAFitterN || doprocessMcWithKFParticle || doprocessMcWithDCAFitterNMl || doprocessMcWithKFParticleMl) { - registry.add("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type", "Thn for D0 candidates with BDT scores", HistType::kTHnSparseD, {thnAxisBkgScore, thnAxisNonPromptScore, thnAxisPromptScore, thnAxisMass, thnAxisPt, thnAxisY, thnAxisCandType, thnAxisPtB, thnAxisOrigin, thnAxisNumPvContr}); - } else { - registry.add("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type", "Thn for D0 candidates with BDT scores", HistType::kTHnSparseD, {thnAxisBkgScore, thnAxisNonPromptScore, thnAxisPromptScore, thnAxisMass, thnAxisPt, thnAxisY, thnAxisCandType}); - } - registry.get(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"))->Sumw2(); - } else { - if (doprocessMcWithDCAFitterN || doprocessMcWithKFParticle || doprocessMcWithDCAFitterNMl || doprocessMcWithKFParticleMl) { - registry.add("hMassVsPtVsPtBVsYVsOriginVsD0Type", "Thn for D0 candidates without BDT scores", HistType::kTHnSparseD, {thnAxisMass, thnAxisPt, thnAxisY, thnAxisCandType, thnAxisPtB, thnAxisOrigin}); - } else { - registry.add("hMassVsPtVsPtBVsYVsOriginVsD0Type", "Thn for D0 candidates without BDT scores", HistType::kTHnSparseD, {thnAxisMass, thnAxisPt, thnAxisY, thnAxisCandType}); - } - registry.get(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"))->Sumw2(); + axes.insert(axes.begin(), thnAxisPromptScore); + axes.insert(axes.begin(), thnAxisNonPromptScore); + axes.insert(axes.begin(), thnAxisBkgScore); + } + if (storeCentrality) { + axes.push_back(thnAxisCent); + } + if (storeOccupancy) { + axes.push_back(thnAxisOccupancy); } + registry.add("hSparseDzero", "Thn for D0 candidates", HistType::kTHnSparseD, axes); + registry.get(HIST("hSparseDzero"))->Sumw2(); } template - void processData(CandType const& candidates) + void processData(CandType const& candidates, CollisionsCent const&) { for (const auto& candidate : candidates) { if (!(candidate.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { @@ -317,64 +346,125 @@ struct HfTaskD0 { registry.fill(HIST("hCPAFinerBinning"), candidate.cpa(), ptCandidate); registry.fill(HIST("hCPAXYFinerBinning"), candidate.cpaXY(), ptCandidate); + float cent{-1.f}; + float occ{-1.f}; + if (storeCentrality || storeOccupancy) { + auto collision = candidate.template collision_as(); + if (storeCentrality && centEstimator != CentralityEstimator::None) { + cent = getCentralityColl(collision, centEstimator); + } + if (storeOccupancy && occEstimator != OccupancyEstimator::None) { + occ = getOccupancyColl(collision, occEstimator); + } + } + if constexpr (applyMl) { - if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), SigD0); - if (candidate.isSelD0bar()) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), ReflectedD0); - } else if (!candidate.isSelD0bar()) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), PureSigD0); + if (storeCentrality && storeOccupancy) { + if (candidate.isSelD0() >= selectionFlagD0) { + registry.fill(HIST("hSparseDzero"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, cent, occ); + registry.fill(HIST("hSparseDzero"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, cent, occ); + } + if (candidate.isSelD0bar() >= selectionFlagD0bar) { + registry.fill(HIST("hSparseDzero"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, cent, occ); + registry.fill(HIST("hSparseDzero"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, cent, occ); + } + } + else if (storeCentrality && !storeOccupancy) { + if (candidate.isSelD0() >= selectionFlagD0) { + registry.fill(HIST("hSparseDzero"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, cent); + registry.fill(HIST("hSparseDzero"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, cent); + } + if (candidate.isSelD0bar() >= selectionFlagD0bar) { + registry.fill(HIST("hSparseDzero"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, cent); + registry.fill(HIST("hSparseDzero"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, cent); } } - if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar); - if (candidate.isSelD0()) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), ReflectedD0bar); - } else if (!candidate.isSelD0()) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), PureSigD0bar); + else if (!storeCentrality && storeOccupancy) { + if (candidate.isSelD0() >= selectionFlagD0) { + registry.fill(HIST("hSparseDzero"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, occ); + registry.fill(HIST("hSparseDzero"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, occ); + } + if (candidate.isSelD0bar() >= selectionFlagD0bar) { + registry.fill(HIST("hSparseDzero"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, occ); + registry.fill(HIST("hSparseDzero"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, occ); + } + } + else { + if (candidate.isSelD0() >= selectionFlagD0) { + registry.fill(HIST("hSparseDzero"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), SigD0); + registry.fill(HIST("hSparseDzero"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0); + } + if (candidate.isSelD0bar() >= selectionFlagD0bar) { + registry.fill(HIST("hSparseDzero"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar); + registry.fill(HIST("hSparseDzero"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar); } } } else { - if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0); - if (candidate.isSelD0bar()) { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), ReflectedD0); - } else if (!candidate.isSelD0bar()) { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), PureSigD0); + if (storeCentrality && storeOccupancy) { + if (candidate.isSelD0() >= selectionFlagD0) { + registry.fill(HIST("hSparseDzero"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, cent, occ); + registry.fill(HIST("hSparseDzero"), massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, cent, occ); + } + if (candidate.isSelD0bar() >= selectionFlagD0bar) { + registry.fill(HIST("hSparseDzero"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, cent, occ); + registry.fill(HIST("hSparseDzero"), massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, cent, occ); } } - if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar); - if (candidate.isSelD0()) { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), ReflectedD0bar); - } else if (!candidate.isSelD0()) { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), PureSigD0bar); + else if (storeCentrality && !storeOccupancy) { + if (candidate.isSelD0() >= selectionFlagD0) { + registry.fill(HIST("hSparseDzero"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, cent); + registry.fill(HIST("hSparseDzero"), massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, cent); + } + if (candidate.isSelD0bar() >= selectionFlagD0bar) { + registry.fill(HIST("hSparseDzero"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, cent); + registry.fill(HIST("hSparseDzero"), massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, cent); + } + } + else if (!storeCentrality && storeOccupancy) { + if (candidate.isSelD0() >= selectionFlagD0) { + registry.fill(HIST("hSparseDzero"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, occ); + registry.fill(HIST("hSparseDzero"), massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, occ); + + } + if (candidate.isSelD0bar() >= selectionFlagD0bar) { + registry.fill(HIST("hSparseDzero"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, occ); + registry.fill(HIST("hSparseDzero"), massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, occ); + } + } + else { + if (candidate.isSelD0() >= selectionFlagD0) { + registry.fill(HIST("hSparseDzero"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0); + registry.fill(HIST("hSparseDzero"), massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0); + } + if (candidate.isSelD0bar() >= selectionFlagD0bar) { + registry.fill(HIST("hSparseDzero"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar); + registry.fill(HIST("hSparseDzero"), massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar); } } } } } - void processDataWithDCAFitterN(D0Candidates const&) + void processDataWithDCAFitterN(D0Candidates const&, CollisionsCent const& collisions) { - processData(selectedD0Candidates); + processData(selectedD0Candidates, collisions); } PROCESS_SWITCH(HfTaskD0, processDataWithDCAFitterN, "process taskD0 with DCAFitterN", true); - void processDataWithKFParticle(D0CandidatesKF const&) + void processDataWithKFParticle(D0CandidatesKF const&, CollisionsCent const& collisions) { - processData(selectedD0CandidatesKF); + processData(selectedD0CandidatesKF, collisions); } PROCESS_SWITCH(HfTaskD0, processDataWithKFParticle, "process taskD0 with KFParticle", false); - void processDataWithDCAFitterNMl(D0CandidatesMl const&) + void processDataWithDCAFitterNMl(D0CandidatesMl const&, CollisionsCent const& collisions) { - processData(selectedD0CandidatesMl); + processData(selectedD0CandidatesMl, collisions); } PROCESS_SWITCH(HfTaskD0, processDataWithDCAFitterNMl, "process taskD0 with DCAFitterN and ML selections", false); - void processDataWithKFParticleMl(D0CandidatesMlKF const&) + void processDataWithKFParticleMl(D0CandidatesMlKF const&, CollisionsCent const& collisions) { - processData(selectedD0CandidatesMlKF); + processData(selectedD0CandidatesMlKF, collisions); } PROCESS_SWITCH(HfTaskD0, processDataWithKFParticleMl, "process taskD0 with KFParticle and ML selections", false); @@ -394,8 +484,16 @@ struct HfTaskD0 { continue; } + float cent{-1.f}; + float occ{-1.f}; auto collision = candidate.template collision_as(); auto numPvContributors = collision.numContrib(); + if (storeCentrality && centEstimator != CentralityEstimator::None) { + cent = getCentralityColl(collision, centEstimator); + } + if (storeOccupancy && occEstimator != OccupancyEstimator::None) { + occ = getOccupancyColl(collision, occEstimator); + } float massD0, massD0bar; if constexpr (reconstructionType == aod::hf_cand::VertexerType::KfParticle) { massD0 = candidate.kfGeoMassD0(); @@ -521,9 +619,31 @@ struct HfTaskD0 { registry.fill(HIST("hDecLengthxyVsPtSig"), declengthxyCandidate, ptCandidate); registry.fill(HIST("hMassSigD0"), massD0, ptCandidate, rapidityCandidate); if constexpr (applyMl) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); + if (storeCentrality && storeOccupancy) { + registry.fill(HIST("hSparseDzero"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); + } + else if (storeCentrality && !storeOccupancy) { + registry.fill(HIST("hSparseDzero"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); + } + else if (!storeCentrality && storeOccupancy) { + registry.fill(HIST("hSparseDzero"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); + } + else { + registry.fill(HIST("hSparseDzero"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); + } } else { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); + if (storeCentrality && storeOccupancy) { + registry.fill(HIST("hSparseDzero"), massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); + } + else if (storeCentrality && !storeOccupancy) { + registry.fill(HIST("hSparseDzero"), massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); + } + else if (!storeCentrality && storeOccupancy) { + registry.fill(HIST("hSparseDzero"), massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); + } + else { + registry.fill(HIST("hSparseDzero"), massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); + } } } else { registry.fill(HIST("hPtProng0Bkg"), ptProng0, rapidityCandidate); @@ -543,9 +663,31 @@ struct HfTaskD0 { if (candidate.flagMcMatchRec() == -(1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { registry.fill(HIST("hMassReflBkgD0"), massD0, ptCandidate, rapidityCandidate); if constexpr (applyMl) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); + if (storeCentrality && storeOccupancy) { + registry.fill(HIST("hSparseDzero"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); + } + else if (storeCentrality && !storeOccupancy) { + registry.fill(HIST("hSparseDzero"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); + } + else if (!storeCentrality && storeOccupancy) { + registry.fill(HIST("hSparseDzero"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); + } + else { + registry.fill(HIST("hSparseDzero"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); + } } else { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); + if (storeCentrality && storeOccupancy) { + registry.fill(HIST("hSparseDzero"), massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); + } + else if (storeCentrality && !storeOccupancy) { + registry.fill(HIST("hSparseDzero"), massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); + } + else if (!storeCentrality && storeOccupancy) { + registry.fill(HIST("hSparseDzero"), massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); + } + else { + registry.fill(HIST("hSparseDzero"), massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); + } } } } @@ -555,18 +697,62 @@ struct HfTaskD0 { if (candidate.flagMcMatchRec() == -(1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { registry.fill(HIST("hMassSigD0bar"), massD0bar, ptCandidate, rapidityCandidate); if constexpr (applyMl) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); + if (storeCentrality && storeOccupancy) { + registry.fill(HIST("hSparseDzero"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); + } + else if (storeCentrality && !storeOccupancy) { + registry.fill(HIST("hSparseDzero"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); + } + else if (!storeCentrality && storeOccupancy) { + registry.fill(HIST("hSparseDzero"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); + } + else { + registry.fill(HIST("hSparseDzero"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); + } } else { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); + if (storeCentrality && storeOccupancy) { + registry.fill(HIST("hSparseDzero"), massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); + } + else if (storeCentrality && !storeOccupancy) { + registry.fill(HIST("hSparseDzero"), massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); + } + else if (!storeCentrality && storeOccupancy) { + registry.fill(HIST("hSparseDzero"), massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); + } + else { + registry.fill(HIST("hSparseDzero"), massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); + } } } else { registry.fill(HIST("hMassBkgD0bar"), massD0bar, ptCandidate, rapidityCandidate); if (candidate.flagMcMatchRec() == (1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { registry.fill(HIST("hMassReflBkgD0bar"), massD0bar, ptCandidate, rapidityCandidate); if constexpr (applyMl) { - registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); + if (storeCentrality && storeOccupancy) { + registry.fill(HIST("hSparseDzero"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); + } + else if (storeCentrality && !storeOccupancy) { + registry.fill(HIST("hSparseDzero"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); + } + else if (!storeCentrality && storeOccupancy) { + registry.fill(HIST("hSparseDzero"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); + } + else { + registry.fill(HIST("hSparseDzero"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); + } } else { - registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); + if (storeCentrality && storeOccupancy) { + registry.fill(HIST("hSparseDzero"), massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); + } + else if (storeCentrality && !storeOccupancy) { + registry.fill(HIST("hSparseDzero"), massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); + } + else if (!storeCentrality && storeOccupancy) { + registry.fill(HIST("hSparseDzero"), massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); + } + else { + registry.fill(HIST("hSparseDzero"), massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); + } } } } @@ -590,17 +776,42 @@ struct HfTaskD0 { maxNumContrib = recCol.numContrib() > maxNumContrib ? recCol.numContrib() : maxNumContrib; } + float cent{-1.f}; + float occ{-1.f}; + if (storeCentrality && centEstimator != CentralityEstimator::None) { + cent = getCentralityGenColl(recoCollsPerMcColl, centEstimator); + } + if (storeOccupancy && occEstimator != OccupancyEstimator::None) { + occ = getOccupancyGenColl(recoCollsPerMcColl, occEstimator); + } + if (particle.originMcGen() == RecoDecay::OriginType::Prompt) { registry.fill(HIST("hPtGenPrompt"), ptGen); registry.fill(HIST("hYGenPrompt"), yGen); registry.fill(HIST("hPtVsYGenPrompt"), ptGen, yGen); - registry.fill(HIST("hSparseAcc"), ptGen, ptGenB, yGen, 1, maxNumContrib); + if (storeCentrality && storeOccupancy) { + registry.fill(HIST("hSparseAcc"), ptGen, ptGenB, yGen, 1, maxNumContrib, cent, occ); + } else if (storeCentrality && !storeOccupancy) { + registry.fill(HIST("hSparseAcc"), ptGen, ptGenB, yGen, 1, maxNumContrib, cent); + } else if (!storeCentrality && storeOccupancy) { + registry.fill(HIST("hSparseAcc"), ptGen, ptGenB, yGen, 1, maxNumContrib, occ); + } else { + registry.fill(HIST("hSparseAcc"), ptGen, ptGenB, yGen, 1, maxNumContrib); + } } else { ptGenB = mcParticles.rawIteratorAt(particle.idxBhadMotherPart()).pt(); registry.fill(HIST("hPtGenNonPrompt"), ptGen); registry.fill(HIST("hYGenNonPrompt"), yGen); registry.fill(HIST("hPtVsYGenNonPrompt"), ptGen, yGen); - registry.fill(HIST("hSparseAcc"), ptGen, ptGenB, yGen, 2, maxNumContrib); + if (storeCentrality && storeOccupancy) { + registry.fill(HIST("hSparseAcc"), ptGen, ptGenB, yGen, 2, maxNumContrib, cent, occ); + } else if (storeCentrality && !storeOccupancy) { + registry.fill(HIST("hSparseAcc"), ptGen, ptGenB, yGen, 2, maxNumContrib, cent); + } else if (!storeCentrality && storeOccupancy) { + registry.fill(HIST("hSparseAcc"), ptGen, ptGenB, yGen, 2, maxNumContrib, occ); + } else { + registry.fill(HIST("hSparseAcc"), ptGen, ptGenB, yGen, 2, maxNumContrib); + } } registry.fill(HIST("hEtaGen"), particle.eta()); } From 02e01f46a21fdd758018e1dda76325725e0c03df Mon Sep 17 00:00:00 2001 From: wuctlby Date: Mon, 13 Jan 2025 15:02:44 +0100 Subject: [PATCH 2/6] rename the thnsparse and add the process with centrality --- PWGHF/D2H/Tasks/taskD0.cxx | 231 ++++++++++++++++++++++--------------- 1 file changed, 139 insertions(+), 92 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskD0.cxx b/PWGHF/D2H/Tasks/taskD0.cxx index 71f7f2cfeed..614ea25dc4f 100644 --- a/PWGHF/D2H/Tasks/taskD0.cxx +++ b/PWGHF/D2H/Tasks/taskD0.cxx @@ -93,10 +93,12 @@ struct HfTaskD0 { using D0CandidatesMlKF = soa::Join; using D0CandidatesMlMcKF = soa::Join; + using Collisions = soa::Join; using CollisionsCent = soa::Join; - using CollisionsWithMcLabels = soa::Join; - // using CollisionsWithMcLabels = soa::Join; //TODO: merge collisions with MC labels in this line + using CollisionsWithMcLabels = soa::Join; + using CollisionsWithMcLabelsCent = soa::Join; PresliceUnsorted colPerMcCollision = aod::mccollisionlabel::mcCollisionId; + PresliceUnsorted colPerMcCollisionCent = aod::mccollisionlabel::mcCollisionId; SliceCache cache; Partition selectedD0Candidates = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; @@ -187,14 +189,16 @@ struct HfTaskD0 { void init(InitContext&) { - std::array doprocess{doprocessDataWithDCAFitterN, doprocessDataWithKFParticle, doprocessMcWithDCAFitterN, doprocessMcWithKFParticle, doprocessDataWithDCAFitterNMl, doprocessDataWithKFParticleMl, doprocessMcWithDCAFitterNMl, doprocessMcWithKFParticleMl}; + std::array doprocess{doprocessDataWithDCAFitterN, doprocessDataWithDCAFitterNCent, doprocessDataWithKFParticle, doprocessMcWithDCAFitterN, doprocessMcWithDCAFitterNCent, doprocessMcWithKFParticle, doprocessDataWithDCAFitterNMl, doprocessDataWithDCAFitterNMlCent, doprocessDataWithKFParticleMl, doprocessMcWithDCAFitterNMl, doprocessMcWithDCAFitterNMlCent, doprocessMcWithKFParticleMl}; if ((std::accumulate(doprocess.begin(), doprocess.end(), 0)) == 0) { LOGP(fatal, "At least one process function should be enabled at a time."); } - if ((doprocessDataWithDCAFitterN || doprocessMcWithDCAFitterN || doprocessDataWithDCAFitterNMl || doprocessMcWithDCAFitterNMl) && (doprocessDataWithKFParticle || doprocessMcWithKFParticle || doprocessDataWithKFParticleMl || doprocessMcWithKFParticleMl)) { + if ((doprocessDataWithDCAFitterN || doprocessDataWithDCAFitterNCent || doprocessMcWithDCAFitterN || doprocessMcWithDCAFitterNCent || doprocessDataWithDCAFitterNMl || doprocessDataWithDCAFitterNMlCent || doprocessMcWithDCAFitterNMl || doprocessMcWithDCAFitterNMlCent) && (doprocessDataWithKFParticle || doprocessMcWithKFParticle || doprocessDataWithKFParticleMl || doprocessMcWithKFParticleMl)) { LOGP(fatal, "DCAFitterN and KFParticle can not be enabled at a time."); } - + if ((storeCentrality || storeOccupancy) && !(doprocessDataWithDCAFitterNCent || doprocessMcWithDCAFitterNCent || doprocessDataWithDCAFitterNMlCent || doprocessMcWithDCAFitterNMlCent)) { + LOGP(fatal, "can't enable the storeCentrality and storeOccupancu without cent process"); + } auto vbins = (std::vector)binsPt; registry.add("hMass", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{500, 0., 5.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); registry.add("hMassVsPhi", "2-prong candidates vs phi;inv. mass (#pi K) (GeV/#it{c}^{2});phi (rad);entries", {HistType::kTH3F, {{120, 1.5848, 2.1848}, {vbins, "#it{p}_{T} (GeV/#it{c})"}, {32, 0, o2::constants::math::TwoPI}}}); @@ -267,6 +271,12 @@ struct HfTaskD0 { axes.push_back(thnAxisOrigin); axes.push_back(thnAxisNumPvContr); } + if (storeCentrality) { + axes.push_back(thnAxisCent); + } + if (storeOccupancy) { + axes.push_back(thnAxisOccupancy); + } if (applyMl) { const AxisSpec thnAxisBkgScore{thnConfigAxisBkgScore, "BDT score bkg."}; const AxisSpec thnAxisNonPromptScore{thnConfigAxisNonPromptScore, "BDT score non-prompt."}; @@ -275,19 +285,17 @@ struct HfTaskD0 { axes.insert(axes.begin(), thnAxisPromptScore); axes.insert(axes.begin(), thnAxisNonPromptScore); axes.insert(axes.begin(), thnAxisBkgScore); + + registry.add("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type", "Thn for D0 candidates", HistType::kTHnSparseD, axes); + registry.get(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"))->Sumw2(); + } else { + registry.add("hMassVsPtVsYVsOriginVsD0Type", "Thn for D0 candidates", HistType::kTHnSparseD, axes); + registry.get(HIST("hMassVsPtVsYVsOriginVsD0Type"))->Sumw2(); } - if (storeCentrality) { - axes.push_back(thnAxisCent); - } - if (storeOccupancy) { - axes.push_back(thnAxisOccupancy); - } - registry.add("hSparseDzero", "Thn for D0 candidates", HistType::kTHnSparseD, axes); - registry.get(HIST("hSparseDzero"))->Sumw2(); } - template - void processData(CandType const& candidates, CollisionsCent const&) + template + void processData(CandType const& candidates, CollType const&) { for (const auto& candidate : candidates) { if (!(candidate.hfflag() & 1 << aod::hf_cand_2prong::DecayType::D0ToPiK)) { @@ -349,7 +357,7 @@ struct HfTaskD0 { float cent{-1.f}; float occ{-1.f}; if (storeCentrality || storeOccupancy) { - auto collision = candidate.template collision_as(); + auto collision = candidate.template collision_as(); if (storeCentrality && centEstimator != CentralityEstimator::None) { cent = getCentralityColl(collision, centEstimator); } @@ -361,118 +369,132 @@ struct HfTaskD0 { if constexpr (applyMl) { if (storeCentrality && storeOccupancy) { if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hSparseDzero"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, cent, occ); - registry.fill(HIST("hSparseDzero"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, cent, occ); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, cent, occ); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, cent, occ); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hSparseDzero"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, cent, occ); - registry.fill(HIST("hSparseDzero"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, cent, occ); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, cent, occ); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, cent, occ); } } else if (storeCentrality && !storeOccupancy) { if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hSparseDzero"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, cent); - registry.fill(HIST("hSparseDzero"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, cent); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, cent); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, cent); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hSparseDzero"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, cent); - registry.fill(HIST("hSparseDzero"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, cent); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, cent); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, cent); } } else if (!storeCentrality && storeOccupancy) { if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hSparseDzero"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, occ); - registry.fill(HIST("hSparseDzero"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, occ); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, occ); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, occ); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hSparseDzero"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, occ); - registry.fill(HIST("hSparseDzero"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, occ); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, occ); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, occ); } } else { if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hSparseDzero"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), SigD0); - registry.fill(HIST("hSparseDzero"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), SigD0); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hSparseDzero"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar); - registry.fill(HIST("hSparseDzero"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar); } } } else { if (storeCentrality && storeOccupancy) { if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hSparseDzero"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, cent, occ); - registry.fill(HIST("hSparseDzero"), massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, cent, occ); + registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, cent, occ); + registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, cent, occ); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hSparseDzero"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, cent, occ); - registry.fill(HIST("hSparseDzero"), massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, cent, occ); + registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, cent, occ); + registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, cent, occ); } } else if (storeCentrality && !storeOccupancy) { if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hSparseDzero"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, cent); - registry.fill(HIST("hSparseDzero"), massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, cent); + registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, cent); + registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, cent); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hSparseDzero"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, cent); - registry.fill(HIST("hSparseDzero"), massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, cent); + registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, cent); + registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, cent); } } else if (!storeCentrality && storeOccupancy) { if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hSparseDzero"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, occ); - registry.fill(HIST("hSparseDzero"), massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, occ); + registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, occ); + registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, occ); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hSparseDzero"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, occ); - registry.fill(HIST("hSparseDzero"), massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, occ); + registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, occ); + registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, occ); } } else { if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hSparseDzero"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0); - registry.fill(HIST("hSparseDzero"), massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0); + registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0); + registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hSparseDzero"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar); - registry.fill(HIST("hSparseDzero"), massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar); + registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar); + registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar); } } } } } - void processDataWithDCAFitterN(D0Candidates const&, CollisionsCent const& collisions) + void processDataWithDCAFitterN(D0Candidates const&, Collisions const& collisions) { processData(selectedD0Candidates, collisions); } PROCESS_SWITCH(HfTaskD0, processDataWithDCAFitterN, "process taskD0 with DCAFitterN", true); - void processDataWithKFParticle(D0CandidatesKF const&, CollisionsCent const& collisions) + void processDataWithDCAFitterNCent(D0Candidates const&, CollisionsCent const& collisions) + { + processData(selectedD0Candidates, collisions); + } + PROCESS_SWITCH(HfTaskD0, processDataWithDCAFitterNCent, "process taskD0 with DCAFitterN and centrality", false); + + void processDataWithKFParticle(D0CandidatesKF const&, Collisions const& collisions) { processData(selectedD0CandidatesKF, collisions); } PROCESS_SWITCH(HfTaskD0, processDataWithKFParticle, "process taskD0 with KFParticle", false); + //TODO: add processKFParticleCent - void processDataWithDCAFitterNMl(D0CandidatesMl const&, CollisionsCent const& collisions) + void processDataWithDCAFitterNMl(D0CandidatesMl const&, Collisions const& collisions) { processData(selectedD0CandidatesMl, collisions); } PROCESS_SWITCH(HfTaskD0, processDataWithDCAFitterNMl, "process taskD0 with DCAFitterN and ML selections", false); - void processDataWithKFParticleMl(D0CandidatesMlKF const&, CollisionsCent const& collisions) + void processDataWithDCAFitterNMlCent(D0CandidatesMl const&, CollisionsCent const& collisions) + { + processData(selectedD0CandidatesMl, collisions); + } + PROCESS_SWITCH(HfTaskD0, processDataWithDCAFitterNMlCent, "process taskD0 with DCAFitterN and ML selections and centrality", false); + + void processDataWithKFParticleMl(D0CandidatesMlKF const&, Collisions const& collisions) { processData(selectedD0CandidatesMlKF, collisions); } PROCESS_SWITCH(HfTaskD0, processDataWithKFParticleMl, "process taskD0 with KFParticle and ML selections", false); + //TODO: add processKFParticleMlCent - template + template void processMc(CandType const& candidates, soa::Join const& mcParticles, aod::TracksWMc const&, - CollisionsWithMcLabels const& collisions, + CollType const& collisions, aod::McCollisions const&) { // MC rec. @@ -486,7 +508,7 @@ struct HfTaskD0 { float cent{-1.f}; float occ{-1.f}; - auto collision = candidate.template collision_as(); + auto collision = candidate.template collision_as(); auto numPvContributors = collision.numContrib(); if (storeCentrality && centEstimator != CentralityEstimator::None) { cent = getCentralityColl(collision, centEstimator); @@ -620,29 +642,29 @@ struct HfTaskD0 { registry.fill(HIST("hMassSigD0"), massD0, ptCandidate, rapidityCandidate); if constexpr (applyMl) { if (storeCentrality && storeOccupancy) { - registry.fill(HIST("hSparseDzero"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); } else if (storeCentrality && !storeOccupancy) { - registry.fill(HIST("hSparseDzero"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); } else if (!storeCentrality && storeOccupancy) { - registry.fill(HIST("hSparseDzero"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); } else { - registry.fill(HIST("hSparseDzero"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); } } else { if (storeCentrality && storeOccupancy) { - registry.fill(HIST("hSparseDzero"), massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); + registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); } else if (storeCentrality && !storeOccupancy) { - registry.fill(HIST("hSparseDzero"), massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); + registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); } else if (!storeCentrality && storeOccupancy) { - registry.fill(HIST("hSparseDzero"), massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); + registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); } else { - registry.fill(HIST("hSparseDzero"), massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); + registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); } } } else { @@ -664,29 +686,29 @@ struct HfTaskD0 { registry.fill(HIST("hMassReflBkgD0"), massD0, ptCandidate, rapidityCandidate); if constexpr (applyMl) { if (storeCentrality && storeOccupancy) { - registry.fill(HIST("hSparseDzero"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); } else if (storeCentrality && !storeOccupancy) { - registry.fill(HIST("hSparseDzero"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); } else if (!storeCentrality && storeOccupancy) { - registry.fill(HIST("hSparseDzero"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); } else { - registry.fill(HIST("hSparseDzero"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); } } else { if (storeCentrality && storeOccupancy) { - registry.fill(HIST("hSparseDzero"), massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); + registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); } else if (storeCentrality && !storeOccupancy) { - registry.fill(HIST("hSparseDzero"), massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); + registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); } else if (!storeCentrality && storeOccupancy) { - registry.fill(HIST("hSparseDzero"), massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); + registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); } else { - registry.fill(HIST("hSparseDzero"), massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); + registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); } } } @@ -698,29 +720,29 @@ struct HfTaskD0 { registry.fill(HIST("hMassSigD0bar"), massD0bar, ptCandidate, rapidityCandidate); if constexpr (applyMl) { if (storeCentrality && storeOccupancy) { - registry.fill(HIST("hSparseDzero"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); } else if (storeCentrality && !storeOccupancy) { - registry.fill(HIST("hSparseDzero"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); } else if (!storeCentrality && storeOccupancy) { - registry.fill(HIST("hSparseDzero"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); } else { - registry.fill(HIST("hSparseDzero"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); } } else { if (storeCentrality && storeOccupancy) { - registry.fill(HIST("hSparseDzero"), massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); + registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); } else if (storeCentrality && !storeOccupancy) { - registry.fill(HIST("hSparseDzero"), massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); + registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); } else if (!storeCentrality && storeOccupancy) { - registry.fill(HIST("hSparseDzero"), massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); + registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); } else { - registry.fill(HIST("hSparseDzero"), massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); + registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); } } } else { @@ -729,29 +751,29 @@ struct HfTaskD0 { registry.fill(HIST("hMassReflBkgD0bar"), massD0bar, ptCandidate, rapidityCandidate); if constexpr (applyMl) { if (storeCentrality && storeOccupancy) { - registry.fill(HIST("hSparseDzero"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); } else if (storeCentrality && !storeOccupancy) { - registry.fill(HIST("hSparseDzero"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); } else if (!storeCentrality && storeOccupancy) { - registry.fill(HIST("hSparseDzero"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); } else { - registry.fill(HIST("hSparseDzero"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); + registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); } } else { if (storeCentrality && storeOccupancy) { - registry.fill(HIST("hSparseDzero"), massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); + registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); } else if (storeCentrality && !storeOccupancy) { - registry.fill(HIST("hSparseDzero"), massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); + registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); } else if (!storeCentrality && storeOccupancy) { - registry.fill(HIST("hSparseDzero"), massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); + registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); } else { - registry.fill(HIST("hSparseDzero"), massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); + registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); } } } @@ -778,11 +800,14 @@ struct HfTaskD0 { float cent{-1.f}; float occ{-1.f}; - if (storeCentrality && centEstimator != CentralityEstimator::None) { - cent = getCentralityGenColl(recoCollsPerMcColl, centEstimator); - } - if (storeOccupancy && occEstimator != OccupancyEstimator::None) { - occ = getOccupancyGenColl(recoCollsPerMcColl, occEstimator); + if (storeCentrality || storeOccupancy){ + const auto& recoCollsPerMcCollCent = collisions.sliceBy(colPerMcCollisionCent, particle.mcCollision().globalIndex()); + if (storeCentrality && centEstimator != CentralityEstimator::None) { + cent = getCentralityGenColl(recoCollsPerMcCollCent, centEstimator); + } + if (storeOccupancy && occEstimator != OccupancyEstimator::None) { + occ = getOccupancyGenColl(recoCollsPerMcCollCent, occEstimator); + } } if (particle.originMcGen() == RecoDecay::OriginType::Prompt) { @@ -828,6 +853,16 @@ struct HfTaskD0 { } PROCESS_SWITCH(HfTaskD0, processMcWithDCAFitterN, "Process MC with DCAFitterN", false); + void processMcWithDCAFitterNCent(D0CandidatesMc const&, + soa::Join const& mcParticles, + aod::TracksWMc const& tracks, + CollisionsWithMcLabelsCent const& collisions, + aod::McCollisions const& mcCollisions) + { + processMc(selectedD0CandidatesMc, mcParticles, tracks, collisions, mcCollisions); + } + PROCESS_SWITCH(HfTaskD0, processMcWithDCAFitterNCent, "Process MC with DCAFitterN and centrality", false); + void processMcWithKFParticle(D0CandidatesMcKF const&, soa::Join const& mcParticles, aod::TracksWMc const& tracks, @@ -837,6 +872,7 @@ struct HfTaskD0 { processMc(selectedD0CandidatesMcKF, mcParticles, tracks, collisions, mcCollisions); } PROCESS_SWITCH(HfTaskD0, processMcWithKFParticle, "Process MC with KFParticle", false); + //TODO: add the processMcWithKFParticleCent void processMcWithDCAFitterNMl(D0CandidatesMlMc const&, soa::Join const& mcParticles, @@ -848,6 +884,16 @@ struct HfTaskD0 { } PROCESS_SWITCH(HfTaskD0, processMcWithDCAFitterNMl, "Process MC with DCAFitterN and ML selection", false); + void processMcWithDCAFitterNMlCent(D0CandidatesMl const&, + soa::Join const& mcParticles, + aod::TracksWMc const& tracks, + CollisionsWithMcLabelsCent const& collisions, + aod::McCollisions const& mcCollisions) + { + processMc(selectedD0CandidatesMlMc, mcParticles, tracks, collisions, mcCollisions); + } + PROCESS_SWITCH(HfTaskD0, processMcWithDCAFitterNMlCent, "Process MC with DCAFitterN and ML selection and centrality", false); + void processMcWithKFParticleMl(D0CandidatesMlMcKF const&, soa::Join const& mcParticles, aod::TracksWMc const& tracks, @@ -857,6 +903,7 @@ struct HfTaskD0 { processMc(selectedD0CandidatesMlMcKF, mcParticles, tracks, collisions, mcCollisions); } PROCESS_SWITCH(HfTaskD0, processMcWithKFParticleMl, "Process MC with KFParticle and ML selections", false); + //TODO: add the processMcWithKFParticleMlCent }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 68bbaf2f0df799b47811d07b5fc7ca4f3059155a Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Mon, 13 Jan 2025 14:07:13 +0000 Subject: [PATCH 3/6] Please consider the following formatting changes --- PWGHF/D2H/Tasks/taskD0.cxx | 102 +++++++++++++------------------------ 1 file changed, 35 insertions(+), 67 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskD0.cxx b/PWGHF/D2H/Tasks/taskD0.cxx index 614ea25dc4f..8a93890a12c 100644 --- a/PWGHF/D2H/Tasks/taskD0.cxx +++ b/PWGHF/D2H/Tasks/taskD0.cxx @@ -264,7 +264,6 @@ struct HfTaskD0 { registry.get(HIST("hSparseAcc"))->Sumw2(); } - std::vector axes = {thnAxisMass, thnAxisPt, thnAxisY, thnAxisCandType}; if (doprocessMcWithDCAFitterN || doprocessMcWithKFParticle || doprocessMcWithDCAFitterNMl || doprocessMcWithKFParticleMl) { axes.push_back(thnAxisPtB); @@ -376,8 +375,7 @@ struct HfTaskD0 { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, cent, occ); registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, cent, occ); } - } - else if (storeCentrality && !storeOccupancy) { + } else if (storeCentrality && !storeOccupancy) { if (candidate.isSelD0() >= selectionFlagD0) { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, cent); registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, cent); @@ -386,8 +384,7 @@ struct HfTaskD0 { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, cent); registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, cent); } - } - else if (!storeCentrality && storeOccupancy) { + } else if (!storeCentrality && storeOccupancy) { if (candidate.isSelD0() >= selectionFlagD0) { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, occ); registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, occ); @@ -396,8 +393,7 @@ struct HfTaskD0 { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, occ); registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, occ); } - } - else { + } else { if (candidate.isSelD0() >= selectionFlagD0) { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), SigD0); registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0); @@ -417,8 +413,7 @@ struct HfTaskD0 { registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, cent, occ); registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, cent, occ); } - } - else if (storeCentrality && !storeOccupancy) { + } else if (storeCentrality && !storeOccupancy) { if (candidate.isSelD0() >= selectionFlagD0) { registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, cent); registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, cent); @@ -427,19 +422,16 @@ struct HfTaskD0 { registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, cent); registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, cent); } - } - else if (!storeCentrality && storeOccupancy) { + } else if (!storeCentrality && storeOccupancy) { if (candidate.isSelD0() >= selectionFlagD0) { registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, occ); registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, occ); - } if (candidate.isSelD0bar() >= selectionFlagD0bar) { registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, occ); registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, occ); } - } - else { + } else { if (candidate.isSelD0() >= selectionFlagD0) { registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0); registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0); @@ -469,7 +461,7 @@ struct HfTaskD0 { processData(selectedD0CandidatesKF, collisions); } PROCESS_SWITCH(HfTaskD0, processDataWithKFParticle, "process taskD0 with KFParticle", false); - //TODO: add processKFParticleCent + // TODO: add processKFParticleCent void processDataWithDCAFitterNMl(D0CandidatesMl const&, Collisions const& collisions) { @@ -488,7 +480,7 @@ struct HfTaskD0 { processData(selectedD0CandidatesMlKF, collisions); } PROCESS_SWITCH(HfTaskD0, processDataWithKFParticleMl, "process taskD0 with KFParticle and ML selections", false); - //TODO: add processKFParticleMlCent + // TODO: add processKFParticleMlCent template void processMc(CandType const& candidates, @@ -643,27 +635,21 @@ struct HfTaskD0 { if constexpr (applyMl) { if (storeCentrality && storeOccupancy) { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); - } - else if (storeCentrality && !storeOccupancy) { + } else if (storeCentrality && !storeOccupancy) { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); - } - else if (!storeCentrality && storeOccupancy) { + } else if (!storeCentrality && storeOccupancy) { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); - } - else { + } else { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); } } else { if (storeCentrality && storeOccupancy) { registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); - } - else if (storeCentrality && !storeOccupancy) { + } else if (storeCentrality && !storeOccupancy) { registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); - } - else if (!storeCentrality && storeOccupancy) { + } else if (!storeCentrality && storeOccupancy) { registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); - } - else { + } else { registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); } } @@ -687,27 +673,21 @@ struct HfTaskD0 { if constexpr (applyMl) { if (storeCentrality && storeOccupancy) { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); - } - else if (storeCentrality && !storeOccupancy) { + } else if (storeCentrality && !storeOccupancy) { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); - } - else if (!storeCentrality && storeOccupancy) { + } else if (!storeCentrality && storeOccupancy) { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); - } - else { + } else { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0()[0], candidate.mlProbD0()[1], candidate.mlProbD0()[2], massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); } } else { if (storeCentrality && storeOccupancy) { registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); - } - else if (storeCentrality && !storeOccupancy) { + } else if (storeCentrality && !storeOccupancy) { registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); - } - else if (!storeCentrality && storeOccupancy) { + } else if (!storeCentrality && storeOccupancy) { registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); - } - else { + } else { registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); } } @@ -721,27 +701,21 @@ struct HfTaskD0 { if constexpr (applyMl) { if (storeCentrality && storeOccupancy) { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); - } - else if (storeCentrality && !storeOccupancy) { + } else if (storeCentrality && !storeOccupancy) { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); - } - else if (!storeCentrality && storeOccupancy) { + } else if (!storeCentrality && storeOccupancy) { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); - } - else { + } else { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); } } else { if (storeCentrality && storeOccupancy) { registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); - } - else if (storeCentrality && !storeOccupancy) { + } else if (storeCentrality && !storeOccupancy) { registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); - } - else if (!storeCentrality && storeOccupancy) { + } else if (!storeCentrality && storeOccupancy) { registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); - } - else { + } else { registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); } } @@ -752,27 +726,21 @@ struct HfTaskD0 { if constexpr (applyMl) { if (storeCentrality && storeOccupancy) { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); - } - else if (storeCentrality && !storeOccupancy) { + } else if (storeCentrality && !storeOccupancy) { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); - } - else if (!storeCentrality && storeOccupancy) { + } else if (!storeCentrality && storeOccupancy) { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); - } - else { + } else { registry.fill(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"), candidate.mlProbD0bar()[0], candidate.mlProbD0bar()[1], candidate.mlProbD0bar()[2], massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); } } else { if (storeCentrality && storeOccupancy) { registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); - } - else if (storeCentrality && !storeOccupancy) { + } else if (storeCentrality && !storeOccupancy) { registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); - } - else if (!storeCentrality && storeOccupancy) { + } else if (!storeCentrality && storeOccupancy) { registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); - } - else { + } else { registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); } } @@ -800,7 +768,7 @@ struct HfTaskD0 { float cent{-1.f}; float occ{-1.f}; - if (storeCentrality || storeOccupancy){ + if (storeCentrality || storeOccupancy) { const auto& recoCollsPerMcCollCent = collisions.sliceBy(colPerMcCollisionCent, particle.mcCollision().globalIndex()); if (storeCentrality && centEstimator != CentralityEstimator::None) { cent = getCentralityGenColl(recoCollsPerMcCollCent, centEstimator); @@ -872,7 +840,7 @@ struct HfTaskD0 { processMc(selectedD0CandidatesMcKF, mcParticles, tracks, collisions, mcCollisions); } PROCESS_SWITCH(HfTaskD0, processMcWithKFParticle, "Process MC with KFParticle", false); - //TODO: add the processMcWithKFParticleCent + // TODO: add the processMcWithKFParticleCent void processMcWithDCAFitterNMl(D0CandidatesMlMc const&, soa::Join const& mcParticles, @@ -903,7 +871,7 @@ struct HfTaskD0 { processMc(selectedD0CandidatesMlMcKF, mcParticles, tracks, collisions, mcCollisions); } PROCESS_SWITCH(HfTaskD0, processMcWithKFParticleMl, "Process MC with KFParticle and ML selections", false); - //TODO: add the processMcWithKFParticleMlCent + // TODO: add the processMcWithKFParticleMlCent }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 555c9cb1cc49bc84b633dc398ab98f2463bc2122 Mon Sep 17 00:00:00 2001 From: wuctlby Date: Mon, 13 Jan 2025 16:00:30 +0100 Subject: [PATCH 4/6] Delte the unnecessary PresliceUnsorted --- PWGHF/D2H/Tasks/taskD0.cxx | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskD0.cxx b/PWGHF/D2H/Tasks/taskD0.cxx index 614ea25dc4f..f765ca77295 100644 --- a/PWGHF/D2H/Tasks/taskD0.cxx +++ b/PWGHF/D2H/Tasks/taskD0.cxx @@ -98,7 +98,6 @@ struct HfTaskD0 { using CollisionsWithMcLabels = soa::Join; using CollisionsWithMcLabelsCent = soa::Join; PresliceUnsorted colPerMcCollision = aod::mccollisionlabel::mcCollisionId; - PresliceUnsorted colPerMcCollisionCent = aod::mccollisionlabel::mcCollisionId; SliceCache cache; Partition selectedD0Candidates = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; @@ -800,14 +799,11 @@ struct HfTaskD0 { float cent{-1.f}; float occ{-1.f}; - if (storeCentrality || storeOccupancy){ - const auto& recoCollsPerMcCollCent = collisions.sliceBy(colPerMcCollisionCent, particle.mcCollision().globalIndex()); - if (storeCentrality && centEstimator != CentralityEstimator::None) { - cent = getCentralityGenColl(recoCollsPerMcCollCent, centEstimator); - } - if (storeOccupancy && occEstimator != OccupancyEstimator::None) { - occ = getOccupancyGenColl(recoCollsPerMcCollCent, occEstimator); - } + if (storeCentrality && centEstimator != CentralityEstimator::None) { + cent = getCentralityGenColl(recoCollsPerMcColl, centEstimator); + } + if (storeOccupancy && occEstimator != OccupancyEstimator::None) { + occ = getOccupancyGenColl(recoCollsPerMcColl, occEstimator); } if (particle.originMcGen() == RecoDecay::OriginType::Prompt) { From 6672cc97187e0c6e6bdb1d4f5440236eb3f53d7c Mon Sep 17 00:00:00 2001 From: wuctlby Date: Mon, 13 Jan 2025 19:11:01 +0100 Subject: [PATCH 5/6] recover the thnsparse name and bugshooting --- PWGHF/D2H/Tasks/taskD0.cxx | 103 ++++++++++++++++++++----------------- 1 file changed, 55 insertions(+), 48 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskD0.cxx b/PWGHF/D2H/Tasks/taskD0.cxx index f4d4184dfb6..412aebbc0fe 100644 --- a/PWGHF/D2H/Tasks/taskD0.cxx +++ b/PWGHF/D2H/Tasks/taskD0.cxx @@ -98,6 +98,7 @@ struct HfTaskD0 { using CollisionsWithMcLabels = soa::Join; using CollisionsWithMcLabelsCent = soa::Join; PresliceUnsorted colPerMcCollision = aod::mccollisionlabel::mcCollisionId; + PresliceUnsorted colPerMcCollisionCent = aod::mccollisionlabel::mcCollisionId; SliceCache cache; Partition selectedD0Candidates = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlagD0bar; @@ -196,7 +197,7 @@ struct HfTaskD0 { LOGP(fatal, "DCAFitterN and KFParticle can not be enabled at a time."); } if ((storeCentrality || storeOccupancy) && !(doprocessDataWithDCAFitterNCent || doprocessMcWithDCAFitterNCent || doprocessDataWithDCAFitterNMlCent || doprocessMcWithDCAFitterNMlCent)) { - LOGP(fatal, "can't enable the storeCentrality and storeOccupancu without cent process"); + LOGP(fatal, "Can't enable the storeCentrality and storeOccupancu without cent process"); } auto vbins = (std::vector)binsPt; registry.add("hMass", "2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries", {HistType::kTH2F, {{500, 0., 5.}, {vbins, "#it{p}_{T} (GeV/#it{c})"}}}); @@ -249,7 +250,7 @@ struct HfTaskD0 { const AxisSpec thnAxisCent{thnConfigAxisCent, "Centrality"}; const AxisSpec thnAxisOccupancy{thnConfigAxisOccupancy, "Occupancy"}; - if (doprocessMcWithDCAFitterN || doprocessMcWithKFParticle || doprocessMcWithDCAFitterNMl || doprocessMcWithKFParticleMl) { + if (doprocessMcWithDCAFitterN || doprocessMcWithDCAFitterNCent || doprocessMcWithKFParticle || doprocessMcWithDCAFitterNMl || doprocessMcWithDCAFitterNMlCent || doprocessMcWithKFParticleMl) { std::vector axesAcc = {thnAxisGenPtD, thnAxisGenPtB, thnAxisY, thnAxisOrigin, thnAxisNumPvContr}; if (storeCentrality) { @@ -264,7 +265,7 @@ struct HfTaskD0 { } std::vector axes = {thnAxisMass, thnAxisPt, thnAxisY, thnAxisCandType}; - if (doprocessMcWithDCAFitterN || doprocessMcWithKFParticle || doprocessMcWithDCAFitterNMl || doprocessMcWithKFParticleMl) { + if (doprocessMcWithDCAFitterN || doprocessMcWithDCAFitterNCent || doprocessMcWithKFParticle || doprocessMcWithDCAFitterNMl || doprocessMcWithDCAFitterNMlCent || doprocessMcWithKFParticleMl) { axes.push_back(thnAxisPtB); axes.push_back(thnAxisOrigin); axes.push_back(thnAxisNumPvContr); @@ -287,8 +288,8 @@ struct HfTaskD0 { registry.add("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type", "Thn for D0 candidates", HistType::kTHnSparseD, axes); registry.get(HIST("hBdtScoreVsMassVsPtVsPtBVsYVsOriginVsD0Type"))->Sumw2(); } else { - registry.add("hMassVsPtVsYVsOriginVsD0Type", "Thn for D0 candidates", HistType::kTHnSparseD, axes); - registry.get(HIST("hMassVsPtVsYVsOriginVsD0Type"))->Sumw2(); + registry.add("hMassVsPtVsPtBVsYVsOriginVsD0Type", "Thn for D0 candidates", HistType::kTHnSparseD, axes); + registry.get(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"))->Sumw2(); } } @@ -405,39 +406,39 @@ struct HfTaskD0 { } else { if (storeCentrality && storeOccupancy) { if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, cent, occ); - registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, cent, occ); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, cent, occ); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, cent, occ); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, cent, occ); - registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, cent, occ); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, cent, occ); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, cent, occ); } } else if (storeCentrality && !storeOccupancy) { if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, cent); - registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, cent); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, cent); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, cent); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, cent); - registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, cent); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, cent); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, cent); } } else if (!storeCentrality && storeOccupancy) { if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, occ); - registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, occ); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0, occ); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0, occ); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, occ); - registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, occ); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar, occ); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar, occ); } } else { if (candidate.isSelD0() >= selectionFlagD0) { - registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0); - registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), SigD0); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0bar() ? ReflectedD0 : PureSigD0); } if (candidate.isSelD0bar() >= selectionFlagD0bar) { - registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar); - registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), SigD0bar); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, hfHelper.yD0(candidate), candidate.isSelD0() ? ReflectedD0bar : PureSigD0bar); } } } @@ -643,13 +644,13 @@ struct HfTaskD0 { } } else { if (storeCentrality && storeOccupancy) { - registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); } else if (storeCentrality && !storeOccupancy) { - registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); } else if (!storeCentrality && storeOccupancy) { - registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); } else { - registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, SigD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); } } } else { @@ -681,13 +682,13 @@ struct HfTaskD0 { } } else { if (storeCentrality && storeOccupancy) { - registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); } else if (storeCentrality && !storeOccupancy) { - registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); } else if (!storeCentrality && storeOccupancy) { - registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); } else { - registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0, ptCandidate, rapidityCandidate, ReflectedD0, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); } } } @@ -709,13 +710,13 @@ struct HfTaskD0 { } } else { if (storeCentrality && storeOccupancy) { - registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); } else if (storeCentrality && !storeOccupancy) { - registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); } else if (!storeCentrality && storeOccupancy) { - registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); } else { - registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, SigD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); } } } else { @@ -734,13 +735,13 @@ struct HfTaskD0 { } } else { if (storeCentrality && storeOccupancy) { - registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent, occ); } else if (storeCentrality && !storeOccupancy) { - registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, cent); } else if (!storeCentrality && storeOccupancy) { - registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors, occ); } else { - registry.fill(HIST("hMassVsPtVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); + registry.fill(HIST("hMassVsPtVsPtBVsYVsOriginVsD0Type"), massD0bar, ptCandidate, rapidityCandidate, ReflectedD0bar, candidate.ptBhadMotherPart(), candidate.originMcRec(), numPvContributors); } } } @@ -760,18 +761,24 @@ struct HfTaskD0 { registry.fill(HIST("hPtVsYGen"), ptGen, yGen); unsigned maxNumContrib = 0; - const auto& recoCollsPerMcColl = collisions.sliceBy(colPerMcCollision, particle.mcCollision().globalIndex()); - for (const auto& recCol : recoCollsPerMcColl) { - maxNumContrib = recCol.numContrib() > maxNumContrib ? recCol.numContrib() : maxNumContrib; - } - float cent{-1.f}; float occ{-1.f}; - if (storeCentrality && centEstimator != CentralityEstimator::None) { - cent = getCentralityGenColl(recoCollsPerMcColl, centEstimator); - } - if (storeOccupancy && occEstimator != OccupancyEstimator::None) { - occ = getOccupancyGenColl(recoCollsPerMcColl, occEstimator); + if (storeCentrality || storeOccupancy){ + const auto& recoCollsPerMcCollCent = collisions.sliceBy(colPerMcCollisionCent, particle.mcCollision().globalIndex()); + for (const auto& recCol : recoCollsPerMcCollCent) { + maxNumContrib = recCol.numContrib() > maxNumContrib ? recCol.numContrib() : maxNumContrib; + } + if (storeCentrality && centEstimator != CentralityEstimator::None) { + cent = getCentralityGenColl(recoCollsPerMcCollCent, centEstimator); + } + if (storeOccupancy && occEstimator != OccupancyEstimator::None) { + occ = getOccupancyGenColl(recoCollsPerMcCollCent, occEstimator); + } + } else { + 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) { @@ -848,7 +855,7 @@ struct HfTaskD0 { } PROCESS_SWITCH(HfTaskD0, processMcWithDCAFitterNMl, "Process MC with DCAFitterN and ML selection", false); - void processMcWithDCAFitterNMlCent(D0CandidatesMl const&, + void processMcWithDCAFitterNMlCent(D0CandidatesMlMc const&, soa::Join const& mcParticles, aod::TracksWMc const& tracks, CollisionsWithMcLabelsCent const& collisions, From 9b846c61ed755988646d058efcbe977a8a5d9ce4 Mon Sep 17 00:00:00 2001 From: wuctlby Date: Mon, 13 Jan 2025 19:20:40 +0100 Subject: [PATCH 6/6] Chnage the if condition for different process --- PWGHF/D2H/Tasks/taskD0.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/D2H/Tasks/taskD0.cxx b/PWGHF/D2H/Tasks/taskD0.cxx index 412aebbc0fe..50c390254c2 100644 --- a/PWGHF/D2H/Tasks/taskD0.cxx +++ b/PWGHF/D2H/Tasks/taskD0.cxx @@ -763,7 +763,7 @@ struct HfTaskD0 { unsigned maxNumContrib = 0; float cent{-1.f}; float occ{-1.f}; - if (storeCentrality || storeOccupancy){ + if constexpr (std::is_same_v) { const auto& recoCollsPerMcCollCent = collisions.sliceBy(colPerMcCollisionCent, particle.mcCollision().globalIndex()); for (const auto& recCol : recoCollsPerMcCollCent) { maxNumContrib = recCol.numContrib() > maxNumContrib ? recCol.numContrib() : maxNumContrib;