@@ -417,6 +417,16 @@ int IsFromCharm(TMCParticle const& p, TMCParticles const& mcparticles)
417417 return -999 ;
418418}
419419// _______________________________________________________________________
420+ template <typename TMCParticle>
421+ bool isFlavorOscillationB (TMCParticle const & mcParticle)
422+ {
423+ if ((std::abs (mcParticle.pdgCode ()) == 511 || std::abs (mcParticle.pdgCode ()) == 531 ) && mcParticle.getGenStatusCode () == 92 ) {
424+ return true ;
425+ } else {
426+ return false ;
427+ }
428+ }
429+ // _______________________________________________________________________
420430template <typename TMCParticle, typename TMCParticles>
421431bool findFlavorOscillationB (TMCParticle const & mcParticle, TMCParticles const & mcParticles)
422432{
@@ -430,7 +440,7 @@ bool findFlavorOscillationB(TMCParticle const& mcParticle, TMCParticles const& m
430440 while (motherid1 > -1 ) {
431441 if (motherid1 < mcParticles.size ()) { // protect against bad mother indices. why is this needed?
432442 auto mp = mcParticles.iteratorAt (motherid1);
433- if (( std::abs (mp. pdgCode ()) == 511 || std::abs (mp. pdgCode ()) == 531 ) && mp. getGenStatusCode () == 92 ) {
443+ if (isFlavorOscillationB (mp) ) {
434444 return true ;
435445 }
436446
@@ -554,8 +564,8 @@ int IsHF(TMCParticle1 const& p1, TMCParticle2 const& p2, TMCParticles const& mcp
554564
555565 auto mpfh1 = mcparticles.iteratorAt (find1stHadron (p1, mcparticles));
556566 auto mpfh2 = mcparticles.iteratorAt (find1stHadron (p2, mcparticles));
557- bool isFOFound1 = findFlavorOscillationB (p1, mcparticles);
558- bool isFOFound2 = findFlavorOscillationB (p2, mcparticles);
567+ bool isFOat1stDecay1 = isFlavorOscillationB (mpfh1); // oscillation occured at 1st hb decay.
568+ bool isFOat1stDecay2 = isFlavorOscillationB (mpfh2); // oscillation occured at 1st hb decay.
559569
560570 bool is_direct_from_b1 = isWeakDecayFromBeautyHadron (p1, mcparticles);
561571 bool is_direct_from_b2 = isWeakDecayFromBeautyHadron (p2, mcparticles);
@@ -564,7 +574,7 @@ int IsHF(TMCParticle1 const& p1, TMCParticle2 const& p2, TMCParticles const& mcp
564574 bool is_c_from_b1 = isWeakDecayFromCharmHadron (p1, mcparticles) && IsFromBeauty (p1, mcparticles) > 0 ;
565575 bool is_c_from_b2 = isWeakDecayFromCharmHadron (p2, mcparticles) && IsFromBeauty (p2, mcparticles) > 0 ;
566576
567- if (is_prompt_c1 && is_prompt_c2 && mpfh1.pdgCode () * mpfh2.pdgCode () < 0 ) { // charmed mesons never oscillate. only ULS
577+ if (is_prompt_c1 && is_prompt_c2 && mpfh1.pdgCode () * mpfh2.pdgCode () < 0 ) { // charmed mesons never oscillate. Be careful with D(2007)*0 -> D0 e+ e-
568578 mothers_id1.clear ();
569579 mothers_pdg1.clear ();
570580 mothers_id2.clear ();
@@ -576,9 +586,9 @@ int IsHF(TMCParticle1 const& p1, TMCParticle2 const& p2, TMCParticles const& mcp
576586 return static_cast <int >(EM_HFeeType::kCe_Ce ); // cc->ee, decay type = 0
577587 }
578588
579- bool b2l_b2l_case0 = is_direct_from_b1 && is_direct_from_b2 && mpfh1.pdgCode () * mpfh2.pdgCode () < 0 && !isFOFound1 && !isFOFound2 ; // 0 oscillation: bbbar -> ll ULS
580- bool b2l_b2l_case1 = is_direct_from_b1 && is_direct_from_b2 && mpfh1.pdgCode () * mpfh2.pdgCode () > 0 && static_cast <bool >(isFOFound1 ^ isFOFound2 ); // 1 oscillation: bbbar -> ll LS
581- bool b2l_b2l_case2 = is_direct_from_b1 && is_direct_from_b2 && mpfh1.pdgCode () * mpfh2.pdgCode () < 0 && isFOFound1 && isFOFound2 ; // 2 oscillation: bbbar -> ll ULS
589+ bool b2l_b2l_case0 = is_direct_from_b1 && is_direct_from_b2 && mpfh1.pdgCode () * mpfh2.pdgCode () < 0 && !isFOat1stDecay1 && !isFOat1stDecay2 ; // bbbar -> ll ULS
590+ bool b2l_b2l_case1 = is_direct_from_b1 && is_direct_from_b2 && mpfh1.pdgCode () * mpfh2.pdgCode () > 0 && static_cast <bool >(isFOat1stDecay1 ^ isFOat1stDecay2 ); // bbbar -> ll LS
591+ bool b2l_b2l_case2 = is_direct_from_b1 && is_direct_from_b2 && mpfh1.pdgCode () * mpfh2.pdgCode () < 0 && isFOat1stDecay1 && isFOat1stDecay2 ; // bbbar -> ll ULS
582592
583593 if (b2l_b2l_case0 || b2l_b2l_case1 || b2l_b2l_case2) {
584594 mothers_id1.clear ();
@@ -592,9 +602,9 @@ int IsHF(TMCParticle1 const& p1, TMCParticle2 const& p2, TMCParticles const& mcp
592602 return static_cast <int >(EM_HFeeType::kBe_Be ); // bb->ee, decay type = 2
593603 }
594604
595- bool b2c2l_b2c2l_case0 = is_c_from_b1 && is_c_from_b2 && mpfh1.pdgCode () * mpfh2.pdgCode () < 0 && !isFOFound1 && !isFOFound2 ; // 0 oscillation: bbbar -> ll ULS
596- bool b2c2l_b2c2l_case1 = is_c_from_b1 && is_c_from_b2 && mpfh1.pdgCode () * mpfh2.pdgCode () > 0 && static_cast <bool >(isFOFound1 ^ isFOFound2 ); // 1 oscillation: bbbar -> ll LS
597- bool b2c2l_b2c2l_case2 = is_c_from_b1 && is_c_from_b2 && mpfh1.pdgCode () * mpfh2.pdgCode () < 0 && isFOFound1 && isFOFound2 ; // 2 oscillation: bbbar -> ll ULS
605+ bool b2c2l_b2c2l_case0 = is_c_from_b1 && is_c_from_b2 && mpfh1.pdgCode () * mpfh2.pdgCode () < 0 && !isFOat1stDecay1 && !isFOat1stDecay2 ; // bbbar -> ll ULS
606+ bool b2c2l_b2c2l_case1 = is_c_from_b1 && is_c_from_b2 && mpfh1.pdgCode () * mpfh2.pdgCode () > 0 && static_cast <bool >(isFOat1stDecay1 ^ isFOat1stDecay2 ); // bbbar -> ll LS
607+ bool b2c2l_b2c2l_case2 = is_c_from_b1 && is_c_from_b2 && mpfh1.pdgCode () * mpfh2.pdgCode () < 0 && isFOat1stDecay1 && isFOat1stDecay2 ; // bbbar -> ll ULS
598608
599609 if (b2c2l_b2c2l_case0 || b2c2l_b2c2l_case1 || b2c2l_b2c2l_case2) {
600610 mothers_id1.clear ();
@@ -625,15 +635,15 @@ int IsHF(TMCParticle1 const& p1, TMCParticle2 const& p2, TMCParticles const& mcp
625635 mothers_pdg1.shrink_to_fit ();
626636 mothers_id2.shrink_to_fit ();
627637 mothers_pdg2.shrink_to_fit ();
628- return static_cast <int >(EM_HFeeType::kBCe_Be_SameB ); // b->c->e and b->e, decay type = 3. this should happen only in ULS.
638+ return static_cast <int >(EM_HFeeType::kBCe_Be_SameB ); // b->c->e and b->e, decay type = 3
629639 }
630640 }
631641 } // end of motherid2
632642 } // end of motherid1
633643
634- bool b2c2l_b2l_diffb_case0 = mpfh1.pdgCode () * mpfh2.pdgCode () > 0 && !isFOFound1 && !isFOFound2 ; // 0 oscillation: bbbar -> ll LS
635- bool b2c2l_b2l_diffb_case1 = mpfh1.pdgCode () * mpfh2.pdgCode () < 0 && static_cast <bool >(isFOFound1 ^ isFOFound2 ); // 1 oscillation: bbbar -> ll ULS
636- bool b2c2l_b2l_diffb_case2 = mpfh1.pdgCode () * mpfh2.pdgCode () > 0 && isFOFound1 && isFOFound2 ; // 2 oscillation: bbbar -> ll LS
644+ bool b2c2l_b2l_diffb_case0 = mpfh1.pdgCode () * mpfh2.pdgCode () < 0 && !isFOat1stDecay1 && !isFOat1stDecay2 ; // bbbar -> ll LS
645+ bool b2c2l_b2l_diffb_case1 = mpfh1.pdgCode () * mpfh2.pdgCode () > 0 && static_cast <bool >(isFOat1stDecay1 ^ isFOat1stDecay2 ); // bbbar -> ll ULS
646+ bool b2c2l_b2l_diffb_case2 = mpfh1.pdgCode () * mpfh2.pdgCode () < 0 && isFOat1stDecay1 && isFOat1stDecay2 ; // bbbar -> ll LS
637647
638648 if (b2c2l_b2l_diffb_case0 || b2c2l_b2l_diffb_case1 || b2c2l_b2l_diffb_case2) {
639649 mothers_id1.clear ();
@@ -644,7 +654,7 @@ int IsHF(TMCParticle1 const& p1, TMCParticle2 const& p2, TMCParticles const& mcp
644654 mothers_pdg1.shrink_to_fit ();
645655 mothers_id2.shrink_to_fit ();
646656 mothers_pdg2.shrink_to_fit ();
647- return static_cast <int >(EM_HFeeType::kBCe_Be_DiffB ); // b->c->e and b->e, decay type = 4. this should happen only in LS.
657+ return static_cast <int >(EM_HFeeType::kBCe_Be_DiffB ); // b->c->e and b->e, decay type = 4
648658 }
649659 }
650660
0 commit comments