@@ -396,14 +396,15 @@ struct HfTaskLc {
396396 double massLc (-1 );
397397 double outputBkg (-1 ), outputPrompt (-1 ), outputFD (-1 );
398398 const float properLifetime = hfHelper.ctLc (candidate) * CtToProperLifetimePs;
399- if ((candidate.isSelLcToPKPi () >= selectionFlagLc) && pdgCodeProng0 == kProton ) {
400- massLc = hfHelper.invMassLcToPKPi (candidate);
399+
400+ auto fillTHnRecSig = [&](bool isPKPi) {
401+ massLc = isPKPi ? hfHelper.invMassLcToPKPi (candidate) : hfHelper.invMassLcToPiKP (candidate);
401402
402403 if constexpr (fillMl) {
403404 if (candidate.mlProbLcToPKPi ().size () == NumberOfMlClasses) {
404- outputBkg = candidate.mlProbLcToPKPi ()[MlClassBackground]; // / bkg score
405- outputPrompt = candidate.mlProbLcToPKPi ()[MlClassPrompt]; // / prompt score
406- outputFD = candidate.mlProbLcToPKPi ()[MlClassNonPrompt]; // / non-prompt score
405+ outputBkg = isPKPi ? candidate.mlProbLcToPKPi ()[MlClassBackground] : candidate. mlProbLcToPiKP ()[MlClassBackground]; // / bkg score
406+ outputPrompt = isPKPi ? candidate.mlProbLcToPKPi ()[MlClassPrompt] : candidate. mlProbLcToPiKP ()[MlClassPrompt]; // / prompt score
407+ outputFD = isPKPi ? candidate.mlProbLcToPKPi ()[MlClassNonPrompt] : candidate. mlProbLcToPiKP ()[MlClassNonPrompt]; // / non-prompt score
407408 }
408409 // / Fill the ML outputScores and variables of candidate
409410 std::vector<double > valuesToFill{massLc, pt, cent, outputBkg, outputPrompt, outputFD, static_cast <double >(numPvContributors), ptRecB, static_cast <double >(originType)};
@@ -424,35 +425,13 @@ struct HfTaskLc {
424425 }
425426 registry.get <THnSparse>(HIST (" hnLcVars" ))->Fill (valuesToFill.data ());
426427 }
428+ };
429+
430+ if ((candidate.isSelLcToPKPi () >= selectionFlagLc) && pdgCodeProng0 == kProton ) {
431+ fillTHnRecSig (true );
427432 }
428433 if ((candidate.isSelLcToPiKP () >= selectionFlagLc) && pdgCodeProng0 == kPiPlus ) {
429- massLc = hfHelper.invMassLcToPiKP (candidate);
430-
431- if constexpr (fillMl) {
432- if (candidate.mlProbLcToPiKP ().size () == NumberOfMlClasses) {
433- outputBkg = candidate.mlProbLcToPiKP ()[MlClassBackground]; // / bkg score
434- outputPrompt = candidate.mlProbLcToPiKP ()[MlClassPrompt]; // / prompt score
435- outputFD = candidate.mlProbLcToPiKP ()[MlClassNonPrompt]; // / non-prompt score
436- }
437- // / Fill the ML outputScores and variables of candidate (todo: add multiplicity)
438- std::vector<double > valuesToFill{massLc, pt, cent, outputBkg, outputPrompt, outputFD, static_cast <double >(numPvContributors), ptRecB, static_cast <double >(originType)};
439- if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) {
440- valuesToFill.push_back (occ);
441- }
442- if (storeProperLifetime) {
443- valuesToFill.push_back (properLifetime);
444- }
445- registry.get <THnSparse>(HIST (" hnLcVarsWithBdt" ))->Fill (valuesToFill.data ());
446- } else {
447- std::vector<double > valuesToFill{massLc, pt, cent, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, static_cast <double >(numPvContributors), ptRecB, static_cast <double >(originType)};
448- if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) {
449- valuesToFill.push_back (occ);
450- }
451- if (storeProperLifetime) {
452- valuesToFill.push_back (properLifetime);
453- }
454- registry.get <THnSparse>(HIST (" hnLcVars" ))->Fill (valuesToFill.data ());
455- }
434+ fillTHnRecSig (false );
456435 }
457436 }
458437 }
0 commit comments