From f4047c347be0ac6b05e38e96db68ba58ba705ae8 Mon Sep 17 00:00:00 2001 From: lmattei01 Date: Tue, 8 Sep 2026 15:46:35 +0200 Subject: [PATCH 1/2] Generalize Jpis-D0 associated table maker to also include Dplus --- PWGDQ/Core/VarManager.h | 10 +- PWGDQ/DataModel/ReducedInfoTables.h | 34 +++ PWGDQ/TableProducer/tableMakerJpsiHf.cxx | 261 ++++++++++++++++++----- 3 files changed, 248 insertions(+), 57 deletions(-) diff --git a/PWGDQ/Core/VarManager.h b/PWGDQ/Core/VarManager.h index 1045441ace2..dab54d5bb73 100644 --- a/PWGDQ/Core/VarManager.h +++ b/PWGDQ/Core/VarManager.h @@ -1214,7 +1214,8 @@ class VarManager : public TObject enum DileptonCharmHadronTypes { kJPsi = 0, kD0ToPiK, - kD0barToKPi + kD0barToKPi, + kDplusToPiKPi }; enum EventFilters { @@ -6608,6 +6609,13 @@ void VarManager::FillSingleDileptonCharmHadron(Cand const& candidate, H hfHelper values[kRapCharmHadron] = hfHelper.yD0(candidate); values[kBdtCharmHadron] = static_cast(bdtScoreCharmHad); } + if constexpr (partType == kDplusToPiKPi) { + values[kMassCharmHadron] = hfHelper.invMassDplusToPiKPi(candidate); + values[kPtCharmHadron] = candidate.pt(); + values[kPhiCharmHadron] = candidate.phi(); + values[kRapCharmHadron] = hfHelper.yDplus(candidate); + values[kBdtCharmHadron] = static_cast(bdtScoreCharmHad); + } } template diff --git a/PWGDQ/DataModel/ReducedInfoTables.h b/PWGDQ/DataModel/ReducedInfoTables.h index e9efc3ddd89..b91222d06b4 100644 --- a/PWGDQ/DataModel/ReducedInfoTables.h +++ b/PWGDQ/DataModel/ReducedInfoTables.h @@ -1338,32 +1338,44 @@ DECLARE_SOA_COLUMN(DeltaY, deltaY, float); DECLARE_SOA_COLUMN(DeltaPhi, deltaPhi, float); //! DECLARE_SOA_COLUMN(NumItsClsDmesProng0, numItsClsDmesProng0, int); //! DECLARE_SOA_COLUMN(NumItsClsDmesProng1, numItsClsDmesProng1, int); //! +DECLARE_SOA_COLUMN(NumItsClsDmesProng2, numItsClsDmesProng2, int); //! DECLARE_SOA_COLUMN(NumTpcCrossedRowsDmesProng0, numTpcCrossedRowsDmesProng0, int); //! DECLARE_SOA_COLUMN(NumTpcCrossedRowsDmesProng1, numTpcCrossedRowsDmesProng1, int); //! +DECLARE_SOA_COLUMN(NumTpcCrossedRowsDmesProng2, numTpcCrossedRowsDmesProng2, int); //! DECLARE_SOA_COLUMN(EtaDmesProng0, etaDmesProng0, float); //! DECLARE_SOA_COLUMN(EtaDmesProng1, etaDmesProng1, float); //! +DECLARE_SOA_COLUMN(EtaDmesProng2, etaDmesProng2, float); //! DECLARE_SOA_COLUMN(PtDmesProng0, ptDmesProng0, float); //! DECLARE_SOA_COLUMN(PtDmesProng1, ptDmesProng1, float); //! +DECLARE_SOA_COLUMN(PtDmesProng2, ptDmesProng2, float); //! DECLARE_SOA_COLUMN(MinNumItsClsDmesProng, minNumItsClsDmesProng, int); //! DECLARE_SOA_COLUMN(MinNumTpcCrossedRowsDmesProng, minNumTpcCrossedRowsDmesProng, int); //! DECLARE_SOA_COLUMN(MinAbsEtaDmesProng, minAbsEtaDmesProng, float); //! DECLARE_SOA_COLUMN(MinPtDmesProng, minPtDmesProng, float); //! DECLARE_SOA_COLUMN(NumSigmaTpcPiProng0, numSigmaTpcPiProng0, float); //! DECLARE_SOA_COLUMN(NumSigmaTpcPiProng1, numSigmaTpcPiProng1, float); //! +DECLARE_SOA_COLUMN(NumSigmaTpcPiProng2, numSigmaTpcPiProng2, float); //! DECLARE_SOA_COLUMN(NumSigmaTofPiProng0, numSigmaTofPiProng0, float); //! DECLARE_SOA_COLUMN(NumSigmaTofPiProng1, numSigmaTofPiProng1, float); //! +DECLARE_SOA_COLUMN(NumSigmaTofPiProng2, numSigmaTofPiProng2, float); //! DECLARE_SOA_COLUMN(NumSigmaTpcKaProng0, numSigmaTpcKaProng0, float); //! DECLARE_SOA_COLUMN(NumSigmaTpcKaProng1, numSigmaTpcKaProng1, float); //! +DECLARE_SOA_COLUMN(NumSigmaTpcKaProng2, numSigmaTpcKaProng2, float); //! DECLARE_SOA_COLUMN(NumSigmaTofKaProng0, numSigmaTofKaProng0, float); //! DECLARE_SOA_COLUMN(NumSigmaTofKaProng1, numSigmaTofKaProng1, float); //! +DECLARE_SOA_COLUMN(NumSigmaTofKaProng2, numSigmaTofKaProng2, float); //! DECLARE_SOA_DYNAMIC_COLUMN(NumSigmaTpcTofPiProng0, numSigmaTpcTofPiProng0, //! [](float tpcNSigmaPi0, float tofNSigmaPi0) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaPi0, tofNSigmaPi0); }); DECLARE_SOA_DYNAMIC_COLUMN(NumSigmaTpcTofPiProng1, numSigmaTpcTofPiProng1, //! [](float tpcNSigmaPi1, float tofNSigmaPi1) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaPi1, tofNSigmaPi1); }); +DECLARE_SOA_DYNAMIC_COLUMN(NumSigmaTpcTofPiProng2, numSigmaTpcTofPiProng2, //! + [](float tpcNSigmaPi2, float tofNSigmaPi2) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaPi2, tofNSigmaPi2); }); DECLARE_SOA_DYNAMIC_COLUMN(NumSigmaTpcTofKaProng0, numSigmaTpcTofKaProng0, //! [](float tpcNSigmaKa0, float tofNSigmaKa0) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaKa0, tofNSigmaKa0); }); DECLARE_SOA_DYNAMIC_COLUMN(NumSigmaTpcTofKaProng1, numSigmaTpcTofKaProng1, //! [](float tpcNSigmaKa1, float tofNSigmaKa1) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaKa1, tofNSigmaKa1); }); +DECLARE_SOA_DYNAMIC_COLUMN(NumSigmaTpcTofKaProng2, numSigmaTpcTofKaProng2, //! + [](float tpcNSigmaKa2, float tofNSigmaKa2) -> float { return pid_tpc_tof_utils::combineNSigma(tpcNSigmaKa2, tofNSigmaKa2); }); } // namespace jpsidmescorr DECLARE_SOA_TABLE(RedJpDmDileptons, "AOD", "REDJPDMDILEPTON", //! @@ -1418,6 +1430,23 @@ DECLARE_SOA_TABLE(RedJpDmDmDau1s, "AOD", "REDJPDMDMDAU1", //! jpsidmescorr::NumSigmaTpcTofPiProng1, jpsidmescorr::NumSigmaTpcTofKaProng1); +DECLARE_SOA_TABLE(RedJpDmDmDau2s, "AOD", "REDJPDMDMDAU2", //! + jpsidmescorr::PtDmesProng2, + jpsidmescorr::EtaDmesProng2, + jpsidmescorr::NumItsClsDmesProng2, + jpsidmescorr::NumTpcCrossedRowsDmesProng2, + jpsidmescorr::NumSigmaTpcPiProng2, + jpsidmescorr::NumSigmaTofPiProng2, + jpsidmescorr::NumSigmaTpcKaProng2, + jpsidmescorr::NumSigmaTofKaProng2, + jpsidmescorr::NumSigmaTpcTofPiProng2, + jpsidmescorr::NumSigmaTpcTofKaProng2); + +//General table for Dmeson mass +DECLARE_SOA_TABLE(RedJpDmDmesMasss, "AOD", "REDJPDMDMESMASS", //??? + jpsidmescorr::MassDmes); + +//Special table for D0 mass: particle and antiparticle separated DECLARE_SOA_TABLE(RedJpDmD0Masss, "AOD", "REDJPDMD0MASS", //! jpsidmescorr::MassD0, jpsidmescorr::MassD0bar); @@ -1430,6 +1459,11 @@ DECLARE_SOA_TABLE(RedJpDmDmesBdts, "AOD", "REDJPDMDMESBDT", //! jpsidmescorr::BdtPromptMassHypo1, jpsidmescorr::BdtNonpromptMassHypo1); +DECLARE_SOA_TABLE(RedJpDmDplusBdts, "AOD", "REDJPDMDPLUSBDT", + jpsidmescorr::BdtBkgMassHypo0, + jpsidmescorr::BdtPromptMassHypo0, + jpsidmescorr::BdtNonpromptMassHypo0); + DECLARE_SOA_TABLE(RedDleptDmesAll, "AOD", "RTDILPTDMESALL", //! reducedpair::Mass, jpsidmescorr::MassDmes, diff --git a/PWGDQ/TableProducer/tableMakerJpsiHf.cxx b/PWGDQ/TableProducer/tableMakerJpsiHf.cxx index c5569ae7e14..f7394d3e6be 100644 --- a/PWGDQ/TableProducer/tableMakerJpsiHf.cxx +++ b/PWGDQ/TableProducer/tableMakerJpsiHf.cxx @@ -15,6 +15,7 @@ /// \author Fabrizio Grosa , CERN #include "PWGDQ/Core/AnalysisCompositeCut.h" +#include "PWGDQ/Core/AnalysisCut.h" #include "PWGDQ/Core/CutsLibrary.h" #include "PWGDQ/Core/HistogramManager.h" #include "PWGDQ/Core/HistogramsLibrary.h" @@ -55,6 +56,7 @@ using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::aod; using namespace o2::aod::hf_cand_2prong; +using namespace o2::aod::hf_cand_3prong; // bit maps used for the Fill functions of the VarManager constexpr static uint32_t gkTrackFillMapWithColl = VarManager::ObjTypes::ReducedTrack | VarManager::ObjTypes::ReducedTrackBarrel | VarManager::ObjTypes::ReducedTrackBarrelPID | VarManager::ObjTypes::ReducedTrackCollInfo; @@ -94,6 +96,8 @@ struct CandidateDilepton { using MyEvents = soa::Join; using MyD0CandidatesSelected = soa::Join; using MyD0CandidatesSelectedWithBdt = soa::Join; +using MyDplusCandidatesSelected = soa::Join; +using MyDplusCandidatesSelectedWithBdt = soa::Join; using TracksWithExtra = soa::Join; using MyBarrelTracksSelectedWithColl = soa::Join; @@ -111,8 +115,11 @@ struct tableMakerJpsiHf { Produces redDmesons; Produces redDmesDau0; Produces redDmesDau1; + Produces redDmesDau2; Produces redDmesBdts; + Produces redDplusBdts; Produces redD0Masses; + Produces redDmesMasses; Produces redDileptons; Produces redCollCounter; @@ -125,17 +132,26 @@ struct tableMakerJpsiHf { Configurable fConfigMuonCuts{"cfgMuonCuts", "muonQualityCuts", "Comma separated list of muon cuts"}; Configurable massDileptonCandMin{"massDileptonCandMin", 1, "minimum dilepton mass"}; Configurable massDileptonCandMax{"massDileptonCandMax", 5, "maximum dilepton mass"}; + // General configurables - Configurable configDebug{"configDebug", true, "If true, fill D0 - J/psi histograms separately"}; + Configurable configDebug{"configDebug", true, "If true, fill D - J/psi histograms separately"}; Configurable storeTableForNorm{"storeTableForNorm", true, "If true, store a table with number of processed collisions for normalisation"}; - Preslice perCollisionDmeson = aod::hf_cand::collisionId; - Preslice perCollisionDmesonWithBdt = aod::hf_cand::collisionId; + enum class DmesonType { + D0, + Dplus + }; + + Preslice perCollisionD0 = aod::hf_cand::collisionId; + Preslice perCollisionD0WithBdt = aod::hf_cand::collisionId; + Preslice perCollisionDplus = aod::hf_cand::collisionId; + Preslice perCollisionDplusWithBdt = aod::hf_cand::collisionId; PresliceUnsorted perCollisionMuons = aod::reducedmuon::collisionId; PresliceUnsorted perCollisionElectrons = aod::reducedtrack::collisionId; SliceCache cache; Filter filterD0Candidates = aod::hf_sel_candidate_d0::isSelD0 >= 1 || aod::hf_sel_candidate_d0::isSelD0bar >= 1; + Filter filterDplusCandidates = aod::hf_sel_candidate_dplus::isSelDplusToPiKPi >= 1; // Define histograms manager float* fValuesDileptonCharmHadron{}; @@ -147,7 +163,7 @@ struct tableMakerJpsiHf { void init(o2::framework::InitContext&) { - std::array doprocess{doprocessJspiToMuMuD0, doprocessJspiToMuMuD0WithBdt, doprocessJspiToEED0, doprocessJspiToEED0WithBdt}; + std::array doprocess{doprocessJspiToMuMuD0, doprocessJspiToMuMuD0WithBdt, doprocessJspiToEED0, doprocessJspiToEED0WithBdt, doprocessJspiToMuMuDplus, doprocessJspiToMuMuDplusWithBdt, doprocessJspiToEEDplus, doprocessJspiToEEDplusWithBdt}; if ((std::accumulate(doprocess.begin(), doprocess.end(), 0)) != 1) { LOGP(fatal, "Only one process function should be enabled! Please check your configuration!"); } @@ -161,11 +177,11 @@ struct tableMakerJpsiHf { fHistMan->AddHistClass("JPsi"); fHistMan->AddHistClass("JPsiDmeson"); dqhistograms::DefineHistograms(fHistMan, "Dmeson", "dilepton-charmhadron", "dmeson"); - if (doprocessJspiToMuMuD0 || doprocessJspiToMuMuD0WithBdt) { + if (doprocessJspiToMuMuD0 || doprocessJspiToMuMuD0WithBdt || doprocessJspiToMuMuDplus || doprocessJspiToMuMuDplusWithBdt) { dqhistograms::DefineHistograms(fHistMan, "JPsi", "dilepton-charmhadron", "jpsitomumu"); dqhistograms::DefineHistograms(fHistMan, "JPsiDmeson", "dilepton-charmhadron", "jpsitomumudmeson"); } - if (doprocessJspiToEED0 || doprocessJspiToEED0WithBdt) { + if (doprocessJspiToEED0 || doprocessJspiToEED0WithBdt || doprocessJspiToEEDplus || doprocessJspiToEEDplusWithBdt) { dqhistograms::DefineHistograms(fHistMan, "JPsi", "dilepton-charmhadron", "jpsitoee"); dqhistograms::DefineHistograms(fHistMan, "JPsiDmeson", "dilepton-charmhadron", "jpsitoeedmeson"); } @@ -173,7 +189,7 @@ struct tableMakerJpsiHf { fOutputList.setObject(fHistMan->GetMainHistogramList()); // cut strings - if (doprocessJspiToMuMuD0 || doprocessJspiToMuMuD0WithBdt) { + if (doprocessJspiToMuMuD0 || doprocessJspiToMuMuD0WithBdt || doprocessJspiToMuMuDplus || doprocessJspiToMuMuDplusWithBdt) { TString cutNamesMuon = fConfigMuonCuts.value; if (!cutNamesMuon.IsNull()) { std::unique_ptr objArray(cutNamesMuon.Tokenize(",")); @@ -182,7 +198,7 @@ struct tableMakerJpsiHf { } } } - if (doprocessJspiToEED0 || doprocessJspiToEED0WithBdt) { + if (doprocessJspiToEED0 || doprocessJspiToEED0WithBdt || doprocessJspiToEEDplus || doprocessJspiToEEDplusWithBdt) { TString cutNamesElectron = fConfigTrackCuts.value; if (!cutNamesElectron.IsNull()) { // if track cuts std::unique_ptr objArray(cutNamesElectron.Tokenize(",")); @@ -262,8 +278,8 @@ struct tableMakerJpsiHf { } // Template function to run pair - hadron combinations - // TODO: generalise to all charm-hadron species - template + // Charm-hadrons: D0, Dplus; can be extended to other species + template void runDileptonDmeson(TDqTrack const& leptons, THfTrack const& dmesons, MyEvents::iterator const& collision, TracksWithExtra const&) { VarManager::ResetValues(0, VarManager::kNVars, fValuesDileptonCharmHadron); @@ -271,12 +287,18 @@ struct tableMakerJpsiHf { bool isCollSel{false}; if (configDebug) { for (auto const& dmeson : dmesons) { - if (!TESTBIT(dmeson.hfflag(), DecayType::D0ToPiK)) { - continue; + if constexpr (TDmeson == DmesonType::D0) { + if (!TESTBIT(dmeson.hfflag(), hf_cand_2prong::DecayType::D0ToPiK)) { + continue; + } + } else if constexpr (TDmeson == DmesonType::Dplus) { + if (!TESTBIT(dmeson.hfflag(), hf_cand_3prong::DecayType::DplusToPiKPi)) { + continue; + } } std::array scores = {999., -999., -999., 999., -999., -999.}; // D0 + D0bar - if constexpr (withBdt) { + if constexpr (withBdt && TDmeson == DmesonType::D0) { if (dmeson.mlProbD0().size() == 3) { for (auto iScore{0u}; iScore < dmeson.mlProbD0().size(); ++iScore) { scores[iScore] = dmeson.mlProbD0()[iScore]; @@ -289,21 +311,43 @@ struct tableMakerJpsiHf { } } - auto rapD0 = hfHelper.yD0(dmeson); + std::array scores_dplus = {999., -999., -999.}; //Dplus + if constexpr (withBdt && TDmeson == DmesonType::Dplus) { + if (dmeson.mlProbDplusToPiKPi().size() == 3) { + for (auto iScore{0u}; iScore < dmeson.mlProbDplusToPiKPi().size(); ++iScore) { + scores_dplus[iScore] = dmeson.mlProbDplusToPiKPi()[iScore]; + } + } + } - if (yCandDmesonMax >= 0. && std::abs(rapD0) > yCandDmesonMax) { - continue; + double rapDmeson; + if constexpr (TDmeson == DmesonType::D0) { + rapDmeson = hfHelper.yD0(dmeson); + } else if constexpr (TDmeson == DmesonType::Dplus) { + rapDmeson = hfHelper.yDplus(dmeson); } - if (dmeson.isSelD0() >= 1) { - VarManager::FillSingleDileptonCharmHadron(dmeson, hfHelper, scores[0], fValuesDileptonCharmHadron); - fHistMan->FillHistClass("Dmeson", fValuesDileptonCharmHadron); - VarManager::ResetValues(0, VarManager::kNVars, fValuesDileptonCharmHadron); + if (yCandDmesonMax >= 0. && std::abs(rapDmeson) > yCandDmesonMax) { + continue; } - if (dmeson.isSelD0bar() >= 1) { - VarManager::FillSingleDileptonCharmHadron(dmeson, hfHelper, scores[3], fValuesDileptonCharmHadron); - fHistMan->FillHistClass("Dmeson", fValuesDileptonCharmHadron); - VarManager::ResetValues(0, VarManager::kNVars, fValuesDileptonCharmHadron); + + if constexpr (TDmeson == DmesonType::D0) { + if (dmeson.isSelD0() >= 1) { + VarManager::FillSingleDileptonCharmHadron(dmeson, hfHelper, scores[0], fValuesDileptonCharmHadron); + fHistMan->FillHistClass("Dmeson", fValuesDileptonCharmHadron); + VarManager::ResetValues(0, VarManager::kNVars, fValuesDileptonCharmHadron); + } + if (dmeson.isSelD0bar() >= 1) { + VarManager::FillSingleDileptonCharmHadron(dmeson, hfHelper, scores[3], fValuesDileptonCharmHadron); + fHistMan->FillHistClass("Dmeson", fValuesDileptonCharmHadron); + VarManager::ResetValues(0, VarManager::kNVars, fValuesDileptonCharmHadron); + } + } else if constexpr (TDmeson == DmesonType::Dplus) { + if (dmeson.isSelDplusToPiKPi() >= 1) { + VarManager::FillSingleDileptonCharmHadron(dmeson, hfHelper, scores_dplus[0], fValuesDileptonCharmHadron); + fHistMan->FillHistClass("Dmeson", fValuesDileptonCharmHadron); + VarManager::ResetValues(0, VarManager::kNVars, fValuesDileptonCharmHadron); + } } } } @@ -330,8 +374,14 @@ struct tableMakerJpsiHf { // loop over D mesons for (auto const& dmeson : dmesons) { - if (!TESTBIT(dmeson.hfflag(), DecayType::D0ToPiK)) { - continue; + if constexpr (TDmeson == DmesonType::D0) { + if (!TESTBIT(dmeson.hfflag(), hf_cand_2prong::DecayType::D0ToPiK)) { + continue; + } + } else if constexpr (TDmeson == DmesonType::Dplus) { + if (!TESTBIT(dmeson.hfflag(), hf_cand_3prong::DecayType::DplusToPiKPi)) { + continue; + } } int dmesonIdx = dmeson.globalIndex(); @@ -340,16 +390,29 @@ struct tableMakerJpsiHf { isDmesonFilled = true; } - auto rapD0 = hfHelper.yD0(dmeson); + double rapDmeson; + if constexpr (TDmeson == DmesonType::D0) { + rapDmeson = hfHelper.yD0(dmeson); + } else if constexpr (TDmeson == DmesonType::Dplus) { + rapDmeson = hfHelper.yDplus(dmeson); + } - if (yCandDmesonMax >= 0. && std::abs(rapD0) > yCandDmesonMax) { + if (yCandDmesonMax >= 0. && std::abs(rapDmeson) > yCandDmesonMax) { continue; } auto massD0 = -1.; auto massD0bar = -1.; + auto massDplus = -1.; + + bool isSelectedDmeson{false}; + if constexpr (TDmeson == DmesonType::D0) { + isSelectedDmeson = dmeson.isSelD0() >= 1 || dmeson.isSelD0bar() >= 1; + } else if constexpr (TDmeson == DmesonType::Dplus) { + isSelectedDmeson = dmeson.isSelDplusToPiKPi() >= 1; + } - if (dmeson.isSelD0() >= 1 || dmeson.isSelD0bar() >= 1) { + if (isSelectedDmeson) { if (!isCollSel) { redCollisions(collision.posX(), collision.posY(), collision.posZ(), collision.numContrib()); isCollSel = true; @@ -370,10 +433,16 @@ struct tableMakerJpsiHf { // one table for each daughter with single track variables redDmesDau0(trackProng0.pt(), trackProng0.eta(), trackProng0.itsNCls(), trackProng0.tpcNClsCrossedRows(), dmeson.nSigTpcPi0(), dmeson.nSigTofPi0(), dmeson.nSigTpcKa0(), dmeson.nSigTofKa0()); redDmesDau1(trackProng1.pt(), trackProng1.eta(), trackProng1.itsNCls(), trackProng1.tpcNClsCrossedRows(), dmeson.nSigTpcPi1(), dmeson.nSigTofPi1(), dmeson.nSigTpcKa1(), dmeson.nSigTofKa1()); + + if constexpr (TDmeson == DmesonType::Dplus) { + auto trackProng2 = dmeson.template prong2_as(); + redDmesDau2(trackProng2.pt(), trackProng2.eta(), trackProng2.itsNCls(), trackProng2.tpcNClsCrossedRows(), dmeson.nSigTpcPi2(), dmeson.nSigTofPi2(), dmeson.nSigTpcKa2(), dmeson.nSigTofKa2()); + } filledDmesonIds.push_back(dmesonIdx); } + std::array scores = {999., -999., -999., 999., -999., -999.}; // D0 + D0bar - if constexpr (withBdt) { + if constexpr (withBdt && TDmeson == DmesonType::D0) { if (!isDmesonFilled) { if (dmeson.mlProbD0().size() == 3) { for (auto iScore{0u}; iScore < dmeson.mlProbD0().size(); ++iScore) { @@ -389,20 +458,44 @@ struct tableMakerJpsiHf { } } - if (dmeson.isSelD0() >= 1) { - massD0 = hfHelper.invMassD0ToPiK(dmeson); - VarManager::FillDileptonCharmHadron(dilepton, dmeson, hfHelper, scores[0], fValuesDileptonCharmHadron); - fHistMan->FillHistClass("JPsiDmeson", fValuesDileptonCharmHadron); - VarManager::ResetValues(0, VarManager::kNVars, fValuesDileptonCharmHadron); - } - if (dmeson.isSelD0bar() >= 1) { - massD0bar = hfHelper.invMassD0barToKPi(dmeson); - VarManager::FillDileptonCharmHadron(dilepton, dmeson, hfHelper, scores[3], fValuesDileptonCharmHadron); - fHistMan->FillHistClass("JPsiDmeson", fValuesDileptonCharmHadron); - VarManager::ResetValues(0, VarManager::kNVars, fValuesDileptonCharmHadron); + std::array scores_dplus = {999., -999., -999.}; + if constexpr (withBdt && TDmeson == DmesonType::Dplus) { + if (!isDmesonFilled) { + if (dmeson.mlProbDplusToPiKPi().size() == 3) { + for (auto iScore{0u}; iScore < dmeson.mlProbDplusToPiKPi().size(); ++iScore) { + scores_dplus[iScore] = dmeson.mlProbDplusToPiKPi()[iScore]; + } + } + redDplusBdts(scores_dplus[0], scores_dplus[1], scores_dplus[2]); + } } - if (!isDmesonFilled) { - redD0Masses(massD0, massD0bar); + + if constexpr (TDmeson == DmesonType::D0) { + if (dmeson.isSelD0() >= 1) { + massD0 = hfHelper.invMassD0ToPiK(dmeson); + VarManager::FillDileptonCharmHadron(dilepton, dmeson, hfHelper, scores[0], fValuesDileptonCharmHadron); + fHistMan->FillHistClass("JPsiDmeson", fValuesDileptonCharmHadron); + VarManager::ResetValues(0, VarManager::kNVars, fValuesDileptonCharmHadron); + } + if (dmeson.isSelD0bar() >= 1) { + massD0bar = hfHelper.invMassD0barToKPi(dmeson); + VarManager::FillDileptonCharmHadron(dilepton, dmeson, hfHelper, scores[3], fValuesDileptonCharmHadron); + fHistMan->FillHistClass("JPsiDmeson", fValuesDileptonCharmHadron); + VarManager::ResetValues(0, VarManager::kNVars, fValuesDileptonCharmHadron); + } + if (!isDmesonFilled) { + redD0Masses(massD0, massD0bar); + } + } else if constexpr (TDmeson == DmesonType::Dplus) { + if (dmeson.isSelDplusToPiKPi() >= 1) { + massDplus = hfHelper.invMassDplusToPiKPi(dmeson); + VarManager::FillDileptonCharmHadron(dilepton, dmeson, hfHelper, scores_dplus[0], fValuesDileptonCharmHadron); + fHistMan->FillHistClass("JPsiDmeson", fValuesDileptonCharmHadron); + VarManager::ResetValues(0, VarManager::kNVars, fValuesDileptonCharmHadron); + } + if (!isDmesonFilled) { + redDmesMasses(massDplus); + } } } } @@ -416,9 +509,48 @@ struct tableMakerJpsiHf { redCollCounter(collisions.size()); } for (auto const& collision : collisions) { - auto groupedDmesonCandidates = selectedD0Candidates.sliceBy(perCollisionDmeson, collision.globalIndex()); + auto groupedDmesonCandidates = selectedD0Candidates.sliceBy(perCollisionD0, collision.globalIndex()); + auto groupedLeptonCandidates = muonCandidates.sliceBy(perCollisionMuons, collision.globalIndex()); + runDileptonDmeson(groupedLeptonCandidates, groupedDmesonCandidates, collision, barrelTracks); + } + } + + // process J/psi(->mumu) - D0 adding the BDT output scores to the D0 table + void processJspiToMuMuD0WithBdt(MyEvents const& collisions, MyMuonTracksSelectedWithColl const& muonCandidates, soa::Filtered const& selectedD0Candidates, TracksWithExtra const& barrelTracks) + { + if (storeTableForNorm) { + redCollCounter(collisions.size()); + } + for (auto const& collision : collisions) { + auto groupedDmesonCandidates = selectedD0Candidates.sliceBy(perCollisionD0WithBdt, collision.globalIndex()); + auto groupedLeptonCandidates = muonCandidates.sliceBy(perCollisionMuons, collision.globalIndex()); + runDileptonDmeson(groupedLeptonCandidates, groupedDmesonCandidates, collision, barrelTracks); + } + } + + // process J/psi(->mumu) - Dplus + void processJspiToMuMuDplus(MyEvents const& collisions, MyMuonTracksSelectedWithColl const& muonCandidates, soa::Filtered const& selectedDplusCandidates, TracksWithExtra const& barrelTracks) + { + if (storeTableForNorm) { + redCollCounter(collisions.size()); + } + for (auto const& collision : collisions) { + auto groupedDmesonCandidates = selectedDplusCandidates.sliceBy(perCollisionDplus, collision.globalIndex()); + auto groupedLeptonCandidates = muonCandidates.sliceBy(perCollisionMuons, collision.globalIndex()); + runDileptonDmeson(groupedLeptonCandidates, groupedDmesonCandidates, collision, barrelTracks); + } + } + + // process J/psi(->mumu) - Dplus adding the BDT output scores to the D0 table + void processJspiToMuMuDplusWithBdt(MyEvents const& collisions, MyMuonTracksSelectedWithColl const& muonCandidates, soa::Filtered const& selectedDplusCandidates, TracksWithExtra const& barrelTracks) + { + if (storeTableForNorm) { + redCollCounter(collisions.size()); + } + for (auto const& collision : collisions) { + auto groupedDmesonCandidates = selectedDplusCandidates.sliceBy(perCollisionDplusWithBdt, collision.globalIndex()); auto groupedLeptonCandidates = muonCandidates.sliceBy(perCollisionMuons, collision.globalIndex()); - runDileptonDmeson(groupedLeptonCandidates, groupedDmesonCandidates, collision, barrelTracks); + runDileptonDmeson(groupedLeptonCandidates, groupedDmesonCandidates, collision, barrelTracks); } } @@ -429,42 +561,59 @@ struct tableMakerJpsiHf { redCollCounter(collisions.size()); } for (auto const& collision : collisions) { - auto groupedDmesonCandidates = selectedD0Candidates.sliceBy(perCollisionDmeson, collision.globalIndex()); + auto groupedDmesonCandidates = selectedD0Candidates.sliceBy(perCollisionD0, collision.globalIndex()); auto groupedLeptonCandidates = electronCandidates.sliceBy(perCollisionElectrons, collision.globalIndex()); - runDileptonDmeson(groupedLeptonCandidates, groupedDmesonCandidates, collision, barrelTracks); + runDileptonDmeson(groupedLeptonCandidates, groupedDmesonCandidates, collision, barrelTracks); } } - // process J/psi(->mumu) - D0 adding the BDT output scores to the D0 table - void processJspiToMuMuD0WithBdt(MyEvents const& collisions, MyMuonTracksSelectedWithColl const& muonCandidates, soa::Filtered const& selectedD0CandidatesWithBdt, TracksWithExtra const& barrelTracks) + // process J/psi(->ee) - D0 adding the BDT output scores to the D0 table + void processJspiToEED0WithBdt(MyEvents const& collisions, MyBarrelTracksSelectedWithColl const& electronCandidates, soa::Filtered const& selectedD0Candidates, TracksWithExtra const& barrelTracks) { if (storeTableForNorm) { redCollCounter(collisions.size()); } for (auto const& collision : collisions) { - auto groupedDmesonCandidates = selectedD0CandidatesWithBdt.sliceBy(perCollisionDmesonWithBdt, collision.globalIndex()); - auto groupedLeptonCandidates = muonCandidates.sliceBy(perCollisionMuons, collision.globalIndex()); - runDileptonDmeson(groupedLeptonCandidates, groupedDmesonCandidates, collision, barrelTracks); + auto groupedDmesonCandidates = selectedD0Candidates.sliceBy(perCollisionD0WithBdt, collision.globalIndex()); + auto groupedLeptonCandidates = electronCandidates.sliceBy(perCollisionElectrons, collision.globalIndex()); + runDileptonDmeson(groupedLeptonCandidates, groupedDmesonCandidates, collision, barrelTracks); } } - // process J/psi(->ee) - D0 adding the BDT output scores to the D0 table - void processJspiToEED0WithBdt(MyEvents const& collisions, MyBarrelTracksSelectedWithColl const& electronCandidates, soa::Filtered const& selectedD0CandidatesWithBdt, TracksWithExtra const& barrelTracks) + // process J/psi(->ee) - Dplus adding the BDT output scores to the D0 table + void processJspiToEEDplus(MyEvents const& collisions, MyBarrelTracksSelectedWithColl const& electronCandidates, soa::Filtered const& selectedDplusCandidates, TracksWithExtra const& barrelTracks) + { + if (storeTableForNorm) { + redCollCounter(collisions.size()); + } + for (auto const& collision : collisions) { + auto groupedDmesonCandidates = selectedDplusCandidates.sliceBy(perCollisionDplus, collision.globalIndex()); + auto groupedLeptonCandidates = electronCandidates.sliceBy(perCollisionElectrons, collision.globalIndex()); + runDileptonDmeson(groupedLeptonCandidates, groupedDmesonCandidates, collision, barrelTracks); + } + } + + // process J/psi(->ee) - Dplus with BDT + void processJspiToEEDplusWithBdt(MyEvents const& collisions, MyBarrelTracksSelectedWithColl const& electronCandidates, soa::Filtered const& selectedDplusCandidates, TracksWithExtra const& barrelTracks) { if (storeTableForNorm) { redCollCounter(collisions.size()); } for (auto const& collision : collisions) { - auto groupedDmesonCandidates = selectedD0CandidatesWithBdt.sliceBy(perCollisionDmesonWithBdt, collision.globalIndex()); auto groupedLeptonCandidates = electronCandidates.sliceBy(perCollisionElectrons, collision.globalIndex()); - runDileptonDmeson(groupedLeptonCandidates, groupedDmesonCandidates, collision, barrelTracks); + auto groupedDmesonCandidates = selectedDplusCandidates.sliceBy(perCollisionDplusWithBdt, collision.globalIndex()); + runDileptonDmeson(groupedLeptonCandidates, groupedDmesonCandidates, collision, barrelTracks); } } PROCESS_SWITCH(tableMakerJpsiHf, processJspiToMuMuD0, "Process J/psi(->mumu) - D0", false); PROCESS_SWITCH(tableMakerJpsiHf, processJspiToEED0, "Process J/psi(->ee) - D0", false); PROCESS_SWITCH(tableMakerJpsiHf, processJspiToMuMuD0WithBdt, "Process J/psi(->mumu) - D0 with BDT", false); + PROCESS_SWITCH(tableMakerJpsiHf, processJspiToMuMuDplus, "Process J/psi(->mumu) - Dplus", false); + PROCESS_SWITCH(tableMakerJpsiHf, processJspiToMuMuDplusWithBdt, "Process J/psi(->mumu) - Dplus with BDT", false); PROCESS_SWITCH(tableMakerJpsiHf, processJspiToEED0WithBdt, "Process J/psi(->ee) - D0 with BDT", false); + PROCESS_SWITCH(tableMakerJpsiHf, processJspiToEEDplus, "Process J/psi(->ee) - Dplus", false); + PROCESS_SWITCH(tableMakerJpsiHf, processJspiToEEDplusWithBdt, "Process J/psi(->ee) - Dplus with BDT", false); }; WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) From 0b248aaebe1694f75f34744f9e79206f19ed092b Mon Sep 17 00:00:00 2001 From: ALICE Action Bot Date: Tue, 8 Sep 2026 14:01:02 +0000 Subject: [PATCH 2/2] Please consider the following formatting changes --- PWGDQ/Core/VarManager.h | 10 +++++----- PWGDQ/DataModel/ReducedInfoTables.h | 4 ++-- PWGDQ/TableProducer/tableMakerJpsiHf.cxx | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/PWGDQ/Core/VarManager.h b/PWGDQ/Core/VarManager.h index dab54d5bb73..8685e866bf7 100644 --- a/PWGDQ/Core/VarManager.h +++ b/PWGDQ/Core/VarManager.h @@ -6610,11 +6610,11 @@ void VarManager::FillSingleDileptonCharmHadron(Cand const& candidate, H hfHelper values[kBdtCharmHadron] = static_cast(bdtScoreCharmHad); } if constexpr (partType == kDplusToPiKPi) { - values[kMassCharmHadron] = hfHelper.invMassDplusToPiKPi(candidate); - values[kPtCharmHadron] = candidate.pt(); - values[kPhiCharmHadron] = candidate.phi(); - values[kRapCharmHadron] = hfHelper.yDplus(candidate); - values[kBdtCharmHadron] = static_cast(bdtScoreCharmHad); + values[kMassCharmHadron] = hfHelper.invMassDplusToPiKPi(candidate); + values[kPtCharmHadron] = candidate.pt(); + values[kPhiCharmHadron] = candidate.phi(); + values[kRapCharmHadron] = hfHelper.yDplus(candidate); + values[kBdtCharmHadron] = static_cast(bdtScoreCharmHad); } } diff --git a/PWGDQ/DataModel/ReducedInfoTables.h b/PWGDQ/DataModel/ReducedInfoTables.h index b91222d06b4..ffd96c9b267 100644 --- a/PWGDQ/DataModel/ReducedInfoTables.h +++ b/PWGDQ/DataModel/ReducedInfoTables.h @@ -1442,11 +1442,11 @@ DECLARE_SOA_TABLE(RedJpDmDmDau2s, "AOD", "REDJPDMDMDAU2", //! jpsidmescorr::NumSigmaTpcTofPiProng2, jpsidmescorr::NumSigmaTpcTofKaProng2); -//General table for Dmeson mass +// General table for Dmeson mass DECLARE_SOA_TABLE(RedJpDmDmesMasss, "AOD", "REDJPDMDMESMASS", //??? jpsidmescorr::MassDmes); -//Special table for D0 mass: particle and antiparticle separated +// Special table for D0 mass: particle and antiparticle separated DECLARE_SOA_TABLE(RedJpDmD0Masss, "AOD", "REDJPDMD0MASS", //! jpsidmescorr::MassD0, jpsidmescorr::MassD0bar); diff --git a/PWGDQ/TableProducer/tableMakerJpsiHf.cxx b/PWGDQ/TableProducer/tableMakerJpsiHf.cxx index f7394d3e6be..d06fbc938f7 100644 --- a/PWGDQ/TableProducer/tableMakerJpsiHf.cxx +++ b/PWGDQ/TableProducer/tableMakerJpsiHf.cxx @@ -311,7 +311,7 @@ struct tableMakerJpsiHf { } } - std::array scores_dplus = {999., -999., -999.}; //Dplus + std::array scores_dplus = {999., -999., -999.}; // Dplus if constexpr (withBdt && TDmeson == DmesonType::Dplus) { if (dmeson.mlProbDplusToPiKPi().size() == 3) { for (auto iScore{0u}; iScore < dmeson.mlProbDplusToPiKPi().size(); ++iScore) {