From 22d5b7a597003042e4a30bc237276587be24ae03 Mon Sep 17 00:00:00 2001 From: marcellocosti Date: Tue, 24 Nov 2026 16:46:23 +0100 Subject: [PATCH 1/3] Track selections for syst. studies --- PWGHF/D2H/Tasks/taskDplus.cxx | 74 ++++++++++++++++++++++++++++------- 1 file changed, 60 insertions(+), 14 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskDplus.cxx b/PWGHF/D2H/Tasks/taskDplus.cxx index 0afa5091b70..7d8074c85eb 100644 --- a/PWGHF/D2H/Tasks/taskDplus.cxx +++ b/PWGHF/D2H/Tasks/taskDplus.cxx @@ -79,7 +79,6 @@ struct HfTaskDplus { Configurable yGenNBins{"yGenNBins", 100, "number of bins for y axis in sparse for gen candidates"}; 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> binsPt{"binsPt", std::vector{hf_cuts_dplus_to_pi_k_pi::vecBinsPt}, "pT bin limits"}; Configurable> classMl{"classMl", {0, 1, 2}, "Indexes of ML scores to be stored. Three indexes max."}; Configurable storeRecRapidity{"storeRecRapidity", false, "Flag to store rec. rapidity information in MC THnSparse"}; Configurable storeCentrality{"storeCentrality", false, "Flag to store centrality information"}; @@ -90,6 +89,12 @@ struct HfTaskDplus { Configurable ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"}; Configurable irSource{"irSource", "ZNC hadronic", "Estimator of the interaction rate (Recommended: pp --> T0VTX, Pb-Pb --> ZNC hadronic)"}; + // Track selection systematics + Configurable applyTrackSelSyst{"applyTrackSelSyst", false, "Flag to apply track selection systematics"}; + Configurable minItsClusters{"minItsClusters", 4, "Minimum number of ITS clusters for prong selection"}; + Configurable minTpcCrossedRows{"minTpcCrossedRows", 70, "Minimum number of TPC crossed rows for prong selection"}; + Configurable maxChi2PerCluster{"maxChi2PerCluster", 4., "Maximum chi2 per cluster for prong selection"}; + HfEventSelection hfEvSel; // event selection and monitoring HfUpcGapThresholds upcThresholds; // UPC gap determination thresholds ctpRateFetcher mRateFetcher; // interaction rate fetcher @@ -568,6 +573,44 @@ struct HfTaskDplus { } } + // Apply prong track selections for systematic studies + /// \param candidate is a particle candidate + template + bool applyProngTrackSels(const T1& candidate) + { + auto prong0 = candidate.template prong0_as(); + auto prong1 = candidate.template prong1_as(); + auto prong2 = candidate.template prong2_as(); + + int const minProngItsCls = std::min({prong0.itsNCls(), prong1.itsNCls(), prong2.itsNCls()}); + if (minProngItsCls < minItsClusters) { + return false; + } + + int const minProngTpcCrossedRows = std::min({prong0.tpcNClsCrossedRows(), prong1.tpcNClsCrossedRows(), prong2.tpcNClsCrossedRows()}); + if (minProngTpcCrossedRows < minTpcCrossedRows) { + return false; + } + + double const maxProngChi2PerCls = std::max({prong0.tpcChi2NCl(), prong1.tpcChi2NCl(), prong2.tpcChi2NCl()}); + if (maxProngChi2PerCls > maxChi2PerCluster) { + return false; + } + + return true; + } + + // Select a candidate based on rapidity and prong track selections for systematic studies + /// \param candidate is a particle candidate + template + bool isCandSelected(const T1& candidate) + { + if (yCandRecoMax >= 0. && std::abs(HfHelper::yDplus(candidate)) > yCandRecoMax) { + return false; + } + return !applyTrackSelSyst || applyProngTrackSels(candidate); + } + // Run analysis for the reconstructed Dplus candidates from data /// \param candidates are reconstructed candidates template @@ -580,14 +623,14 @@ struct HfTaskDplus { int const flagBHad{-1}; if constexpr (!FillMl) { for (const auto& candidate : selectedDPlusCandidates) { - if ((yCandRecoMax >= 0. && std::abs(HfHelper::yDplus(candidate)) > yCandRecoMax)) { + if (!isCandSelected(candidate)) { continue; } fillHisto(candidate); } } else { for (const auto& candidate : selectedDPlusCandidatesWithMl) { - if ((yCandRecoMax >= 0. && std::abs(HfHelper::yDplus(candidate)) > yCandRecoMax)) { + if (!isCandSelected(candidate)) { continue; } @@ -625,7 +668,7 @@ struct HfTaskDplus { // MC rec. w/o Ml if constexpr (!FillMl) { for (const auto& candidate : recoDPlusCandidates) { - if ((yCandRecoMax >= 0. && std::abs(HfHelper::yDplus(candidate)) > yCandRecoMax)) { + if (!isCandSelected(candidate)) { continue; } fillHisto(candidate); @@ -634,7 +677,7 @@ struct HfTaskDplus { // Bkg if (fillMcBkgHistos) { for (const auto& candidate : recoBkgCandidates) { - if ((yCandRecoMax >= 0. && std::abs(HfHelper::yDplus(candidate)) > yCandRecoMax)) { + if (!isCandSelected(candidate)) { continue; } fillHistoMCRec(candidate); @@ -642,9 +685,10 @@ struct HfTaskDplus { } } else { for (const auto& candidate : recoDPlusCandidatesWithMl) { - if ((yCandRecoMax >= 0. && std::abs(HfHelper::yDplus(candidate)) > yCandRecoMax)) { + if (!isCandSelected(candidate)) { continue; } + ptBhad = candidate.ptBhadMotherPart(); flagBHad = getBHadMotherFlag(candidate.pdgBhadMotherPart()); auto collision = candidate.template collision_as(); @@ -668,7 +712,7 @@ struct HfTaskDplus { flagBHad = -1; if (fillMcBkgHistos) { for (const auto& candidate : recoBkgCandidatesWithMl) { - if ((yCandRecoMax >= 0. && std::abs(HfHelper::yDplus(candidate)) > yCandRecoMax)) { + if (!isCandSelected(candidate)) { continue; } auto collision = candidate.template collision_as(); @@ -845,7 +889,7 @@ struct HfTaskDplus { }; for (const auto& candidate : groupedDplusCandidates) { - if ((yCandRecoMax >= 0. && std::abs(HfHelper::yDplus(candidate)) > yCandRecoMax)) { + if (!isCandSelected(candidate)) { continue; } fillHisto(candidate); @@ -855,13 +899,13 @@ struct HfTaskDplus { } // process functions - void processData(CandDplusData const& candidates, CollisionsCent const& collisions) + void processData(CandDplusData const& candidates, CollisionsCent const& collisions, aod::TracksWExtra const&) { runDataAnalysis(candidates, collisions); } PROCESS_SWITCH(HfTaskDplus, processData, "Process data w/o ML", true); - void processDataWithMl(CandDplusDataWithMl const& candidates, CollisionsCent const& collisions) + void processDataWithMl(CandDplusDataWithMl const& candidates, CollisionsCent const& collisions, aod::TracksWExtra const&) { runDataAnalysis(candidates, collisions); } @@ -870,7 +914,8 @@ struct HfTaskDplus { void processMc(CandDplusMcReco const&, CandDplusMcGen const& mcGenParticles, McRecoCollisionsCent const& mcRecoCollisions, - aod::McCollisions const& mcGenCollisions) + aod::McCollisions const& mcGenCollisions, + aod::TracksWExtra const&) { runAnalysisMcRec(mcRecoCollisions); runAnalysisMcGen(mcGenCollisions, mcRecoCollisions, mcGenParticles); @@ -880,7 +925,8 @@ struct HfTaskDplus { void processMcWithMl(CandDplusMcRecoWithMl const&, CandDplusMcGen const& mcGenParticles, McRecoCollisionsCent const& mcRecoCollisions, - aod::McCollisions const& mcGenCollisions) + aod::McCollisions const& mcGenCollisions, + aod::TracksWExtra const&) { runAnalysisMcRec(mcRecoCollisions); runAnalysisMcGen(mcGenCollisions, mcRecoCollisions, mcGenParticles); @@ -890,7 +936,7 @@ struct HfTaskDplus { void processDataWithUpc(soa::Join const& collisions, aod::BcFullInfos const& bcs, CandDplusData const& selectedDplusCandidates, - aod::Tracks const&, + aod::TracksWExtra const&, aod::FT0s const& ft0s, aod::FV0As const& fv0as, aod::FDDs const& fdds, @@ -903,7 +949,7 @@ struct HfTaskDplus { void processDataWithMlWithUpc(soa::Join const& collisions, aod::BcFullInfos const& bcs, CandDplusDataWithMl const& selectedDplusCandidatesMl, - aod::Tracks const&, + aod::TracksWExtra const&, aod::FT0s const& ft0s, aod::FV0As const& fv0as, aod::FDDs const& fdds, From 5a9d14cab300ee4decc0abc992602dab74476b5c Mon Sep 17 00:00:00 2001 From: marcellocosti Date: Tue, 24 Nov 2026 17:08:47 +0100 Subject: [PATCH 2/3] Make code-check happy --- PWGHF/D2H/Tasks/taskDplus.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskDplus.cxx b/PWGHF/D2H/Tasks/taskDplus.cxx index 7d8074c85eb..0032b6a1849 100644 --- a/PWGHF/D2H/Tasks/taskDplus.cxx +++ b/PWGHF/D2H/Tasks/taskDplus.cxx @@ -21,7 +21,6 @@ #include "PWGHF/Core/CentralityEstimation.h" #include "PWGHF/Core/DecayChannels.h" #include "PWGHF/Core/HfHelper.h" -#include "PWGHF/Core/SelectorCuts.h" #include "PWGHF/DataModel/AliasTables.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" @@ -765,7 +764,7 @@ struct HfTaskDplus { auto yGen = RecoDecay::y(particle.pVector(), o2::constants::physics::MassDPlus); if ((yCandGenMax >= 0. && std::abs(yGen) > yCandGenMax) || (std::abs(particle.flagMcMatchGen()) != hf_decay::hf_cand_3prong::DecayChannelMain::DplusToPiKPi)) { continue; - } + } if (particle.originMcGen() == RecoDecay::OriginType::NonPrompt) { auto bHadMother = mcGenParticles.rawIteratorAt(particle.idxBhadMotherPart() - mcGenParticles.offset()); flagGenB = getBHadMotherFlag(bHadMother.pdgCode()); From 2c3f3e863290d363bf9c5bd0614696576a4cf612 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Tue, 24 Nov 2026 16:09:55 +0000 Subject: [PATCH 3/3] Please consider the following formatting changes --- PWGHF/D2H/Tasks/taskDplus.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/D2H/Tasks/taskDplus.cxx b/PWGHF/D2H/Tasks/taskDplus.cxx index 0032b6a1849..e171016ac7a 100644 --- a/PWGHF/D2H/Tasks/taskDplus.cxx +++ b/PWGHF/D2H/Tasks/taskDplus.cxx @@ -764,7 +764,7 @@ struct HfTaskDplus { auto yGen = RecoDecay::y(particle.pVector(), o2::constants::physics::MassDPlus); if ((yCandGenMax >= 0. && std::abs(yGen) > yCandGenMax) || (std::abs(particle.flagMcMatchGen()) != hf_decay::hf_cand_3prong::DecayChannelMain::DplusToPiKPi)) { continue; - } + } if (particle.originMcGen() == RecoDecay::OriginType::NonPrompt) { auto bHadMother = mcGenParticles.rawIteratorAt(particle.idxBhadMotherPart() - mcGenParticles.offset()); flagGenB = getBHadMotherFlag(bHadMother.pdgCode());