@@ -156,9 +156,6 @@ struct Alice3Selector3Prong {
156156 bool selectionTopol (const T& cand, float candPt)
157157 {
158158 int const ptBin = findBin (binsPt, candPt);
159- if (ptBin == -1 ) {
160- return false ;
161- }
162159
163160 // check that the cand pT is within the analysis range
164161 if (candPt < ptCandMin || candPt >= ptCandMax) {
@@ -209,11 +206,11 @@ struct Alice3Selector3Prong {
209206 return true ;
210207 }
211208
212- template <typename TCandidate>
209+ template <CharmHadAlice3 CharmHad, typename TCandidate>
213210 bool selectionCandidateMass (int const ptBin, const TCandidate& cand)
214211 {
215212 float massCand{0 .f };
216- if ( std::abs (cand. flagMcRec ()) == o2::constants::physics::Pdg:: kLambdaCPlus ) {
213+ if constexpr (CharmHad == CharmHadAlice3::Lc ) {
217214 if (cand.isSwapped ()) {
218215 massCand = hfHelper.invMassLcToPiKP (cand);
219216 } else {
@@ -244,7 +241,7 @@ struct Alice3Selector3Prong {
244241 // / \param pidTrack0 is the PID status of proton cand track
245242 // / \param pidTrack1 is the PID status of kaon cand track
246243 // / \param pidTrack2 is the PID status of pion cand track
247- template <typename TCand>
244+ template <CharmHadAlice3 CharmHad, typename TCand>
248245 void configurePidMask (const TCand& cand, uint32_t & pidMask)
249246 {
250247
@@ -257,7 +254,7 @@ struct Alice3Selector3Prong {
257254
258255 // prong 0
259256 float ptProng0{cand.ptProng0 ()};
260- if ( std::abs (cand. flagMcRec ()) == o2::constants::physics::Pdg:: kLambdaCPlus ) {
257+ if constexpr (CharmHad == CharmHadAlice3::Lc ) {
261258 isSelPid (cand.nSigTrkPr0 (), PidSels::TrkProng0, ptProng0, nSigmaTrkMax, ptPidTrkMin, ptPidTrkMax);
262259 isSelPid (cand.nSigRichPr0 (), PidSels::RichProng0, ptProng0, nSigmaRichMax, ptPidRichMin, ptPidRichMax);
263260 isSelPid (cand.nSigInnTofPr0 (), PidSels::InnTofProng0, ptProng0, nSigmaInnTofMax, ptPidInnTofMin, ptPidInnTofMax);
@@ -266,7 +263,7 @@ struct Alice3Selector3Prong {
266263
267264 // prong 1
268265 float ptProng1{cand.ptProng1 ()};
269- if ( std::abs (cand. flagMcRec ()) == o2::constants::physics::Pdg:: kLambdaCPlus ) {
266+ if constexpr (CharmHad == CharmHadAlice3::Lc ) {
270267 isSelPid (cand.nSigTrkKa1 (), PidSels::TrkProng1, ptProng1, nSigmaTrkMax, ptPidTrkMin, ptPidTrkMax);
271268 isSelPid (cand.nSigRichKa1 (), PidSels::RichProng1, ptProng1, nSigmaRichMax, ptPidRichMin, ptPidRichMax);
272269 isSelPid (cand.nSigInnTofKa1 (), PidSels::InnTofProng1, ptProng1, nSigmaInnTofMax, ptPidInnTofMin, ptPidInnTofMax);
@@ -275,7 +272,7 @@ struct Alice3Selector3Prong {
275272
276273 // prong 2
277274 float ptProng2{cand.ptProng2 ()};
278- if ( std::abs (cand. flagMcRec ()) == o2::constants::physics::Pdg:: kLambdaCPlus ) {
275+ if constexpr (CharmHad == CharmHadAlice3::Lc ) {
279276 isSelPid (cand.nSigTrkPi2 (), PidSels::TrkProng2, ptProng2, nSigmaTrkMax, ptPidTrkMin, ptPidTrkMax);
280277 isSelPid (cand.nSigRichPi2 (), PidSels::RichProng2, ptProng2, nSigmaRichMax, ptPidRichMin, ptPidRichMax);
281278 isSelPid (cand.nSigInnTofPi2 (), PidSels::InnTofProng2, ptProng2, nSigmaInnTofMax, ptPidInnTofMin, ptPidInnTofMax);
@@ -288,7 +285,7 @@ struct Alice3Selector3Prong {
288285 // / \brief function to apply Lc selections
289286 // / \param cands Lc cand table
290287 // / \param tracks track table
291- template <typename CandType>
288+ template <CharmHadAlice3 CharmHad, typename CandType>
292289 void runSelect3Prong (CandType const & cands)
293290 {
294291 bool isSel = false ;
@@ -312,7 +309,7 @@ struct Alice3Selector3Prong {
312309 }
313310
314311 // Here all cands pass the cut on the mass selection
315- if (!selectionCandidateMass (ptBin, cand)) {
312+ if (!selectionCandidateMass<CharmHad> (ptBin, cand)) {
316313 candSelFlags (isSel, pidMask);
317314 if (applyMl) {
318315 candMlScores (outputMl[0 ], outputMl[1 ], outputMl[2 ]);
@@ -336,7 +333,7 @@ struct Alice3Selector3Prong {
336333 }
337334
338335 // PID selection
339- configurePidMask (cand, pidMask);
336+ configurePidMask<CharmHad> (cand, pidMask);
340337 if (pidMask == 0 ) {
341338 candSelFlags (isSel, pidMask);
342339 if (applyMl) {
@@ -352,7 +349,7 @@ struct Alice3Selector3Prong {
352349 // ML selections
353350 if (applyMl) {
354351
355- std::vector<float > inputFeaturesMassHypo0 = mlResponse.getInputFeatures (cand, std::abs (cand. flagMcRec ()) );
352+ std::vector<float > inputFeaturesMassHypo0 = mlResponse.getInputFeatures (cand);
356353 isSelectedMl = mlResponse.isSelectedMl (inputFeaturesMassHypo0, ptCand, outputMl);
357354 candMlScores (outputMl[0 ], outputMl[1 ], outputMl[2 ]);
358355 if (!isSelectedMl) {
@@ -376,7 +373,7 @@ struct Alice3Selector3Prong {
376373 void processLc (CandsLcWMcTruth const & cands)
377374 {
378375 LOG (info) << " Starting Lc 3-prong cand selection: " << cands.size () << " cands to be processed." ;
379- runSelect3Prong (cands);
376+ runSelect3Prong<CharmHadAlice3::Lc> (cands);
380377 }
381378 PROCESS_SWITCH (Alice3Selector3Prong, processLc, " Process 3 prong selection for Lc" , true );
382379};
0 commit comments