From 510255e253433a9633fae2d3f44c9829afa77de1 Mon Sep 17 00:00:00 2001 From: Chuntai Date: Thu, 4 Sep 2025 11:55:28 +0200 Subject: [PATCH 1/6] [PWGHF] Add D0 into correlatorFlowCharmHadrons and separate the HfcRedCharmHads to HfcRedCharmHads2P and HfcRedCharmHads3P --- .../DataModel/DerivedDataCorrelationTables.h | 12 +++- .../correlatorFlowCharmHadrons.cxx | 65 +++++++++++++++++-- 2 files changed, 71 insertions(+), 6 deletions(-) diff --git a/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h b/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h index d48cd0f9d10..d84e9d3c78b 100644 --- a/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h +++ b/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h @@ -81,7 +81,17 @@ DECLARE_SOA_TABLE(DsCandSelInfos, "AOD", "DSCANDSELINFO", //! Table with Ds cand aod::hf_candidate_reduced::BdtScorePrompt, aod::hf_candidate_reduced::BdtScoreBkg); -DECLARE_SOA_TABLE(HfcRedCharmHads, "AOD", "HFCREDCHARMHAD", //! Table with charm hadron candidate info +DECLARE_SOA_TABLE(HfcRedCharmHads2P, "AOD", "HFCREDCHARMHAD2P", //! Table with charm hadron candidate info + soa::Index<>, + aod::hf_candidate_reduced::HfcRedFlowCollId, + aod::hf_candidate_reduced::PhiCand, + aod::hf_candidate_reduced::EtaCand, + aod::hf_candidate_reduced::PtCand, + aod::hf_candidate_reduced::InvMassCharmHad, + aod::hf_candidate_reduced::Prong0Id, + aod::hf_candidate_reduced::Prong1Id); + +DECLARE_SOA_TABLE(HfcRedCharmHads3P, "AOD", "HFCREDCHARMHAD3P", //! Table with charm hadron candidate info soa::Index<>, aod::hf_candidate_reduced::HfcRedFlowCollId, aod::hf_candidate_reduced::PhiCand, diff --git a/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx index ec5f2a40c19..cb0462b8f75 100644 --- a/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx @@ -51,13 +51,16 @@ using namespace o2::hf_evsel; enum DecayChannel { DplusToPiKPi = 0, DsToKKPi, - DsToPiKK + DsToPiKK, + D0ToPiK, + D0ToKPi }; /// Code to select collisions with at least one Ds meson struct HfCorrelatorFlowCharmHadrons { Produces rowCollisions; - Produces rowCharmCandidates; + Produces rowCharmCandidates2P; + Produces rowCharmCandidates3P; Produces rowCharmCandidatesMl; Produces rowAssocTrackReduced; Produces rowAssocTrackSelInfo; @@ -86,18 +89,23 @@ struct HfCorrelatorFlowCharmHadrons { using CollsWithCentMult = soa::Join; using CandDsDataWMl = soa::Filtered>; using CandDplusDataWMl = soa::Filtered>; + using CandD0DataWMl = soa::Filtered>; using TracksData = soa::Filtered>; Filter filterSelectDsCandidates = aod::hf_sel_candidate_ds::isSelDsToKKPi >= selectionFlag || aod::hf_sel_candidate_ds::isSelDsToPiKK >= selectionFlag; Filter filterSelectDplusCandidates = aod::hf_sel_candidate_dplus::isSelDplusToPiKPi >= selectionFlag; + Filter filterSelectD0Candidates = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlag || aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlag; Filter filterSelectTrackData = (nabs(aod::track::eta) < etaTrackMax) && (aod::track::pt > ptTrackMin) && (aod::track::pt < ptTrackMax) && (nabs(aod::track::dcaXY) < dcaXYTrackMax) && (nabs(aod::track::dcaZ) < dcaZTrackMax); Preslice candsDsPerCollWMl = aod::hf_cand::collisionId; Preslice candsDplusPerCollWMl = aod::hf_cand::collisionId; + Preslice candsD0PerCollWMl = aod::hf_cand::collisionId; Preslice trackIndicesPerColl = aod::track::collisionId; Partition selectedDsToKKPiWMl = aod::hf_sel_candidate_ds::isSelDsToKKPi >= selectionFlag; Partition selectedDsToPiKKWMl = aod::hf_sel_candidate_ds::isSelDsToPiKK >= selectionFlag; + Partition selectedD0ToPiKWMl = aod::hf_sel_candidate_d0::isSelD0 >= selectionFlag; + Partition selectedD0ToKPiWMl = aod::hf_sel_candidate_d0::isSelD0bar >= selectionFlag; HistogramRegistry registry{"registry", {}}; @@ -107,6 +115,11 @@ struct HfCorrelatorFlowCharmHadrons { massCharm = o2::constants::physics::MassDPlus; } else if (doprocessDsWithMl) { massCharm = o2::constants::physics::MassDS; + } else if (doprocessD0WithMl) { + massCharm = o2::constants::physics::MassD0; + } else { + LOG(fatal) << "No decay channel selected to process"; + std::abort(); } hfEvSel.addHistograms(registry); // collision monitoring @@ -161,6 +174,12 @@ struct HfCorrelatorFlowCharmHadrons { if constexpr (channel == DecayChannel::DplusToPiKPi) { return hfHelper.invMassDplusToPiKPi(candidate); } + if constexpr (channel == DecayChannel::D0ToPiK) { + return hfHelper.invMassD0ToPiK(candidate); + } + if constexpr (channel == DecayChannel::D0ToKPi) { + return hfHelper.invMassD0barToKPi(candidate); + } return -1.; } @@ -185,6 +204,16 @@ struct HfCorrelatorFlowCharmHadrons { outputMl[iclass] = candidate.mlProbDplusToPiKPi()[classMl->at(iclass)]; } } + if constexpr (channel == DecayChannel::D0ToPiK) { + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { + outputMl[iclass] = candidate.mlProbD0()[classMl->at(iclass)]; + } + } + if constexpr (channel == DecayChannel::D0ToKPi) { + for (unsigned int iclass = 0; iclass < classMl->size(); iclass++) { + outputMl[iclass] = candidate.mlProbD0bar()[classMl->at(iclass)]; + } + } return outputMl; } @@ -199,8 +228,11 @@ struct HfCorrelatorFlowCharmHadrons { continue; } double massCand = getCandMass(candidate); - rowCharmCandidates(indexRedColl, candidate.phi(), candidate.eta(), candidate.pt(), massCand, candidate.prong0Id(), candidate.prong1Id(), candidate.prong2Id()); - + if constexpr (channel == DecayChannel::D0ToKPi || channel == DecayChannel::D0ToPiK) { + rowCharmCandidates2P(indexRedColl, candidate.phi(), candidate.eta(), candidate.pt(), massCand, candidate.prong0Id(), candidate.prong1Id()); + } else { + rowCharmCandidates3P(indexRedColl, candidate.phi(), candidate.eta(), candidate.pt(), massCand, candidate.prong0Id(), candidate.prong1Id(), candidate.prong2Id()); + } std::vector outputMl = getCandMlScores(candidate); rowCharmCandidatesMl(indexRedColl, outputMl[0], outputMl[1]); } @@ -264,9 +296,32 @@ struct HfCorrelatorFlowCharmHadrons { } } PROCESS_SWITCH(HfCorrelatorFlowCharmHadrons, processDsWithMl, "Process Ds candidates with ML info", false); + + // D0 with ML selections + void processD0WithMl(CollsWithCentMult const& colls, + TracksData const& tracks, + CandD0DataWMl const&) + { + for (const auto& coll : colls) { + auto thisCollId = coll.globalIndex(); + auto candsD0ToPiKWMl = selectedD0ToPiKWMl->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache); + auto candsD0ToKPiWMl = selectedD0ToKPiWMl->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache); + if (forceCharmInCollision && candsD0ToPiKWMl.size() < 1 && candsD0ToKPiWMl.size() < 1) { + continue; + } + if (!checkAndFillCollision(coll)) { + continue; + } + auto trackIdsThisColl = tracks.sliceBy(trackIndicesPerColl, thisCollId); + fillCharmHadronTables(candsD0ToPiKWMl); + fillCharmHadronTables(candsD0ToKPiWMl); + fillTracksTables(trackIdsThisColl); + } + } + PROCESS_SWITCH(HfCorrelatorFlowCharmHadrons, processD0WithMl, "Process D0 candidates with ML info", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; -} +} \ No newline at end of file From 91f4769be253f37f83c192627c905a69af9144d1 Mon Sep 17 00:00:00 2001 From: Chuntai Date: Thu, 4 Sep 2025 11:55:28 +0200 Subject: [PATCH 2/6] [PWGHF] Add D0 into correlatorFlowCharmHadrons and separate the HfcRedCharmHads to HfcRedCharmHads2P and HfcRedCharmHads3P --- PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h | 4 ++-- PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h b/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h index d84e9d3c78b..b8f7254a577 100644 --- a/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h +++ b/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h @@ -81,7 +81,7 @@ DECLARE_SOA_TABLE(DsCandSelInfos, "AOD", "DSCANDSELINFO", //! Table with Ds cand aod::hf_candidate_reduced::BdtScorePrompt, aod::hf_candidate_reduced::BdtScoreBkg); -DECLARE_SOA_TABLE(HfcRedCharmHads2P, "AOD", "HFCREDCHARMHAD2P", //! Table with charm hadron candidate info +DECLARE_SOA_TABLE(HfcRedCharmHads2P, "AOD", "HFCREDCHARMHAD2P", //! Table with 2-prong charm hadron candidate info soa::Index<>, aod::hf_candidate_reduced::HfcRedFlowCollId, aod::hf_candidate_reduced::PhiCand, @@ -91,7 +91,7 @@ DECLARE_SOA_TABLE(HfcRedCharmHads2P, "AOD", "HFCREDCHARMHAD2P", //! Table with c aod::hf_candidate_reduced::Prong0Id, aod::hf_candidate_reduced::Prong1Id); -DECLARE_SOA_TABLE(HfcRedCharmHads3P, "AOD", "HFCREDCHARMHAD3P", //! Table with charm hadron candidate info +DECLARE_SOA_TABLE(HfcRedCharmHads3P, "AOD", "HFCREDCHARMHAD3P", //! Table with 3-prong charm hadron candidate info soa::Index<>, aod::hf_candidate_reduced::HfcRedFlowCollId, aod::hf_candidate_reduced::PhiCand, diff --git a/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx index cb0462b8f75..288add97c4c 100644 --- a/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx @@ -13,6 +13,7 @@ /// \brief CharmHadrons-Hadrons correlator tree creator for data and MC-reco analyses /// \author Marcello Di Costanzo , Politecnico and INFN Torino /// \author Stefano PolitanĂ² , CERN +/// \author Wu Chuntai , CCNU, INFN Padova, and Padova University #include "PWGHF/Core/HfHelper.h" #include "PWGHF/DataModel/CandidateReconstructionTables.h" From ac047ef8c1933070814f01d481df57ac9627e6e6 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Thu, 4 Sep 2025 13:59:41 +0000 Subject: [PATCH 3/6] Please consider the following formatting changes --- PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx index 288add97c4c..aeb66995bf4 100644 --- a/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx @@ -325,4 +325,5 @@ struct HfCorrelatorFlowCharmHadrons { WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; -} \ No newline at end of file +} + \ No newline at end of file From cac11418108173ee4af6d7a3848d149610649e33 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Thu, 4 Sep 2025 14:01:47 +0000 Subject: [PATCH 4/6] Please consider the following formatting changes --- PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx index aeb66995bf4..ef353fa6b04 100644 --- a/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx @@ -326,4 +326,3 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask(cfgc)}; } - \ No newline at end of file From d521aa032903fc7a894cd24e726927b20a3880c0 Mon Sep 17 00:00:00 2001 From: Chuntai Date: Thu, 4 Sep 2025 17:13:08 +0200 Subject: [PATCH 5/6] Short the desription of `HfcRedCharmHads2/3P` --- PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h | 4 ++-- PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h b/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h index b8f7254a577..4565189a5ab 100644 --- a/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h +++ b/PWGHF/HFC/DataModel/DerivedDataCorrelationTables.h @@ -81,7 +81,7 @@ DECLARE_SOA_TABLE(DsCandSelInfos, "AOD", "DSCANDSELINFO", //! Table with Ds cand aod::hf_candidate_reduced::BdtScorePrompt, aod::hf_candidate_reduced::BdtScoreBkg); -DECLARE_SOA_TABLE(HfcRedCharmHads2P, "AOD", "HFCREDCHARMHAD2P", //! Table with 2-prong charm hadron candidate info +DECLARE_SOA_TABLE(HfcRedCharmHads2P, "AOD", "HFCREDCHARM2P", //! Table with 2-prong charm hadron candidate info soa::Index<>, aod::hf_candidate_reduced::HfcRedFlowCollId, aod::hf_candidate_reduced::PhiCand, @@ -91,7 +91,7 @@ DECLARE_SOA_TABLE(HfcRedCharmHads2P, "AOD", "HFCREDCHARMHAD2P", //! Table with 2 aod::hf_candidate_reduced::Prong0Id, aod::hf_candidate_reduced::Prong1Id); -DECLARE_SOA_TABLE(HfcRedCharmHads3P, "AOD", "HFCREDCHARMHAD3P", //! Table with 3-prong charm hadron candidate info +DECLARE_SOA_TABLE(HfcRedCharmHads3P, "AOD", "HFCREDCHARM3P", //! Table with 3-prong charm hadron candidate info soa::Index<>, aod::hf_candidate_reduced::HfcRedFlowCollId, aod::hf_candidate_reduced::PhiCand, diff --git a/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx index ef353fa6b04..cb5e76f29c8 100644 --- a/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx @@ -120,7 +120,6 @@ struct HfCorrelatorFlowCharmHadrons { massCharm = o2::constants::physics::MassD0; } else { LOG(fatal) << "No decay channel selected to process"; - std::abort(); } hfEvSel.addHistograms(registry); // collision monitoring @@ -307,7 +306,7 @@ struct HfCorrelatorFlowCharmHadrons { auto thisCollId = coll.globalIndex(); auto candsD0ToPiKWMl = selectedD0ToPiKWMl->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache); auto candsD0ToKPiWMl = selectedD0ToKPiWMl->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache); - if (forceCharmInCollision && candsD0ToPiKWMl.size() < 1 && candsD0ToKPiWMl.size() < 1) { + if (forceCharmInCollision && candsD0ToPiKWMl.empty() && candsD0ToKPiWMl.empty()) { continue; } if (!checkAndFillCollision(coll)) { From a1e5243f2e56c697edcfe26e33c99f0d5452c4dd Mon Sep 17 00:00:00 2001 From: Chuntai Date: Sun, 7 Sep 2025 16:06:15 +0200 Subject: [PATCH 6/6] Restore using the method `.size()` --- PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx b/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx index cb5e76f29c8..9de2a52aabc 100644 --- a/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx +++ b/PWGHF/HFC/TableProducer/correlatorFlowCharmHadrons.cxx @@ -306,7 +306,7 @@ struct HfCorrelatorFlowCharmHadrons { auto thisCollId = coll.globalIndex(); auto candsD0ToPiKWMl = selectedD0ToPiKWMl->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache); auto candsD0ToKPiWMl = selectedD0ToKPiWMl->sliceByCached(aod::hf_cand::collisionId, thisCollId, cache); - if (forceCharmInCollision && candsD0ToPiKWMl.empty() && candsD0ToKPiWMl.empty()) { + if (forceCharmInCollision && candsD0ToPiKWMl.size() < 1 && candsD0ToKPiWMl.size() < 1) { continue; } if (!checkAndFillCollision(coll)) {