diff --git a/PWGJE/Core/JetHFUtilities.h b/PWGJE/Core/JetHFUtilities.h index a018c0c177b..1a52ba5019c 100644 --- a/PWGJE/Core/JetHFUtilities.h +++ b/PWGJE/Core/JetHFUtilities.h @@ -609,58 +609,33 @@ bool isHFDaughterTrack(T& track, U& candidate) * @param particles particle table */ template -auto matchedHFParticle(const T& candidate, const U& /*tracks*/, const V& /*particles*/, bool& isMatched) +auto matchedHFParticle(const T& candidate, const U& /*tracks*/, const V& /*particles*/) { typename V::iterator candidateDaughterParticle; - isMatched = false; if constexpr (isD0Candidate()) { - if (std::abs(candidate.flagMcMatchRec()) == o2::hf_decay::hf_cand_2prong::DecayChannelMain::D0ToPiK) { - candidateDaughterParticle = candidate.template prong0_as().template mcParticle_as(); - isMatched = true; - } + candidateDaughterParticle = candidate.template prong0_as().template mcParticle_as(); } if constexpr (isDplusCandidate()) { - if (std::abs(candidate.flagMcMatchRec()) == o2::hf_decay::hf_cand_3prong::DecayChannelMain::DplusToPiKPi) { - candidateDaughterParticle = candidate.template prong0_as().template mcParticle_as(); - isMatched = true; - } + candidateDaughterParticle = candidate.template prong0_as().template mcParticle_as(); } if constexpr (isDsCandidate()) { - if (std::abs(candidate.flagMcMatchRec()) == o2::hf_decay::hf_cand_3prong::DecayChannelMain::DsToPiKK) { - candidateDaughterParticle = candidate.template prong0_as().template mcParticle_as(); - isMatched = true; - } + candidateDaughterParticle = candidate.template prong0_as().template mcParticle_as(); } if constexpr (isDstarCandidate()) { - if (std::abs(candidate.flagMcMatchRec()) == o2::hf_decay::hf_cand_dstar::DecayChannelMain::DstarToPiKPi) { - candidateDaughterParticle = candidate.template prong2_as().template mcParticle_as(); - isMatched = true; - } + candidateDaughterParticle = candidate.template prong2_as().template mcParticle_as(); } if constexpr (isLcCandidate()) { - if (std::abs(candidate.flagMcMatchRec()) == o2::hf_decay::hf_cand_3prong::DecayChannelMain::LcToPKPi) { - candidateDaughterParticle = candidate.template prong0_as().template mcParticle_as(); - isMatched = true; - } + candidateDaughterParticle = candidate.template prong0_as().template mcParticle_as(); } if constexpr (isB0Candidate()) { - if (std::abs(candidate.flagMcMatchRec()) == o2::hf_decay::hf_cand_beauty::DecayChannelMain::B0ToDminusPi) { - candidateDaughterParticle = candidate.template prong3_as().template mcParticle_as(); - isMatched = true; - } + candidateDaughterParticle = candidate.template prong3_as().template mcParticle_as(); } if constexpr (isBplusCandidate()) { - if (std::abs(candidate.flagMcMatchRec()) == o2::hf_decay::hf_cand_beauty::DecayChannelMain::BplusToD0Pi) { - candidateDaughterParticle = candidate.template prong2_as().template mcParticle_as(); - isMatched = true; - } + candidateDaughterParticle = candidate.template prong2_as().template mcParticle_as(); } if constexpr (isXicToXiPiPiCandidate()) { - if (std::abs(candidate.flagMcMatchRec()) == o2::aod::hf_cand_xic_to_xi_pi_pi::DecayType::XicToXiPiPi) { - candidateDaughterParticle = candidate.template prong0_as().template mcParticle_as(); - isMatched = true; - } + candidateDaughterParticle = candidate.template prong0_as().template mcParticle_as(); } return candidateDaughterParticle.template mothers_first_as(); } @@ -675,13 +650,8 @@ auto matchedHFParticle(const T& candidate, const U& /*tracks*/, const V& /*parti template auto matchedHFParticleId(const T& candidate, const U& tracks, const V& particles) { - bool isMatched = false; - auto matchedParticle = matchedHFParticle(candidate, tracks, particles, isMatched); - if (isMatched) { - return matchedParticle.globalIndex(); - } else { - return int64_t{-1}; // does this clash with the case where a track doesnt have an associated particle? - } + auto matchedParticle = matchedHFParticle(candidate, tracks, particles); + return matchedParticle.globalIndex(); } /** diff --git a/PWGJE/Tasks/jetCorrelationD0.cxx b/PWGJE/Tasks/jetCorrelationD0.cxx index 1196c7b52a4..99e7718948d 100644 --- a/PWGJE/Tasks/jetCorrelationD0.cxx +++ b/PWGJE/Tasks/jetCorrelationD0.cxx @@ -456,11 +456,7 @@ struct JetCorrelationD0 { if (d0Candidate.pt() < d0PtCutMin) { // once settled on a mlcut, then add the lower bound of the systematics as a cut here continue; } - bool isMatched = false; - const auto& d0Particle = jethfutilities::matchedHFParticle(d0Candidate, tracks, particles, isMatched); - if (!isMatched) { - continue; - } + const auto& d0Particle = jethfutilities::matchedHFParticle(d0Candidate, tracks, particles); for (const auto& McDJet : McDJets) { if (McDJet.pt() < jetPtCutMin) { continue;