From 4a589aed5898739dc10d95af8bbfdc84443e7cf9 Mon Sep 17 00:00:00 2001 From: marcellocosti Date: Tue, 15 Jul 2025 11:18:04 +0200 Subject: [PATCH 1/7] Add B0->D*pi channel --- .../dataCreatorCharmHadPiReduced.cxx | 773 ++++++++++++------ .../DataModel/CandidateReconstructionTables.h | 1 + 2 files changed, 537 insertions(+), 237 deletions(-) diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx index 609eb51701d..9468b05b41e 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx @@ -96,7 +96,8 @@ enum DecayChannel : uint8_t { B0ToDminusPi = 0, BplusToD0barPi, BsToDsminusPi, - LbToLcplusPi + LbToLcplusPi, + B0ToDstarPi }; enum WrongCollisionType : uint8_t { @@ -109,47 +110,49 @@ enum WrongCollisionType : uint8_t { struct HfDataCreatorCharmHadPiReduced { // Produces AOD tables to store track information // collision related tables - Produces hfReducedCollision; - Produces hfReducedCollCentrality; - Produces hfReducedQvector; - Produces hfReducedCollExtra; - Produces hfCollisionCounter; - // Pi bachelor related tables - Produces hfTrackPion; - Produces hfTrackCovPion; - Produces hfTrackPidPion; - // charm hadron related tables - Produces hfCand2Prong; - Produces hfCand2ProngCov; - Produces hfCand2ProngMl; - Produces hfCand3Prong; - Produces hfCand3ProngCov; - Produces hfCand3ProngMl; - // PID tables for charm-hadron candidate daughter tracks - Produces hfCandPidProng0; - Produces hfCandPidProng1; - Produces hfCandPidProng2; - - // B-hadron config and MC related tables - Produces rowCandidateConfigB0; - Produces rowHfDPiMcRecReduced; - Produces rowHfDPiMcCheckReduced; - Produces rowHfB0McGenReduced; - - Produces rowCandidateConfigBplus; - Produces rowHfD0PiMcRecReduced; - Produces rowHfD0PiMcCheckReduced; - Produces rowHfBpMcGenReduced; - - Produces rowCandidateConfigBs; - Produces rowHfDsPiMcRecReduced; - Produces rowHfDsPiMcCheckReduced; - Produces rowHfBsMcGenReduced; - - Produces rowCandidateConfigLb; - Produces rowHfLcPiMcRecReduced; - Produces rowHfLcPiMcCheckReduced; - Produces rowHfLbMcGenReduced; + struct : ProducesGroup { + Produces hfReducedCollision; + Produces hfReducedCollCentrality; + Produces hfReducedQvector; + Produces hfReducedCollExtra; + Produces hfCollisionCounter; + // Pi bachelor related tables + Produces hfTrackPion; + Produces hfTrackCovPion; + Produces hfTrackPidPion; + // charm hadron related tables + Produces hfCand2Prong; + Produces hfCand2ProngCov; + Produces hfCand2ProngMl; + Produces hfCand3Prong; + Produces hfCand3ProngCov; + Produces hfCand3ProngMl; + // PID tables for charm-hadron candidate daughter tracks + Produces hfCandPidProng0; + Produces hfCandPidProng1; + Produces hfCandPidProng2; + + // B-hadron config and MC related tables + Produces rowCandidateConfigB0; + Produces rowHfDPiMcRecReduced; + Produces rowHfDPiMcCheckReduced; + Produces rowHfB0McGenReduced; + + Produces rowCandidateConfigBplus; + Produces rowHfD0PiMcRecReduced; + Produces rowHfD0PiMcCheckReduced; + Produces rowHfBpMcGenReduced; + + Produces rowCandidateConfigBs; + Produces rowHfDsPiMcRecReduced; + Produces rowHfDsPiMcCheckReduced; + Produces rowHfBsMcGenReduced; + + Produces rowCandidateConfigLb; + Produces rowHfLcPiMcRecReduced; + Produces rowHfLcPiMcCheckReduced; + Produces rowHfLbMcGenReduced; + } tables; // generic configurables struct : o2::framework::ConfigurableGroup { @@ -188,6 +191,7 @@ struct HfDataCreatorCharmHadPiReduced { Configurable selectionFlagD0{"selectionFlagD0", 1, "Selection Flag for D0"}; Configurable selectionFlagD0bar{"selectionFlagD0bar", 1, "Selection Flag for D0bar"}; Configurable selectionFlagLc{"selectionFlagLc", 1, "Selection Flag for Lc"}; + Configurable selectionFlagDstar{"selectionFlagDstar", true, "Selection Flag for D* decay to D0 Pi"}; } hfflagConfigurations; HfHelper hfHelper; @@ -202,13 +206,13 @@ struct HfDataCreatorCharmHadPiReduced { // O2DatabasePDG service Service pdg; - double massPi{0.}; double massC{0.}; double massB{0.}; double invMass2ChHadPiMin{0.}; double invMass2ChHadPiMax{0.}; double bz{0.}; static constexpr std::size_t NDaughtersDs{2u}; + static constexpr std::size_t NDaughtersDstar{2u}; bool isHfCandBhadConfigFilled = false; // Fitter to redo D-vertex to get extrapolated daughter tracks (2/3-prong vertex filter) @@ -227,6 +231,8 @@ struct HfDataCreatorCharmHadPiReduced { using CandsD0FilteredWithMl = soa::Filtered>; using CandsLcFiltered = soa::Filtered>; using CandsLcFilteredWithMl = soa::Filtered>; + using CandsDstarFiltered = soa::Filtered>; + using CandsDstarFilteredWithMl = soa::Filtered>; using CollisionsWCent = soa::Join; using CollisionsWCentAndMcLabels = soa::Join; @@ -237,38 +243,43 @@ struct HfDataCreatorCharmHadPiReduced { Filter filterSelectDsCandidates = (aod::hf_sel_candidate_ds::isSelDsToKKPi >= hfflagConfigurations.selectionFlagDs || aod::hf_sel_candidate_ds::isSelDsToPiKK >= hfflagConfigurations.selectionFlagDs); Filter filterSelectDzeroCandidates = (aod::hf_sel_candidate_d0::isSelD0 >= hfflagConfigurations.selectionFlagD0 || aod::hf_sel_candidate_d0::isSelD0bar >= hfflagConfigurations.selectionFlagD0bar); Filter filterSelectLcCandidates = (aod::hf_sel_candidate_lc::isSelLcToPKPi >= hfflagConfigurations.selectionFlagLc || aod::hf_sel_candidate_lc::isSelLcToPiKP >= hfflagConfigurations.selectionFlagLc); - - Preslice candsDplusPerCollision = aod::track_association::collisionId; - Preslice candsDplusPerCollisionWithMl = aod::track_association::collisionId; - Preslice candsDsPerCollision = aod::track_association::collisionId; - Preslice candsDsPerCollisionWithMl = aod::track_association::collisionId; - Preslice candsD0PerCollision = aod::track_association::collisionId; - Preslice candsD0PerCollisionWithMl = aod::track_association::collisionId; - Preslice candsLcPerCollision = aod::track_association::collisionId; - Preslice candsLcPerCollisionWithMl = aod::track_association::collisionId; - Preslice trackIndicesPerCollision = aod::track_association::collisionId; - Preslice mcParticlesPerMcCollision = aod::mcparticle::mcCollisionId; - - PresliceUnsorted colPerMcCollision = aod::mccollisionlabel::mcCollisionId; - - std::shared_ptr hCandidatesD0, hCandidatesDPlus, hCandidatesDs, hCandidatesLc; + Filter filterSelectDstarCandidates = (aod::hf_sel_candidate_dstar::isSelDstarToD0Pi == hfflagConfigurations.selectionFlagDstar); + + struct : PresliceGroup { + Preslice candsDplusPerCollision = aod::track_association::collisionId; + Preslice candsDplusPerCollisionWithMl = aod::track_association::collisionId; + Preslice candsDsPerCollision = aod::track_association::collisionId; + Preslice candsDsPerCollisionWithMl = aod::track_association::collisionId; + Preslice candsD0PerCollision = aod::track_association::collisionId; + Preslice candsD0PerCollisionWithMl = aod::track_association::collisionId; + Preslice candsLcPerCollision = aod::track_association::collisionId; + Preslice candsLcPerCollisionWithMl = aod::track_association::collisionId; + Preslice candsDstarPerCollision = aod::track_association::collisionId; + Preslice candsDstarPerCollisionWithMl = aod::track_association::collisionId; + Preslice trackIndicesPerCollision = aod::track_association::collisionId; + Preslice mcParticlesPerMcCollision = aod::mcparticle::mcCollisionId; + PresliceUnsorted colPerMcCollision = aod::mccollisionlabel::mcCollisionId; + } preslices; + + std::shared_ptr hCandidatesD0, hCandidatesDPlus, hCandidatesDs, hCandidatesLc, hCandidatesDstar; HistogramRegistry registry{"registry"}; std::array arrPDGResonantDsPhiPi = {kPhi, kPiPlus}; // Ds± → Phi π± std::array arrPDGResonantDKstarK = {kK0Star892, kKPlus}; // Ds± → K*(892)0bar K± and D± → K*(892)0bar K± + std::array arrPDGResonantDstarD0Pi = {kD0, kPiPlus}; // D*± → D0 π± void init(InitContext& initContext) { - std::array doProcess = {doprocessDplusPiData, doprocessDplusPiDataWithMl, doprocessDplusPiMc, doprocessDplusPiMcWithMl, + std::array doProcess = {doprocessDplusPiData, doprocessDplusPiDataWithMl, doprocessDplusPiMc, doprocessDplusPiMcWithMl, doprocessDsPiData, doprocessDsPiDataWithMl, doprocessDsPiMc, doprocessDsPiMcWithMl, doprocessD0PiData, doprocessD0PiDataWithMl, doprocessD0PiMc, doprocessD0PiMcWithMl, - doprocessLcPiData, doprocessLcPiDataWithMl, doprocessLcPiMc, doprocessLcPiMcWithMl}; + doprocessLcPiData, doprocessLcPiDataWithMl, doprocessLcPiMc, doprocessLcPiMcWithMl, + doprocessDstarPiData, doprocessDstarPiDataWithMl, doprocessDstarPiMc, doprocessDstarPiMcWithMl}; if (std::accumulate(doProcess.begin(), doProcess.end(), 0) != 1) { LOGP(fatal, "One and only one process function can be enabled at a time, please fix your configuration!"); } // invariant-mass window cut - massPi = MassPiPlus; if (doprocessDplusPiData || doprocessDplusPiDataWithMl || doprocessDplusPiMc || doprocessDplusPiMcWithMl) { massC = MassDMinus; massB = MassB0; @@ -281,13 +292,18 @@ struct HfDataCreatorCharmHadPiReduced { } else if (doprocessLcPiData || doprocessLcPiDataWithMl || doprocessLcPiMc || doprocessLcPiMcWithMl) { massC = MassLambdaCPlus; massB = MassLambdaB0; + } else if (doprocessDstarPiData || doprocessDstarPiDataWithMl || doprocessDstarPiMc || doprocessDstarPiMcWithMl) { + massC = MassDStar; + massB = MassB0; } invMass2ChHadPiMin = (massB - configs.invMassWindowCharmHadPi) * (massB - configs.invMassWindowCharmHadPi); invMass2ChHadPiMax = (massB + configs.invMassWindowCharmHadPi) * (massB + configs.invMassWindowCharmHadPi); // Initialize fitter if (doprocessDplusPiData || doprocessDplusPiDataWithMl || doprocessDplusPiMc || doprocessDplusPiMcWithMl || - doprocessDsPiData || doprocessDsPiDataWithMl || doprocessDsPiMc || doprocessDsPiMcWithMl || doprocessLcPiData || doprocessLcPiDataWithMl || doprocessLcPiMc || doprocessLcPiMcWithMl) { + doprocessDsPiData || doprocessDsPiDataWithMl || doprocessDsPiMc || doprocessDsPiMcWithMl || + doprocessLcPiData || doprocessLcPiDataWithMl || doprocessLcPiMc || doprocessLcPiMcWithMl || + doprocessDstarPiData || doprocessDstarPiDataWithMl || doprocessDstarPiMc || doprocessDstarPiMcWithMl) { df3.setPropagateToPCA(vertexConfigurations.propagateToPCA); df3.setMaxR(vertexConfigurations.maxR); df3.setMaxDZIni(vertexConfigurations.maxDZIni); @@ -346,6 +362,10 @@ struct HfDataCreatorCharmHadPiReduced { histMassTitle = "Lc"; registry.add("hMassLcToPKPi", "#Lambda_{c}^{+} to KKpi candidates; #it{M}(pK#pi) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {{500, 0., 5.}}}); registry.add("hMassLcToPiKP", "#Lambda_{c}^{+} to piKK candidates; #it{M}(#piKp) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {{500, 0., 5.}}}); + } else if (doprocessDstarPiData || doprocessDstarPiDataWithMl || doprocessDstarPiMc || doprocessDstarPiMcWithMl) { + charmHadTitle = "D^{*}"; + histMassTitle = "Dstar"; + registry.add("hMassDstarToD0Pi", "D^{*} candidates; #it{M}(K#pi#pi) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {{500, 0., 5.}}}); } registry.add(Form("hPt%s", histMassTitle.data()), Form("%s candidates candidates;%s candidate #it{p}_{T} (GeV/#it{c});entries", charmHadTitle.data(), charmHadTitle.data()), {HistType::kTH1D, {{100, 0., 10.}}}); @@ -357,15 +377,21 @@ struct HfDataCreatorCharmHadPiReduced { hCandidatesDPlus = registry.add("hCandidatesDPlus", "Dplus candidate counter", {HistType::kTH1D, {axisCands}}); hCandidatesDs = registry.add("hCandidatesDs", "Ds candidate counter", {HistType::kTH1D, {axisCands}}); hCandidatesLc = registry.add("hCandidatesLc", "Lc candidate counter", {HistType::kTH1D, {axisCands}}); + hCandidatesDstar = registry.add("hCandidatesDstar", "Dstar candidate counter", {HistType::kTH1D, {axisCands}}); setLabelHistoCands(hCandidatesD0); setLabelHistoCands(hCandidatesDPlus); setLabelHistoCands(hCandidatesDs); setLabelHistoCands(hCandidatesLc); + setLabelHistoCands(hCandidatesDstar); // init HF event selection helper hfEvSel.init(registry); - if (doprocessDplusPiMc || doprocessDplusPiMcWithMl || doprocessDsPiMc || doprocessDsPiMcWithMl || doprocessD0PiMc || doprocessD0PiMcWithMl || doprocessLcPiMc || doprocessLcPiMcWithMl) { + if (doprocessDplusPiMc || doprocessDplusPiMcWithMl || + doprocessDsPiMc || doprocessDsPiMcWithMl || + doprocessD0PiMc || doprocessD0PiMcWithMl || + doprocessLcPiMc || doprocessLcPiMcWithMl || + doprocessDstarPiMc || doprocessDstarPiMcWithMl) { const auto& workflows = initContext.services().get(); for (const DeviceSpec& device : workflows.devices) { if (device.name.compare("hf-data-creator-charm-had-pi-reduced") == 0) { @@ -580,9 +606,9 @@ struct HfDataCreatorCharmHadPiReduced { } } } - rowHfDPiMcCheckReduced(pdgCodeBeautyMother, pdgCodeCharmMother, pdgCodeProng0, pdgCodeProng1, pdgCodeProng2, pdgCodeProng3); + tables.rowHfDPiMcCheckReduced(pdgCodeBeautyMother, pdgCodeCharmMother, pdgCodeProng0, pdgCodeProng1, pdgCodeProng2, pdgCodeProng3); } - rowHfDPiMcRecReduced(indexHfCandCharm, selectedTracksPion[vecDaughtersB.back().globalIndex()], flag, flagWrongCollision, debug, motherPt); + tables.rowHfDPiMcRecReduced(indexHfCandCharm, selectedTracksPion[vecDaughtersB.back().globalIndex()], flag, flagWrongCollision, debug, motherPt); } else if constexpr (decChannel == DecayChannel::BsToDsminusPi) { // Bs → Ds- π+ → (K- K+ π-) π+ auto indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2], vecDaughtersB[3]}, Pdg::kBS, std::array{-kKPlus, +kKPlus, -kPiPlus, +kPiPlus}, true, &sign, 3); @@ -735,9 +761,9 @@ struct HfDataCreatorCharmHadPiReduced { } } } - rowHfDsPiMcCheckReduced(pdgCodeBeautyMother, pdgCodeCharmMother, pdgCodeProng0, pdgCodeProng1, pdgCodeProng2, pdgCodeProng3); + tables.rowHfDsPiMcCheckReduced(pdgCodeBeautyMother, pdgCodeCharmMother, pdgCodeProng0, pdgCodeProng1, pdgCodeProng2, pdgCodeProng3); } - rowHfDsPiMcRecReduced(indexHfCandCharm, selectedTracksPion[vecDaughtersB.back().globalIndex()], flag, flagWrongCollision, debug, motherPt); + tables.rowHfDsPiMcRecReduced(indexHfCandCharm, selectedTracksPion[vecDaughtersB.back().globalIndex()], flag, flagWrongCollision, debug, motherPt); } else if constexpr (decChannel == DecayChannel::BplusToD0barPi) { // B+ → D0(bar) π+ → (K+ π-) π+ auto indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2]}, Pdg::kBPlus, std::array{+kPiPlus, +kKPlus, -kPiPlus}, true, &sign, 2); @@ -832,9 +858,9 @@ struct HfDataCreatorCharmHadPiReduced { } } } - rowHfD0PiMcCheckReduced(pdgCodeBeautyMother, pdgCodeCharmMother, pdgCodeProng0, pdgCodeProng1, pdgCodeProng2); + tables.rowHfD0PiMcCheckReduced(pdgCodeBeautyMother, pdgCodeCharmMother, pdgCodeProng0, pdgCodeProng1, pdgCodeProng2); } - rowHfD0PiMcRecReduced(indexHfCandCharm, selectedTracksPion[vecDaughtersB.back().globalIndex()], flag, flagWrongCollision, debug, motherPt); + tables.rowHfD0PiMcRecReduced(indexHfCandCharm, selectedTracksPion[vecDaughtersB.back().globalIndex()], flag, flagWrongCollision, debug, motherPt); } else if constexpr (decChannel == DecayChannel::LbToLcplusPi) { // Lb → Lc+ π- → (p K- π+) π- auto indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2], vecDaughtersB[3]}, Pdg::kLambdaB0, std::array{+kProton, -kKPlus, +kPiPlus, -kPiPlus}, true, &sign, 3); @@ -936,9 +962,44 @@ struct HfDataCreatorCharmHadPiReduced { } } } - rowHfLcPiMcCheckReduced(pdgCodeBeautyMother, pdgCodeCharmMother, pdgCodeProng0, pdgCodeProng1, pdgCodeProng2, pdgCodeProng3); + tables.rowHfLcPiMcCheckReduced(pdgCodeBeautyMother, pdgCodeCharmMother, pdgCodeProng0, pdgCodeProng1, pdgCodeProng2, pdgCodeProng3); + } + tables.rowHfLcPiMcRecReduced(indexHfCandCharm, selectedTracksPion[vecDaughtersB.back().globalIndex()], flag, flagWrongCollision, debug, motherPt); + } else if constexpr (decChannel == DecayChannel::B0ToDstarPi) { + // B0 → D*+ π- → (K- π+ π+) π- + auto indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2], vecDaughtersB[3]}, Pdg::kB0, std::array{-kKPlus, +kPiPlus, +kPiPlus, -kPiPlus}, true, &sign, 3); + if (indexRec > -1) { + // D*+ → K- π+ π+ + indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2]}, +Pdg::kDStar, std::array{-kKPlus, +kPiPlus, +kPiPlus}, true, &sign, 2); + if (indexRec > -1) { + std::vector arrDaughDstarIndex; + std::array arrPDGDaughDstar; + RecoDecay::getDaughters(particlesMc.rawIteratorAt(indexRec), &arrDaughDstarIndex, std::array{0}, 1); + if (arrDaughDstarIndex.size() == NDaughtersDstar) { + for (auto iProng = 0u; iProng < arrDaughDstarIndex.size(); ++iProng) { + auto daughI = particlesMc.rawIteratorAt(arrDaughDstarIndex[iProng]); + arrPDGDaughDstar[iProng] = std::abs(daughI.pdgCode()); + } + if ((arrPDGDaughDstar[0] == arrPDGResonantDstarD0Pi[0] && arrPDGDaughDstar[1] == arrPDGResonantDstarD0Pi[1]) || (arrPDGDaughDstar[0] == arrPDGResonantDstarD0Pi[1] && arrPDGDaughDstar[1] == arrPDGResonantDstarD0Pi[0])) { + flag = sign * BIT(hf_cand_b0::DecayTypeMc::B0ToDstarPiToD0PiPiToKPiPiPi); + } else { + debug = 1; + LOGF(debug, "B0 decays in the expected final state but the condition on the intermediate state is not fulfilled"); + } + } + } else { + debug = 1; + LOGF(debug, "B0 decays in the expected final state but the condition on the intermediate state is not fulfilled"); + } + + auto indexMother = RecoDecay::getMother(particlesMc, vecDaughtersB.back().template mcParticle_as(), Pdg::kB0, true); + if (indexMother >= 0) { + auto particleMother = particlesMc.rawIteratorAt(indexMother); + motherPt = particleMother.pt(); + checkWrongCollision(particleMother, collision, indexCollisionMaxNumContrib, flagWrongCollision); + } } - rowHfLcPiMcRecReduced(indexHfCandCharm, selectedTracksPion[vecDaughtersB.back().globalIndex()], flag, flagWrongCollision, debug, motherPt); + tables.rowHfDPiMcCheckReduced(indexHfCandCharm, selectedTracksPion[vecDaughtersB.back().globalIndex()], flag, flagWrongCollision, debug, motherPt); } } @@ -951,6 +1012,7 @@ struct HfDataCreatorCharmHadPiReduced { uint64_t const& indexCollisionMaxNumContrib, BBCs const&) { + LOG(debug) << "Running data creation for decay channel " << decChannel << " with doMc=" << doMc << ", withMl=" << withMl << ", withQvec=" << withQvec; registry.fill(HIST("hEvents"), 1 + Event::Processed); float centrality = -1.f; auto hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); @@ -959,7 +1021,7 @@ struct HfDataCreatorCharmHadPiReduced { } // helpers for ReducedTables filling - int indexHfReducedCollision = hfReducedCollision.lastIndex() + 1; + int indexHfReducedCollision = tables.hfReducedCollision.lastIndex() + 1; // std::map where the key is the track.globalIndex() and // the value is the track index in the table of the selected pions std::map selectedTracksPion; @@ -989,13 +1051,13 @@ struct HfDataCreatorCharmHadPiReduced { int indexHfCandCharm{-1}; float invMassC0{-1.f}, invMassC1{-1.f}; if constexpr (decChannel == DecayChannel::B0ToDminusPi) { - indexHfCandCharm = hfCand3Prong.lastIndex() + 1; + indexHfCandCharm = tables.hfCand3Prong.lastIndex() + 1; invMassC0 = hfHelper.invMassDplusToPiKPi(candC); registry.fill(HIST("hMassDplus"), invMassC0); registry.fill(HIST("hPtDplus"), candC.pt()); registry.fill(HIST("hCpaDplus"), candC.cpa()); } else if constexpr (decChannel == DecayChannel::BsToDsminusPi) { - indexHfCandCharm = hfCand3Prong.lastIndex() + 1; + indexHfCandCharm = tables.hfCand3Prong.lastIndex() + 1; if (candC.isSelDsToKKPi() >= hfflagConfigurations.selectionFlagDs) { invMassC0 = hfHelper.invMassDsToKKPi(candC); registry.fill(HIST("hMassDsToKKPi"), invMassC0); @@ -1007,7 +1069,7 @@ struct HfDataCreatorCharmHadPiReduced { registry.fill(HIST("hPtDs"), candC.pt()); registry.fill(HIST("hCpaDs"), candC.cpa()); } else if constexpr (decChannel == DecayChannel::BplusToD0barPi) { - indexHfCandCharm = hfCand2Prong.lastIndex() + 1; + indexHfCandCharm = tables.hfCand2Prong.lastIndex() + 1; if (candC.isSelD0() >= hfflagConfigurations.selectionFlagD0) { invMassC0 = hfHelper.invMassD0ToPiK(candC); registry.fill(HIST("hMassD0"), invMassC0); @@ -1019,7 +1081,7 @@ struct HfDataCreatorCharmHadPiReduced { registry.fill(HIST("hPtD0"), candC.pt()); registry.fill(HIST("hCpaD0"), candC.cpa()); } else if constexpr (decChannel == DecayChannel::LbToLcplusPi) { - indexHfCandCharm = hfCand3Prong.lastIndex() + 1; + indexHfCandCharm = tables.hfCand3Prong.lastIndex() + 1; if (candC.isSelLcToPKPi() >= hfflagConfigurations.selectionFlagLc) { invMassC0 = hfHelper.invMassLcToPKPi(candC); registry.fill(HIST("hMassLcToPKPi"), invMassC0); @@ -1030,11 +1092,29 @@ struct HfDataCreatorCharmHadPiReduced { } registry.fill(HIST("hPtLc"), candC.pt()); registry.fill(HIST("hCpaLc"), candC.cpa()); + } else if constexpr (decChannel == DecayChannel::B0ToDstarPi) { + indexHfCandCharm = tables.hfCand3Prong.lastIndex() + 1; + invMassC0 = candC.invMassDstar(); + registry.fill(HIST("hMassDstarToD0Pi"), invMassC0); + registry.fill(HIST("hPtDstar"), candC.pt()); } - bool fillHfCandCharm = false; - std::vector charmHadDauTracks{candC.template prong0_as(), candC.template prong1_as()}; + std::vector charmHadDauTracks; + // std::vector charmHadDauTracks{candC.template prong0_as(), candC.template prong1_as()}; + + if constexpr (decChannel == DecayChannel::B0ToDstarPi) { + auto prongD0 = candC.template prongD0_as(); + charmHadDauTracks = { + prongD0.template prong0_as(), + prongD0.template prong1_as() + }; + } else { + charmHadDauTracks = { + candC.template prong0_as(), + candC.template prong1_as() + }; + } o2::track::TrackParCov trackParCov0 = getTrackParCov(charmHadDauTracks[0]); o2::track::TrackParCov trackParCov1 = getTrackParCov(charmHadDauTracks[1]); o2::track::TrackParCov trackParCov2{}; @@ -1056,8 +1136,13 @@ struct HfDataCreatorCharmHadPiReduced { } // third track, if it's a 3-prong - if constexpr (decChannel == DecayChannel::B0ToDminusPi || decChannel == DecayChannel::BsToDsminusPi || decChannel == DecayChannel::LbToLcplusPi) { - charmHadDauTracks.push_back(candC.template prong2_as()); + if constexpr (decChannel == DecayChannel::B0ToDminusPi || decChannel == DecayChannel::BsToDsminusPi || decChannel == DecayChannel::LbToLcplusPi || decChannel == DecayChannel::B0ToDstarPi) { + // charmHadDauTracks.push_back(candC.template prong2_as()); + if constexpr (decChannel == DecayChannel::B0ToDstarPi) { + charmHadDauTracks.push_back(candC.template prong0_as()); + } else { + charmHadDauTracks.push_back(candC.template prong2_as()); + } trackParCov2 = getTrackParCov(charmHadDauTracks[2]); pVec2 = charmHadDauTracks[2].pVector(); auto dca2 = o2::dataformats::DCA(charmHadDauTracks[2].dcaXY(), charmHadDauTracks[2].dcaZ(), charmHadDauTracks[2].cYY(), charmHadDauTracks[2].cZY(), charmHadDauTracks[2].cZZ()); @@ -1068,7 +1153,7 @@ struct HfDataCreatorCharmHadPiReduced { } // --------------------------------- - // reconstruct charm candidate secondary vertex + // reconstruct charm candidate secondary vertex (add D*?) o2::track::TrackParCov trackParCovCharmHad{}; std::array pVecCharm{}; if constexpr (decChannel == DecayChannel::B0ToDminusPi || decChannel == DecayChannel::BsToDsminusPi || decChannel == DecayChannel::LbToLcplusPi) { // D∓ → π∓ K± π∓ and Ds∓ → K∓ K± π∓ and Lc∓ → p∓ K± π∓ @@ -1171,7 +1256,7 @@ struct HfDataCreatorCharmHadPiReduced { } // reject pi D with same sign as D - if constexpr (decChannel == DecayChannel::B0ToDminusPi || decChannel == DecayChannel::BsToDsminusPi || decChannel == DecayChannel::LbToLcplusPi) { // D∓ → π∓ K± π∓ and Ds∓ → K∓ K± π∓ and Lc∓ → p∓ K± π∓ + if constexpr (decChannel == DecayChannel::B0ToDminusPi || decChannel == DecayChannel::BsToDsminusPi || decChannel == DecayChannel::LbToLcplusPi || decChannel == DecayChannel::B0ToDstarPi) { // D∓ → π∓ K± π∓ and Ds∓ → K∓ K± π∓ and Lc∓ → p∓ K± π∓ and D*+ → D0 π+ if (trackPion.sign() * charmHadDauTracks[0].sign() > 0) { continue; } @@ -1188,7 +1273,7 @@ struct HfDataCreatorCharmHadPiReduced { registry.fill(HIST("hPtPion"), trackParCovPion.getPt()); // compute invariant mass square and apply selection - auto invMass2DPi = RecoDecay::m2(std::array{pVecCharm, pVecPion}, std::array{massC, massPi}); + auto invMass2DPi = RecoDecay::m2(std::array{pVecCharm, pVecPion}, std::array{massC, MassPiPlus}); if ((invMass2DPi < invMass2ChHadPiMin) || (invMass2DPi > invMass2ChHadPiMax)) { continue; } @@ -1196,23 +1281,23 @@ struct HfDataCreatorCharmHadPiReduced { // fill Pion tracks table // if information on track already stored, go to next track if (!selectedTracksPion.count(trackPion.globalIndex())) { - hfTrackPion(trackPion.globalIndex(), indexHfReducedCollision, - trackParCovPion.getX(), trackParCovPion.getAlpha(), - trackParCovPion.getY(), trackParCovPion.getZ(), trackParCovPion.getSnp(), - trackParCovPion.getTgl(), trackParCovPion.getQ2Pt(), - trackPion.itsNCls(), trackPion.tpcNClsCrossedRows(), trackPion.tpcChi2NCl()); - hfTrackCovPion(trackParCovPion.getSigmaY2(), trackParCovPion.getSigmaZY(), trackParCovPion.getSigmaZ2(), - trackParCovPion.getSigmaSnpY(), trackParCovPion.getSigmaSnpZ(), - trackParCovPion.getSigmaSnp2(), trackParCovPion.getSigmaTglY(), trackParCovPion.getSigmaTglZ(), - trackParCovPion.getSigmaTglSnp(), trackParCovPion.getSigmaTgl2(), - trackParCovPion.getSigma1PtY(), trackParCovPion.getSigma1PtZ(), trackParCovPion.getSigma1PtSnp(), - trackParCovPion.getSigma1PtTgl(), trackParCovPion.getSigma1Pt2()); - hfTrackPidPion(trackPion.hasTPC(), trackPion.hasTOF(), - trackPion.tpcNSigmaPi(), trackPion.tofNSigmaPi()); + tables.hfTrackPion(trackPion.globalIndex(), indexHfReducedCollision, + trackParCovPion.getX(), trackParCovPion.getAlpha(), + trackParCovPion.getY(), trackParCovPion.getZ(), trackParCovPion.getSnp(), + trackParCovPion.getTgl(), trackParCovPion.getQ2Pt(), + trackPion.itsNCls(), trackPion.tpcNClsCrossedRows(), trackPion.tpcChi2NCl()); + tables.hfTrackCovPion(trackParCovPion.getSigmaY2(), trackParCovPion.getSigmaZY(), trackParCovPion.getSigmaZ2(), + trackParCovPion.getSigmaSnpY(), trackParCovPion.getSigmaSnpZ(), + trackParCovPion.getSigmaSnp2(), trackParCovPion.getSigmaTglY(), trackParCovPion.getSigmaTglZ(), + trackParCovPion.getSigmaTglSnp(), trackParCovPion.getSigmaTgl2(), + trackParCovPion.getSigma1PtY(), trackParCovPion.getSigma1PtZ(), trackParCovPion.getSigma1PtSnp(), + trackParCovPion.getSigma1PtTgl(), trackParCovPion.getSigma1Pt2()); + tables.hfTrackPidPion(trackPion.hasTPC(), trackPion.hasTOF(), + trackPion.tpcNSigmaPi(), trackPion.tofNSigmaPi()); // add trackPion.globalIndex() to a list // to keep memory of the pions filled in the table and avoid refilling them if they are paired to another D candidate - // and keep track of their index in hfTrackPion for McRec purposes - selectedTracksPion[trackPion.globalIndex()] = hfTrackPion.lastIndex(); + // and keep track of their index in tables.hfTrackPion for McRec purposes + selectedTracksPion[trackPion.globalIndex()] = tables.hfTrackPion.lastIndex(); } if constexpr (doMc) { @@ -1228,19 +1313,19 @@ struct HfDataCreatorCharmHadPiReduced { if (fillHfCandCharm) { // fill candCplus table only once per D candidate constexpr std::size_t NSizeMLScore{3u}; if constexpr (decChannel == DecayChannel::B0ToDminusPi || decChannel == DecayChannel::BsToDsminusPi || decChannel == DecayChannel::LbToLcplusPi) { // D∓ → π∓ K± π∓ and Ds∓ → K∓ K± π∓ and Lc∓ → p∓ K± π∓ - hfCand3Prong(charmHadDauTracks[0].globalIndex(), charmHadDauTracks[1].globalIndex(), charmHadDauTracks[2].globalIndex(), - indexHfReducedCollision, - trackParCovCharmHad.getX(), trackParCovCharmHad.getAlpha(), - trackParCovCharmHad.getY(), trackParCovCharmHad.getZ(), trackParCovCharmHad.getSnp(), - trackParCovCharmHad.getTgl(), trackParCovCharmHad.getQ2Pt(), - candC.xSecondaryVertex(), candC.ySecondaryVertex(), candC.zSecondaryVertex(), invMassC0, invMassC1, - ptDauMin, etaDauMin, nItsClsDauMin, nTpcCrossRowsDauMin, chi2TpcDauMax); - hfCand3ProngCov(trackParCovCharmHad.getSigmaY2(), trackParCovCharmHad.getSigmaZY(), trackParCovCharmHad.getSigmaZ2(), - trackParCovCharmHad.getSigmaSnpY(), trackParCovCharmHad.getSigmaSnpZ(), - trackParCovCharmHad.getSigmaSnp2(), trackParCovCharmHad.getSigmaTglY(), trackParCovCharmHad.getSigmaTglZ(), - trackParCovCharmHad.getSigmaTglSnp(), trackParCovCharmHad.getSigmaTgl2(), - trackParCovCharmHad.getSigma1PtY(), trackParCovCharmHad.getSigma1PtZ(), trackParCovCharmHad.getSigma1PtSnp(), - trackParCovCharmHad.getSigma1PtTgl(), trackParCovCharmHad.getSigma1Pt2()); + tables.hfCand3Prong(charmHadDauTracks[0].globalIndex(), charmHadDauTracks[1].globalIndex(), charmHadDauTracks[2].globalIndex(), + indexHfReducedCollision, + trackParCovCharmHad.getX(), trackParCovCharmHad.getAlpha(), + trackParCovCharmHad.getY(), trackParCovCharmHad.getZ(), trackParCovCharmHad.getSnp(), + trackParCovCharmHad.getTgl(), trackParCovCharmHad.getQ2Pt(), + candC.xSecondaryVertex(), candC.ySecondaryVertex(), candC.zSecondaryVertex(), invMassC0, invMassC1, + ptDauMin, etaDauMin, nItsClsDauMin, nTpcCrossRowsDauMin, chi2TpcDauMax); + tables.hfCand3ProngCov(trackParCovCharmHad.getSigmaY2(), trackParCovCharmHad.getSigmaZY(), trackParCovCharmHad.getSigmaZ2(), + trackParCovCharmHad.getSigmaSnpY(), trackParCovCharmHad.getSigmaSnpZ(), + trackParCovCharmHad.getSigmaSnp2(), trackParCovCharmHad.getSigmaTglY(), trackParCovCharmHad.getSigmaTglZ(), + trackParCovCharmHad.getSigmaTglSnp(), trackParCovCharmHad.getSigmaTgl2(), + trackParCovCharmHad.getSigma1PtY(), trackParCovCharmHad.getSigma1PtZ(), trackParCovCharmHad.getSigma1PtSnp(), + trackParCovCharmHad.getSigma1PtTgl(), trackParCovCharmHad.getSigma1Pt2()); float nSigmaTpcPr0{-999.f}, nSigmaTpcPr1{-999.f}, nSigmaTpcPr2{-999.f}; float nSigmaTofPr0{-999.f}, nSigmaTofPr1{-999.f}, nSigmaTofPr2{-999.f}; if constexpr (decChannel == DecayChannel::LbToLcplusPi) { @@ -1252,13 +1337,13 @@ struct HfDataCreatorCharmHadPiReduced { nSigmaTofPr1 = candC.nSigTofPr1(); nSigmaTofPr2 = candC.nSigTofPr2(); } - hfCandPidProng0(candC.nSigTpcPi0(), candC.nSigTofPi0(), candC.nSigTpcKa0(), candC.nSigTofKa0(), nSigmaTpcPr0, nSigmaTofPr0, charmHadDauTracks[0].hasTOF(), charmHadDauTracks[0].hasTPC()); - hfCandPidProng1(candC.nSigTpcPi1(), candC.nSigTofPi1(), candC.nSigTpcKa1(), candC.nSigTofKa1(), nSigmaTpcPr1, nSigmaTofPr1, charmHadDauTracks[1].hasTOF(), charmHadDauTracks[1].hasTPC()); - hfCandPidProng2(candC.nSigTpcPi2(), candC.nSigTofPi2(), candC.nSigTpcKa2(), candC.nSigTofKa2(), nSigmaTpcPr2, nSigmaTofPr2, charmHadDauTracks[2].hasTOF(), charmHadDauTracks[2].hasTPC()); + tables.hfCandPidProng0(candC.nSigTpcPi0(), candC.nSigTofPi0(), candC.nSigTpcKa0(), candC.nSigTofKa0(), nSigmaTpcPr0, nSigmaTofPr0, charmHadDauTracks[0].hasTOF(), charmHadDauTracks[0].hasTPC()); + tables.hfCandPidProng1(candC.nSigTpcPi1(), candC.nSigTofPi1(), candC.nSigTpcKa1(), candC.nSigTofKa1(), nSigmaTpcPr1, nSigmaTofPr1, charmHadDauTracks[1].hasTOF(), charmHadDauTracks[1].hasTPC()); + tables.hfCandPidProng2(candC.nSigTpcPi2(), candC.nSigTofPi2(), candC.nSigTpcKa2(), candC.nSigTofKa2(), nSigmaTpcPr2, nSigmaTofPr2, charmHadDauTracks[2].hasTOF(), charmHadDauTracks[2].hasTPC()); if constexpr (withMl) { std::array mlScores = {-1.f, -1.f, -1.f, -1.f, -1.f, -1.f}; if constexpr (decChannel == DecayChannel::B0ToDminusPi) { - hfCand3ProngMl(candC.mlProbDplusToPiKPi()[0], candC.mlProbDplusToPiKPi()[1], candC.mlProbDplusToPiKPi()[2], -1., -1., -1.); + tables.hfCand3ProngMl(candC.mlProbDplusToPiKPi()[0], candC.mlProbDplusToPiKPi()[1], candC.mlProbDplusToPiKPi()[2], -1., -1., -1.); } else if constexpr (decChannel == DecayChannel::BsToDsminusPi) { if (candC.mlProbDsToKKPi().size() == NSizeMLScore) { std::copy(candC.mlProbDsToKKPi().begin(), candC.mlProbDsToKKPi().end(), mlScores.begin()); @@ -1266,7 +1351,7 @@ struct HfDataCreatorCharmHadPiReduced { if (candC.mlProbDsToPiKK().size() == NSizeMLScore) { std::copy(candC.mlProbDsToPiKK().begin(), candC.mlProbDsToPiKK().end(), mlScores.begin() + 3); } - hfCand3ProngMl(mlScores[0], mlScores[1], mlScores[2], mlScores[3], mlScores[4], mlScores[5]); + tables.hfCand3ProngMl(mlScores[0], mlScores[1], mlScores[2], mlScores[3], mlScores[4], mlScores[5]); } else if constexpr (decChannel == DecayChannel::LbToLcplusPi) { if (candC.mlProbLcToPKPi().size() == NSizeMLScore) { std::copy(candC.mlProbLcToPKPi().begin(), candC.mlProbLcToPKPi().end(), mlScores.begin()); @@ -1274,25 +1359,30 @@ struct HfDataCreatorCharmHadPiReduced { if (candC.mlProbLcToPiKP().size() == NSizeMLScore) { std::copy(candC.mlProbLcToPiKP().begin(), candC.mlProbLcToPiKP().end(), mlScores.begin() + 3); } - hfCand3ProngMl(mlScores[0], mlScores[1], mlScores[2], mlScores[3], mlScores[4], mlScores[5]); + tables.hfCand3ProngMl(mlScores[0], mlScores[1], mlScores[2], mlScores[3], mlScores[4], mlScores[5]); + } else if constexpr (decChannel == DecayChannel::B0ToDstarPi) { + if (candC.mlProbDStarToD0Pi().size() == NSizeMLScore) { + std::copy(candC.mlProbDStarToD0Pi().begin(), candC.mlProbDStarToD0Pi().end(), mlScores.begin()); + } + tables.hfCand3ProngMl(mlScores[0], mlScores[1], mlScores[2], -1.f, -1.f, -1.f); } } } else if constexpr (decChannel == DecayChannel::BplusToD0barPi) { // D0(bar) → K± π∓ - hfCand2Prong(charmHadDauTracks[0].globalIndex(), charmHadDauTracks[1].globalIndex(), + tables.hfCand2Prong(charmHadDauTracks[0].globalIndex(), charmHadDauTracks[1].globalIndex(), indexHfReducedCollision, trackParCovCharmHad.getX(), trackParCovCharmHad.getAlpha(), trackParCovCharmHad.getY(), trackParCovCharmHad.getZ(), trackParCovCharmHad.getSnp(), trackParCovCharmHad.getTgl(), trackParCovCharmHad.getQ2Pt(), candC.xSecondaryVertex(), candC.ySecondaryVertex(), candC.zSecondaryVertex(), invMassC0, invMassC1, ptDauMin, etaDauMin, nItsClsDauMin, nTpcCrossRowsDauMin, chi2TpcDauMax); - hfCand2ProngCov(trackParCovCharmHad.getSigmaY2(), trackParCovCharmHad.getSigmaZY(), trackParCovCharmHad.getSigmaZ2(), + tables.hfCand2ProngCov(trackParCovCharmHad.getSigmaY2(), trackParCovCharmHad.getSigmaZY(), trackParCovCharmHad.getSigmaZ2(), trackParCovCharmHad.getSigmaSnpY(), trackParCovCharmHad.getSigmaSnpZ(), trackParCovCharmHad.getSigmaSnp2(), trackParCovCharmHad.getSigmaTglY(), trackParCovCharmHad.getSigmaTglZ(), trackParCovCharmHad.getSigmaTglSnp(), trackParCovCharmHad.getSigmaTgl2(), trackParCovCharmHad.getSigma1PtY(), trackParCovCharmHad.getSigma1PtZ(), trackParCovCharmHad.getSigma1PtSnp(), trackParCovCharmHad.getSigma1PtTgl(), trackParCovCharmHad.getSigma1Pt2()); - hfCandPidProng0(candC.nSigTpcPi0(), candC.nSigTofPi0(), candC.nSigTpcKa0(), candC.nSigTofKa0(), 0., 0., charmHadDauTracks[0].hasTOF(), charmHadDauTracks[0].hasTPC()); - hfCandPidProng1(candC.nSigTpcPi1(), candC.nSigTofPi1(), candC.nSigTpcKa1(), candC.nSigTofKa1(), 0., 0., charmHadDauTracks[1].hasTOF(), charmHadDauTracks[1].hasTPC()); + tables.hfCandPidProng0(candC.nSigTpcPi0(), candC.nSigTofPi0(), candC.nSigTpcKa0(), candC.nSigTofKa0(), 0., 0., charmHadDauTracks[0].hasTOF(), charmHadDauTracks[0].hasTPC()); + tables.hfCandPidProng1(candC.nSigTpcPi1(), candC.nSigTofPi1(), candC.nSigTpcKa1(), candC.nSigTofKa1(), 0., 0., charmHadDauTracks[1].hasTOF(), charmHadDauTracks[1].hasTPC()); if constexpr (withMl) { std::array mlScores = {-1.f, -1.f, -1.f, -1.f, -1.f, -1.f}; if (candC.mlProbD0().size() == NSizeMLScore) { @@ -1301,7 +1391,7 @@ struct HfDataCreatorCharmHadPiReduced { if (candC.mlProbD0bar().size() == NSizeMLScore) { std::copy(candC.mlProbD0bar().begin(), candC.mlProbD0bar().end(), mlScores.begin() + 3); } - hfCand2ProngMl(mlScores[0], mlScores[1], mlScores[2], mlScores[3], mlScores[4], mlScores[5]); + tables.hfCand2ProngMl(mlScores[0], mlScores[1], mlScores[2], mlScores[3], mlScores[4], mlScores[5]); } } fillHfReducedCollision = true; @@ -1315,12 +1405,12 @@ struct HfDataCreatorCharmHadPiReduced { registry.fill(HIST("hEvents"), 1 + Event::CharmHadPiSelected); // fill collision table if it contains a DPi pair a minima - hfReducedCollision(collision.posX(), collision.posY(), collision.posZ(), collision.numContrib(), hfRejMap, bz); - hfReducedCollExtra(collision.covXX(), collision.covXY(), collision.covYY(), + tables.hfReducedCollision(collision.posX(), collision.posY(), collision.posZ(), collision.numContrib(), hfRejMap, bz); + tables.hfReducedCollExtra(collision.covXX(), collision.covXY(), collision.covYY(), collision.covXZ(), collision.covYZ(), collision.covZZ()); - hfReducedCollCentrality(collision.centFT0C(), collision.centFT0M(), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); + tables.hfReducedCollCentrality(collision.centFT0C(), collision.centFT0M(), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); if constexpr (withQvec) { - hfReducedQvector(collision.qvecFT0CRe(), collision.qvecFT0CIm(), collision.sumAmplFT0C(), + tables.hfReducedQvector(collision.qvecFT0CRe(), collision.qvecFT0CIm(), collision.sumAmplFT0C(), collision.qvecFT0ARe(), collision.qvecFT0AIm(), collision.sumAmplFT0A(), collision.qvecFT0MRe(), collision.qvecFT0MIm(), collision.sumAmplFT0M(), collision.qvecTPCposRe(), collision.qvecTPCposIm(), collision.nTrkTPCpos(), @@ -1337,7 +1427,7 @@ struct HfDataCreatorCharmHadPiReduced { { // Check event selection float centDummy{-1.f}, centFT0C{-1.f}, centFT0M{-1.f}; - const auto collSlice = collisions.sliceBy(colPerMcCollision, mcCollision.globalIndex()); + const auto collSlice = collisions.sliceBy(preslices.colPerMcCollision, mcCollision.globalIndex()); auto hfRejMap = hfEvSelMc.getHfMcCollisionRejectionMask(mcCollision, collSlice, centDummy); if (configs.skipRejectedCollisions && hfRejMap != 0) { return; @@ -1354,7 +1444,7 @@ struct HfDataCreatorCharmHadPiReduced { } } - const auto mcParticlesPerMcColl = particlesMc.sliceBy(mcParticlesPerMcCollision, mcCollision.globalIndex()); + const auto mcParticlesPerMcColl = particlesMc.sliceBy(preslices.mcParticlesPerMcCollision, mcCollision.globalIndex()); // Match generated particles. for (const auto& particle : mcParticlesPerMcColl) { @@ -1390,9 +1480,9 @@ struct HfDataCreatorCharmHadPiReduced { yProngs[counter] = RecoDecay::y(daught.pVector(), pdg->Mass(daught.pdgCode())); counter++; } - rowHfB0McGenReduced(flag, -1 /*channel*/, ptParticle, yParticle, etaParticle, - ptProngs[0], yProngs[0], etaProngs[0], - ptProngs[1], yProngs[1], etaProngs[1], hfRejMap, centFT0C, centFT0M); + tables.rowHfB0McGenReduced(flag, -1 /*channel*/, ptParticle, yParticle, etaParticle, + ptProngs[0], yProngs[0], etaProngs[0], + ptProngs[1], yProngs[1], etaProngs[1], hfRejMap, centFT0C, centFT0M); } else if constexpr (decayChannel == DecayChannel::BsToDsminusPi) { // Bs → Ds- π+ if (RecoDecay::isMatchedMCGen(particlesMc, particle, Pdg::kBS, std::array{-static_cast(Pdg::kDS), +kPiPlus}, true)) { @@ -1465,7 +1555,7 @@ struct HfDataCreatorCharmHadPiReduced { yProngs[counter] = RecoDecay::y(daught.pVector(), pdg->Mass(daught.pdgCode())); counter++; } - rowHfBsMcGenReduced(flag, -1 /*channel*/, ptParticle, yParticle, etaParticle, + tables.rowHfBsMcGenReduced(flag, -1 /*channel*/, ptParticle, yParticle, etaParticle, ptProngs[0], yProngs[0], etaProngs[0], ptProngs[1], yProngs[1], etaProngs[1], hfRejMap, centFT0C, centFT0M); } else if constexpr (decayChannel == DecayChannel::BplusToD0barPi) { @@ -1498,7 +1588,7 @@ struct HfDataCreatorCharmHadPiReduced { yProngs[counter] = RecoDecay::y(daught.pVector(), pdg->Mass(daught.pdgCode())); counter++; } - rowHfBpMcGenReduced(flag, -1 /*channel*/, ptParticle, yParticle, etaParticle, + tables.rowHfBpMcGenReduced(flag, -1 /*channel*/, ptParticle, yParticle, etaParticle, ptProngs[0], yProngs[0], etaProngs[0], ptProngs[1], yProngs[1], etaProngs[1], hfRejMap, centFT0C, centFT0M); } else if constexpr (decayChannel == DecayChannel::LbToLcplusPi) { @@ -1531,9 +1621,9 @@ struct HfDataCreatorCharmHadPiReduced { yProngs[counter] = RecoDecay::y(daught.pVector(), pdg->Mass(daught.pdgCode())); counter++; } - rowHfLbMcGenReduced(flag, ptParticle, yParticle, etaParticle, - ptProngs[0], yProngs[0], etaProngs[0], - ptProngs[1], yProngs[1], etaProngs[1], hfRejMap, centFT0C, centFT0M); + tables.rowHfLbMcGenReduced(flag, ptParticle, yParticle, etaParticle, + ptProngs[0], yProngs[0], etaProngs[0], + ptProngs[1], yProngs[1], etaProngs[1], hfRejMap, centFT0C, centFT0M); } } // gen } @@ -1549,7 +1639,7 @@ struct HfDataCreatorCharmHadPiReduced { { // store configurables needed for B0 workflow if (!isHfCandBhadConfigFilled) { - rowCandidateConfigB0(hfflagConfigurations.selectionFlagDplus.value, configs.invMassWindowCharmHadPi.value); + tables.rowCandidateConfigB0(hfflagConfigurations.selectionFlagDplus.value, configs.invMassWindowCharmHadPi.value); isHfCandBhadConfigFilled = true; } @@ -1562,14 +1652,14 @@ struct HfDataCreatorCharmHadPiReduced { o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + auto candsCThisColl = candsC.sliceBy(preslices.candsDplusPerCollision, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); } // handle normalization by the right number of collisions - hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + tables.hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } - PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDplusPiData, "Process DplusPi without MC info and without ML info", true); + PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDplusPiData, "Process DplusPi without MC info and without ML info", false); void processDplusPiDataWithMl(CollisionsWCent const& collisions, CandsDplusFilteredWithMl const& candsC, @@ -1577,9 +1667,10 @@ struct HfDataCreatorCharmHadPiReduced { TracksPidWithSel const& tracks, aod::BCsWithTimestamps const& bcs) { + LOG(info) << "Processing DplusPi data with ML info"; // store configurables needed for B0 workflow if (!isHfCandBhadConfigFilled) { - rowCandidateConfigB0(hfflagConfigurations.selectionFlagDplus.value, configs.invMassWindowCharmHadPi.value); + tables.rowCandidateConfigB0(hfflagConfigurations.selectionFlagDplus.value, configs.invMassWindowCharmHadPi.value); isHfCandBhadConfigFilled = true; } @@ -1592,12 +1683,17 @@ struct HfDataCreatorCharmHadPiReduced { o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + auto candsCThisColl = candsC.sliceBy(preslices.candsDplusPerCollisionWithMl, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); + LOG(info) << "Processing DplusPi data with ML info for collision ID: " << thisCollId; + LOG(info) << "Number of candidates in this collision: " << candsCThisColl.size(); + LOG(info) << "Number of track indices in this collision: " << trackIdsThisCollision.size(); + // Run data creation for DplusPi with ML info + LOG(info) << "Running data creation for DplusPi with ML info"; runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); } // handle normalization by the right number of collisions - hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + tables.hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDplusPiDataWithMl, "Process DplusPi without MC info and with ML info", false); @@ -1609,7 +1705,7 @@ struct HfDataCreatorCharmHadPiReduced { { // store configurables needed for B0 workflow if (!isHfCandBhadConfigFilled) { - rowCandidateConfigB0(hfflagConfigurations.selectionFlagDplus.value, configs.invMassWindowCharmHadPi.value); + tables.rowCandidateConfigB0(hfflagConfigurations.selectionFlagDplus.value, configs.invMassWindowCharmHadPi.value); isHfCandBhadConfigFilled = true; } @@ -1622,14 +1718,14 @@ struct HfDataCreatorCharmHadPiReduced { o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + auto candsCThisColl = candsC.sliceBy(preslices.candsDplusPerCollision, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); } // handle normalization by the right number of collisions - hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + tables.hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } - PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDplusPiDataWithQvec, "Process DplusPi without MC info, without ML info and with Q-vectors", true); + PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDplusPiDataWithQvec, "Process DplusPi without MC info, without ML info and with Q-vectors", false); void processDplusPiDataWithMlAndQvec(CollisionsWCentAndQvectors const& collisions, CandsDplusFilteredWithMl const& candsC, @@ -1639,7 +1735,7 @@ struct HfDataCreatorCharmHadPiReduced { { // store configurables needed for B0 workflow if (!isHfCandBhadConfigFilled) { - rowCandidateConfigB0(hfflagConfigurations.selectionFlagDplus.value, configs.invMassWindowCharmHadPi.value); + tables.rowCandidateConfigB0(hfflagConfigurations.selectionFlagDplus.value, configs.invMassWindowCharmHadPi.value); isHfCandBhadConfigFilled = true; } @@ -1652,15 +1748,142 @@ struct HfDataCreatorCharmHadPiReduced { o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + auto candsCThisColl = candsC.sliceBy(preslices.candsDplusPerCollisionWithMl, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); } // handle normalization by the right number of collisions - hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + tables.hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDplusPiDataWithMlAndQvec, "Process DplusPi without MC info, with ML info and with Q-vectors", false); + void processDstarPiData(CollisionsWCent const& collisions, + CandsDstarFiltered const& candsC, + aod::TrackAssoc const& trackIndices, + TracksPidWithSel const& tracks, + aod::BCsWithTimestamps const& bcs, + aod::Hf2Prongs const&) + { + LOG(info) << "Processing DstarPi data without ML info and without Q-vectors"; + // store configurables needed for B0 workflow + if (!isHfCandBhadConfigFilled) { + tables.rowCandidateConfigB0(hfflagConfigurations.selectionFlagDplus.value, configs.invMassWindowCharmHadPi.value); + isHfCandBhadConfigFilled = true; + } + + int zvtxColl{0}; + int sel8Coll{0}; + int zvtxAndSel8Coll{0}; + int zvtxAndSel8CollAndSoftTrig{0}; + int allSelColl{0}; + for (const auto& collision : collisions) { + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + + auto thisCollId = collision.globalIndex(); + auto candsCThisColl = candsC.sliceBy(preslices.candsDstarPerCollision, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); + runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); + } + // handle normalization by the right number of collisions + tables.hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + } + PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDstarPiData, "Process DstarPi without MC info and without ML info", true); + + void processDstarPiDataWithMl(CollisionsWCent const& collisions, + CandsDstarFilteredWithMl const& candsC, + aod::TrackAssoc const& trackIndices, + TracksPidWithSel const& tracks, + aod::BCsWithTimestamps const& bcs, + aod::Hf2Prongs const&) + { + // store configurables needed for B0 workflow + if (!isHfCandBhadConfigFilled) { + tables.rowCandidateConfigB0(hfflagConfigurations.selectionFlagDplus.value, configs.invMassWindowCharmHadPi.value); + isHfCandBhadConfigFilled = true; + } + + int zvtxColl{0}; + int sel8Coll{0}; + int zvtxAndSel8Coll{0}; + int zvtxAndSel8CollAndSoftTrig{0}; + int allSelColl{0}; + for (const auto& collision : collisions) { + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + + auto thisCollId = collision.globalIndex(); + auto candsCThisColl = candsC.sliceBy(preslices.candsDstarPerCollisionWithMl, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); + LOG(info) << "Processing DstarPi with ML info for collision " << thisCollId; + LOG(info) << "Number of candidates in this collision: " << candsCThisColl.size(); + runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); + } + // handle normalization by the right number of collisions + tables.hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + } + PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDstarPiDataWithMl, "Process DstarPi without MC info and with ML info", false); + + void processDstarPiDataWithQvec(CollisionsWCentAndQvectors const& collisions, + CandsDstarFiltered const& candsC, + aod::TrackAssoc const& trackIndices, + TracksPidWithSel const& tracks, + aod::BCsWithTimestamps const& bcs, + aod::Hf2Prongs const&) + { + // store configurables needed for B0 workflow + if (!isHfCandBhadConfigFilled) { + tables.rowCandidateConfigB0(hfflagConfigurations.selectionFlagDplus.value, configs.invMassWindowCharmHadPi.value); + isHfCandBhadConfigFilled = true; + } + + int zvtxColl{0}; + int sel8Coll{0}; + int zvtxAndSel8Coll{0}; + int zvtxAndSel8CollAndSoftTrig{0}; + int allSelColl{0}; + for (const auto& collision : collisions) { + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + + auto thisCollId = collision.globalIndex(); + auto candsCThisColl = candsC.sliceBy(preslices.candsDstarPerCollision, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); + runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); + } + // handle normalization by the right number of collisions + tables.hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + } + PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDstarPiDataWithQvec, "Process DstarPi without MC info, without ML info and with Q-vectors", false); + + void processDstarPiDataWithMlAndQvec(CollisionsWCentAndQvectors const& collisions, + CandsDstarFilteredWithMl const& candsC, + aod::TrackAssoc const& trackIndices, + TracksPidWithSel const& tracks, + aod::BCsWithTimestamps const& bcs, + aod::Hf2Prongs const&) + { + // store configurables needed for B0 workflow + if (!isHfCandBhadConfigFilled) { + tables.rowCandidateConfigB0(hfflagConfigurations.selectionFlagDplus.value, configs.invMassWindowCharmHadPi.value); + isHfCandBhadConfigFilled = true; + } + + int zvtxColl{0}; + int sel8Coll{0}; + int zvtxAndSel8Coll{0}; + int zvtxAndSel8CollAndSoftTrig{0}; + int allSelColl{0}; + for (const auto& collision : collisions) { + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + + auto thisCollId = collision.globalIndex(); + auto candsCThisColl = candsC.sliceBy(preslices.candsDstarPerCollisionWithMl, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); + runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); + } + // handle normalization by the right number of collisions + tables.hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + } + PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDstarPiDataWithMlAndQvec, "Process DstarPi without MC info, with ML info and with Q-vectors", false); + void processDsPiData(CollisionsWCent const& collisions, CandsDsFiltered const& candsC, aod::TrackAssoc const& trackIndices, @@ -1669,7 +1892,7 @@ struct HfDataCreatorCharmHadPiReduced { { // store configurables needed for Bs workflow if (!isHfCandBhadConfigFilled) { - rowCandidateConfigBs(hfflagConfigurations.selectionFlagDs.value, configs.invMassWindowCharmHadPi.value); + tables.rowCandidateConfigBs(hfflagConfigurations.selectionFlagDs.value, configs.invMassWindowCharmHadPi.value); isHfCandBhadConfigFilled = true; } @@ -1682,14 +1905,14 @@ struct HfDataCreatorCharmHadPiReduced { o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsDsPerCollision, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + auto candsCThisColl = candsC.sliceBy(preslices.candsDsPerCollision, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); } // handle normalization by the right number of collisions - hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + tables.hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } - PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDsPiData, "Process DsPi without MC info and without ML info", true); + PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDsPiData, "Process DsPi without MC info and without ML info", false); void processDsPiDataWithMl(CollisionsWCent const& collisions, CandsDsFilteredWithMl const& candsC, @@ -1699,7 +1922,7 @@ struct HfDataCreatorCharmHadPiReduced { { // store configurables needed for Bs workflow if (!isHfCandBhadConfigFilled) { - rowCandidateConfigBs(hfflagConfigurations.selectionFlagDs.value, configs.invMassWindowCharmHadPi.value); + tables.rowCandidateConfigBs(hfflagConfigurations.selectionFlagDs.value, configs.invMassWindowCharmHadPi.value); isHfCandBhadConfigFilled = true; } @@ -1712,12 +1935,12 @@ struct HfDataCreatorCharmHadPiReduced { o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsDsPerCollisionWithMl, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + auto candsCThisColl = candsC.sliceBy(preslices.candsDsPerCollisionWithMl, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); } // handle normalization by the right number of collisions - hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + tables.hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDsPiDataWithMl, "Process DsPi without MC info and with ML info", false); @@ -1729,7 +1952,7 @@ struct HfDataCreatorCharmHadPiReduced { { // store configurables needed for Bs workflow if (!isHfCandBhadConfigFilled) { - rowCandidateConfigBs(hfflagConfigurations.selectionFlagDs.value, configs.invMassWindowCharmHadPi.value); + tables.rowCandidateConfigBs(hfflagConfigurations.selectionFlagDs.value, configs.invMassWindowCharmHadPi.value); isHfCandBhadConfigFilled = true; } @@ -1742,14 +1965,14 @@ struct HfDataCreatorCharmHadPiReduced { o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsDsPerCollision, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + auto candsCThisColl = candsC.sliceBy(preslices.candsDsPerCollision, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); } // handle normalization by the right number of collisions - hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + tables.hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } - PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDsPiDataWithQvec, "Process DsPi without MC info, without ML info and with Q-vectors", true); + PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDsPiDataWithQvec, "Process DsPi without MC info, without ML info and with Q-vectors", false); void processDsPiDataWithMlAndQvec(CollisionsWCentAndQvectors const& collisions, CandsDsFilteredWithMl const& candsC, @@ -1759,7 +1982,7 @@ struct HfDataCreatorCharmHadPiReduced { { // store configurables needed for Bs workflow if (!isHfCandBhadConfigFilled) { - rowCandidateConfigBs(hfflagConfigurations.selectionFlagDs.value, configs.invMassWindowCharmHadPi.value); + tables.rowCandidateConfigBs(hfflagConfigurations.selectionFlagDs.value, configs.invMassWindowCharmHadPi.value); isHfCandBhadConfigFilled = true; } @@ -1772,12 +1995,12 @@ struct HfDataCreatorCharmHadPiReduced { o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsDsPerCollisionWithMl, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + auto candsCThisColl = candsC.sliceBy(preslices.candsDsPerCollisionWithMl, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); } // handle normalization by the right number of collisions - hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + tables.hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDsPiDataWithMlAndQvec, "Process DsPi without MC info, with ML info and Q-vectors", false); @@ -1789,7 +2012,7 @@ struct HfDataCreatorCharmHadPiReduced { { // store configurables needed for B+ workflow if (!isHfCandBhadConfigFilled) { - rowCandidateConfigBplus(hfflagConfigurations.selectionFlagD0.value, hfflagConfigurations.selectionFlagD0bar.value, configs.invMassWindowCharmHadPi.value); + tables.rowCandidateConfigBplus(hfflagConfigurations.selectionFlagD0.value, hfflagConfigurations.selectionFlagD0bar.value, configs.invMassWindowCharmHadPi.value); isHfCandBhadConfigFilled = true; } @@ -1802,12 +2025,12 @@ struct HfDataCreatorCharmHadPiReduced { o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsD0PerCollision, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + auto candsCThisColl = candsC.sliceBy(preslices.candsD0PerCollision, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); } // handle normalization by the right number of collisions - hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + tables.hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processD0PiData, "Process D0Pi without MC info and without ML info", false); @@ -1819,7 +2042,7 @@ struct HfDataCreatorCharmHadPiReduced { { // store configurables needed for B+ workflow if (!isHfCandBhadConfigFilled) { - rowCandidateConfigBplus(hfflagConfigurations.selectionFlagD0.value, hfflagConfigurations.selectionFlagD0bar.value, configs.invMassWindowCharmHadPi.value); + tables.rowCandidateConfigBplus(hfflagConfigurations.selectionFlagD0.value, hfflagConfigurations.selectionFlagD0bar.value, configs.invMassWindowCharmHadPi.value); isHfCandBhadConfigFilled = true; } @@ -1832,12 +2055,12 @@ struct HfDataCreatorCharmHadPiReduced { o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsD0PerCollisionWithMl, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + auto candsCThisColl = candsC.sliceBy(preslices.candsD0PerCollisionWithMl, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); } // handle normalization by the right number of collisions - hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + tables.hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processD0PiDataWithMl, "Process D0Pi without MC info and with ML info", false); @@ -1849,7 +2072,7 @@ struct HfDataCreatorCharmHadPiReduced { { // store configurables needed for B+ workflow if (!isHfCandBhadConfigFilled) { - rowCandidateConfigBplus(hfflagConfigurations.selectionFlagD0.value, hfflagConfigurations.selectionFlagD0bar.value, configs.invMassWindowCharmHadPi.value); + tables.rowCandidateConfigBplus(hfflagConfigurations.selectionFlagD0.value, hfflagConfigurations.selectionFlagD0bar.value, configs.invMassWindowCharmHadPi.value); isHfCandBhadConfigFilled = true; } @@ -1862,12 +2085,12 @@ struct HfDataCreatorCharmHadPiReduced { o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsD0PerCollision, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + auto candsCThisColl = candsC.sliceBy(preslices.candsD0PerCollision, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); } // handle normalization by the right number of collisions - hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + tables.hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processD0PiDataWithQvec, "Process D0Pi without MC info, without ML info, and with Q-vectors", false); @@ -1879,7 +2102,7 @@ struct HfDataCreatorCharmHadPiReduced { { // store configurables needed for B+ workflow if (!isHfCandBhadConfigFilled) { - rowCandidateConfigBplus(hfflagConfigurations.selectionFlagD0.value, hfflagConfigurations.selectionFlagD0bar.value, configs.invMassWindowCharmHadPi.value); + tables.rowCandidateConfigBplus(hfflagConfigurations.selectionFlagD0.value, hfflagConfigurations.selectionFlagD0bar.value, configs.invMassWindowCharmHadPi.value); isHfCandBhadConfigFilled = true; } @@ -1892,12 +2115,12 @@ struct HfDataCreatorCharmHadPiReduced { o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsD0PerCollisionWithMl, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + auto candsCThisColl = candsC.sliceBy(preslices.candsD0PerCollisionWithMl, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); } // handle normalization by the right number of collisions - hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + tables.hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processD0PiDataWithMlAndQvec, "Process D0Pi without MC info, with ML info, and with Q-vectors", false); @@ -1909,7 +2132,7 @@ struct HfDataCreatorCharmHadPiReduced { { // store configurables needed for Lb workflow if (!isHfCandBhadConfigFilled) { - rowCandidateConfigLb(hfflagConfigurations.selectionFlagLc.value, configs.invMassWindowCharmHadPi.value); + tables.rowCandidateConfigLb(hfflagConfigurations.selectionFlagLc.value, configs.invMassWindowCharmHadPi.value); isHfCandBhadConfigFilled = true; } @@ -1922,14 +2145,14 @@ struct HfDataCreatorCharmHadPiReduced { o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsLcPerCollision, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + auto candsCThisColl = candsC.sliceBy(preslices.candsLcPerCollision, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); } // handle normalization by the right number of collisions - hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + tables.hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } - PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processLcPiData, "Process LcPi without MC info and without ML info", true); + PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processLcPiData, "Process LcPi without MC info and without ML info", false); void processLcPiDataWithMl(CollisionsWCent const& collisions, CandsLcFilteredWithMl const& candsC, @@ -1939,7 +2162,7 @@ struct HfDataCreatorCharmHadPiReduced { { // store configurables needed for Lb workflow if (!isHfCandBhadConfigFilled) { - rowCandidateConfigLb(hfflagConfigurations.selectionFlagLc.value, configs.invMassWindowCharmHadPi.value); + tables.rowCandidateConfigLb(hfflagConfigurations.selectionFlagLc.value, configs.invMassWindowCharmHadPi.value); isHfCandBhadConfigFilled = true; } @@ -1952,12 +2175,12 @@ struct HfDataCreatorCharmHadPiReduced { o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsLcPerCollisionWithMl, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); + auto candsCThisColl = candsC.sliceBy(preslices.candsLcPerCollisionWithMl, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); } // handle normalization by the right number of collisions - hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + tables.hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processLcPiDataWithMl, "Process LcPi without MC info and with ML info", false); @@ -1974,7 +2197,7 @@ struct HfDataCreatorCharmHadPiReduced { { // store configurables needed for B0 workflow if (!isHfCandBhadConfigFilled) { - rowCandidateConfigB0(hfflagConfigurations.selectionFlagDplus.value, configs.invMassWindowCharmHadPi.value); + tables.rowCandidateConfigB0(hfflagConfigurations.selectionFlagDplus.value, configs.invMassWindowCharmHadPi.value); isHfCandBhadConfigFilled = true; } @@ -1987,14 +2210,14 @@ struct HfDataCreatorCharmHadPiReduced { o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsDplusPerCollision, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - auto collsSameMcCollision = collisions.sliceBy(colPerMcCollision, collision.mcCollisionId()); + auto candsCThisColl = candsC.sliceBy(preslices.candsDplusPerCollision, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); + auto collsSameMcCollision = collisions.sliceBy(preslices.colPerMcCollision, collision.mcCollisionId()); int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); } // handle normalization by the right number of collisions - hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + tables.hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); for (const auto& mcCollision : mcCollisions) { runMcGen(mcCollision, particlesMc, collisions, bcs); } @@ -2011,7 +2234,7 @@ struct HfDataCreatorCharmHadPiReduced { { // store configurables needed for B0 workflow if (!isHfCandBhadConfigFilled) { - rowCandidateConfigB0(hfflagConfigurations.selectionFlagDplus.value, configs.invMassWindowCharmHadPi.value); + tables.rowCandidateConfigB0(hfflagConfigurations.selectionFlagDplus.value, configs.invMassWindowCharmHadPi.value); isHfCandBhadConfigFilled = true; } @@ -2024,20 +2247,96 @@ struct HfDataCreatorCharmHadPiReduced { o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsDplusPerCollisionWithMl, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - auto collsSameMcCollision = collisions.sliceBy(colPerMcCollision, collision.mcCollisionId()); + auto candsCThisColl = candsC.sliceBy(preslices.candsDplusPerCollisionWithMl, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); + auto collsSameMcCollision = collisions.sliceBy(preslices.colPerMcCollision, collision.mcCollisionId()); int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); } // handle normalization by the right number of collisions - hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + tables.hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); for (const auto& mcCollision : mcCollisions) { runMcGen(mcCollision, particlesMc, collisions, bcs); } } PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDplusPiMcWithMl, "Process DplusPi with MC info and with ML info", false); + void processDstarPiMc(CollisionsWCentAndMcLabels const& collisions, + CandsDstarFiltered const& candsC, + aod::TrackAssoc const& trackIndices, + TracksPidWithSelAndMc const& tracks, + aod::McParticles const& particlesMc, + BCsInfo const& bcs, + McCollisions const& mcCollisions, + aod::Hf2Prongs const&) + { + // store configurables needed for B0 workflow + if (!isHfCandBhadConfigFilled) { + tables.rowCandidateConfigB0(hfflagConfigurations.selectionFlagDstar.value, configs.invMassWindowCharmHadPi.value); + isHfCandBhadConfigFilled = true; + } + + int zvtxColl{0}; + int sel8Coll{0}; + int zvtxAndSel8Coll{0}; + int zvtxAndSel8CollAndSoftTrig{0}; + int allSelColl{0}; + for (const auto& collision : collisions) { + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + + auto thisCollId = collision.globalIndex(); + auto candsCThisColl = candsC.sliceBy(preslices.candsDstarPerCollision, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); + auto collsSameMcCollision = collisions.sliceBy(preslices.colPerMcCollision, collision.mcCollisionId()); + int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); + runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); + } + // handle normalization by the right number of collisions + tables.hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + for (const auto& mcCollision : mcCollisions) { + runMcGen(mcCollision, particlesMc, collisions, bcs); + } + } + PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDstarPiMc, "Process DstarPi with MC info and without ML info", false); + + void processDstarPiMcWithMl(CollisionsWCentAndMcLabels const& collisions, + CandsDstarFilteredWithMl const& candsC, + aod::TrackAssoc const& trackIndices, + TracksPidWithSelAndMc const& tracks, + aod::McParticles const& particlesMc, + BCsInfo const& bcs, + McCollisions const& mcCollisions, + aod::Hf2Prongs const&) + { + // store configurables needed for B0 workflow + if (!isHfCandBhadConfigFilled) { + tables.rowCandidateConfigB0(hfflagConfigurations.selectionFlagDstar.value, configs.invMassWindowCharmHadPi.value); + isHfCandBhadConfigFilled = true; + } + + int zvtxColl{0}; + int sel8Coll{0}; + int zvtxAndSel8Coll{0}; + int zvtxAndSel8CollAndSoftTrig{0}; + int allSelColl{0}; + for (const auto& collision : collisions) { + o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); + + auto thisCollId = collision.globalIndex(); + auto candsCThisColl = candsC.sliceBy(preslices.candsDstarPerCollisionWithMl, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); + auto collsSameMcCollision = collisions.sliceBy(preslices.colPerMcCollision, collision.mcCollisionId()); + int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); + runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); + } + // handle normalization by the right number of collisions + tables.hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + for (const auto& mcCollision : mcCollisions) { + runMcGen(mcCollision, particlesMc, collisions, bcs); + } + } + PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDstarPiMcWithMl, "Process DstarPi with MC info and with ML info", false); + void processDsPiMc(CollisionsWCentAndMcLabels const& collisions, CandsDsFiltered const& candsC, aod::TrackAssoc const& trackIndices, @@ -2048,7 +2347,7 @@ struct HfDataCreatorCharmHadPiReduced { { // store configurables needed for Bs workflow if (!isHfCandBhadConfigFilled) { - rowCandidateConfigBs(hfflagConfigurations.selectionFlagDs.value, configs.invMassWindowCharmHadPi.value); + tables.rowCandidateConfigBs(hfflagConfigurations.selectionFlagDs.value, configs.invMassWindowCharmHadPi.value); isHfCandBhadConfigFilled = true; } @@ -2061,14 +2360,14 @@ struct HfDataCreatorCharmHadPiReduced { o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsDsPerCollision, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - auto collsSameMcCollision = collisions.sliceBy(colPerMcCollision, collision.mcCollisionId()); + auto candsCThisColl = candsC.sliceBy(preslices.candsDsPerCollision, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); + auto collsSameMcCollision = collisions.sliceBy(preslices.colPerMcCollision, collision.mcCollisionId()); int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); } // handle normalization by the right number of collisions - hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + tables.hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); for (const auto& mcCollision : mcCollisions) { runMcGen(mcCollision, particlesMc, collisions, bcs); } @@ -2085,7 +2384,7 @@ struct HfDataCreatorCharmHadPiReduced { { // store configurables needed for Bs workflow if (!isHfCandBhadConfigFilled) { - rowCandidateConfigBs(hfflagConfigurations.selectionFlagDs.value, configs.invMassWindowCharmHadPi.value); + tables.rowCandidateConfigBs(hfflagConfigurations.selectionFlagDs.value, configs.invMassWindowCharmHadPi.value); isHfCandBhadConfigFilled = true; } @@ -2098,14 +2397,14 @@ struct HfDataCreatorCharmHadPiReduced { o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsDsPerCollisionWithMl, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - auto collsSameMcCollision = collisions.sliceBy(colPerMcCollision, collision.mcCollisionId()); + auto candsCThisColl = candsC.sliceBy(preslices.candsDsPerCollisionWithMl, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); + auto collsSameMcCollision = collisions.sliceBy(preslices.colPerMcCollision, collision.mcCollisionId()); int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); } // handle normalization by the right number of collisions - hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + tables.hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); for (const auto& mcCollision : mcCollisions) { runMcGen(mcCollision, particlesMc, collisions, bcs); } @@ -2122,7 +2421,7 @@ struct HfDataCreatorCharmHadPiReduced { { // store configurables needed for B+ workflow if (!isHfCandBhadConfigFilled) { - rowCandidateConfigBplus(hfflagConfigurations.selectionFlagD0.value, hfflagConfigurations.selectionFlagD0bar.value, configs.invMassWindowCharmHadPi.value); + tables.rowCandidateConfigBplus(hfflagConfigurations.selectionFlagD0.value, hfflagConfigurations.selectionFlagD0bar.value, configs.invMassWindowCharmHadPi.value); isHfCandBhadConfigFilled = true; } @@ -2135,14 +2434,14 @@ struct HfDataCreatorCharmHadPiReduced { o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsD0PerCollision, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - auto collsSameMcCollision = collisions.sliceBy(colPerMcCollision, collision.mcCollisionId()); + auto candsCThisColl = candsC.sliceBy(preslices.candsD0PerCollision, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); + auto collsSameMcCollision = collisions.sliceBy(preslices.colPerMcCollision, collision.mcCollisionId()); int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); } // handle normalization by the right number of collisions - hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + tables.hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); for (const auto& mcCollision : mcCollisions) { runMcGen(mcCollision, particlesMc, collisions, bcs); } @@ -2159,7 +2458,7 @@ struct HfDataCreatorCharmHadPiReduced { { // store configurables needed for B+ workflow if (!isHfCandBhadConfigFilled) { - rowCandidateConfigBplus(hfflagConfigurations.selectionFlagD0.value, hfflagConfigurations.selectionFlagD0bar.value, configs.invMassWindowCharmHadPi.value); + tables.rowCandidateConfigBplus(hfflagConfigurations.selectionFlagD0.value, hfflagConfigurations.selectionFlagD0bar.value, configs.invMassWindowCharmHadPi.value); isHfCandBhadConfigFilled = true; } @@ -2172,14 +2471,14 @@ struct HfDataCreatorCharmHadPiReduced { o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsD0PerCollisionWithMl, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - auto collsSameMcCollision = collisions.sliceBy(colPerMcCollision, collision.mcCollisionId()); + auto candsCThisColl = candsC.sliceBy(preslices.candsD0PerCollisionWithMl, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); + auto collsSameMcCollision = collisions.sliceBy(preslices.colPerMcCollision, collision.mcCollisionId()); int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); } // handle normalization by the right number of collisions - hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + tables.hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); for (const auto& mcCollision : mcCollisions) { runMcGen(mcCollision, particlesMc, collisions, bcs); } @@ -2196,7 +2495,7 @@ struct HfDataCreatorCharmHadPiReduced { { // store configurables needed for Lb workflow if (!isHfCandBhadConfigFilled) { - rowCandidateConfigLb(hfflagConfigurations.selectionFlagDplus.value, configs.invMassWindowCharmHadPi.value); + tables.rowCandidateConfigLb(hfflagConfigurations.selectionFlagDplus.value, configs.invMassWindowCharmHadPi.value); isHfCandBhadConfigFilled = true; } @@ -2209,14 +2508,14 @@ struct HfDataCreatorCharmHadPiReduced { o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsLcPerCollision, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - auto collsSameMcCollision = collisions.sliceBy(colPerMcCollision, collision.mcCollisionId()); + auto candsCThisColl = candsC.sliceBy(preslices.candsLcPerCollision, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); + auto collsSameMcCollision = collisions.sliceBy(preslices.colPerMcCollision, collision.mcCollisionId()); int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); } // handle normalization by the right number of collisions - hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + tables.hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); for (const auto& mcCollision : mcCollisions) { runMcGen(mcCollision, particlesMc, collisions, bcs); } @@ -2233,7 +2532,7 @@ struct HfDataCreatorCharmHadPiReduced { { // store configurables needed for Lb workflow if (!isHfCandBhadConfigFilled) { - rowCandidateConfigLb(hfflagConfigurations.selectionFlagLc.value, configs.invMassWindowCharmHadPi.value); + tables.rowCandidateConfigLb(hfflagConfigurations.selectionFlagLc.value, configs.invMassWindowCharmHadPi.value); isHfCandBhadConfigFilled = true; } @@ -2246,14 +2545,14 @@ struct HfDataCreatorCharmHadPiReduced { o2::hf_evsel::checkEvSel(collision, hfEvSel, zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl, ccdb, registry); auto thisCollId = collision.globalIndex(); - auto candsCThisColl = candsC.sliceBy(candsLcPerCollisionWithMl, thisCollId); - auto trackIdsThisCollision = trackIndices.sliceBy(trackIndicesPerCollision, thisCollId); - auto collsSameMcCollision = collisions.sliceBy(colPerMcCollision, collision.mcCollisionId()); + auto candsCThisColl = candsC.sliceBy(preslices.candsLcPerCollisionWithMl, thisCollId); + auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); + auto collsSameMcCollision = collisions.sliceBy(preslices.colPerMcCollision, collision.mcCollisionId()); int64_t indexCollisionMaxNumContrib = getIndexCollisionMaxNumContrib(collsSameMcCollision); runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, particlesMc, indexCollisionMaxNumContrib, bcs); } // handle normalization by the right number of collisions - hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); + tables.hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); for (const auto& mcCollision : mcCollisions) { runMcGen(mcCollision, particlesMc, collisions, bcs); } diff --git a/PWGHF/DataModel/CandidateReconstructionTables.h b/PWGHF/DataModel/CandidateReconstructionTables.h index d411369fa3e..462685d9f8c 100644 --- a/PWGHF/DataModel/CandidateReconstructionTables.h +++ b/PWGHF/DataModel/CandidateReconstructionTables.h @@ -2197,6 +2197,7 @@ enum DecayTypeMc : uint8_t { B0ToDplusPiToPiKPiPi = 0, B0ToDsPiToKKPiPi, BsToDsPiToKKPiPi, B0ToDplusKToPiKPiK, + B0ToDstarPiToD0PiPiToKPiPiPi, PartlyRecoDecay, OtherDecay, NDecayTypeMc }; From 6d2954c011c36ddc520d8d3599809358873affb5 Mon Sep 17 00:00:00 2001 From: marcellocosti Date: Wed, 16 Jul 2025 23:46:29 +0200 Subject: [PATCH 2/7] Add process functions + table for soft pi --- PWGHF/D2H/DataModel/ReducedDataModel.h | 8 + .../dataCreatorCharmHadPiReduced.cxx | 162 +++++++++++------- .../candidateSelectorDstarToD0Pi.cxx | 5 - 3 files changed, 105 insertions(+), 70 deletions(-) diff --git a/PWGHF/D2H/DataModel/ReducedDataModel.h b/PWGHF/D2H/DataModel/ReducedDataModel.h index e5a776c02c4..7cee5fc5d52 100644 --- a/PWGHF/D2H/DataModel/ReducedDataModel.h +++ b/PWGHF/D2H/DataModel/ReducedDataModel.h @@ -698,6 +698,7 @@ DECLARE_SOA_INDEX_COLUMN_FULL(Prong1, prong1, int, HfRedTrackBases, "_1"); //! P DECLARE_SOA_COLUMN(Prong0MlScoreBkg, prong0MlScoreBkg, float); //! Bkg ML score of the D daughter DECLARE_SOA_COLUMN(Prong0MlScorePrompt, prong0MlScorePrompt, float); //! Prompt ML score of the D daughter DECLARE_SOA_COLUMN(Prong0MlScoreNonprompt, prong0MlScoreNonprompt, float); //! Nonprompt ML score of the D daughter +DECLARE_SOA_COLUMN(PtSoftPi, ptSoftPi, float); //! Soft pion pt for B0 → D*+ π- } // namespace hf_cand_b0_reduced DECLARE_SOA_TABLE(HfRedB0Prongs, "AOD", "HFREDB0PRONG", //! Table with B0 daughter indices @@ -711,6 +712,13 @@ DECLARE_SOA_TABLE(HfRedB0DpMls, "AOD", "HFREDB0DPML", //! Table with ML scores f using HfRedCandB0 = soa::Join; +DECLARE_SOA_TABLE(HfRedB0SoftPi, "AOD", "HFREDB0SOFTPI", //! Table with ML scores for the D+ daughter + o2::aod::hf_cand_dstar::ImpParamSoftPi, + o2::aod::hf_cand_dstar::ImpParamZSoftPi, + o2::aod::hf_cand_dstar::ErrorImpParamSoftPi, + o2::aod::hf_cand_dstar::ErrorImpParamZSoftPi, + o2::aod::hf_cand_b0_reduced::PtSoftPi); + namespace hf_cand_bplus_reduced { DECLARE_SOA_INDEX_COLUMN_FULL(Prong0, prong0, int, HfRed2Prongs, "_0"); //! Prong0 index diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx index 9468b05b41e..bce6ec8d1b4 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx @@ -127,6 +127,7 @@ struct HfDataCreatorCharmHadPiReduced { Produces hfCand3Prong; Produces hfCand3ProngCov; Produces hfCand3ProngMl; + Produces hfCandDstarSoftPi; // PID tables for charm-hadron candidate daughter tracks Produces hfCandPidProng0; Produces hfCandPidProng1; @@ -231,8 +232,8 @@ struct HfDataCreatorCharmHadPiReduced { using CandsD0FilteredWithMl = soa::Filtered>; using CandsLcFiltered = soa::Filtered>; using CandsLcFilteredWithMl = soa::Filtered>; - using CandsDstarFiltered = soa::Filtered>; - using CandsDstarFilteredWithMl = soa::Filtered>; + using CandsDstarFiltered = soa::Filtered>; + using CandsDstarFilteredWithMl = soa::Filtered>; using CollisionsWCent = soa::Join; using CollisionsWCentAndMcLabels = soa::Join; @@ -270,29 +271,29 @@ struct HfDataCreatorCharmHadPiReduced { void init(InitContext& initContext) { - std::array doProcess = {doprocessDplusPiData, doprocessDplusPiDataWithMl, doprocessDplusPiMc, doprocessDplusPiMcWithMl, - doprocessDsPiData, doprocessDsPiDataWithMl, doprocessDsPiMc, doprocessDsPiMcWithMl, - doprocessD0PiData, doprocessD0PiDataWithMl, doprocessD0PiMc, doprocessD0PiMcWithMl, + std::array doProcess = {doprocessDplusPiData, doprocessDplusPiDataWithMl, doprocessDplusPiDataWithQvec, doprocessDplusPiDataWithMlAndQvec, doprocessDplusPiMc, doprocessDplusPiMcWithMl, + doprocessDsPiData, doprocessDsPiDataWithMl, doprocessDsPiDataWithQvec, doprocessDsPiDataWithMlAndQvec, doprocessDsPiMc, doprocessDsPiMcWithMl, + doprocessD0PiData, doprocessD0PiDataWithMl, doprocessD0PiDataWithQvec, doprocessD0PiDataWithMlAndQvec, doprocessD0PiMc, doprocessD0PiMcWithMl, doprocessLcPiData, doprocessLcPiDataWithMl, doprocessLcPiMc, doprocessLcPiMcWithMl, - doprocessDstarPiData, doprocessDstarPiDataWithMl, doprocessDstarPiMc, doprocessDstarPiMcWithMl}; + doprocessDstarPiData, doprocessDstarPiDataWithMl, doprocessDstarPiDataWithQvec, doprocessDstarPiDataWithMlAndQvec, doprocessDstarPiMc, doprocessDstarPiMcWithMl}; if (std::accumulate(doProcess.begin(), doProcess.end(), 0) != 1) { LOGP(fatal, "One and only one process function can be enabled at a time, please fix your configuration!"); } // invariant-mass window cut - if (doprocessDplusPiData || doprocessDplusPiDataWithMl || doprocessDplusPiMc || doprocessDplusPiMcWithMl) { + if (doprocessDplusPiData || doprocessDplusPiDataWithMl || doprocessDplusPiDataWithQvec || doprocessDplusPiDataWithMlAndQvec || doprocessDplusPiMc || doprocessDplusPiMcWithMl) { massC = MassDMinus; massB = MassB0; - } else if (doprocessDsPiData || doprocessDsPiDataWithMl || doprocessDsPiMc || doprocessDsPiMcWithMl) { + } else if (doprocessDsPiData || doprocessDsPiDataWithMl || doprocessDsPiDataWithQvec || doprocessDsPiDataWithMlAndQvec || doprocessDsPiMc || doprocessDsPiMcWithMl) { massC = MassDS; massB = MassBS; - } else if (doprocessD0PiData || doprocessD0PiDataWithMl || doprocessD0PiMc || doprocessD0PiMcWithMl) { + } else if (doprocessD0PiData || doprocessD0PiDataWithMl || doprocessD0PiDataWithQvec || doprocessD0PiDataWithMlAndQvec || doprocessD0PiMc || doprocessD0PiMcWithMl) { massC = MassD0; massB = MassBPlus; } else if (doprocessLcPiData || doprocessLcPiDataWithMl || doprocessLcPiMc || doprocessLcPiMcWithMl) { massC = MassLambdaCPlus; massB = MassLambdaB0; - } else if (doprocessDstarPiData || doprocessDstarPiDataWithMl || doprocessDstarPiMc || doprocessDstarPiMcWithMl) { + } else if (doprocessDstarPiData || doprocessDstarPiDataWithMl || doprocessDstarPiDataWithQvec || doprocessDstarPiDataWithMlAndQvec || doprocessDstarPiMc || doprocessDstarPiMcWithMl) { massC = MassDStar; massB = MassB0; } @@ -300,10 +301,10 @@ struct HfDataCreatorCharmHadPiReduced { invMass2ChHadPiMax = (massB + configs.invMassWindowCharmHadPi) * (massB + configs.invMassWindowCharmHadPi); // Initialize fitter - if (doprocessDplusPiData || doprocessDplusPiDataWithMl || doprocessDplusPiMc || doprocessDplusPiMcWithMl || - doprocessDsPiData || doprocessDsPiDataWithMl || doprocessDsPiMc || doprocessDsPiMcWithMl || + if (doprocessDplusPiData || doprocessDplusPiDataWithMl || doprocessDplusPiDataWithQvec || doprocessDplusPiDataWithMlAndQvec || doprocessDplusPiMc || doprocessDplusPiMcWithMl || + doprocessDsPiData || doprocessDsPiDataWithMl || doprocessDsPiDataWithQvec || doprocessDsPiDataWithMlAndQvec || doprocessDsPiMc || doprocessDsPiMcWithMl || doprocessLcPiData || doprocessLcPiDataWithMl || doprocessLcPiMc || doprocessLcPiMcWithMl || - doprocessDstarPiData || doprocessDstarPiDataWithMl || doprocessDstarPiMc || doprocessDstarPiMcWithMl) { + doprocessDstarPiData || doprocessDstarPiDataWithMl || doprocessDstarPiDataWithQvec || doprocessDstarPiDataWithMlAndQvec || doprocessDstarPiMc || doprocessDstarPiMcWithMl) { df3.setPropagateToPCA(vertexConfigurations.propagateToPCA); df3.setMaxR(vertexConfigurations.maxR); df3.setMaxDZIni(vertexConfigurations.maxDZIni); @@ -312,7 +313,7 @@ struct HfDataCreatorCharmHadPiReduced { df3.setUseAbsDCA(vertexConfigurations.useAbsDCA); df3.setWeightedFinalPCA(vertexConfigurations.useWeightedFinalPCA); df3.setMatCorrType(noMatCorr); - } else if (doprocessD0PiData || doprocessD0PiDataWithMl || doprocessD0PiMc || doprocessD0PiMcWithMl) { + } else if (doprocessD0PiData || doprocessD0PiDataWithMl || doprocessD0PiDataWithQvec || doprocessD0PiDataWithMlAndQvec || doprocessD0PiMc || doprocessD0PiMcWithMl) { df2.setPropagateToPCA(vertexConfigurations.propagateToPCA); df2.setMaxR(vertexConfigurations.maxR); df2.setMaxDZIni(vertexConfigurations.maxDZIni); @@ -343,16 +344,16 @@ struct HfDataCreatorCharmHadPiReduced { std::string charmHadTitle = ""; std::string histMassTitle = ""; - if (doprocessDplusPiData || doprocessDplusPiDataWithMl || doprocessDplusPiMc || doprocessDplusPiMcWithMl) { + if (doprocessDplusPiData || doprocessDplusPiDataWithMl || doprocessDplusPiDataWithQvec || doprocessDplusPiDataWithMlAndQvec || doprocessDplusPiMc || doprocessDplusPiMcWithMl) { charmHadTitle = "D^{#plus}"; histMassTitle = "Dplus"; registry.add("hMassDplus", "D^{#plus} candidates; #it{M}(K#pi#pi) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {{500, 0., 5.}}}); - } else if (doprocessDsPiData || doprocessDsPiDataWithMl || doprocessDsPiMc || doprocessDsPiMcWithMl) { + } else if (doprocessDsPiData || doprocessDsPiDataWithMl || doprocessDsPiDataWithQvec || doprocessDsPiDataWithMlAndQvec || doprocessDsPiMc || doprocessDsPiMcWithMl) { charmHadTitle = "D_{s}^{#plus}"; histMassTitle = "Ds"; registry.add("hMassDsToKKPi", "D_{s}^{#plus} to KKpi candidates; #it{M}(KK#pi) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {{500, 0., 5.}}}); registry.add("hMassDsToPiKK", "D_{s}^{#plus} to piKK candidates; #it{M}(KK#pi) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {{500, 0., 5.}}}); - } else if (doprocessD0PiData || doprocessD0PiDataWithMl || doprocessD0PiMc || doprocessD0PiMcWithMl) { + } else if (doprocessD0PiData || doprocessD0PiDataWithMl || doprocessD0PiDataWithQvec || doprocessD0PiDataWithMlAndQvec || doprocessD0PiMc || doprocessD0PiMcWithMl) { charmHadTitle = "D^{0}"; histMassTitle = "D0"; registry.add("hMassD0", "D^{0} candidates; #it{M}(K#pi) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {{500, 0., 5.}}}); @@ -362,10 +363,10 @@ struct HfDataCreatorCharmHadPiReduced { histMassTitle = "Lc"; registry.add("hMassLcToPKPi", "#Lambda_{c}^{+} to KKpi candidates; #it{M}(pK#pi) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {{500, 0., 5.}}}); registry.add("hMassLcToPiKP", "#Lambda_{c}^{+} to piKK candidates; #it{M}(#piKp) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {{500, 0., 5.}}}); - } else if (doprocessDstarPiData || doprocessDstarPiDataWithMl || doprocessDstarPiMc || doprocessDstarPiMcWithMl) { + } else if (doprocessDstarPiData || doprocessDstarPiDataWithMl || doprocessDstarPiDataWithQvec || doprocessDstarPiDataWithMlAndQvec || doprocessDstarPiMc || doprocessDstarPiMcWithMl) { charmHadTitle = "D^{*}"; histMassTitle = "Dstar"; - registry.add("hMassDstarToD0Pi", "D^{*} candidates; #it{M}(K#pi#pi) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {{500, 0., 5.}}}); + registry.add("hMassDstarToD0Pi", "D^{*} candidates; #it{M}(K#pi#pi) - #it{M}(K#pi) (GeV/#it{c}^{2});entries", {HistType::kTH1D, {{500, 0., 1.}}}); } registry.add(Form("hPt%s", histMassTitle.data()), Form("%s candidates candidates;%s candidate #it{p}_{T} (GeV/#it{c});entries", charmHadTitle.data(), charmHadTitle.data()), {HistType::kTH1D, {{100, 0., 10.}}}); @@ -966,11 +967,11 @@ struct HfDataCreatorCharmHadPiReduced { } tables.rowHfLcPiMcRecReduced(indexHfCandCharm, selectedTracksPion[vecDaughtersB.back().globalIndex()], flag, flagWrongCollision, debug, motherPt); } else if constexpr (decChannel == DecayChannel::B0ToDstarPi) { - // B0 → D*+ π- → (K- π+ π+) π- - auto indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2], vecDaughtersB[3]}, Pdg::kB0, std::array{-kKPlus, +kPiPlus, +kPiPlus, -kPiPlus}, true, &sign, 3); + // B0 → D*+ π- → (D0 π+) π- → (K- π+ π+) π- + auto indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2], vecDaughtersB[3]}, Pdg::kB0, std::array{-kKPlus, +kPiPlus, +kPiPlus, -kPiPlus}, true, &sign, 4); if (indexRec > -1) { - // D*+ → K- π+ π+ - indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2]}, +Pdg::kDStar, std::array{-kKPlus, +kPiPlus, +kPiPlus}, true, &sign, 2); + // D*+ → (D0 π+) → K- π+ π+ + indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2]}, +Pdg::kDStar, std::array{-kKPlus, +kPiPlus, +kPiPlus}, true, &sign, 3); if (indexRec > -1) { std::vector arrDaughDstarIndex; std::array arrPDGDaughDstar; @@ -984,7 +985,7 @@ struct HfDataCreatorCharmHadPiReduced { flag = sign * BIT(hf_cand_b0::DecayTypeMc::B0ToDstarPiToD0PiPiToKPiPiPi); } else { debug = 1; - LOGF(debug, "B0 decays in the expected final state but the condition on the intermediate state is not fulfilled"); + LOGF(debug, "B0 decays in the expected final state but the condition on D* intermediate state is not fulfilled"); } } } else { @@ -999,7 +1000,7 @@ struct HfDataCreatorCharmHadPiReduced { checkWrongCollision(particleMother, collision, indexCollisionMaxNumContrib, flagWrongCollision); } } - tables.rowHfDPiMcCheckReduced(indexHfCandCharm, selectedTracksPion[vecDaughtersB.back().globalIndex()], flag, flagWrongCollision, debug, motherPt); + tables.rowHfDPiMcRecReduced(indexHfCandCharm, selectedTracksPion[vecDaughtersB.back().globalIndex()], flag, flagWrongCollision, debug, motherPt); } } @@ -1094,27 +1095,18 @@ struct HfDataCreatorCharmHadPiReduced { registry.fill(HIST("hCpaLc"), candC.cpa()); } else if constexpr (decChannel == DecayChannel::B0ToDstarPi) { indexHfCandCharm = tables.hfCand3Prong.lastIndex() + 1; - invMassC0 = candC.invMassDstar(); + if (candC.signSoftPi() > 0) { + invMassC0 = candC.invMassDstar() - candC.invMassD0(); + } else { + invMassC0 = candC.invMassAntiDstar() - candC.invMassD0Bar(); + } registry.fill(HIST("hMassDstarToD0Pi"), invMassC0); registry.fill(HIST("hPtDstar"), candC.pt()); + registry.fill(HIST("hCpaDstar"), candC.cpaD0()); } bool fillHfCandCharm = false; - std::vector charmHadDauTracks; - // std::vector charmHadDauTracks{candC.template prong0_as(), candC.template prong1_as()}; - - if constexpr (decChannel == DecayChannel::B0ToDstarPi) { - auto prongD0 = candC.template prongD0_as(); - charmHadDauTracks = { - prongD0.template prong0_as(), - prongD0.template prong1_as() - }; - } else { - charmHadDauTracks = { - candC.template prong0_as(), - candC.template prong1_as() - }; - } + std::vector charmHadDauTracks{candC.template prong0_as(), candC.template prong1_as()}; o2::track::TrackParCov trackParCov0 = getTrackParCov(charmHadDauTracks[0]); o2::track::TrackParCov trackParCov1 = getTrackParCov(charmHadDauTracks[1]); o2::track::TrackParCov trackParCov2{}; @@ -1137,9 +1129,8 @@ struct HfDataCreatorCharmHadPiReduced { // third track, if it's a 3-prong if constexpr (decChannel == DecayChannel::B0ToDminusPi || decChannel == DecayChannel::BsToDsminusPi || decChannel == DecayChannel::LbToLcplusPi || decChannel == DecayChannel::B0ToDstarPi) { - // charmHadDauTracks.push_back(candC.template prong2_as()); if constexpr (decChannel == DecayChannel::B0ToDstarPi) { - charmHadDauTracks.push_back(candC.template prong0_as()); + charmHadDauTracks.push_back(candC.template prongPi_as()); // Soft pion from D* decay } else { charmHadDauTracks.push_back(candC.template prong2_as()); } @@ -1153,7 +1144,7 @@ struct HfDataCreatorCharmHadPiReduced { } // --------------------------------- - // reconstruct charm candidate secondary vertex (add D*?) + // reconstruct charm candidate secondary vertex o2::track::TrackParCov trackParCovCharmHad{}; std::array pVecCharm{}; if constexpr (decChannel == DecayChannel::B0ToDminusPi || decChannel == DecayChannel::BsToDsminusPi || decChannel == DecayChannel::LbToLcplusPi) { // D∓ → π∓ K± π∓ and Ds∓ → K∓ K± π∓ and Lc∓ → p∓ K± π∓ @@ -1221,6 +1212,36 @@ struct HfDataCreatorCharmHadPiReduced { pVecCharm = RecoDecay::pVec(pVec0, pVec1); trackParCovCharmHad = df2.createParentTrackParCov(); trackParCovCharmHad.setAbsCharge(0); // to be sure + } else if constexpr (decChannel == DecayChannel::B0ToDstarPi) { + hCandidatesDstar->Fill(SVFitting::BeforeFit); + + df2.process(trackParCov0, trackParCov1); // D0 vertex + df2.propagateTracksToVertex(); + std::array pVecPosVtx{}, pVecNegVtx{}; + df2.getTrack(0).getPxPyPzGlo(pVecPosVtx); + df2.getTrack(1).getPxPyPzGlo(pVecNegVtx); + auto trackParD = df2.createParentTrackParCov(); + trackParD.setAbsCharge(0); // to be sure + auto pVec2ProngVtx = RecoDecay::pVec(pVecPosVtx, pVecNegVtx); + try { + if (df2.process(trackParD, trackParCov2) == 0) { + continue; // D* vertex + } + } catch (const std::runtime_error& error) { + LOG(info) << "Run time error found: " << error.what() << ". DCAFitterN cannot work, skipping the candidate."; + hCandidatesDstar->Fill(SVFitting::Fail); + continue; + } + hCandidatesDstar->Fill(SVFitting::FitOk); + + auto secondaryVertexCharm = df2.getPCACandidate(); + trackParCov0.propagateTo(secondaryVertexCharm[0], bz); + trackParCov1.propagateTo(secondaryVertexCharm[0], bz); + std::array pVecD0{}; + df2.getTrack(0).getPxPyPzGlo(pVecD0); // D0 + pVecCharm = RecoDecay::pVec(pVecD0, pVec2); + trackParCovCharmHad = df2.createParentTrackParCov(); + trackParCovCharmHad.setAbsCharge(charmHadDauTracks[2].sign()); // sign of soft pion } float ptDauMin = 1.e6, etaDauMin = 999.f, chi2TpcDauMax = -1.f; @@ -1393,6 +1414,26 @@ struct HfDataCreatorCharmHadPiReduced { } tables.hfCand2ProngMl(mlScores[0], mlScores[1], mlScores[2], mlScores[3], mlScores[4], mlScores[5]); } + } else if constexpr (decChannel == DecayChannel::B0ToDstarPi) { + tables.hfCand3Prong(charmHadDauTracks[0].globalIndex(), charmHadDauTracks[1].globalIndex(), charmHadDauTracks[2].globalIndex(), + indexHfReducedCollision, + trackParCovCharmHad.getX(), trackParCovCharmHad.getAlpha(), + trackParCovCharmHad.getY(), trackParCovCharmHad.getZ(), trackParCovCharmHad.getSnp(), + trackParCovCharmHad.getTgl(), trackParCovCharmHad.getQ2Pt(), + candC.xSecondaryVertexD0(), candC.ySecondaryVertexD0(), candC.zSecondaryVertexD0(), invMassC0, invMassC1, + ptDauMin, etaDauMin, nItsClsDauMin, nTpcCrossRowsDauMin, chi2TpcDauMax); + tables.hfCand3ProngCov(trackParCovCharmHad.getSigmaY2(), trackParCovCharmHad.getSigmaZY(), trackParCovCharmHad.getSigmaZ2(), + trackParCovCharmHad.getSigmaSnpY(), trackParCovCharmHad.getSigmaSnpZ(), + trackParCovCharmHad.getSigmaSnp2(), trackParCovCharmHad.getSigmaTglY(), trackParCovCharmHad.getSigmaTglZ(), + trackParCovCharmHad.getSigmaTglSnp(), trackParCovCharmHad.getSigmaTgl2(), + trackParCovCharmHad.getSigma1PtY(), trackParCovCharmHad.getSigma1PtZ(), trackParCovCharmHad.getSigma1PtSnp(), + trackParCovCharmHad.getSigma1PtTgl(), trackParCovCharmHad.getSigma1Pt2()); + tables.hfCandDstarSoftPi(candC.impParamSoftPi(), candC.impParamZSoftPi(), candC.errorImpParamSoftPi(), candC.errorImpParamZSoftPi(), candC.ptSoftPi()); + float nSigmaTpcPr0{-999.f}, nSigmaTpcPr1{-999.f}, nSigmaTpcPr2{-999.f}; + float nSigmaTofPr0{-999.f}, nSigmaTofPr1{-999.f}, nSigmaTofPr2{-999.f}; + tables.hfCandPidProng0(candC.nSigTpcPi0(), candC.nSigTofPi0(), candC.nSigTpcKa0(), candC.nSigTofKa0(), nSigmaTpcPr0, nSigmaTofPr0, charmHadDauTracks[0].hasTOF(), charmHadDauTracks[0].hasTPC()); + tables.hfCandPidProng1(candC.nSigTpcPi1(), candC.nSigTofPi1(), candC.nSigTpcKa1(), candC.nSigTofKa1(), nSigmaTpcPr1, nSigmaTofPr1, charmHadDauTracks[1].hasTOF(), charmHadDauTracks[1].hasTPC()); + tables.hfCandPidProng2(candC.nSigTpcPi2(), candC.nSigTofPi2(), candC.nSigTpcKa2(), candC.nSigTofKa2(), nSigmaTpcPr2, nSigmaTofPr2, charmHadDauTracks[2].hasTOF(), charmHadDauTracks[2].hasTPC()); } fillHfReducedCollision = true; } @@ -1407,15 +1448,15 @@ struct HfDataCreatorCharmHadPiReduced { // fill collision table if it contains a DPi pair a minima tables.hfReducedCollision(collision.posX(), collision.posY(), collision.posZ(), collision.numContrib(), hfRejMap, bz); tables.hfReducedCollExtra(collision.covXX(), collision.covXY(), collision.covYY(), - collision.covXZ(), collision.covYZ(), collision.covZZ()); + collision.covXZ(), collision.covYZ(), collision.covZZ()); tables.hfReducedCollCentrality(collision.centFT0C(), collision.centFT0M(), collision.trackOccupancyInTimeRange(), collision.ft0cOccupancyInTimeRange()); if constexpr (withQvec) { tables.hfReducedQvector(collision.qvecFT0CRe(), collision.qvecFT0CIm(), collision.sumAmplFT0C(), - collision.qvecFT0ARe(), collision.qvecFT0AIm(), collision.sumAmplFT0A(), - collision.qvecFT0MRe(), collision.qvecFT0MIm(), collision.sumAmplFT0M(), - collision.qvecTPCposRe(), collision.qvecTPCposIm(), collision.nTrkTPCpos(), - collision.qvecTPCnegRe(), collision.qvecTPCnegIm(), collision.nTrkTPCneg(), - collision.qvecTPCallRe(), collision.qvecTPCallIm(), collision.nTrkTPCall()); + collision.qvecFT0ARe(), collision.qvecFT0AIm(), collision.sumAmplFT0A(), + collision.qvecFT0MRe(), collision.qvecFT0MIm(), collision.sumAmplFT0M(), + collision.qvecTPCposRe(), collision.qvecTPCposIm(), collision.nTrkTPCpos(), + collision.qvecTPCnegRe(), collision.qvecTPCnegIm(), collision.nTrkTPCneg(), + collision.qvecTPCallRe(), collision.qvecTPCallIm(), collision.nTrkTPCall()); } } @@ -1659,7 +1700,7 @@ struct HfDataCreatorCharmHadPiReduced { // handle normalization by the right number of collisions tables.hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } - PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDplusPiData, "Process DplusPi without MC info and without ML info", false); + PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDplusPiData, "Process DplusPi without MC info and without ML info", true); void processDplusPiDataWithMl(CollisionsWCent const& collisions, CandsDplusFilteredWithMl const& candsC, @@ -1667,7 +1708,6 @@ struct HfDataCreatorCharmHadPiReduced { TracksPidWithSel const& tracks, aod::BCsWithTimestamps const& bcs) { - LOG(info) << "Processing DplusPi data with ML info"; // store configurables needed for B0 workflow if (!isHfCandBhadConfigFilled) { tables.rowCandidateConfigB0(hfflagConfigurations.selectionFlagDplus.value, configs.invMassWindowCharmHadPi.value); @@ -1685,11 +1725,6 @@ struct HfDataCreatorCharmHadPiReduced { auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(preslices.candsDplusPerCollisionWithMl, thisCollId); auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); - LOG(info) << "Processing DplusPi data with ML info for collision ID: " << thisCollId; - LOG(info) << "Number of candidates in this collision: " << candsCThisColl.size(); - LOG(info) << "Number of track indices in this collision: " << trackIdsThisCollision.size(); - // Run data creation for DplusPi with ML info - LOG(info) << "Running data creation for DplusPi with ML info"; runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); } // handle normalization by the right number of collisions @@ -1764,10 +1799,9 @@ struct HfDataCreatorCharmHadPiReduced { aod::BCsWithTimestamps const& bcs, aod::Hf2Prongs const&) { - LOG(info) << "Processing DstarPi data without ML info and without Q-vectors"; // store configurables needed for B0 workflow if (!isHfCandBhadConfigFilled) { - tables.rowCandidateConfigB0(hfflagConfigurations.selectionFlagDplus.value, configs.invMassWindowCharmHadPi.value); + tables.rowCandidateConfigB0(hfflagConfigurations.selectionFlagDstar.value, configs.invMassWindowCharmHadPi.value); isHfCandBhadConfigFilled = true; } @@ -1787,7 +1821,7 @@ struct HfDataCreatorCharmHadPiReduced { // handle normalization by the right number of collisions tables.hfCollisionCounter(collisions.tableSize(), zvtxColl, sel8Coll, zvtxAndSel8Coll, zvtxAndSel8CollAndSoftTrig, allSelColl); } - PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDstarPiData, "Process DstarPi without MC info and without ML info", true); + PROCESS_SWITCH(HfDataCreatorCharmHadPiReduced, processDstarPiData, "Process DstarPi without MC info and without ML info", false); void processDstarPiDataWithMl(CollisionsWCent const& collisions, CandsDstarFilteredWithMl const& candsC, @@ -1798,7 +1832,7 @@ struct HfDataCreatorCharmHadPiReduced { { // store configurables needed for B0 workflow if (!isHfCandBhadConfigFilled) { - tables.rowCandidateConfigB0(hfflagConfigurations.selectionFlagDplus.value, configs.invMassWindowCharmHadPi.value); + tables.rowCandidateConfigB0(hfflagConfigurations.selectionFlagDstar.value, configs.invMassWindowCharmHadPi.value); isHfCandBhadConfigFilled = true; } @@ -1813,8 +1847,6 @@ struct HfDataCreatorCharmHadPiReduced { auto thisCollId = collision.globalIndex(); auto candsCThisColl = candsC.sliceBy(preslices.candsDstarPerCollisionWithMl, thisCollId); auto trackIdsThisCollision = trackIndices.sliceBy(preslices.trackIndicesPerCollision, thisCollId); - LOG(info) << "Processing DstarPi with ML info for collision " << thisCollId; - LOG(info) << "Number of candidates in this collision: " << candsCThisColl.size(); runDataCreation(collision, candsCThisColl, trackIdsThisCollision, tracks, tracks, -1, bcs); } // handle normalization by the right number of collisions @@ -1831,7 +1863,7 @@ struct HfDataCreatorCharmHadPiReduced { { // store configurables needed for B0 workflow if (!isHfCandBhadConfigFilled) { - tables.rowCandidateConfigB0(hfflagConfigurations.selectionFlagDplus.value, configs.invMassWindowCharmHadPi.value); + tables.rowCandidateConfigB0(hfflagConfigurations.selectionFlagDstar.value, configs.invMassWindowCharmHadPi.value); isHfCandBhadConfigFilled = true; } @@ -1862,7 +1894,7 @@ struct HfDataCreatorCharmHadPiReduced { { // store configurables needed for B0 workflow if (!isHfCandBhadConfigFilled) { - tables.rowCandidateConfigB0(hfflagConfigurations.selectionFlagDplus.value, configs.invMassWindowCharmHadPi.value); + tables.rowCandidateConfigB0(hfflagConfigurations.selectionFlagDstar.value, configs.invMassWindowCharmHadPi.value); isHfCandBhadConfigFilled = true; } diff --git a/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx b/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx index e1417802a33..3df427ad2bb 100644 --- a/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx +++ b/PWGHF/TableProducer/candidateSelectorDstarToD0Pi.cxx @@ -234,11 +234,6 @@ struct HfCandidateSelectorDstarToD0Pi { if (candidate.decayLengthXYD0() > cutsD0->get(binPt, "max decay length XY")) { return false; } - - //.............Why is this if condition commented? - if (candidate.decayLengthNormalisedD0() * candidate.decayLengthNormalisedD0() < 1.0) { - // return false; // add back when getter fixed - } return true; } From e276a40f008ca6829f781d125d5cb37cfef41e4d Mon Sep 17 00:00:00 2001 From: marcellocosti Date: Thu, 17 Jul 2025 11:47:24 +0200 Subject: [PATCH 3/7] Add generated matching --- .../dataCreatorCharmHadPiReduced.cxx | 33 +++++++++++++++++++ .../DataModel/CandidateReconstructionTables.h | 3 +- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx index bce6ec8d1b4..f126f811c2a 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx @@ -1665,6 +1665,39 @@ struct HfDataCreatorCharmHadPiReduced { tables.rowHfLbMcGenReduced(flag, ptParticle, yParticle, etaParticle, ptProngs[0], yProngs[0], etaProngs[0], ptProngs[1], yProngs[1], etaProngs[1], hfRejMap, centFT0C, centFT0M); + } else if constexpr (decayChannel == DecayChannel::B0ToDstarPi) { + // B0 → D* π+ + if (RecoDecay::isMatchedMCGen(particlesMc, particle, Pdg::kB0, std::array{+static_cast(Pdg::kDStar), -kPiPlus}, true)) { + // Match D- -> π- K+ π- + auto candCMC = particlesMc.rawIteratorAt(particle.daughtersIds().front()); + // Printf("Checking D- -> π- K+ π-"); + if (RecoDecay::isMatchedMCGen(particlesMc, candCMC, +static_cast(Pdg::kDStar), std::array{+kPiPlus, -kKPlus, +kPiPlus}, true, &sign, 3)) { + flag = sign * BIT(hf_cand_b0::DecayType::B0ToDstarPi); + } + } + + // save information for B0 task + if (!TESTBIT(std::abs(flag), hf_cand_b0::DecayType::B0ToDstarPi)) { + continue; + } + + auto ptParticle = particle.pt(); + auto yParticle = RecoDecay::y(particle.pVector(), massB); + auto etaParticle = particle.eta(); + + std::array ptProngs; + std::array yProngs; + std::array etaProngs; + int counter = 0; + for (const auto& daught : particle.daughters_as()) { + ptProngs[counter] = daught.pt(); + etaProngs[counter] = daught.eta(); + yProngs[counter] = RecoDecay::y(daught.pVector(), pdg->Mass(daught.pdgCode())); + counter++; + } + tables.rowHfB0McGenReduced(flag, -1 /*channel*/, ptParticle, yParticle, etaParticle, + ptProngs[0], yProngs[0], etaProngs[0], + ptProngs[1], yProngs[1], etaProngs[1], hfRejMap, centFT0C, centFT0M); } } // gen } diff --git a/PWGHF/DataModel/CandidateReconstructionTables.h b/PWGHF/DataModel/CandidateReconstructionTables.h index 462685d9f8c..fb94e13345c 100644 --- a/PWGHF/DataModel/CandidateReconstructionTables.h +++ b/PWGHF/DataModel/CandidateReconstructionTables.h @@ -2191,7 +2191,8 @@ DECLARE_SOA_COLUMN(FlagWrongCollision, flagWrongCollision, int8_t); // reconstru DECLARE_SOA_COLUMN(DebugMcRec, debugMcRec, int8_t); // debug flag for mis-association reconstruction level // mapping of decay types -enum DecayType { B0ToDPi = 0 }; +enum DecayType { B0ToDPi = 0, + B0ToDstarPi}; enum DecayTypeMc : uint8_t { B0ToDplusPiToPiKPiPi = 0, B0ToDsPiToKKPiPi, From 2f3c6cf83333e697132daaa513d09e7cab19ed56 Mon Sep 17 00:00:00 2001 From: marcellocosti Date: Thu, 17 Jul 2025 20:45:31 +0200 Subject: [PATCH 4/7] Implement Fabrizio comments --- PWGHF/D2H/DataModel/ReducedDataModel.h | 34 ++++++--- .../dataCreatorCharmHadPiReduced.cxx | 69 ++++++++++++------- 2 files changed, 67 insertions(+), 36 deletions(-) diff --git a/PWGHF/D2H/DataModel/ReducedDataModel.h b/PWGHF/D2H/DataModel/ReducedDataModel.h index 7cee5fc5d52..4e1b8fc0e16 100644 --- a/PWGHF/D2H/DataModel/ReducedDataModel.h +++ b/PWGHF/D2H/DataModel/ReducedDataModel.h @@ -285,11 +285,33 @@ DECLARE_SOA_TABLE(HfRedTrackBases, "AOD", "HFREDTRACKBASE", //! Table with track aod::track::Px, aod::track::Py, aod::track::Pz, - aod::track::PVector); + aod::track::PVector, + o2::soa::Marker<1>); DECLARE_SOA_TABLE(HfRedTracksCov, "AOD", "HFREDTRACKCOV", //! Table with track covariance information for reduced workflow soa::Index<>, - HFTRACKPARCOV_COLUMNS); + HFTRACKPARCOV_COLUMNS, + o2::soa::Marker<1>); + +DECLARE_SOA_TABLE(HfRedSoftPiBases, "AOD", "HFREDSOFTPIBASE", //! Table with track information for reduced workflow + soa::Index<>, + hf_track_index_reduced::TrackId, + hf_track_index_reduced::HfRedCollisionId, + HFTRACKPAR_COLUMNS, + hf_track_vars_reduced::ItsNCls, + hf_track_vars_reduced::TpcNClsCrossedRows, + hf_track_vars_reduced::TpcChi2NCl, + aod::track::Px, + aod::track::Py, + aod::track::Pz, + aod::track::PVector, + o2::soa::Marker<2>); + +DECLARE_SOA_TABLE(HfRedSoftPiCov, "AOD", "HFREDSOFTPICOV", //! Table with track covariance information for reduced workflow + soa::Index<>, + HFTRACKPARCOV_COLUMNS, + o2::soa::Marker<2>); + // CAREFUL: need to follow convention [Name = Description + 's'] in DECLARE_SOA_TABLE(Name, "AOD", Description) // to call DECLARE_SOA_INDEX_COLUMN_FULL later on @@ -698,7 +720,6 @@ DECLARE_SOA_INDEX_COLUMN_FULL(Prong1, prong1, int, HfRedTrackBases, "_1"); //! P DECLARE_SOA_COLUMN(Prong0MlScoreBkg, prong0MlScoreBkg, float); //! Bkg ML score of the D daughter DECLARE_SOA_COLUMN(Prong0MlScorePrompt, prong0MlScorePrompt, float); //! Prompt ML score of the D daughter DECLARE_SOA_COLUMN(Prong0MlScoreNonprompt, prong0MlScoreNonprompt, float); //! Nonprompt ML score of the D daughter -DECLARE_SOA_COLUMN(PtSoftPi, ptSoftPi, float); //! Soft pion pt for B0 → D*+ π- } // namespace hf_cand_b0_reduced DECLARE_SOA_TABLE(HfRedB0Prongs, "AOD", "HFREDB0PRONG", //! Table with B0 daughter indices @@ -712,13 +733,6 @@ DECLARE_SOA_TABLE(HfRedB0DpMls, "AOD", "HFREDB0DPML", //! Table with ML scores f using HfRedCandB0 = soa::Join; -DECLARE_SOA_TABLE(HfRedB0SoftPi, "AOD", "HFREDB0SOFTPI", //! Table with ML scores for the D+ daughter - o2::aod::hf_cand_dstar::ImpParamSoftPi, - o2::aod::hf_cand_dstar::ImpParamZSoftPi, - o2::aod::hf_cand_dstar::ErrorImpParamSoftPi, - o2::aod::hf_cand_dstar::ErrorImpParamZSoftPi, - o2::aod::hf_cand_b0_reduced::PtSoftPi); - namespace hf_cand_bplus_reduced { DECLARE_SOA_INDEX_COLUMN_FULL(Prong0, prong0, int, HfRed2Prongs, "_0"); //! Prong0 index diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx index f126f811c2a..7e067b5919b 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx @@ -26,6 +26,7 @@ #include "PWGHF/DataModel/CandidateReconstructionTables.h" #include "PWGHF/DataModel/CandidateSelectionTables.h" #include "PWGHF/Utils/utilsEvSelHf.h" +#include "PWGHF/Utils/utilsMcMatching.h" #include "PWGHF/Utils/utilsTrkCandHf.h" #include "Common/Core/RecoDecay.h" @@ -83,6 +84,7 @@ using namespace o2::aod; using namespace o2::constants::physics; using namespace o2::framework; using namespace o2::framework::expressions; +using namespace o2::hf_decay; using namespace o2::hf_trkcandsel; enum Event : uint8_t { @@ -127,7 +129,9 @@ struct HfDataCreatorCharmHadPiReduced { Produces hfCand3Prong; Produces hfCand3ProngCov; Produces hfCand3ProngMl; - Produces hfCandDstarSoftPi; + // D* soft pion related tables + Produces hfTrackSoftPion; + Produces hfTrackCovSoftPion; // PID tables for charm-hadron candidate daughter tracks Produces hfCandPidProng0; Produces hfCandPidProng1; @@ -267,7 +271,6 @@ struct HfDataCreatorCharmHadPiReduced { std::array arrPDGResonantDsPhiPi = {kPhi, kPiPlus}; // Ds± → Phi π± std::array arrPDGResonantDKstarK = {kK0Star892, kKPlus}; // Ds± → K*(892)0bar K± and D± → K*(892)0bar K± - std::array arrPDGResonantDstarD0Pi = {kD0, kPiPlus}; // D*± → D0 π± void init(InitContext& initContext) { @@ -485,6 +488,7 @@ struct HfDataCreatorCharmHadPiReduced { // we check the MC matching to be stored int8_t sign{0}; + int8_t signD{0}; int8_t flag{0}; int8_t flagWrongCollision{WrongCollisionType::None}; int8_t debug{0}; @@ -968,20 +972,22 @@ struct HfDataCreatorCharmHadPiReduced { tables.rowHfLcPiMcRecReduced(indexHfCandCharm, selectedTracksPion[vecDaughtersB.back().globalIndex()], flag, flagWrongCollision, debug, motherPt); } else if constexpr (decChannel == DecayChannel::B0ToDstarPi) { // B0 → D*+ π- → (D0 π+) π- → (K- π+ π+) π- - auto indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2], vecDaughtersB[3]}, Pdg::kB0, std::array{-kKPlus, +kPiPlus, +kPiPlus, -kPiPlus}, true, &sign, 4); + auto indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2], vecDaughtersB[3]}, Pdg::kB0, std::array{+kKPlus, -kPiPlus, -kPiPlus, +kPiPlus}, true, &sign, 4); if (indexRec > -1) { // D*+ → (D0 π+) → K- π+ π+ - indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2]}, +Pdg::kDStar, std::array{-kKPlus, +kPiPlus, +kPiPlus}, true, &sign, 3); + indexRec = RecoDecay::getMatchedMCRec(particlesMc, std::array{vecDaughtersB[0], vecDaughtersB[1], vecDaughtersB[2]}, +Pdg::kDStar, std::array{-kKPlus, +kPiPlus, +kPiPlus}, true, &signD, 3); if (indexRec > -1) { std::vector arrDaughDstarIndex; - std::array arrPDGDaughDstar; RecoDecay::getDaughters(particlesMc.rawIteratorAt(indexRec), &arrDaughDstarIndex, std::array{0}, 1); if (arrDaughDstarIndex.size() == NDaughtersDstar) { + bool matchD0{0}; for (auto iProng = 0u; iProng < arrDaughDstarIndex.size(); ++iProng) { auto daughI = particlesMc.rawIteratorAt(arrDaughDstarIndex[iProng]); - arrPDGDaughDstar[iProng] = std::abs(daughI.pdgCode()); + if (std::abs(daughI.pdgCode()) == Pdg::kD0) { + matchD0 = RecoDecay::isMatchedMCGen(particlesMc, daughI, +Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &signD, 2); + } } - if ((arrPDGDaughDstar[0] == arrPDGResonantDstarD0Pi[0] && arrPDGDaughDstar[1] == arrPDGResonantDstarD0Pi[1]) || (arrPDGDaughDstar[0] == arrPDGResonantDstarD0Pi[1] && arrPDGDaughDstar[1] == arrPDGResonantDstarD0Pi[0])) { + if (matchD0) { flag = sign * BIT(hf_cand_b0::DecayTypeMc::B0ToDstarPiToD0PiPiToKPiPiPi); } else { debug = 1; @@ -1013,7 +1019,6 @@ struct HfDataCreatorCharmHadPiReduced { uint64_t const& indexCollisionMaxNumContrib, BBCs const&) { - LOG(debug) << "Running data creation for decay channel " << decChannel << " with doMc=" << doMc << ", withMl=" << withMl << ", withQvec=" << withQvec; registry.fill(HIST("hEvents"), 1 + Event::Processed); float centrality = -1.f; auto hfRejMap = hfEvSel.getHfCollisionRejectionMask(collision, centrality, ccdb, registry); @@ -1213,19 +1218,12 @@ struct HfDataCreatorCharmHadPiReduced { trackParCovCharmHad = df2.createParentTrackParCov(); trackParCovCharmHad.setAbsCharge(0); // to be sure } else if constexpr (decChannel == DecayChannel::B0ToDstarPi) { - hCandidatesDstar->Fill(SVFitting::BeforeFit); - df2.process(trackParCov0, trackParCov1); // D0 vertex - df2.propagateTracksToVertex(); - std::array pVecPosVtx{}, pVecNegVtx{}; - df2.getTrack(0).getPxPyPzGlo(pVecPosVtx); - df2.getTrack(1).getPxPyPzGlo(pVecNegVtx); - auto trackParD = df2.createParentTrackParCov(); - trackParD.setAbsCharge(0); // to be sure - auto pVec2ProngVtx = RecoDecay::pVec(pVecPosVtx, pVecNegVtx); + hCandidatesDstar->Fill(SVFitting::BeforeFit); try { - if (df2.process(trackParD, trackParCov2) == 0) { - continue; // D* vertex + // D0 vertex + if (df2.process(trackParCov0, trackParCov1) == 0) { + continue; } } catch (const std::runtime_error& error) { LOG(info) << "Run time error found: " << error.what() << ". DCAFitterN cannot work, skipping the candidate."; @@ -1233,15 +1231,14 @@ struct HfDataCreatorCharmHadPiReduced { continue; } hCandidatesDstar->Fill(SVFitting::FitOk); - auto secondaryVertexCharm = df2.getPCACandidate(); trackParCov0.propagateTo(secondaryVertexCharm[0], bz); trackParCov1.propagateTo(secondaryVertexCharm[0], bz); - std::array pVecD0{}; - df2.getTrack(0).getPxPyPzGlo(pVecD0); // D0 - pVecCharm = RecoDecay::pVec(pVecD0, pVec2); + df2.getTrack(0).getPxPyPzGlo(pVec0); + df2.getTrack(1).getPxPyPzGlo(pVec1); + pVecCharm = RecoDecay::pVec(pVec0, pVec1); trackParCovCharmHad = df2.createParentTrackParCov(); - trackParCovCharmHad.setAbsCharge(charmHadDauTracks[2].sign()); // sign of soft pion + trackParCovCharmHad.setAbsCharge(0); // to be sure } float ptDauMin = 1.e6, etaDauMin = 999.f, chi2TpcDauMax = -1.f; @@ -1428,12 +1425,32 @@ struct HfDataCreatorCharmHadPiReduced { trackParCovCharmHad.getSigmaTglSnp(), trackParCovCharmHad.getSigmaTgl2(), trackParCovCharmHad.getSigma1PtY(), trackParCovCharmHad.getSigma1PtZ(), trackParCovCharmHad.getSigma1PtSnp(), trackParCovCharmHad.getSigma1PtTgl(), trackParCovCharmHad.getSigma1Pt2()); - tables.hfCandDstarSoftPi(candC.impParamSoftPi(), candC.impParamZSoftPi(), candC.errorImpParamSoftPi(), candC.errorImpParamZSoftPi(), candC.ptSoftPi()); float nSigmaTpcPr0{-999.f}, nSigmaTpcPr1{-999.f}, nSigmaTpcPr2{-999.f}; float nSigmaTofPr0{-999.f}, nSigmaTofPr1{-999.f}, nSigmaTofPr2{-999.f}; tables.hfCandPidProng0(candC.nSigTpcPi0(), candC.nSigTofPi0(), candC.nSigTpcKa0(), candC.nSigTofKa0(), nSigmaTpcPr0, nSigmaTofPr0, charmHadDauTracks[0].hasTOF(), charmHadDauTracks[0].hasTPC()); tables.hfCandPidProng1(candC.nSigTpcPi1(), candC.nSigTofPi1(), candC.nSigTpcKa1(), candC.nSigTofKa1(), nSigmaTpcPr1, nSigmaTofPr1, charmHadDauTracks[1].hasTOF(), charmHadDauTracks[1].hasTPC()); tables.hfCandPidProng2(candC.nSigTpcPi2(), candC.nSigTofPi2(), candC.nSigTpcKa2(), candC.nSigTofKa2(), nSigmaTpcPr2, nSigmaTofPr2, charmHadDauTracks[2].hasTOF(), charmHadDauTracks[2].hasTPC()); + + // Soft pion tables + auto trackSoftPion = charmHadDauTracks.back(); + auto trackParCovSoftPion = getTrackParCov(trackSoftPion); + std::array dcaSoftPion{trackSoftPion.dcaXY(), trackSoftPion.dcaZ()}; + std::array pVecSoftPion = trackSoftPion.pVector(); + if (trackSoftPion.collisionId() != thisCollId) { + o2::base::Propagator::Instance()->propagateToDCABxByBz({collision.posX(), collision.posY(), collision.posZ()}, trackParCovSoftPion, 2.f, noMatCorr, &dcaSoftPion); + getPxPyPz(trackParCovSoftPion, pVecSoftPion); + } + tables.hfTrackSoftPion(trackSoftPion.globalIndex(), indexHfReducedCollision, + trackParCovSoftPion.getX(), trackParCovSoftPion.getAlpha(), + trackParCovSoftPion.getY(), trackParCovSoftPion.getZ(), trackParCovSoftPion.getSnp(), + trackParCovSoftPion.getTgl(), trackParCovSoftPion.getQ2Pt(), + trackSoftPion.itsNCls(), trackSoftPion.tpcNClsCrossedRows(), trackSoftPion.tpcChi2NCl()); + tables.hfTrackCovSoftPion(trackParCovSoftPion.getSigmaY2(), trackParCovSoftPion.getSigmaZY(), trackParCovSoftPion.getSigmaZ2(), + trackParCovSoftPion.getSigmaSnpY(), trackParCovSoftPion.getSigmaSnpZ(), + trackParCovSoftPion.getSigmaSnp2(), trackParCovSoftPion.getSigmaTglY(), trackParCovSoftPion.getSigmaTglZ(), + trackParCovSoftPion.getSigmaTglSnp(), trackParCovSoftPion.getSigmaTgl2(), + trackParCovSoftPion.getSigma1PtY(), trackParCovSoftPion.getSigma1PtZ(), trackParCovSoftPion.getSigma1PtSnp(), + trackParCovSoftPion.getSigma1PtTgl(), trackParCovSoftPion.getSigma1Pt2()); } fillHfReducedCollision = true; } @@ -1667,7 +1684,7 @@ struct HfDataCreatorCharmHadPiReduced { ptProngs[1], yProngs[1], etaProngs[1], hfRejMap, centFT0C, centFT0M); } else if constexpr (decayChannel == DecayChannel::B0ToDstarPi) { // B0 → D* π+ - if (RecoDecay::isMatchedMCGen(particlesMc, particle, Pdg::kB0, std::array{+static_cast(Pdg::kDStar), -kPiPlus}, true)) { + if (RecoDecay::isMatchedMCGen(particlesMc, particle, Pdg::kB0, std::array{-static_cast(Pdg::kDStar), +kPiPlus}, true)) { // Match D- -> π- K+ π- auto candCMC = particlesMc.rawIteratorAt(particle.daughtersIds().front()); // Printf("Checking D- -> π- K+ π-"); From 44ccb086bfc3f8fc1e14b9cd591f65b7b45cf6dd Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Thu, 17 Jul 2025 18:49:36 +0000 Subject: [PATCH 5/7] Please consider the following formatting changes --- PWGHF/D2H/DataModel/ReducedDataModel.h | 1 - .../dataCreatorCharmHadPiReduced.cxx | 42 +++++++++---------- .../DataModel/CandidateReconstructionTables.h | 2 +- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/PWGHF/D2H/DataModel/ReducedDataModel.h b/PWGHF/D2H/DataModel/ReducedDataModel.h index 4e1b8fc0e16..82df09123da 100644 --- a/PWGHF/D2H/DataModel/ReducedDataModel.h +++ b/PWGHF/D2H/DataModel/ReducedDataModel.h @@ -312,7 +312,6 @@ DECLARE_SOA_TABLE(HfRedSoftPiCov, "AOD", "HFREDSOFTPICOV", //! Table with track HFTRACKPARCOV_COLUMNS, o2::soa::Marker<2>); - // CAREFUL: need to follow convention [Name = Description + 's'] in DECLARE_SOA_TABLE(Name, "AOD", Description) // to call DECLARE_SOA_INDEX_COLUMN_FULL later on DECLARE_SOA_TABLE(HfRedBach0Bases, "AOD", "HFREDBACH0BASE", //! Table with track information for reduced workflow diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx index 7e067b5919b..776d1e0d6d8 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx @@ -391,10 +391,10 @@ struct HfDataCreatorCharmHadPiReduced { // init HF event selection helper hfEvSel.init(registry); - if (doprocessDplusPiMc || doprocessDplusPiMcWithMl || - doprocessDsPiMc || doprocessDsPiMcWithMl || - doprocessD0PiMc || doprocessD0PiMcWithMl || - doprocessLcPiMc || doprocessLcPiMcWithMl || + if (doprocessDplusPiMc || doprocessDplusPiMcWithMl || + doprocessDsPiMc || doprocessDsPiMcWithMl || + doprocessD0PiMc || doprocessD0PiMcWithMl || + doprocessLcPiMc || doprocessLcPiMcWithMl || doprocessDstarPiMc || doprocessDstarPiMcWithMl) { const auto& workflows = initContext.services().get(); for (const DeviceSpec& device : workflows.devices) { @@ -1218,8 +1218,8 @@ struct HfDataCreatorCharmHadPiReduced { trackParCovCharmHad = df2.createParentTrackParCov(); trackParCovCharmHad.setAbsCharge(0); // to be sure } else if constexpr (decChannel == DecayChannel::B0ToDstarPi) { - - hCandidatesDstar->Fill(SVFitting::BeforeFit); + + hCandidatesDstar->Fill(SVFitting::BeforeFit); try { // D0 vertex if (df2.process(trackParCov0, trackParCov1) == 0) { @@ -1387,18 +1387,18 @@ struct HfDataCreatorCharmHadPiReduced { } } else if constexpr (decChannel == DecayChannel::BplusToD0barPi) { // D0(bar) → K± π∓ tables.hfCand2Prong(charmHadDauTracks[0].globalIndex(), charmHadDauTracks[1].globalIndex(), - indexHfReducedCollision, - trackParCovCharmHad.getX(), trackParCovCharmHad.getAlpha(), - trackParCovCharmHad.getY(), trackParCovCharmHad.getZ(), trackParCovCharmHad.getSnp(), - trackParCovCharmHad.getTgl(), trackParCovCharmHad.getQ2Pt(), - candC.xSecondaryVertex(), candC.ySecondaryVertex(), candC.zSecondaryVertex(), invMassC0, invMassC1, - ptDauMin, etaDauMin, nItsClsDauMin, nTpcCrossRowsDauMin, chi2TpcDauMax); + indexHfReducedCollision, + trackParCovCharmHad.getX(), trackParCovCharmHad.getAlpha(), + trackParCovCharmHad.getY(), trackParCovCharmHad.getZ(), trackParCovCharmHad.getSnp(), + trackParCovCharmHad.getTgl(), trackParCovCharmHad.getQ2Pt(), + candC.xSecondaryVertex(), candC.ySecondaryVertex(), candC.zSecondaryVertex(), invMassC0, invMassC1, + ptDauMin, etaDauMin, nItsClsDauMin, nTpcCrossRowsDauMin, chi2TpcDauMax); tables.hfCand2ProngCov(trackParCovCharmHad.getSigmaY2(), trackParCovCharmHad.getSigmaZY(), trackParCovCharmHad.getSigmaZ2(), - trackParCovCharmHad.getSigmaSnpY(), trackParCovCharmHad.getSigmaSnpZ(), - trackParCovCharmHad.getSigmaSnp2(), trackParCovCharmHad.getSigmaTglY(), trackParCovCharmHad.getSigmaTglZ(), - trackParCovCharmHad.getSigmaTglSnp(), trackParCovCharmHad.getSigmaTgl2(), - trackParCovCharmHad.getSigma1PtY(), trackParCovCharmHad.getSigma1PtZ(), trackParCovCharmHad.getSigma1PtSnp(), - trackParCovCharmHad.getSigma1PtTgl(), trackParCovCharmHad.getSigma1Pt2()); + trackParCovCharmHad.getSigmaSnpY(), trackParCovCharmHad.getSigmaSnpZ(), + trackParCovCharmHad.getSigmaSnp2(), trackParCovCharmHad.getSigmaTglY(), trackParCovCharmHad.getSigmaTglZ(), + trackParCovCharmHad.getSigmaTglSnp(), trackParCovCharmHad.getSigmaTgl2(), + trackParCovCharmHad.getSigma1PtY(), trackParCovCharmHad.getSigma1PtZ(), trackParCovCharmHad.getSigma1PtSnp(), + trackParCovCharmHad.getSigma1PtTgl(), trackParCovCharmHad.getSigma1Pt2()); tables.hfCandPidProng0(candC.nSigTpcPi0(), candC.nSigTofPi0(), candC.nSigTpcKa0(), candC.nSigTofKa0(), 0., 0., charmHadDauTracks[0].hasTOF(), charmHadDauTracks[0].hasTPC()); tables.hfCandPidProng1(candC.nSigTpcPi1(), candC.nSigTofPi1(), candC.nSigTpcKa1(), candC.nSigTofKa1(), 0., 0., charmHadDauTracks[1].hasTOF(), charmHadDauTracks[1].hasTPC()); if constexpr (withMl) { @@ -1614,8 +1614,8 @@ struct HfDataCreatorCharmHadPiReduced { counter++; } tables.rowHfBsMcGenReduced(flag, -1 /*channel*/, ptParticle, yParticle, etaParticle, - ptProngs[0], yProngs[0], etaProngs[0], - ptProngs[1], yProngs[1], etaProngs[1], hfRejMap, centFT0C, centFT0M); + ptProngs[0], yProngs[0], etaProngs[0], + ptProngs[1], yProngs[1], etaProngs[1], hfRejMap, centFT0C, centFT0M); } else if constexpr (decayChannel == DecayChannel::BplusToD0barPi) { // B+ → D0bar π+ if (RecoDecay::isMatchedMCGen(particlesMc, particle, Pdg::kBPlus, std::array{-static_cast(Pdg::kD0), +kPiPlus}, true)) { @@ -1647,8 +1647,8 @@ struct HfDataCreatorCharmHadPiReduced { counter++; } tables.rowHfBpMcGenReduced(flag, -1 /*channel*/, ptParticle, yParticle, etaParticle, - ptProngs[0], yProngs[0], etaProngs[0], - ptProngs[1], yProngs[1], etaProngs[1], hfRejMap, centFT0C, centFT0M); + ptProngs[0], yProngs[0], etaProngs[0], + ptProngs[1], yProngs[1], etaProngs[1], hfRejMap, centFT0C, centFT0M); } else if constexpr (decayChannel == DecayChannel::LbToLcplusPi) { // Lb → Lc+ π- if (RecoDecay::isMatchedMCGen(particlesMc, particle, Pdg::kLambdaB0, std::array{static_cast(Pdg::kLambdaCPlus), -kPiPlus}, true)) { diff --git a/PWGHF/DataModel/CandidateReconstructionTables.h b/PWGHF/DataModel/CandidateReconstructionTables.h index fb94e13345c..6c90926df89 100644 --- a/PWGHF/DataModel/CandidateReconstructionTables.h +++ b/PWGHF/DataModel/CandidateReconstructionTables.h @@ -2192,7 +2192,7 @@ DECLARE_SOA_COLUMN(DebugMcRec, debugMcRec, int8_t); // debug fla // mapping of decay types enum DecayType { B0ToDPi = 0, - B0ToDstarPi}; + B0ToDstarPi }; enum DecayTypeMc : uint8_t { B0ToDplusPiToPiKPiPi = 0, B0ToDsPiToKKPiPi, From eb1a54170bbe3b29b3e9c8446939083af80c986c Mon Sep 17 00:00:00 2001 From: marcellocosti Date: Fri, 18 Jul 2025 11:38:36 +0200 Subject: [PATCH 6/7] Implement Fabrizio comments --- .../dataCreatorCharmHadPiReduced.cxx | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx index 776d1e0d6d8..6d28587420f 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx @@ -1378,11 +1378,6 @@ struct HfDataCreatorCharmHadPiReduced { std::copy(candC.mlProbLcToPiKP().begin(), candC.mlProbLcToPiKP().end(), mlScores.begin() + 3); } tables.hfCand3ProngMl(mlScores[0], mlScores[1], mlScores[2], mlScores[3], mlScores[4], mlScores[5]); - } else if constexpr (decChannel == DecayChannel::B0ToDstarPi) { - if (candC.mlProbDStarToD0Pi().size() == NSizeMLScore) { - std::copy(candC.mlProbDStarToD0Pi().begin(), candC.mlProbDStarToD0Pi().end(), mlScores.begin()); - } - tables.hfCand3ProngMl(mlScores[0], mlScores[1], mlScores[2], -1.f, -1.f, -1.f); } } } else if constexpr (decChannel == DecayChannel::BplusToD0barPi) { // D0(bar) → K± π∓ @@ -1412,24 +1407,23 @@ struct HfDataCreatorCharmHadPiReduced { tables.hfCand2ProngMl(mlScores[0], mlScores[1], mlScores[2], mlScores[3], mlScores[4], mlScores[5]); } } else if constexpr (decChannel == DecayChannel::B0ToDstarPi) { - tables.hfCand3Prong(charmHadDauTracks[0].globalIndex(), charmHadDauTracks[1].globalIndex(), charmHadDauTracks[2].globalIndex(), + tables.hfCand2Prong(charmHadDauTracks[0].globalIndex(), charmHadDauTracks[1].globalIndex(), indexHfReducedCollision, trackParCovCharmHad.getX(), trackParCovCharmHad.getAlpha(), trackParCovCharmHad.getY(), trackParCovCharmHad.getZ(), trackParCovCharmHad.getSnp(), trackParCovCharmHad.getTgl(), trackParCovCharmHad.getQ2Pt(), candC.xSecondaryVertexD0(), candC.ySecondaryVertexD0(), candC.zSecondaryVertexD0(), invMassC0, invMassC1, ptDauMin, etaDauMin, nItsClsDauMin, nTpcCrossRowsDauMin, chi2TpcDauMax); - tables.hfCand3ProngCov(trackParCovCharmHad.getSigmaY2(), trackParCovCharmHad.getSigmaZY(), trackParCovCharmHad.getSigmaZ2(), + tables.hfCand2ProngCov(trackParCovCharmHad.getSigmaY2(), trackParCovCharmHad.getSigmaZY(), trackParCovCharmHad.getSigmaZ2(), trackParCovCharmHad.getSigmaSnpY(), trackParCovCharmHad.getSigmaSnpZ(), trackParCovCharmHad.getSigmaSnp2(), trackParCovCharmHad.getSigmaTglY(), trackParCovCharmHad.getSigmaTglZ(), trackParCovCharmHad.getSigmaTglSnp(), trackParCovCharmHad.getSigmaTgl2(), trackParCovCharmHad.getSigma1PtY(), trackParCovCharmHad.getSigma1PtZ(), trackParCovCharmHad.getSigma1PtSnp(), trackParCovCharmHad.getSigma1PtTgl(), trackParCovCharmHad.getSigma1Pt2()); - float nSigmaTpcPr0{-999.f}, nSigmaTpcPr1{-999.f}, nSigmaTpcPr2{-999.f}; - float nSigmaTofPr0{-999.f}, nSigmaTofPr1{-999.f}, nSigmaTofPr2{-999.f}; + float nSigmaTpcPr0{-999.f}, nSigmaTpcPr1{-999.f}; + float nSigmaTofPr0{-999.f}, nSigmaTofPr1{-999.f}; tables.hfCandPidProng0(candC.nSigTpcPi0(), candC.nSigTofPi0(), candC.nSigTpcKa0(), candC.nSigTofKa0(), nSigmaTpcPr0, nSigmaTofPr0, charmHadDauTracks[0].hasTOF(), charmHadDauTracks[0].hasTPC()); tables.hfCandPidProng1(candC.nSigTpcPi1(), candC.nSigTofPi1(), candC.nSigTpcKa1(), candC.nSigTofKa1(), nSigmaTpcPr1, nSigmaTofPr1, charmHadDauTracks[1].hasTOF(), charmHadDauTracks[1].hasTPC()); - tables.hfCandPidProng2(candC.nSigTpcPi2(), candC.nSigTofPi2(), candC.nSigTpcKa2(), candC.nSigTofKa2(), nSigmaTpcPr2, nSigmaTofPr2, charmHadDauTracks[2].hasTOF(), charmHadDauTracks[2].hasTPC()); // Soft pion tables auto trackSoftPion = charmHadDauTracks.back(); @@ -1451,6 +1445,13 @@ struct HfDataCreatorCharmHadPiReduced { trackParCovSoftPion.getSigmaTglSnp(), trackParCovSoftPion.getSigmaTgl2(), trackParCovSoftPion.getSigma1PtY(), trackParCovSoftPion.getSigma1PtZ(), trackParCovSoftPion.getSigma1PtSnp(), trackParCovSoftPion.getSigma1PtTgl(), trackParCovSoftPion.getSigma1Pt2()); + if constexpr (withMl) { + std::array mlScores = {-1.f, -1.f, -1.f, -1.f, -1.f, -1.f}; + if (candC.mlProbDstarToD0Pi().size() == NSizeMLScore) { + std::copy(candC.mlProbDstarToD0Pi().begin(), candC.mlProbDstarToD0Pi().end(), mlScores.begin()); + } + tables.hfCand3ProngMl(mlScores[0], mlScores[1], mlScores[2], -1.f, -1.f, -1.f); + } } fillHfReducedCollision = true; } From 40ea58e754d2c4d6c85a8b1fe1f2e7797d567e16 Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Fri, 18 Jul 2025 09:41:14 +0000 Subject: [PATCH 7/7] Please consider the following formatting changes --- PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx index 6d28587420f..0b73b385893 100644 --- a/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx +++ b/PWGHF/D2H/TableProducer/dataCreatorCharmHadPiReduced.cxx @@ -1445,7 +1445,7 @@ struct HfDataCreatorCharmHadPiReduced { trackParCovSoftPion.getSigmaTglSnp(), trackParCovSoftPion.getSigmaTgl2(), trackParCovSoftPion.getSigma1PtY(), trackParCovSoftPion.getSigma1PtZ(), trackParCovSoftPion.getSigma1PtSnp(), trackParCovSoftPion.getSigma1PtTgl(), trackParCovSoftPion.getSigma1Pt2()); - if constexpr (withMl) { + if constexpr (withMl) { std::array mlScores = {-1.f, -1.f, -1.f, -1.f, -1.f, -1.f}; if (candC.mlProbDstarToD0Pi().size() == NSizeMLScore) { std::copy(candC.mlProbDstarToD0Pi().begin(), candC.mlProbDstarToD0Pi().end(), mlScores.begin());