@@ -80,6 +80,13 @@ enum DecayTypeMc : uint8_t {
8080 Ds1ToDStarK0ToD0PiK0sPart
8181};
8282
83+ enum PartialMatchMc : uint8_t {
84+ K0Matched = 0 ,
85+ D0Matched,
86+ DStarMatched,
87+ DPlusMatched
88+ };
89+
8390// / Creation of D-V0 pairs
8491struct HfDataCreatorCharmResoReduced {
8592
@@ -232,7 +239,7 @@ struct HfDataCreatorCharmResoReduced {
232239 registry.add (" hDType" , " D selection flag" , {HistType::kTH1F , {{5 , -2.5 , 2.5 }}});
233240
234241 registry.add (" hMCRecCounter" , " Number of Reconstructed MC Matched candidates per channel" , {HistType::kTH1F , {{17 , -8.5 , 8.5 }}});
235- registry.add (" hMCRecDebug" , " Debug of MC Reco" , {HistType::kTH1F , {{5 , -0.5 , 4 .5 }}});
242+ registry.add (" hMCRecDebug" , " Debug of MC Reco" , {HistType::kTH1F , {{16 , -0.5 , 15 .5 }}});
236243 registry.add (" hMCRecOrigin" , " Origin of Matched particles" , {HistType::kTH1F , {{3 , -0.5 , 2.5 }}});
237244
238245 registry.add (" hMCGenCounter" , " Number of Generated particles; Decay Channel Flag; pT [GeV/c]" , {HistType::kTH2F , {{17 , -8.5 , 8.5 }, {100 , 0 , 50 }}});
@@ -505,7 +512,6 @@ struct HfDataCreatorCharmResoReduced {
505512 int8_t origin{0 };
506513 std::vector<int > idxBhadMothers{};
507514 float motherPt{-1 .f };
508- bool fillHisto{false };
509515
510516 if constexpr (decChannel == DecayChannel::DstarV0) {
511517 // Ds1 → D* K0 → (D0 π+) K0s → ((K-π+) π+)(π+π-)
@@ -517,41 +523,17 @@ struct HfDataCreatorCharmResoReduced {
517523 auto indexRecK0 = RecoDecay::getMatchedMCRec<false , true >(particlesMc, std::array{vecDaughtersReso[3 ], vecDaughtersReso[4 ]}, kK0 , std::array{+kPiPlus , -kPiPlus }, true , &signV0, 2 );
518524 if (indexRecDstar > -1 && indexRecD0 > -1 && indexRecK0 > -1 ) {
519525 flag = sign * BIT (DecayTypeMc::Ds1ToDStarK0ToD0PiK0s);
520- } else {
521- if (indexRecDstar <= -1 ) {
522- debug = 1 ;
523- LOGF (info, " DS1 decays in the expected final state but Dstar does not!" );
524- }
525- if (indexRecDstar > -1 && indexRecD0 <= -1 ) {
526- debug = 2 ;
527- LOGF (info, " DS1 and Dstar decays in the expected final state but D0 does not!" );
528- }
529- if (indexRecDstar > -1 && indexRecK0 <= -1 ) {
530- debug = 3 ;
531- LOGF (info, " DS1 and Dstar decays in the expected final state but K0 does not!" );
532- }
533- }
534- auto indexMother = RecoDecay::getMother (particlesMc, vecDaughtersReso.back ().template mcParticle_as <PParticles>(), Pdg::kDS1 , true );
535- if (indexMother >= 0 ) {
536- auto particleMother = particlesMc.rawIteratorAt (indexMother);
537- motherPt = particleMother.pt ();
538- }
539- fillHisto = true ;
540- } else { // Verify partly reconstructed decay Ds1 -> D* K0s -> D+ π0 K0s
541- indexRecReso = 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 , -kPiPlus }, true , &sign, 3 );
542- if (indexRecReso > -1 ) {
526+ }
527+ } else if (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 , -kPiPlus }, true , &sign, 3 ) > -1 ){ // Verify partly reconstructed decay Ds1 -> D* K0s -> D+ π0 K0s
543528 auto indexRecDstar = RecoDecay::getMatchedMCRec<false , false , true >(particlesMc, std::array{vecDaughtersReso[0 ], vecDaughtersReso[1 ], vecDaughtersReso[2 ]}, Pdg::kDStar , std::array{-kKPlus , +kPiPlus , +kPiPlus }, true , &signDStar, 2 );
544529 auto indexRecK0 = RecoDecay::getMatchedMCRec<false , true >(particlesMc, std::array{vecDaughtersReso[3 ], vecDaughtersReso[4 ]}, kK0 , std::array{+kPiPlus , -kPiPlus }, true , &signV0, 2 );
545530 if (indexRecDstar > -1 && indexRecK0 > -1 ) {
546531 if (RecoDecay::getMatchedMCRec (particlesMc, std::array{vecDaughtersReso[0 ], vecDaughtersReso[1 ], vecDaughtersReso[2 ]}, Pdg::kDPlus , std::array{+kPiPlus , -kKPlus , +kPiPlus }, true , &signDPlus, 2 ) > -1 ) {
547532 flag = sign * BIT (DecayTypeMc::Ds1ToDStarK0ToDPlusPi0K0s);
548- fillHisto = true ;
549533 } else if (RecoDecay::getMatchedMCRec<false , false , true >(particlesMc, std::array{vecDaughtersReso[0 ], vecDaughtersReso[1 ]}, Pdg::kD0 , std::array{+kPiPlus , -kKPlus }, true , &signD0, 2 ) > -1 ) {
550534 flag = sign * BIT (DecayTypeMc::Ds1ToDStarK0ToD0PiK0sPart);
551- fillHisto = true ;
552535 }
553536 }
554- }
555537 }
556538 if (flag != 0 ) {
557539 auto particleReso = particlesMc.iteratorAt (indexRecReso);
@@ -566,22 +548,12 @@ struct HfDataCreatorCharmResoReduced {
566548 auto indexRecK0 = RecoDecay::getMatchedMCRec<false , true >(particlesMc, std::array{vecDaughtersReso[3 ], vecDaughtersReso[4 ]}, kK0 , std::array{+kPiPlus , -kPiPlus }, true , &signV0, 2 );
567549 if (indexRecDplus > -1 && indexRecK0 > -1 ) {
568550 flag = sign * BIT (DecayTypeMc::Ds2StarToDplusK0s);
569- } else {
570- if (indexRecDplus <= -1 ) {
571- debug = 1 ;
572- LOGF (info, " DS2Star decays in the expected final state but DPlus does not!" );
573- }
574- if (indexRecDplus > -1 && indexRecK0 <= -1 ) {
575- debug = 3 ;
576- LOGF (info, " DS2Star and DPlus decays in the expected final state but K0 does not!" );
577- }
578- }
551+ }
579552 auto indexMother = RecoDecay::getMother (particlesMc, vecDaughtersReso.back ().template mcParticle_as <PParticles>(), Pdg::kDS2Star , true );
580553 if (indexMother >= 0 ) {
581554 auto particleMother = particlesMc.rawIteratorAt (indexMother);
582555 motherPt = particleMother.pt ();
583556 }
584- fillHisto = true ;
585557 } else { // Verify partly reconstructed decay Ds1 -> D* K0s -> D+ π0 K0s
586558 indexRecReso = 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 , -kPiPlus }, true , &sign, 3 );
587559 if (indexRecReso > -1 ) {
@@ -591,20 +563,32 @@ struct HfDataCreatorCharmResoReduced {
591563 auto indexRecDplus = RecoDecay::getMatchedMCRec (particlesMc, std::array{vecDaughtersReso[0 ], vecDaughtersReso[1 ], vecDaughtersReso[2 ]}, Pdg::kDPlus , std::array{+kPiPlus , -kKPlus , +kPiPlus }, true , &sign, 2 );
592564 if (indexRecDplus > -1 ) {
593565 flag = sign * BIT (DecayTypeMc::Ds1ToDStarK0ToDPlusPi0K0s);
594- fillHisto = true ;
595566 }
596567 }
597568 }
598569 }
599570 if (flag != 0 ) {
600571 auto particleReso = particlesMc.iteratorAt (indexRecReso);
601572 origin = RecoDecay::getCharmHadronOrigin (particlesMc, particleReso, false , &idxBhadMothers);
602- }
573+ }
603574 }
604- if (fillHisto ) {
575+ if (flag != 0 ) {
605576 registry.fill (HIST (" hMCRecCounter" ), flag);
606- registry.fill (HIST (" hMCRecDebug" ), debug);
607577 registry.fill (HIST (" hMCRecOrigin" ), origin);
578+ } else {
579+ if (RecoDecay::getMatchedMCRec<false , true >(particlesMc, std::array{vecDaughtersReso[3 ], vecDaughtersReso[4 ]}, kK0 , std::array{+kPiPlus , -kPiPlus }, true , &signV0, 2 ) > -1 ){
580+ SETBIT (debug, PartialMatchMc::K0Matched);
581+ }
582+ if (RecoDecay::getMatchedMCRec (particlesMc, std::array{vecDaughtersReso[0 ], vecDaughtersReso[1 ]}, Pdg::kD0 , std::array{+kPiPlus , -kKPlus }, true , &signD0, 1 ) > -1 ){
583+ SETBIT (debug, PartialMatchMc::D0Matched);
584+ }
585+ if (RecoDecay::getMatchedMCRec<false , false , true >(particlesMc, std::array{vecDaughtersReso[0 ], vecDaughtersReso[1 ], vecDaughtersReso[2 ]}, Pdg::kDStar , std::array{-kKPlus , +kPiPlus , +kPiPlus }, true , &signDStar, 2 ) > -1 ){
586+ SETBIT (debug, PartialMatchMc::DStarMatched);
587+ }
588+ if (RecoDecay::getMatchedMCRec (particlesMc, std::array{vecDaughtersReso[0 ], vecDaughtersReso[1 ], vecDaughtersReso[2 ]}, Pdg::kDPlus , std::array{+kPiPlus , -kKPlus , +kPiPlus }, true , &signDPlus, 2 ) > -1 ){
589+ SETBIT (debug, PartialMatchMc::DPlusMatched);
590+ }
591+ registry.fill (HIST (" hMCRecDebug" ), debug);
608592 }
609593 rowHfDV0McRecReduced (indexHfCandCharm, indexCandV0, flag, debug, origin, motherPt);
610594 }
0 commit comments