From 122509cde9cb7c58c9cc62f5be4b6a1f00d12c04 Mon Sep 17 00:00:00 2001 From: nzardosh Date: Sat, 22 Nov 2025 13:28:45 +0100 Subject: [PATCH] fixing bug in HF matching --- PWGJE/Core/JetHFUtilities.h | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/PWGJE/Core/JetHFUtilities.h b/PWGJE/Core/JetHFUtilities.h index dcdf022a849..7dc84055cd6 100644 --- a/PWGJE/Core/JetHFUtilities.h +++ b/PWGJE/Core/JetHFUtilities.h @@ -625,7 +625,33 @@ auto matchedHFParticleId(const T& candidate, const U& /*tracks*/, const V& /*par template auto matchedHFParticle(const T& candidate, const U& /*tracks*/, const V& /*particles*/) { - const auto candidateDaughterParticle = candidate.template prong1_as().template mcParticle_as(); + + const typename V::iterator candidateDaughterParticle; + if (std::abs(candidate.flagMcMatchRec()) == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { + candidateDaughterParticle = candidate.template prong1_as().template mcParticle_as(); + } + if (std::abs(candidate.flagMcMatchRec()) == o2::hf_decay::hf_cand_3prong::DecayChannelMain::DplusToPiKPi) { + candidateDaughterParticle = candidate.template prong1_as().template mcParticle_as(); + } + if (std::abs(candidate.flagMcMatchRec()) == o2::hf_decay::hf_cand_3prong::DecayChannelMain::DsToPiKK) { + candidateDaughterParticle = candidate.template prong1_as().template mcParticle_as(); + } + if (std::abs(candidate.flagMcMatchRec()) == o2::hf_decay::hf_cand_dstar::DecayChannelMain::DstarToPiKPi) { + candidateDaughterParticle = candidate.template prong3_as().template mcParticle_as(); + } + if (std::abs(candidate.flagMcMatchRec()) == o2::hf_decay::hf_cand_3prong::DecayChannelMain::LcToPKPi) { + candidateDaughterParticle = candidate.template prong1_as().template mcParticle_as(); + } + if (std::abs(candidate.flagMcMatchRec()) == o2::hf_decay::hf_cand_beauty::DecayChannelMain::B0ToDminusPi) { + candidateDaughterParticle = candidate.template prong4_as().template mcParticle_as(); + } + if (std::abs(candidate.flagMcMatchRec()) == o2::hf_decay::hf_cand_beauty::DecayChannelMain::BplusToD0Pi) { + candidateDaughterParticle = candidate.template prong3_as().template mcParticle_as(); + } + if (std::abs(candidate.flagMcMatchRec()) == o2::aod::hf_cand_xic_to_xi_pi_pi::DecayType::XicToXiPiPi) { + candidateDaughterParticle = candidate.template prong1_as().template mcParticle_as(); + } + return candidateDaughterParticle.template mothers_first_as(); }