Skip to content

Commit 877668f

Browse files
authored
[PWGCF,PWGHF] Add missing protection in femto dream container in case of HF-V0 combinations (#17429)
1 parent cf647b3 commit 877668f

2 files changed

Lines changed: 20 additions & 17 deletions

File tree

PWGCF/FemtoDream/Core/femtoDreamContainer.h

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ enum Observable { kstar ///< kstar
4646
enum EventType { same, ///< Pair from same event
4747
mixed ///< Pair from mixed event
4848
};
49+
50+
static constexpr int nMinMomComponents{4}; ///< Minimum number of momentum components to compute the femto observable
51+
4952
}; // namespace femtoDreamContainer
5053

5154
/// \class FemtoDreamContainer
@@ -367,18 +370,21 @@ class FemtoDreamContainer
367370
if constexpr (isMC) {
368371
if constexpr (isHF) {
369372
// calculate the femto observable and the mT with MC truth information
370-
if constexpr (mFemtoObs == femtoDreamContainer::Observable::kstar) {
371-
femtoObsMC = FemtoDreamMath::getkstar(part1.fdMCParticle(), mMassOne, part2, mMassTwo);
372-
}
373-
const float mTMC = FemtoDreamMath::getmT(part1.fdMCParticle(), mMassOne, part2, mMassTwo);
374-
375-
if (std::abs(part1.fdMCParticle().pdgMCTruth()) == mPDGOne) { // Note: all pair-histogramms are filled with MC truth information ONLY in case of non-fake candidates
376-
setPair_base<o2::aod::femtodreamMCparticle::MCType::kTruth>(femtoObsMC, mTMC, part1.fdMCParticle(), part2, mult, multPercentile, use4dplots, extendedplots);
377-
setPair_MC(femtoObsMC, femtoObs, mT, mult, part1.fdMCParticle().partOriginMCTruth(), part2.flagMc(), smearingByOrigin);
373+
if (part1.has_fdMCParticle()) {
374+
if constexpr (mFemtoObs == femtoDreamContainer::Observable::kstar) {
375+
femtoObsMC = FemtoDreamMath::getkstar(part1.fdMCParticle(), mMassOne, part2, mMassTwo);
376+
}
377+
const float mTMC = FemtoDreamMath::getmT(part1.fdMCParticle(), mMassOne, part2, mMassTwo);
378+
379+
if (std::abs(part1.fdMCParticle().pdgMCTruth()) == mPDGOne) { // Note: all pair-histogramms are filled with MC truth information ONLY in case of non-fake candidates
380+
setPair_base<o2::aod::femtodreamMCparticle::MCType::kTruth>(femtoObsMC, mTMC, part1.fdMCParticle(), part2, mult, multPercentile, use4dplots, extendedplots);
381+
setPair_MC(femtoObsMC, femtoObs, mT, mult, part1.fdMCParticle().partOriginMCTruth(), part2.flagMc(), smearingByOrigin);
382+
} else {
383+
mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[o2::aod::femtodreamMCparticle::MCType::kTruth]) + HIST("/hFakePairsCounter"), 0);
384+
}
378385
} else {
379-
mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[o2::aod::femtodreamMCparticle::MCType::kTruth]) + HIST("/hFakePairsCounter"), 0);
386+
mHistogramRegistry->fill(HIST(mFolderSuffix[mEventType]) + HIST(o2::aod::femtodreamMCparticle::MCTypeName[o2::aod::femtodreamMCparticle::MCType::kTruth]) + HIST("/hNoMCtruthPairsCounter"), 0);
380387
}
381-
382388
} else if (part1.has_fdMCParticle() && part2.has_fdMCParticle()) {
383389
// calculate the femto observable and the mT with MC truth information
384390
if constexpr (mFemtoObs == femtoDreamContainer::Observable::kstar) {
@@ -517,7 +523,7 @@ class FemtoDreamContainer
517523
{
518524

519525
std::vector<double> k3d = FemtoDreamMath::newpairfunc(part1, mMassOne, part2, mMassTwo, IsSameSpecies);
520-
if (k3d.size() < 4) {
526+
if (k3d.size() < femtoDreamContainer::nMinMomComponents) {
521527
LOG(error) << "newpairfunc returned size=" << k3d.size();
522528
return;
523529
}
@@ -536,7 +542,7 @@ class FemtoDreamContainer
536542
if (part1.has_fdMCParticle() && part2.has_fdMCParticle()) {
537543

538544
std::vector<double> k3dMC = FemtoDreamMath::newpairfuncMC(part1.fdMCParticle(), mMassOne, part2.fdMCParticle(), mMassTwo, IsSameSpecies);
539-
if (k3dMC.size() < 4) {
545+
if (k3dMC.size() < femtoDreamContainer::nMinMomComponents) {
540546
LOG(error) << "newpairfunc returned size=" << k3d.size();
541547
return;
542548
}
@@ -562,7 +568,7 @@ class FemtoDreamContainer
562568
{
563569

564570
std::vector<double> k3d = FemtoDreamMath::newpairfunc(part1, mMassOne, part2, mMassTwo, IsSameSpecies);
565-
if (k3d.size() < 4) {
571+
if (k3d.size() < femtoDreamContainer::nMinMomComponents) {
566572
LOG(error) << "newpairfunc returned size=" << k3d.size();
567573
return;
568574
}
@@ -581,7 +587,7 @@ class FemtoDreamContainer
581587
if (part1.has_fdMCParticle() && part2.has_fdMCParticle()) {
582588

583589
std::vector<double> k3dMC = FemtoDreamMath::newpairfuncMC(part1.fdMCParticle(), mMassOne, part2.fdMCParticle(), mMassTwo, IsSameSpecies);
584-
if (k3dMC.size() < 4) {
590+
if (k3dMC.size() < femtoDreamContainer::nMinMomComponents) {
585591
LOG(error) << "newpairfunc returned size=" << k3d.size();
586592
return;
587593
}

PWGHF/HFC/TableProducer/producerCharmHadronsV0FemtoDream.cxx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -579,21 +579,18 @@ struct HfProducerCharmHadronsV0FemtoDream {
579579
}
580580
} else {
581581
// positive daughter
582-
outputPartsMc(aod::femtodreamMCparticle::ParticleOriginMCTruth::kFake, 0, -1.f, -1.f, -1.f);
583582
outputPartsMcLabels(-1);
584583
if (isDebug) {
585584
outputPartsExtMcLabels(-1);
586585
outputDebugPartsMc(0);
587586
}
588587
// negative daughter
589-
outputPartsMc(aod::femtodreamMCparticle::ParticleOriginMCTruth::kFake, 0, -1.f, -1.f, -1.f);
590588
outputPartsMcLabels(-1);
591589
if (isDebug) {
592590
outputPartsExtMcLabels(-1);
593591
outputDebugPartsMc(0);
594592
}
595593
// V0
596-
outputPartsMc(aod::femtodreamMCparticle::ParticleOriginMCTruth::kFake, 0, -1.f, -1.f, -1.f);
597594
outputPartsMcLabels(-1);
598595
if (isDebug) {
599596
outputPartsExtMcLabels(-1);

0 commit comments

Comments
 (0)