Skip to content

Commit 2fe286a

Browse files
committed
check HfMlLcToPKPi size when applyMl == true
1 parent 33bb1c0 commit 2fe286a

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

PWGHF/TableProducer/treeCreatorLcToPKPi.cxx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,21 @@ struct HfTreeCreatorLcToPKPi {
478478
}
479479
}
480480

481+
/// \brief function to check when applyMl == true if the HfMlLcToPKPi size is equal to that of the table with candidates
482+
/// \param candidates Lc->pKpi candidate table
483+
/// \param candidateMlScores ML scores table
484+
template <typename CandType>
485+
void checkHfMlLcToPKPiSize(CandType const& candidates, aod::HfMlLcToPKPi const& candidateMlScores)
486+
{
487+
if (applyMl) {
488+
const auto candidatesSize = candidates.size();
489+
const auto candidateMlScoresSize = candidateMlScores.size();
490+
if (candidatesSize != candidateMlScoresSize) {
491+
LOG(fatal) << "Tables with candidates and ML scores have different sizes (" << candidatesSize << " vs " << candidateMlScoresSize << ") while applyMl == true. Check if applyMl is enabled in the candidateSelectorLc";
492+
}
493+
}
494+
}
495+
481496
/// \brief function to fill event properties
482497
/// \param collisions Collision table
483498
template <bool UseCentrality, bool IsMc, typename Colls>
@@ -918,6 +933,7 @@ struct HfTreeCreatorLcToPKPi {
918933
soa::Join<aod::McParticles, aod::HfCand3ProngMcGen> const& particles,
919934
soa::Join<TracksWPid, o2::aod::McTrackLabels> const&, aod::BCs const&)
920935
{
936+
checkHfMlLcToPKPiSize(candidates, candidateMlScores);
921937

922938
constexpr bool IsMc = true;
923939

@@ -1105,6 +1121,7 @@ struct HfTreeCreatorLcToPKPi {
11051121
aod::HfMlLcToPKPi const& candidateMlScores,
11061122
TracksWPid const&, aod::BCs const&)
11071123
{
1124+
checkHfMlLcToPKPiSize(candidates, candidateMlScores);
11081125

11091126
constexpr bool IsMc = false;
11101127

0 commit comments

Comments
 (0)