diff --git a/PWGHF/D2H/Tasks/taskCharmResoToDTrkReduced.cxx b/PWGHF/D2H/Tasks/taskCharmResoToDTrkReduced.cxx index 356e36e6894..07e56a5cfab 100644 --- a/PWGHF/D2H/Tasks/taskCharmResoToDTrkReduced.cxx +++ b/PWGHF/D2H/Tasks/taskCharmResoToDTrkReduced.cxx @@ -412,9 +412,11 @@ struct HfTaskCharmResoToDTrkReduced { std::array ptProngs = {particle.ptProng0(), particle.ptProng1()}; std::array etaProngs = {particle.etaProng0(), particle.etaProng1()}; bool const prongsInAcc = isProngInAcceptance(etaProngs[0], ptProngs[0]) && isProngInAcceptance(etaProngs[1], ptProngs[1]); - if (Channel == DecayChannel::D0Kplus && - !hf_decay::hf_cand_reso::particlesToD0Kplus.contains(static_cast(std::abs(flag)))) { - continue; + if constexpr (Channel == DecayChannel::D0Kplus) { + if (fillOnlySignal && + !hf_decay::hf_cand_reso::particlesToD0Kplus.contains(static_cast(std::abs(flag)))) { + continue; + } } registry.fill(HIST("hYGenAll"), ptParticle, yParticle); if (yCandGenMax >= 0. && std::abs(yParticle) > yCandGenMax) {