From 5795b0ecac29411a45968b1c9e5eaace6ded239d Mon Sep 17 00:00:00 2001 From: Fabrizio Grosa Date: Tue, 7 Jul 2026 16:55:42 +0200 Subject: [PATCH 1/3] Fix MC flagging for c-deuteron --- PWGHF/TableProducer/candidateCreator3Prong.cxx | 3 +++ PWGHF/Utils/utilsMcMatching.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/PWGHF/TableProducer/candidateCreator3Prong.cxx b/PWGHF/TableProducer/candidateCreator3Prong.cxx index e9ad967d846..ef3932f1f22 100644 --- a/PWGHF/TableProducer/candidateCreator3Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator3Prong.cxx @@ -1358,6 +1358,9 @@ struct HfCandidateCreator3ProngExpressions { auto bHadMother = mcParticles.rawIteratorAt(idxBhadMothers[0]); rowMcMatchRec(flagChannelMain, origin, swapping, flagChannelResonant, bHadMother.pt(), bHadMother.pdgCode(), nKinkedTracks, nInteractionsWithMaterial); } else { + if (std::abs(flagChannelMain) == DecayChannelMain::CDeuteronToDeKPi) { + origin == RecoDecay::OriginType::Prompt; + } rowMcMatchRec(flagChannelMain, origin, swapping, flagChannelResonant, -1.f, 0, nKinkedTracks, nInteractionsWithMaterial); } } diff --git a/PWGHF/Utils/utilsMcMatching.h b/PWGHF/Utils/utilsMcMatching.h index a5de35c6200..ec4c4a1c7cf 100644 --- a/PWGHF/Utils/utilsMcMatching.h +++ b/PWGHF/Utils/utilsMcMatching.h @@ -338,7 +338,7 @@ inline void flipPdgSign(const int pdgMother, const int pdgToFlip, std::array inline int getResonantDecayCDeuteron(Part const& particle) { - auto statusCode = std::abs(particle.getGenStatusCode()); + auto statusCode = particle.getGenStatusCode(); if (statusCode == o2::hf_decay::hf_cand_3prong::StatusCodeCDeuteronToDeKstar0[0] || statusCode == o2::hf_decay::hf_cand_3prong::StatusCodeCDeuteronToDeKstar0[1]) { return o2::hf_decay::hf_cand_3prong::DecayChannelResonant::CDeuteronToDeKstar0; } From d6b4b86b33518b1f509e0ef85c88b19574e32f9b Mon Sep 17 00:00:00 2001 From: Fabrizio Grosa Date: Tue, 7 Jul 2026 17:19:16 +0200 Subject: [PATCH 2/3] Fix variable assigment and camel case --- PWGHF/TableProducer/candidateCreator3Prong.cxx | 2 +- PWGHF/Utils/utilsMcMatching.h | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/PWGHF/TableProducer/candidateCreator3Prong.cxx b/PWGHF/TableProducer/candidateCreator3Prong.cxx index ef3932f1f22..e83396da8ab 100644 --- a/PWGHF/TableProducer/candidateCreator3Prong.cxx +++ b/PWGHF/TableProducer/candidateCreator3Prong.cxx @@ -1359,7 +1359,7 @@ struct HfCandidateCreator3ProngExpressions { rowMcMatchRec(flagChannelMain, origin, swapping, flagChannelResonant, bHadMother.pt(), bHadMother.pdgCode(), nKinkedTracks, nInteractionsWithMaterial); } else { if (std::abs(flagChannelMain) == DecayChannelMain::CDeuteronToDeKPi) { - origin == RecoDecay::OriginType::Prompt; + origin = RecoDecay::OriginType::Prompt; } rowMcMatchRec(flagChannelMain, origin, swapping, flagChannelResonant, -1.f, 0, nKinkedTracks, nInteractionsWithMaterial); } diff --git a/PWGHF/Utils/utilsMcMatching.h b/PWGHF/Utils/utilsMcMatching.h index ec4c4a1c7cf..ae37e04ec1e 100644 --- a/PWGHF/Utils/utilsMcMatching.h +++ b/PWGHF/Utils/utilsMcMatching.h @@ -160,9 +160,9 @@ static const std::unordered_map> daught {DecayChannelMain::CDeuteronToDeKPi, {+o2::constants::physics::Pdg::kDeuteron, +PDG_t::kKMinus, +PDG_t::kPiPlus}}}; /// resonances in c-deuteron decay are not stored in the particle stack for c-deuteron, but tagged with specific status codes -static const std::array StatusCodeCDeuteronToDeKstar0{-85, -95}; -static const std::array StatusCodeCDeuteronToNeDeltaplusK{-86, -96}; -static const std::array StatusCodeCDeuteronToNeL1520Pi{-87, -97}; +static const std::array statusCodeCDeuteronToDeKstar0{-85, -95}; +static const std::array statusCodeCDeuteronToNeDeltaplusK{-86, -96}; +static const std::array statusCodeCDeuteronToNeL1520Pi{-87, -97}; /// Returns a map of the possible final states for a specific 3-prong particle specie /// \param pdgMother PDG code of the mother particle @@ -339,13 +339,13 @@ template inline int getResonantDecayCDeuteron(Part const& particle) { auto statusCode = particle.getGenStatusCode(); - if (statusCode == o2::hf_decay::hf_cand_3prong::StatusCodeCDeuteronToDeKstar0[0] || statusCode == o2::hf_decay::hf_cand_3prong::StatusCodeCDeuteronToDeKstar0[1]) { + if (statusCode == o2::hf_decay::hf_cand_3prong::statusCodeCDeuteronToDeKstar0[0] || statusCode == o2::hf_decay::hf_cand_3prong::statusCodeCDeuteronToDeKstar0[1]) { return o2::hf_decay::hf_cand_3prong::DecayChannelResonant::CDeuteronToDeKstar0; } - if (statusCode == o2::hf_decay::hf_cand_3prong::StatusCodeCDeuteronToNeDeltaplusK[0] || statusCode == o2::hf_decay::hf_cand_3prong::StatusCodeCDeuteronToNeDeltaplusK[1]) { + if (statusCode == o2::hf_decay::hf_cand_3prong::statusCodeCDeuteronToNeDeltaplusK[0] || statusCode == o2::hf_decay::hf_cand_3prong::statusCodeCDeuteronToNeDeltaplusK[1]) { return o2::hf_decay::hf_cand_3prong::DecayChannelResonant::CDeuteronToNeDeltaplusK; } - if (statusCode == o2::hf_decay::hf_cand_3prong::StatusCodeCDeuteronToNeL1520Pi[0] || statusCode == o2::hf_decay::hf_cand_3prong::StatusCodeCDeuteronToNeL1520Pi[1]) { + if (statusCode == o2::hf_decay::hf_cand_3prong::statusCodeCDeuteronToNeL1520Pi[0] || statusCode == o2::hf_decay::hf_cand_3prong::statusCodeCDeuteronToNeL1520Pi[1]) { return o2::hf_decay::hf_cand_3prong::DecayChannelResonant::CDeuteronToNeL1520Pi; } return 0; From fcc840e728df7afefb62c8c75c3bcb650a74d4db Mon Sep 17 00:00:00 2001 From: Fabrizio Grosa Date: Tue, 7 Jul 2026 18:25:03 +0200 Subject: [PATCH 3/3] Use constexpr for const arrays --- PWGHF/Utils/utilsMcMatching.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PWGHF/Utils/utilsMcMatching.h b/PWGHF/Utils/utilsMcMatching.h index ae37e04ec1e..d4989053dd7 100644 --- a/PWGHF/Utils/utilsMcMatching.h +++ b/PWGHF/Utils/utilsMcMatching.h @@ -160,9 +160,9 @@ static const std::unordered_map> daught {DecayChannelMain::CDeuteronToDeKPi, {+o2::constants::physics::Pdg::kDeuteron, +PDG_t::kKMinus, +PDG_t::kPiPlus}}}; /// resonances in c-deuteron decay are not stored in the particle stack for c-deuteron, but tagged with specific status codes -static const std::array statusCodeCDeuteronToDeKstar0{-85, -95}; -static const std::array statusCodeCDeuteronToNeDeltaplusK{-86, -96}; -static const std::array statusCodeCDeuteronToNeL1520Pi{-87, -97}; +static constexpr std::array statusCodeCDeuteronToDeKstar0{-85, -95}; +static constexpr std::array statusCodeCDeuteronToNeDeltaplusK{-86, -96}; +static constexpr std::array statusCodeCDeuteronToNeL1520Pi{-87, -97}; /// Returns a map of the possible final states for a specific 3-prong particle specie /// \param pdgMother PDG code of the mother particle