From d10e854829d397d1028ea2988a55a1889e050068 Mon Sep 17 00:00:00 2001 From: Fabrizio Grosa Date: Wed, 12 Aug 2026 13:59:57 +0200 Subject: [PATCH 1/2] Add missing protection in femto dream container in case of HF-V0 combinations --- PWGCF/FemtoDream/Core/femtoDreamContainer.h | 23 +++++++++++-------- .../producerCharmHadronsV0FemtoDream.cxx | 3 --- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/PWGCF/FemtoDream/Core/femtoDreamContainer.h b/PWGCF/FemtoDream/Core/femtoDreamContainer.h index 8a8f05b6879..0625c3e3d18 100644 --- a/PWGCF/FemtoDream/Core/femtoDreamContainer.h +++ b/PWGCF/FemtoDream/Core/femtoDreamContainer.h @@ -367,18 +367,21 @@ class FemtoDreamContainer if constexpr (isMC) { if constexpr (isHF) { // calculate the femto observable and the mT with MC truth information - if constexpr (mFemtoObs == femtoDreamContainer::Observable::kstar) { - femtoObsMC = FemtoDreamMath::getkstar(part1.fdMCParticle(), mMassOne, part2, mMassTwo); - } - const float mTMC = FemtoDreamMath::getmT(part1.fdMCParticle(), mMassOne, part2, mMassTwo); - - if (std::abs(part1.fdMCParticle().pdgMCTruth()) == mPDGOne) { // Note: all pair-histogramms are filled with MC truth information ONLY in case of non-fake candidates - setPair_base(femtoObsMC, mTMC, part1.fdMCParticle(), part2, mult, multPercentile, use4dplots, extendedplots); - setPair_MC(femtoObsMC, femtoObs, mT, mult, part1.fdMCParticle().partOriginMCTruth(), part2.flagMc(), smearingByOrigin); + if (part1.has_fdMCParticle()) { + if constexpr (mFemtoObs == femtoDreamContainer::Observable::kstar) { + femtoObsMC = FemtoDreamMath::getkstar(part1.fdMCParticle(), mMassOne, part2, mMassTwo); + } + const float mTMC = FemtoDreamMath::getmT(part1.fdMCParticle(), mMassOne, part2, mMassTwo); + + if (std::abs(part1.fdMCParticle().pdgMCTruth()) == mPDGOne) { // Note: all pair-histogramms are filled with MC truth information ONLY in case of non-fake candidates + setPair_base(femtoObsMC, mTMC, part1.fdMCParticle(), part2, mult, multPercentile, use4dplots, extendedplots); + setPair_MC(femtoObsMC, femtoObs, mT, mult, part1.fdMCParticle().partOriginMCTruth(), part2.flagMc(), smearingByOrigin); + } else { + mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[o2::aod::femtodreamMCparticle::MCType::kTruth]) + HIST("/hFakePairsCounter"), 0); + } } else { - mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[o2::aod::femtodreamMCparticle::MCType::kTruth]) + HIST("/hFakePairsCounter"), 0); + mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[o2::aod::femtodreamMCparticle::MCType::kTruth]) + HIST("/hNoMCtruthPairsCounter"), 0); } - } else if (part1.has_fdMCParticle() && part2.has_fdMCParticle()) { // calculate the femto observable and the mT with MC truth information if constexpr (mFemtoObs == femtoDreamContainer::Observable::kstar) { diff --git a/PWGHF/HFC/TableProducer/producerCharmHadronsV0FemtoDream.cxx b/PWGHF/HFC/TableProducer/producerCharmHadronsV0FemtoDream.cxx index c490ea599ba..06aed471a3b 100644 --- a/PWGHF/HFC/TableProducer/producerCharmHadronsV0FemtoDream.cxx +++ b/PWGHF/HFC/TableProducer/producerCharmHadronsV0FemtoDream.cxx @@ -579,21 +579,18 @@ struct HfProducerCharmHadronsV0FemtoDream { } } else { // positive daughter - outputPartsMc(aod::femtodreamMCparticle::ParticleOriginMCTruth::kFake, 0, -1.f, -1.f, -1.f); outputPartsMcLabels(-1); if (isDebug) { outputPartsExtMcLabels(-1); outputDebugPartsMc(0); } // negative daughter - outputPartsMc(aod::femtodreamMCparticle::ParticleOriginMCTruth::kFake, 0, -1.f, -1.f, -1.f); outputPartsMcLabels(-1); if (isDebug) { outputPartsExtMcLabels(-1); outputDebugPartsMc(0); } // V0 - outputPartsMc(aod::femtodreamMCparticle::ParticleOriginMCTruth::kFake, 0, -1.f, -1.f, -1.f); outputPartsMcLabels(-1); if (isDebug) { outputPartsExtMcLabels(-1); From 53c04e36621f87872a91e3dbe518e57f535bc96a Mon Sep 17 00:00:00 2001 From: Fabrizio Grosa Date: Wed, 12 Aug 2026 14:41:55 +0200 Subject: [PATCH 2/2] Fix linter --- PWGCF/FemtoDream/Core/femtoDreamContainer.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/PWGCF/FemtoDream/Core/femtoDreamContainer.h b/PWGCF/FemtoDream/Core/femtoDreamContainer.h index 0625c3e3d18..a245e9b22e5 100644 --- a/PWGCF/FemtoDream/Core/femtoDreamContainer.h +++ b/PWGCF/FemtoDream/Core/femtoDreamContainer.h @@ -46,6 +46,9 @@ enum Observable { kstar ///< kstar enum EventType { same, ///< Pair from same event mixed ///< Pair from mixed event }; + +static constexpr int nMinMomComponents{4}; ///< Minimum number of momentum components to compute the femto observable + }; // namespace femtoDreamContainer /// \class FemtoDreamContainer @@ -520,7 +523,7 @@ class FemtoDreamContainer { std::vector k3d = FemtoDreamMath::newpairfunc(part1, mMassOne, part2, mMassTwo, IsSameSpecies); - if (k3d.size() < 4) { + if (k3d.size() < femtoDreamContainer::nMinMomComponents) { LOG(error) << "newpairfunc returned size=" << k3d.size(); return; } @@ -539,7 +542,7 @@ class FemtoDreamContainer if (part1.has_fdMCParticle() && part2.has_fdMCParticle()) { std::vector k3dMC = FemtoDreamMath::newpairfuncMC(part1.fdMCParticle(), mMassOne, part2.fdMCParticle(), mMassTwo, IsSameSpecies); - if (k3dMC.size() < 4) { + if (k3dMC.size() < femtoDreamContainer::nMinMomComponents) { LOG(error) << "newpairfunc returned size=" << k3d.size(); return; } @@ -565,7 +568,7 @@ class FemtoDreamContainer { std::vector k3d = FemtoDreamMath::newpairfunc(part1, mMassOne, part2, mMassTwo, IsSameSpecies); - if (k3d.size() < 4) { + if (k3d.size() < femtoDreamContainer::nMinMomComponents) { LOG(error) << "newpairfunc returned size=" << k3d.size(); return; } @@ -584,7 +587,7 @@ class FemtoDreamContainer if (part1.has_fdMCParticle() && part2.has_fdMCParticle()) { std::vector k3dMC = FemtoDreamMath::newpairfuncMC(part1.fdMCParticle(), mMassOne, part2.fdMCParticle(), mMassTwo, IsSameSpecies); - if (k3dMC.size() < 4) { + if (k3dMC.size() < femtoDreamContainer::nMinMomComponents) { LOG(error) << "newpairfunc returned size=" << k3d.size(); return; }