@@ -485,6 +485,7 @@ struct HfTaskLc {
485485 auto fillTHnRecSig = [&](bool isPKPi) {
486486 const auto massLc = isPKPi ? HfHelper::invMassLcToPKPi (candidate) : HfHelper::invMassLcToPiKP (candidate);
487487
488+ std::vector<double > valuesToFill;
488489 if constexpr (FillMl) {
489490 const auto & mlProb = isPKPi ? candidate.mlProbLcToPKPi () : candidate.mlProbLcToPiKP ();
490491 if (mlProb.size () == NumberOfMlClasses) {
@@ -493,22 +494,21 @@ struct HfTaskLc {
493494 outputFD = mlProb[MlClassNonPrompt]; // / non-prompt score
494495 }
495496 // / Fill the ML outputScores and variables of candidate
496- std::vector<double > valuesToFill{massLc, pt, cent, outputBkg, outputPrompt, outputFD, static_cast <double >(numPvContributors), ptRecB, static_cast <double >(originType)};
497- if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) {
498- valuesToFill.push_back (occ);
499- }
500- if (storeProperLifetime) {
501- valuesToFill.push_back (properLifetime);
502- }
497+ valuesToFill.reserve (registry.get <THnSparse>(HIST (" hnLcVarsWithBdt" ))->GetNdimensions ());
498+ valuesToFill.insert (valuesToFill.end (), {massLc, pt, cent, outputBkg, outputPrompt, outputFD, static_cast <double >(numPvContributors), ptRecB, static_cast <double >(originType)});
499+ } else {
500+ valuesToFill.reserve (registry.get <THnSparse>(HIST (" hnLcVars" ))->GetNdimensions ());
501+ valuesToFill.insert (valuesToFill.end (), {massLc, pt, cent, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, static_cast <double >(numPvContributors), ptRecB, static_cast <double >(originType)});
502+ }
503+ if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) {
504+ valuesToFill.push_back (occ);
505+ }
506+ if (storeProperLifetime) {
507+ valuesToFill.push_back (properLifetime);
508+ }
509+ if constexpr (FillMl) {
503510 registry.get <THnSparse>(HIST (" hnLcVarsWithBdt" ))->Fill (valuesToFill.data ());
504511 } else {
505- std::vector<double > valuesToFill{massLc, pt, cent, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, static_cast <double >(numPvContributors), ptRecB, static_cast <double >(originType)};
506- if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) {
507- valuesToFill.push_back (occ);
508- }
509- if (storeProperLifetime) {
510- valuesToFill.push_back (properLifetime);
511- }
512512 registry.get <THnSparse>(HIST (" hnLcVars" ))->Fill (valuesToFill.data ());
513513 }
514514 };
@@ -678,6 +678,7 @@ struct HfTaskLc {
678678 auto fillTHnData = [&](bool isPKPi) {
679679 const auto massLc = isPKPi ? HfHelper::invMassLcToPKPi (candidate) : HfHelper::invMassLcToPiKP (candidate);
680680
681+ std::vector<double > valuesToFill;
681682 if constexpr (FillMl) {
682683 const auto & mlProb = isPKPi ? candidate.mlProbLcToPKPi () : candidate.mlProbLcToPiKP ();
683684 if (mlProb.size () == NumberOfMlClasses) {
@@ -686,22 +687,21 @@ struct HfTaskLc {
686687 outputFD = mlProb[MlClassNonPrompt]; // / non-prompt score
687688 }
688689 // / Fill the ML outputScores and variables of candidate
689- std::vector<double > valuesToFill{massLc, pt, cent, outputBkg, outputPrompt, outputFD, static_cast <double >(numPvContributors)};
690- if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) {
691- valuesToFill.push_back (occ);
692- }
693- if (storeProperLifetime) {
694- valuesToFill.push_back (properLifetime);
695- }
690+ valuesToFill.reserve (registry.get <THnSparse>(HIST (" hnLcVarsWithBdt" ))->GetNdimensions ());
691+ valuesToFill.insert (valuesToFill.end (), {massLc, pt, cent, outputBkg, outputPrompt, outputFD, static_cast <double >(numPvContributors)});
692+ } else {
693+ valuesToFill.reserve (registry.get <THnSparse>(HIST (" hnLcVars" ))->GetNdimensions ());
694+ valuesToFill.insert (valuesToFill.end (), {massLc, pt, cent, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, static_cast <double >(numPvContributors)});
695+ }
696+ if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) {
697+ valuesToFill.push_back (occ);
698+ }
699+ if (storeProperLifetime) {
700+ valuesToFill.push_back (properLifetime);
701+ }
702+ if constexpr (FillMl) {
696703 registry.get <THnSparse>(HIST (" hnLcVarsWithBdt" ))->Fill (valuesToFill.data ());
697704 } else {
698- std::vector<double > valuesToFill{massLc, pt, cent, ptProng0, ptProng1, ptProng2, chi2PCA, decayLength, cpa, static_cast <double >(numPvContributors)};
699- if (storeOccupancy && occEstimator != o2::hf_occupancy::OccupancyEstimator::None) {
700- valuesToFill.push_back (occ);
701- }
702- if (storeProperLifetime) {
703- valuesToFill.push_back (properLifetime);
704- }
705705 registry.get <THnSparse>(HIST (" hnLcVars" ))->Fill (valuesToFill.data ());
706706 }
707707 };
0 commit comments