@@ -586,14 +586,15 @@ struct HfTaskLc {
586586 double massLc (-1 );
587587 double outputBkg (-1 ), outputPrompt (-1 ), outputFD (-1 );
588588 const float properLifetime = hfHelper.ctLc (candidate) * CtToProperLifetimePs;
589- if (candidate.isSelLcToPKPi () >= selectionFlagLc) {
590- massLc = hfHelper.invMassLcToPKPi (candidate);
589+
590+ auto fillTHnData = [&](bool isPKPi) {
591+ massLc = isPKPi ? hfHelper.invMassLcToPKPi (candidate) : hfHelper.invMassLcToPiKP (candidate);
591592
592593 if constexpr (fillMl) {
593594 if (candidate.mlProbLcToPKPi ().size () == NumberOfMlClasses) {
594- outputBkg = candidate.mlProbLcToPKPi ()[MlClassBackground]; // / bkg score
595- outputPrompt = candidate.mlProbLcToPKPi ()[MlClassPrompt]; // / prompt score
596- outputFD = candidate.mlProbLcToPKPi ()[MlClassNonPrompt]; // / non-prompt score
595+ outputBkg = isPKPi ? candidate.mlProbLcToPKPi ()[MlClassBackground] : candidate. mlProbLcToPiKP ()[MlClassBackground]; // / bkg score
596+ outputPrompt = isPKPi ? candidate.mlProbLcToPKPi ()[MlClassPrompt] : candidate. mlProbLcToPiKP ()[MlClassPrompt]; // / prompt score
597+ outputFD = isPKPi ? candidate.mlProbLcToPKPi ()[MlClassNonPrompt] : candidate. mlProbLcToPiKP ()[MlClassNonPrompt]; // / non-prompt score
597598 }
598599 // / Fill the ML outputScores and variables of candidate
599600 std::vector<double > valuesToFill{massLc, pt, cent, outputBkg, outputPrompt, outputFD, static_cast <double >(numPvContributors)};
@@ -614,35 +615,13 @@ struct HfTaskLc {
614615 }
615616 registry.get <THnSparse>(HIST (" hnLcVars" ))->Fill (valuesToFill.data ());
616617 }
618+ };
619+
620+ if (candidate.isSelLcToPKPi () >= selectionFlagLc) {
621+ fillTHnData (true );
617622 }
618623 if (candidate.isSelLcToPiKP () >= selectionFlagLc) {
619- massLc = hfHelper.invMassLcToPiKP (candidate);
620-
621- if constexpr (fillMl) {
622- if (candidate.mlProbLcToPiKP ().size () == NumberOfMlClasses) {
623- outputBkg = candidate.mlProbLcToPiKP ()[MlClassBackground]; // / bkg score
624- outputPrompt = candidate.mlProbLcToPiKP ()[MlClassPrompt]; // / prompt score
625- outputFD = candidate.mlProbLcToPiKP ()[MlClassNonPrompt]; // / non-prompt score
626- }
627- // / Fill the ML outputScores and variables of candidate
628- std::vector<double > valuesToFill{massLc, pt, cent, outputBkg, outputPrompt, outputFD, static_cast <double >(numPvContributors)};
629- if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) {
630- valuesToFill.push_back (occ);
631- }
632- if (storeProperLifetime) {
633- valuesToFill.push_back (properLifetime);
634- }
635- registry.get <THnSparse>(HIST (" hnLcVarsWithBdt" ))->Fill (valuesToFill.data ());
636- } else {
637- std::vector<double > valuesToFill{massLc, pt, cent, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, static_cast <double >(numPvContributors)};
638- if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) {
639- valuesToFill.push_back (occ);
640- }
641- if (storeProperLifetime) {
642- valuesToFill.push_back (properLifetime);
643- }
644- registry.get <THnSparse>(HIST (" hnLcVars" ))->Fill (valuesToFill.data ());
645- }
624+ fillTHnData (false );
646625 }
647626 }
648627 }
0 commit comments