@@ -39,7 +39,8 @@ enum Selections : uint8_t {
3939enum DecayChannel : uint8_t {
4040 Ds1ToDstarK0s = 0 ,
4141 Ds2StarToDplusK0s,
42- XcToDplusLambda
42+ XcToDplusLambda,
43+ LambdaDminus
4344};
4445enum V0Type : uint8_t {
4546 K0s = 0 ,
@@ -61,6 +62,8 @@ auto vecBins = std::vector<double>{binsPt, binsPt + nBins + 1};
6162struct HfCandidateCreatorCharmResoReduced {
6263 // Produces: Tables with resonance info
6364 Produces<aod::HfCandCharmReso> rowCandidateReso;
65+ // Optional D daughter ML scores table
66+ Produces<aod::HfCharmResoMLs> mlScores;
6467
6568 // Configurables
6669 Configurable<double > invMassWindowD{" invMassWindowD" , 0.5 , " invariant-mass window for D candidates (GeV/c2)" };
@@ -70,6 +73,8 @@ struct HfCandidateCreatorCharmResoReduced {
7073 // Hist Axis
7174 Configurable<std::vector<double >> binsPt{" binsPt" , std::vector<double >{vecBins}, " pT bin limits" };
7275
76+ using reducedDWithMl = soa::Join<aod::HfRed3PrNoTrks, aod::HfRed3ProngsMl>;
77+
7378 // Partition of V0 candidates based on v0Type
7479 Partition<aod::HfRedVzeros> candidatesK0s = aod::hf_reso_cand_reduced::v0Type == (uint8_t )1 || aod::hf_reso_cand_reduced::v0Type == (uint8_t )3 || aod::hf_reso_cand_reduced::v0Type == (uint8_t )5 ;
7580 Partition<aod::HfRedVzeros> candidatesLambda = aod::hf_reso_cand_reduced::v0Type == (uint8_t )2 || aod::hf_reso_cand_reduced::v0Type == (uint8_t )4 ;
@@ -85,14 +90,17 @@ struct HfCandidateCreatorCharmResoReduced {
8590
8691 void init (InitContext const &)
8792 {
88- for (const auto & value : vecBins) {
89- LOGF (info, " bin limit %f" , value);
93+ // check that only one process function is enabled
94+ std::array<bool , 8 > doprocess{doprocessDs2StarToDplusK0s, doprocessDs2StarToDplusK0sWithMl, doprocessDs1ToDstarK0s, doprocessDs1ToDstarK0sWithMl, doprocessXcToDplusLambda, doprocessXcToDplusLambdaWithMl, doprocessLambdaDminus, doprocessLambdaDminusWithMl};
95+ if ((std::accumulate (doprocess.begin (), doprocess.end (), 0 )) != 1 ) {
96+ LOGP (fatal, " Only one process function should be enabled! Please check your configuration!" );
9097 }
91- const AxisSpec axisPt{(std::vector<double >)vecBins, " #it{p}_{T} (GeV/#it{c})" };
9298 // histograms
93- registry.add (" hMassDs1" , " Ds1 candidates;m_{Ds1} - m_{D^{*}} (GeV/#it{c}^{2});entries" , {HistType::kTH2F , {{100 , 2.4 , 2.7 }, {(std::vector<double >)binsPt, " #it{p}_{T} (GeV/#it{c})" }}});
94- registry.add (" hMassDs2Star" , " Ds^{*}2 candidates; Ds^{*}2 - m_{D^{#plus}} (GeV/#it{c}^{2}) ;entries" , {HistType::kTH2F , {{100 , 2.4 , 2.7 }, {(std::vector<double >)binsPt, " #it{p}_{T} (GeV/#it{c})" }}});
95- registry.add (" hMassXcRes" , " XcRes candidates; XcRes - m_{D^{#plus}} (GeV/#it{c}^{2}) ;entries" , {HistType::kTH2F , {{100 , 2.9 , 3.3 }, {(std::vector<double >)binsPt, " #it{p}_{T} (GeV/#it{c})" }}});
99+ const AxisSpec axisPt{(std::vector<double >)vecBins, " #it{p}_{T} (GeV/#it{c})" };
100+ registry.add (" hMassDs1" , " Ds1 candidates;m_{Ds1} (GeV/#it{c}^{2});entries" , {HistType::kTH2F , {{100 , 2.4 , 2.7 }, {(std::vector<double >)binsPt, " #it{p}_{T} (GeV/#it{c})" }}});
101+ registry.add (" hMassDs2Star" , " Ds^{*}2 candidates; m_Ds^{*}2 (GeV/#it{c}^{2}) ;entries" , {HistType::kTH2F , {{100 , 2.4 , 2.7 }, {(std::vector<double >)binsPt, " #it{p}_{T} (GeV/#it{c})" }}});
102+ registry.add (" hMassXcRes" , " XcRes candidates; m_XcRes (GeV/#it{c}^{2}) ;entries" , {HistType::kTH2F , {{100 , 2.9 , 3.3 }, {(std::vector<double >)binsPt, " #it{p}_{T} (GeV/#it{c})" }}});
103+ registry.add (" hMassLambdaDminus" , " LambdaDminus candidates; m_LambdaDminus (GeV/#it{c}^{2}) ;entries" , {HistType::kTH2F , {{100 , 2.9 , 3.3 }, {(std::vector<double >)binsPt, " #it{p}_{T} (GeV/#it{c})" }}});
96104 if (activateQA) {
97105 constexpr int kNBinsSelections = Selections::NSelSteps;
98106 std::string labels[kNBinsSelections ];
@@ -105,19 +113,21 @@ struct HfCandidateCreatorCharmResoReduced {
105113 registry.get <TH1 >(HIST (" hSelections" ))->GetXaxis ()->SetBinLabel (iBin + 1 , labels[iBin].data ());
106114 }
107115 }
108-
116+ // mass constants
109117 massK0 = o2::constants::physics::MassK0Short;
110118 massLambda = o2::constants::physics::MassLambda;
111119 massDplus = o2::constants::physics::MassDPlus;
112120 massDstar = o2::constants::physics::MassDStar;
113121 }
114-
122+ // / Basic selection of D candidates
123+ // / \param candD is the reduced D meson candidate
124+ // / \return true if selections are passed
115125 template <DecayChannel channel, typename DRedTable>
116126 bool isDSelected (DRedTable const & candD)
117127 {
118128 float massD{0 .};
119129 // slection on D candidate mass
120- if (channel == DecayChannel::Ds2StarToDplusK0s || channel == DecayChannel::XcToDplusLambda) {
130+ if (channel == DecayChannel::Ds2StarToDplusK0s || channel == DecayChannel::XcToDplusLambda || channel == DecayChannel::LambdaDminus ) {
121131 massD = massDplus;
122132 } else if (channel == DecayChannel::Ds1ToDstarK0s) {
123133 massD = massDstar;
@@ -128,19 +138,27 @@ struct HfCandidateCreatorCharmResoReduced {
128138 return true ;
129139 }
130140
141+ // / Basic selection of V0 candidates
142+ // / \param candV0 is the reduced V0 candidate
143+ // / \param candD is the reduced D meson candidate
144+ // / \return true if selections are passed
131145 template <DecayChannel channel, typename DRedTable, typename V0RedTable>
132146 bool isV0Selected (V0RedTable const & candV0, DRedTable const & candD)
133147 {
134148 float massV0{0 .};
135149 float invMassV0{0 .};
150+
136151 // slection on V0 candidate mass
137152 if (channel == DecayChannel::Ds2StarToDplusK0s || channel == DecayChannel::Ds1ToDstarK0s) {
138153 massV0 = massK0;
139154 invMassV0 = candV0.invMassK0s ();
140- } else if (channel == DecayChannel::XcToDplusLambda) {
155+ } else if (channel == DecayChannel::XcToDplusLambda || channel == DecayChannel::LambdaDminus ) {
141156 massV0 = massLambda;
157+ int wsFact{1 };
158+ if (channel == DecayChannel::LambdaDminus)
159+ wsFact = -1 ;
142160 uint8_t targetV0Type{0 };
143- if (candD.dType () > 0 ) {
161+ if (wsFact * candD.dType () > 0 ) {
144162 invMassV0 = candV0.invMassLambda ();
145163 targetV0Type = V0Type::Lambda;
146164 } else {
@@ -157,7 +175,7 @@ struct HfCandidateCreatorCharmResoReduced {
157175 return true ;
158176 }
159177
160- template <DecayChannel channel, typename Coll, typename DRedTable, typename V0RedTable>
178+ template <bool fillMl, DecayChannel channel, typename Coll, typename DRedTable, typename V0RedTable>
161179 void runCandidateCreation (Coll const & collisions,
162180 DRedTable const & candsD,
163181 V0RedTable const & candsV0)
@@ -213,6 +231,15 @@ struct HfCandidateCreatorCharmResoReduced {
213231 invMassReso = RecoDecay::m (std::array{pVecD, pVecV0}, std::array{massDplus, massLambda});
214232 registry.fill (HIST (" hMassXcRes" ), invMassReso, ptReso);
215233 break ;
234+ case DecayChannel::LambdaDminus:
235+ if (candD.dType () < 0 ) {
236+ invMassV0 = candV0.invMassLambda ();
237+ } else {
238+ invMassV0 = candV0.invMassAntiLambda ();
239+ }
240+ invMassReso = RecoDecay::m (std::array{pVecD, pVecV0}, std::array{massDplus, massLambda});
241+ registry.fill (HIST (" hMassLambdaDminus" ), invMassReso, ptReso);
242+ break ;
216243 default :
217244 break ;
218245 }
@@ -227,6 +254,9 @@ struct HfCandidateCreatorCharmResoReduced {
227254 candV0.cpa (),
228255 candV0.dca (),
229256 candV0.radius ());
257+ if constexpr (fillMl) {
258+ mlScores (candD.mlScoreBkgMassHypo0 (), candD.mlScorePromptMassHypo0 (), candD.mlScoreNonpromptMassHypo0 ());
259+ }
230260 }
231261 }
232262 } // main function
@@ -235,25 +265,66 @@ struct HfCandidateCreatorCharmResoReduced {
235265 aod::HfRed3PrNoTrks const & candsD,
236266 aod::HfRedVzeros const &)
237267 {
238- runCandidateCreation<DecayChannel::Ds2StarToDplusK0s>(collision, candsD, candidatesK0s);
268+ runCandidateCreation<false , DecayChannel::Ds2StarToDplusK0s>(collision, candsD, candidatesK0s);
239269 }
240- PROCESS_SWITCH (HfCandidateCreatorCharmResoReduced, processDs2StarToDplusK0s, " Process Ds2* candidates without MC info and without ML info" , true );
270+ PROCESS_SWITCH (HfCandidateCreatorCharmResoReduced, processDs2StarToDplusK0s, " Process Ds2* candidates without ML info" , true );
271+
272+ void processDs2StarToDplusK0sWithMl (aod::HfRedCollisions::iterator const & collision,
273+ soa::Join<aod::HfRed3PrNoTrks, aod::HfRed3ProngsMl> const & candsD,
274+ aod::HfRedVzeros const &)
275+ {
276+ runCandidateCreation<true , DecayChannel::Ds2StarToDplusK0s>(collision, candsD, candidatesK0s);
277+ }
278+ PROCESS_SWITCH (HfCandidateCreatorCharmResoReduced, processDs2StarToDplusK0sWithMl, " Process Ds2* candidates with Ml info" , false );
241279
242280 void processDs1ToDstarK0s (aod::HfRedCollisions::iterator const & collision,
243281 aod::HfRed3PrNoTrks const & candsD,
244282 aod::HfRedVzeros const &)
245283 {
246- runCandidateCreation<DecayChannel::Ds1ToDstarK0s>(collision, candsD, candidatesK0s);
284+ runCandidateCreation<false , DecayChannel::Ds1ToDstarK0s>(collision, candsD, candidatesK0s);
285+ }
286+ PROCESS_SWITCH (HfCandidateCreatorCharmResoReduced, processDs1ToDstarK0s, " Process Ds1 candidates without Ml info" , false );
287+
288+ void processDs1ToDstarK0sWithMl (aod::HfRedCollisions::iterator const & collision,
289+ soa::Join<aod::HfRed3PrNoTrks, aod::HfRed3ProngsMl> const & candsD,
290+ aod::HfRedVzeros const &)
291+ {
292+ runCandidateCreation<true , DecayChannel::Ds1ToDstarK0s>(collision, candsD, candidatesK0s);
247293 }
248- PROCESS_SWITCH (HfCandidateCreatorCharmResoReduced, processDs1ToDstarK0s , " Process Ds1 candidates without MC info and without ML info" , false );
294+ PROCESS_SWITCH (HfCandidateCreatorCharmResoReduced, processDs1ToDstarK0sWithMl , " Process Ds1 candidates with Ml info" , false );
249295
250296 void processXcToDplusLambda (aod::HfRedCollisions::iterator const & collision,
251297 aod::HfRed3PrNoTrks const & candsD,
252298 aod::HfRedVzeros const &)
253299 {
254- runCandidateCreation<DecayChannel::XcToDplusLambda>(collision, candsD, candidatesLambda);
300+ runCandidateCreation<false , DecayChannel::XcToDplusLambda>(collision, candsD, candidatesLambda);
301+ }
302+ PROCESS_SWITCH (HfCandidateCreatorCharmResoReduced, processXcToDplusLambda, " Process Xc candidates without Ml info" , false );
303+
304+ void processXcToDplusLambdaWithMl (aod::HfRedCollisions::iterator const & collision,
305+ soa::Join<aod::HfRed3PrNoTrks, aod::HfRed3ProngsMl> const & candsD,
306+ aod::HfRedVzeros const &)
307+ {
308+ runCandidateCreation<true , DecayChannel::XcToDplusLambda>(collision, candsD, candidatesLambda);
255309 }
256- PROCESS_SWITCH (HfCandidateCreatorCharmResoReduced, processXcToDplusLambda, " Process Xc candidates without MC info and without ML info" , false );
310+ PROCESS_SWITCH (HfCandidateCreatorCharmResoReduced, processXcToDplusLambdaWithMl, " Process Xc candidates with Ml info" , false );
311+
312+ void processLambdaDminus (aod::HfRedCollisions::iterator const & collision,
313+ aod::HfRed3PrNoTrks const & candsD,
314+ aod::HfRedVzeros const &)
315+ {
316+ runCandidateCreation<false , DecayChannel::LambdaDminus>(collision, candsD, candidatesLambda);
317+ }
318+ PROCESS_SWITCH (HfCandidateCreatorCharmResoReduced, processLambdaDminus, " Process LambdaDminus candidates without Ml info" , false );
319+
320+ void processLambdaDminusWithMl (aod::HfRedCollisions::iterator const & collision,
321+ soa::Join<aod::HfRed3PrNoTrks, aod::HfRed3ProngsMl> const & candsD,
322+ aod::HfRedVzeros const &)
323+ {
324+ runCandidateCreation<true , DecayChannel::LambdaDminus>(collision, candsD, candidatesLambda);
325+ }
326+ PROCESS_SWITCH (HfCandidateCreatorCharmResoReduced, processLambdaDminusWithMl, " Process LambdaDminus candidates with Ml info" , false );
327+
257328}; // struct
258329
259330WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
0 commit comments