@@ -778,46 +778,42 @@ struct HfCandidateCreator2ProngExpressions {
778778
779779 if (matchCorrBkgs) {
780780 indexRec = -1 ; // Index of the matched reconstructed candidate
781- int depth = 2 ;
782- for (const auto & [chn, finalState] : hf_cand_2prong::DaughtersD0Main) {
781+ constexpr int FinalStateDepth = 2 ;
782+ constexpr int ResoDepth = 1 ;
783+
784+ // D0(bar) → π+ K−, π+ K− π0, π+ π−, π+ π− π0, K+ K−
785+ for (const auto & [chn, finalState] : hf_cand_2prong::daughtersD0Main) {
783786 std::array<int , 2 > finalStateParts2Prong = std::array{finalState[0 ], finalState[1 ]};
784787 if (finalState.size () == 3 ) { // Partly Reco 2-prong decays
785788 if (matchKinkedDecayTopology && matchInteractionsWithMaterial) {
786- indexRec = RecoDecay::getMatchedMCRec<false , false , true , true , true >(mcParticles, arrayDaughters, Pdg::kD0 , finalStateParts2Prong, true , &sign, depth , &nKinkedTracks, &nInteractionsWithMaterial);
789+ indexRec = RecoDecay::getMatchedMCRec<false , false , true , true , true >(mcParticles, arrayDaughters, Pdg::kD0 , finalStateParts2Prong, true , &sign, FinalStateDepth , &nKinkedTracks, &nInteractionsWithMaterial);
787790 } else if (matchKinkedDecayTopology && !matchInteractionsWithMaterial) {
788- indexRec = RecoDecay::getMatchedMCRec<false , false , true , true , false >(mcParticles, arrayDaughters, Pdg::kD0 , finalStateParts2Prong, true , &sign, depth , &nKinkedTracks);
791+ indexRec = RecoDecay::getMatchedMCRec<false , false , true , true , false >(mcParticles, arrayDaughters, Pdg::kD0 , finalStateParts2Prong, true , &sign, FinalStateDepth , &nKinkedTracks);
789792 } else if (!matchKinkedDecayTopology && matchInteractionsWithMaterial) {
790- indexRec = RecoDecay::getMatchedMCRec<false , false , true , false , true >(mcParticles, arrayDaughters, Pdg::kD0 , finalStateParts2Prong, true , &sign, depth , nullptr , &nInteractionsWithMaterial);
793+ indexRec = RecoDecay::getMatchedMCRec<false , false , true , false , true >(mcParticles, arrayDaughters, Pdg::kD0 , finalStateParts2Prong, true , &sign, FinalStateDepth , nullptr , &nInteractionsWithMaterial);
791794 } else {
792- indexRec = RecoDecay::getMatchedMCRec<false , false , true , false , false >(mcParticles, arrayDaughters, Pdg::kD0 , finalStateParts2Prong, true , &sign, depth );
795+ indexRec = RecoDecay::getMatchedMCRec<false , false , true , false , false >(mcParticles, arrayDaughters, Pdg::kD0 , finalStateParts2Prong, true , &sign, FinalStateDepth );
793796 }
794797
795798 if (indexRec > -1 ) {
796799 auto motherParticle = mcParticles.rawIteratorAt (indexRec);
797800 std::array<int , 3 > finalStateParts2ProngAll = std::array{finalState[0 ], finalState[1 ], finalState[2 ]};
798- if (motherParticle.pdgCode () < 0 ) {
799- for (auto & part : finalStateParts2ProngAll) {
800- if (part == kPi0 ) {
801- part = -part; // The Pi0 pdg code does not change between particle and antiparticle
802- }
803- }
804- }
805- if (!RecoDecay::isMatchedMCGen (mcParticles, motherParticle, Pdg::kD0 , finalStateParts2ProngAll, true , &sign, depth)) {
801+ if (!RecoDecay::isMatchedMCGen (mcParticles, motherParticle, Pdg::kD0 , finalStateParts2ProngAll, true , &sign, FinalStateDepth)) {
806802 indexRec = -1 ; // Reset indexRec if the generated decay does not match the reconstructed one does not match the reconstructed one
807803 }
808804 }
809805 } else if (finalState.size () == 2 ) { // Fully Reco 2-prong decays
810806 if (matchKinkedDecayTopology && matchInteractionsWithMaterial) {
811- indexRec = RecoDecay::getMatchedMCRec<false , false , false , true , true >(mcParticles, arrayDaughters, Pdg::kD0 , finalStateParts2Prong, true , &sign, depth , &nKinkedTracks, &nInteractionsWithMaterial);
807+ indexRec = RecoDecay::getMatchedMCRec<false , false , false , true , true >(mcParticles, arrayDaughters, Pdg::kD0 , finalStateParts2Prong, true , &sign, FinalStateDepth , &nKinkedTracks, &nInteractionsWithMaterial);
812808 } else if (matchKinkedDecayTopology && !matchInteractionsWithMaterial) {
813- indexRec = RecoDecay::getMatchedMCRec<false , false , false , true , false >(mcParticles, arrayDaughters, Pdg::kD0 , finalStateParts2Prong, true , &sign, depth , &nKinkedTracks);
809+ indexRec = RecoDecay::getMatchedMCRec<false , false , false , true , false >(mcParticles, arrayDaughters, Pdg::kD0 , finalStateParts2Prong, true , &sign, FinalStateDepth , &nKinkedTracks);
814810 } else if (!matchKinkedDecayTopology && matchInteractionsWithMaterial) {
815- indexRec = RecoDecay::getMatchedMCRec<false , false , false , false , true >(mcParticles, arrayDaughters, Pdg::kD0 , finalStateParts2Prong, true , &sign, depth , nullptr , &nInteractionsWithMaterial);
811+ indexRec = RecoDecay::getMatchedMCRec<false , false , false , false , true >(mcParticles, arrayDaughters, Pdg::kD0 , finalStateParts2Prong, true , &sign, FinalStateDepth , nullptr , &nInteractionsWithMaterial);
816812 } else {
817- indexRec = RecoDecay::getMatchedMCRec<false , false , false , false , false >(mcParticles, arrayDaughters, Pdg::kD0 , finalStateParts2Prong, true , &sign, depth );
813+ indexRec = RecoDecay::getMatchedMCRec<false , false , false , false , false >(mcParticles, arrayDaughters, Pdg::kD0 , finalStateParts2Prong, true , &sign, FinalStateDepth );
818814 }
819815 } else {
820- LOG (info ) << " Final state size not supported: " << finalStateParts2Prong .size ();
816+ LOG (fatal ) << " Final state size not supported: " << finalState .size ();
821817 continue ;
822818 }
823819 if (indexRec > -1 ) {
@@ -826,7 +822,7 @@ struct HfCandidateCreator2ProngExpressions {
826822 // Flag the resonant decay channel
827823 int resoMaxDepth = 1 ;
828824 std::vector<int > arrResoDaughIndex = {};
829- RecoDecay::getDaughters (mcParticles.rawIteratorAt (indexRec), &arrResoDaughIndex, std::array{0 }, resoMaxDepth );
825+ RecoDecay::getDaughters (mcParticles.rawIteratorAt (indexRec), &arrResoDaughIndex, std::array{0 }, ResoDepth );
830826 std::array<int , NDaughtersResonant> arrPDGDaugh = {};
831827 if (arrResoDaughIndex.size () == NDaughtersResonant) {
832828 for (auto iProng = 0u ; iProng < arrResoDaughIndex.size (); ++iProng) {
0 commit comments