@@ -564,24 +564,52 @@ struct HfDataCreatorCharmResoReduced {
564564 }
565565
566566 // Check if one pion decayed to a muon
567- if (indexRecD0 < 0 ) {
568- indexRecD0ToMu = RecoDecay::getMatchedMCRec<false , false , true >(particlesMc, std::array{vecDaughtersReso[0 ], vecDaughtersReso[1 ]}, Pdg::kD0 , std::array{+kMuonPlus , -kKPlus }, true , &signD0, 2 );
569- }
570- if (indexRecK0 < 0 ) {
571- indexRecK0ToMu = RecoDecay::getMatchedMCRec<false , true , true >(particlesMc, std::array{vecDaughtersReso[3 ], vecDaughtersReso[4 ]}, kK0 , std::array{+kMuonPlus , -kPiPlus }, true , &signV0, 3 );
572- }
573- if (indexRecDstar < 0 ) {
574- indexRecDstarToMu = RecoDecay::getMatchedMCRec<false , false , true >(particlesMc, std::array{vecDaughtersReso[0 ], vecDaughtersReso[1 ], vecDaughtersReso[2 ]}, Pdg::kDStar , std::array{-kKPlus , +kPiPlus , +kMuonPlus }, true , &signDStar, 3 );
567+ if (indexRecK0 < 0 && indexRecDstar > -1 ) {
568+ int indexDs1[2 ] = {-1 , -1 };
569+ int nMuons{0 };
570+ int8_t sgn;
571+ for (int iTrack = 3 ; iTrack <= 4 ; iTrack++) {
572+ if (vecDaughtersReso[iTrack].has_mcParticle ()) {
573+ auto particleK0Dau = vecDaughtersReso[iTrack].template mcParticle_as <PParticles>();
574+ auto absPdgK0Dau = std::abs (particleK0Dau.pdgCode ());
575+ if (absPdgK0Dau == +kMuonPlus ) {
576+ nMuons++;
577+ indexDs1[iTrack - 3 ] = RecoDecay::getMother (particlesMc, particleK0Dau, Pdg::kDS1 , true , &sgn, 4 );
578+ } else if (absPdgK0Dau == +kPiPlus ) {
579+ indexDs1[iTrack - 3 ] = RecoDecay::getMother (particlesMc, particleK0Dau, Pdg::kDS1 , true , &sgn, 3 );
580+ }
581+ }
582+ }
583+ if (indexDs1[0 ] > -1 && indexDs1[0 ] == indexDs1[1 ] && nMuons > 0 ) {
584+ auto partDstar = particlesMc.rawIteratorAt (indexRecDstar);
585+ if (RecoDecay::getMother (particlesMc, partDstar, Pdg::kDS1 , true , &sgn, 1 ) == indexDs1[0 ]) {
586+ indexRecResoToMu = indexDs1[0 ];
587+ indexRecResoPartReco = -1 ;
588+ flag = sign * BIT (DecayTypeMc::Ds1ToDStarK0ToD0PiK0sOneMu);
589+ }
590+ }
575591 }
576-
577- if (indexRecD0ToMu + indexRecK0ToMu + indexRecDstarToMu > -3 ) {
578- indexRecResoToMu = RecoDecay::getMatchedMCRec<false , true , true >(particlesMc, std::array{vecDaughtersReso[0 ], vecDaughtersReso[1 ], vecDaughtersReso[2 ], vecDaughtersReso[3 ], vecDaughtersReso[4 ]}, Pdg::kDS1 , std::array{+kPiPlus , -kKPlus , +kPiPlus , +kMuonPlus , -kPiPlus }, true , &sign, 4 );
579- if (indexRecResoToMu > -1 ) {
580- indexRecResoPartReco = -1 ;
581- flag = sign * BIT (DecayTypeMc::Ds1ToDStarK0ToD0PiK0sOneMu);
582- } else {
583- indexRecResoToMu = RecoDecay::getMatchedMCRec<false , true , true >(particlesMc, std::array{vecDaughtersReso[0 ], vecDaughtersReso[1 ], vecDaughtersReso[2 ], vecDaughtersReso[3 ], vecDaughtersReso[4 ]}, Pdg::kDS1 , std::array{+kPiPlus , -kKPlus , +kPiPlus , +kPiPlus , -kMuonPlus }, true , &sign, 4 );
584- if (indexRecResoToMu > -1 ) {
592+ if (indexRecDstar < 0 && indexRecK0 > -1 && indexRecD0 > -1 ) {
593+ int indexDs1{-1 };
594+ int indexDstar{-1 };
595+ int8_t sgn;
596+ if (vecDaughtersReso[3 ].has_mcParticle ()) {
597+ auto particleDstarDau = vecDaughtersReso[3 ].template mcParticle_as <PParticles>();
598+ auto absPdgDstarDau = std::abs (particleDstarDau.pdgCode ());
599+ if (absPdgDstarDau == +kMuonPlus ) {
600+ indexDs1 = RecoDecay::getMother (particlesMc, particleDstarDau, Pdg::kDS1 , true , &sgn, 3 );
601+ indexDstar = RecoDecay::getMother (particlesMc, particleDstarDau, Pdg::kDStar , true , &sgn, 2 );
602+ }
603+ }
604+ if (indexDs1 > -1 && indexDstar > -1 ) {
605+ auto partK0 = particlesMc.rawIteratorAt (indexRecK0);
606+ auto partDstar = particlesMc.rawIteratorAt (indexDstar);
607+ auto partD0 = particlesMc.rawIteratorAt (indexRecD0);
608+ auto motherDstar = RecoDecay::getMother (particlesMc, partDstar, Pdg::kDS1 , true , &sgn, 1 );
609+ auto motherK0 = RecoDecay::getMother (particlesMc, partK0, Pdg::kDS1 , true , &sgn, 1 );
610+ auto motherD0 = RecoDecay::getMother (particlesMc, partD0, Pdg::kDS1 , true , &sgn, 2 );
611+ if (indexDs1 == motherDstar && indexDs1 == motherD0 && indexDs1 == motherK0) {
612+ indexRecResoToMu = indexDs1;
585613 indexRecResoPartReco = -1 ;
586614 flag = sign * BIT (DecayTypeMc::Ds1ToDStarK0ToD0PiK0sOneMu);
587615 }
0 commit comments