@@ -725,19 +725,30 @@ struct HfCandidateCreatorDstarExpressions {
725725 }
726726
727727 // D*± → D0(bar) π±
728- if (RecoDecay::isMatchedMCGen (mcParticles, particle, Pdg::kDStar , std::array{+kPiPlus , +kPiPlus , -kKPlus }, true , &signDstar, 2 )) {
729- flagDstar = signDstar * (BIT (aod::hf_cand_dstar::DecayType::DstarToD0Pi));
730- } else if (RecoDecay::isMatchedMCGen (mcParticles, particle, Pdg::kDStar , std::array{+kPiPlus , +kPiPlus , -kKPlus , +kPi0 }, false , &signDstar, 2 ) || RecoDecay::isMatchedMCGen (mcParticles, particle, Pdg::kDStar , std::array{-kPiPlus , -kPiPlus , +kKPlus , +kPi0 }, false , &signDstar, 2 )) {
731- flagDstar = signDstar * (BIT (aod::hf_cand_dstar::DecayType::DstarToD0PiPi0));
732- }
728+ std::vector<int > listIndexDaughters{};
729+ bool isDstarToDzeroPi = RecoDecay::isMatchedMCGen (mcParticles, particle, Pdg::kDStar , std::array{+Pdg::kD0 , +kPiPlus }, true , &signDstar, 1 , &listIndexDaughters);
730+
733731 // D0(bar) → π± K∓
734- if (RecoDecay::isMatchedMCGen (mcParticles, particle, Pdg::kD0 , std::array{+kPiPlus , -kKPlus }, true , &signD0)) {
735- flagD0 = signD0 * (BIT (aod::hf_cand_dstar::DecayType::D0ToPiK));
736- } else if (RecoDecay::isMatchedMCGen (mcParticles, particle, Pdg::kD0 , std::array{+kPiPlus , -kKPlus , +kPi0 }, false , &signD0) || RecoDecay::isMatchedMCGen (mcParticles, particle, Pdg::kD0 , std::array{-kPiPlus , +kKPlus , +kPi0 }, false , &signD0)) {
737- flagD0 = signD0 * (BIT (aod::hf_cand_dstar::DecayType::D0ToPiKPi0));
732+ if (isDstarToDzeroPi) {
733+ aod::McParticles::iterator particleD0;
734+ for (const auto & dauIdx : listIndexDaughters) {
735+ if (dauIdx >= 0 ) {
736+ particleD0 = mcParticles.rawIteratorAt (dauIdx);
737+ if (std::abs (particleD0.pdgCode ()) == Pdg::kD0 ) {
738+ break ;
739+ }
740+ }
741+ }
742+ if (RecoDecay::isMatchedMCGen (mcParticles, particleD0, Pdg::kD0 , std::array{+kPiPlus , -kKPlus }, true , &signD0)) {
743+ flagDstar = signDstar * (BIT (aod::hf_cand_dstar::DecayType::DstarToD0Pi));
744+ flagD0 = signD0 * (BIT (aod::hf_cand_dstar::DecayType::D0ToPiK));
745+ } else if (RecoDecay::isMatchedMCGen (mcParticles, particleD0, Pdg::kD0 , std::array{+kPiPlus , -kKPlus , +kPi0 }, false , &signD0) || RecoDecay::isMatchedMCGen (mcParticles, particleD0, -Pdg::kD0 , std::array{-kPiPlus , +kKPlus , +kPi0 }, false , &signD0)) {
746+ flagDstar = signDstar * (BIT (aod::hf_cand_dstar::DecayType::DstarToD0PiPi0));
747+ flagD0 = signD0 * (BIT (aod::hf_cand_dstar::DecayType::D0ToPiKPi0));
748+ }
738749 }
739750
740- // check wether the particle is non-promt (from a B0 hadron)
751+ // check wether the particle is non-prompt (from a B0 hadron)
741752 if (flagDstar != 0 ) {
742753 originDstar = RecoDecay::getCharmHadronOrigin (mcParticles, particle, false , &idxBhadMothers);
743754 }
0 commit comments