9 #include <analysis/modules/TauDecayMode/TauDecayModeModule.h>
10 #include <framework/datastore/StoreArray.h>
11 #include <framework/datastore/StoreObjPtr.h>
12 #include <framework/logging/Logger.h>
13 #include <framework/particledb/EvtGenDatabasePDG.h>
17 #include <TParticlePDG.h>
24 std::map<std::string, int> make_map(
const std::string& file,
int chg)
29 B2INFO(
"Missing input mapping file: use mp_file_minus=basf2.find_file('data/analysis/modules/TauDecayMode/map_tauminus.txt') TauDecayMode.param('file_minus', mp_file_minus) to classify with default mapping.");
31 B2INFO(
"Missing input mapping file: use mp_file_plus=basf2.find_file('data/analysis/modules/TauDecayMode/map_tauplus.txt') TauDecayMode.param('file_plus', mp_file_plus) to classify with default mapping.");
42 std::map <std::string, int> map_tau;
45 istringstream ss(line);
61 TauDecayModeModule::TauDecayModeModule() :
Module(), m_taum_no(0), m_taup_no(0), m_mmode(-2), m_pmode(-2),
62 m_mprong(0), m_pprong(0), tauPair(false), numOfTauMinus(0), numOfTauPlus(0), idOfTauMinus(-1), idOfTauPlus(-1),
63 m_isEtaPizPizPizFromTauMinus(false), m_isEtaPizPizPizFromTauPlus(false),
64 m_isOmegaPimPipFromTauMinus(false), m_isOmegaPimPipFromTauPlus(false)
67 setDescription(
"Module to identify generated tau pair decays, using MCParticle information."
68 "By default, each tau decay is numbered as TauolaBelle2DecayMode [Ref: BELLE2-NOTE-PH-2020-055]");
70 addParam(
"printmode",
m_printmode,
"Printout more information from each event", std::string(
"default"));
71 addParam(
"file_minus",
m_file_minus,
"Path for an alternative mapping for tau- decays", std::string(
""));
72 addParam(
"file_plus",
m_file_plus,
"Path for an alternative mapping for tau+ decays", std::string(
""));
190 map<int, std::vector<int>> map_vec;
233 map_vec[9010221] =
vec_f0;
239 bool elecFirst =
true;
240 bool muonFirst =
true;
242 bool isPiPizGamTauMinusFirst =
true;
243 bool isPiPizGamTauPlusFirst =
true;
245 bool isLFVTauMinus2BodyDecayFirst =
true;
246 bool isLFVTauPlus2BodyDecayFirst =
true;
248 bool isChargedRhoFromTauMinusFirst =
true;
249 bool isChargedRhoFromTauPlusFirst =
true;
251 bool isChargedA1FromTauMinusFirst =
true;
252 bool isChargedA1FromTauPlusFirst =
true;
254 bool isEtaPPGFromTauMinusFirst =
true;
255 bool isEtaPPGFromTauPlusFirst =
true;
257 bool isOmegaPizGamFromTauMinusFirst =
true;
258 bool isOmegaPizGamFromTauPlusFirst =
true;
260 bool isEtaPizPizPizFromTauMinusFirst =
true;
261 bool isEtaPizPizPizFromTauPlusFirst =
true;
266 bool isOmegaPimPipFromTauMinusFirst =
true;
267 bool isOmegaPimPipFromTauPlusFirst =
true;
273 for (
int i = 0; i <
MCParticles.getEntries(); i++) {
277 int pdgid = p.getPDG();
283 if (p.isInitial())
continue;
288 const vector<MCParticle*> daughters = mother->
getDaughters();
291 stringstream elec_ss;
294 elec_ss << d->getPDG() <<
" ";
298 if (nElMinus == 1 && nElPlus == 1) {
299 B2DEBUG(1,
"Mother of elec pair is = " << mother->
getPDG() <<
" which has daughters : " << elec_ss.str());
303 if (pdgid ==
Const::muon.getPDGCode() && muonFirst) {
306 const vector<MCParticle*> daughters = mother->
getDaughters();
309 stringstream muon_ss;
312 muon_ss << d->getPDG() <<
" ";
316 if (nMuMinus == 1 && nMuPlus == 1) {
317 B2DEBUG(1,
"Mother of muon pair is = " << mother->
getPDG() <<
" which has daughters : " << muon_ss.str());
322 bool accept_photon =
false;
325 int mothid = abs(mother->
getPDG());
328 bool isRadiationfromFinalStateChargedParticle =
false;
335 isRadiationfromFinalStateChargedParticle =
true;
339 bool isRadiationFromChargedRho =
false;
342 if (chg < 0 && isChargedRhoFromTauMinusFirst) {
343 isChargedRhoFromTauMinusFirst =
false;
344 isRadiationFromChargedRho =
true;
346 if (chg > 0 && isChargedRhoFromTauPlusFirst) {
347 isChargedRhoFromTauPlusFirst =
false;
348 isRadiationFromChargedRho =
true;
353 bool isRadiationFromChargedA1 =
false;
354 if (mothid == 20213) {
356 if (chg < 0 && isChargedA1FromTauMinusFirst) {
357 isChargedA1FromTauMinusFirst =
false;
358 isRadiationFromChargedA1 =
true;
360 if (chg > 0 && isChargedA1FromTauPlusFirst) {
361 isChargedA1FromTauPlusFirst =
false;
362 isRadiationFromChargedA1 =
true;
367 bool isRadiationfromIntermediateWBoson =
false;
368 if (mothid == 24) isRadiationfromIntermediateWBoson =
true;
373 bool isPiPizGam =
false;
374 if (isRadiationfromIntermediateWBoson) {
375 if (p.get4Vector().E() > 0.050) {
376 const vector<MCParticle*> daughters = mother->
getDaughters();
380 int nOtherSisters = 0;
384 if (abs(d->getPDG()) == 211) {
386 }
else if (abs(d->getPDG()) == 111) {
388 }
else if (abs(d->getPDG()) != 22) {
393 if (nTotSisters >= 3 && nPiSisters == 1 && nPizSisters == 1 && nOtherSisters == 0) {
395 if (chg < 0 && isPiPizGamTauMinusFirst) {
396 isPiPizGamTauMinusFirst =
false;
399 if (chg > 0 && isPiPizGamTauPlusFirst) {
400 isPiPizGamTauPlusFirst =
false;
408 bool isRadiationfromTau =
false;
409 if (mothid == 15) isRadiationfromTau =
true;
412 bool isLFVTau2BodyDecay =
false;
413 if (isRadiationfromTau) {
414 bool hasNeutrinoAsSister =
false;
415 int numChargedSister = 0;
416 int numNeutralNonNeutrinoNonPhotonSister = 0;
417 const vector<MCParticle*> daughters = mother->
getDaughters();
421 if (hasNeutrinoAsSister)
break;
423 if (!hasNeutrinoAsSister) {
427 if (isChargedFinalState) {
429 }
else if (d->getPDG() != 22) {
430 numNeutralNonNeutrinoNonPhotonSister++;
433 if (numChargedSister == 1 && numNeutralNonNeutrinoNonPhotonSister == 0) {
434 if (mother->
getPDG() == 15 && isLFVTauMinus2BodyDecayFirst) {
435 isLFVTauMinus2BodyDecayFirst =
false;
436 isLFVTau2BodyDecay =
true;
438 if (mother->
getPDG() == -15 && isLFVTauPlus2BodyDecayFirst) {
439 isLFVTauPlus2BodyDecayFirst =
false;
440 isLFVTau2BodyDecay =
true;
444 B2DEBUG(1,
"hasNeutrinoAsSister = " << hasNeutrinoAsSister
445 <<
" numChargedSister = " << numChargedSister
446 <<
" numNeutralNonNeutrinoNonPhotonSister = " << numNeutralNonNeutrinoNonPhotonSister
447 <<
" isLFVTau2BodyDecay = " << isLFVTau2BodyDecay);
450 bool isPi0GG =
false;
451 bool isEtaGG =
false;
452 bool isEtpGG =
false;
453 bool isPi0GEE =
false;
454 bool isEtaPPG =
false;
455 bool isOmPizG =
false;
456 if (mothid == 111 || mothid == 221 || mothid == 331 || mothid == 223) {
457 const vector<MCParticle*> daughters = mother->
getDaughters();
458 int numberofTotalDaughters = 0;
459 int numberOfPhotonDaughters = 0;
460 int numberOfElectronDaughters = 0;
461 int numberOfPionDaughters = 0;
462 int numberOfPizDaughters = 0;
465 numberofTotalDaughters ++;
466 if (abs(d->getPDG()) == 22) numberOfPhotonDaughters++;
467 if (abs(d->getPDG()) == 11) numberOfElectronDaughters++;
468 if (abs(d->getPDG()) == 211) numberOfPionDaughters++;
469 if (abs(d->getPDG()) == 111) numberOfPizDaughters++;
471 if (numberofTotalDaughters == 2 && numberOfPhotonDaughters == 2) {
472 if (mothid == 111) isPi0GG =
true;
473 if (mothid == 221) isEtaGG =
true;
474 if (mothid == 331) isEtpGG =
true;
476 if (numberofTotalDaughters >= 3 && numberOfPhotonDaughters >= 1 && numberOfElectronDaughters == 2 && numberOfPionDaughters == 0
477 && numberOfPizDaughters == 0) {
478 if (mothid == 111) isPi0GEE =
true;
480 if (numberofTotalDaughters >= 3 && numberOfPhotonDaughters >= 1 && numberOfPizDaughters == 0 && numberOfPionDaughters == 2) {
483 if (chg < 0 && isEtaPPGFromTauMinusFirst) {
484 isEtaPPGFromTauMinusFirst =
false;
487 if (chg > 0 && isEtaPPGFromTauPlusFirst) {
488 isEtaPPGFromTauPlusFirst =
false;
493 if (numberofTotalDaughters >= 2 && numberOfPhotonDaughters >= 1 && numberOfPizDaughters == 1 && numberOfPionDaughters == 0) {
496 if (chg < 0 && isOmegaPizGamFromTauMinusFirst) {
497 isOmegaPizGamFromTauMinusFirst =
false;
500 if (chg > 0 && isOmegaPizGamFromTauPlusFirst) {
501 isOmegaPizGamFromTauPlusFirst =
false;
508 B2DEBUG(1,
"isRadiationfromFinalStateChargedParticle = " << isRadiationfromFinalStateChargedParticle);
509 B2DEBUG(1,
"isRadiationFromChargedRho = " << isRadiationFromChargedRho);
510 B2DEBUG(1,
"isRadiationFromChargedA1 = " << isRadiationFromChargedA1);
511 B2DEBUG(1,
"isRadiationfromIntermediateWBoson = " << isRadiationfromIntermediateWBoson <<
" isPiPizGam = " << isPiPizGam);
512 B2DEBUG(1,
"isRadiationfromTau = " << isRadiationfromTau <<
" isLFVTau2BodyDecay = " << isLFVTau2BodyDecay);
513 B2DEBUG(1,
"isPi0GG = " << isPi0GG <<
" isEtaGG = " << isEtaGG <<
" isEtpGG = " << isEtpGG <<
" isPi0GEE = " << isPi0GEE);
514 B2DEBUG(1,
"isEtaPPG = " << isEtaPPG <<
" isOmPizG = " << isOmPizG);
520 if (isRadiationfromFinalStateChargedParticle) {
521 }
else if (isRadiationFromChargedRho) {
522 accept_photon =
true;
523 }
else if (isRadiationFromChargedA1) {
524 accept_photon =
true;
525 }
else if (isRadiationfromIntermediateWBoson) {
527 accept_photon =
true;
529 }
else if (isRadiationfromTau) {
530 if (isLFVTau2BodyDecay) {
531 accept_photon =
true;
533 }
else if (isPi0GG) {
534 }
else if (isEtaGG) {
535 }
else if (isEtpGG) {
536 }
else if (isPi0GEE) {
537 }
else if (isEtaPPG) {
538 accept_photon =
true;
539 }
else if (isOmPizG) {
540 accept_photon =
true;
548 if (pdgid == 111 && (isEtaPizPizPizFromTauMinusFirst || isEtaPizPizPizFromTauPlusFirst)) {
550 if (mother->
getPDG() == 221) {
551 const vector<MCParticle*> daughters = mother->
getDaughters();
555 if (d->getPDG() == 111) nPizSisters++;
557 B2DEBUG(1,
"nPizSisters = " << nPizSisters);
558 if (nPizSisters == 3) {
560 if (chg < 0 && isEtaPizPizPizFromTauMinusFirst) {
561 isEtaPizPizPizFromTauMinusFirst =
false;
564 if (chg > 0 && isEtaPizPizPizFromTauPlusFirst) {
565 isEtaPizPizPizFromTauPlusFirst =
false;
572 "isEtaPizPizPizFromTauMinusFirst = " << isEtaPizPizPizFromTauMinusFirst <<
" "
574 "isEtaPizPizPizFromTauPlusFirst = " << isEtaPizPizPizFromTauPlusFirst <<
" "
591 if (pdgid == -211 && (isOmegaPimPipFromTauMinusFirst || isOmegaPimPipFromTauPlusFirst)) {
593 if (mother->
getPDG() == 223) {
594 const vector<MCParticle*> daughters = mother->
getDaughters();
595 int nOmegaDaughters = 0;
602 if (d->getPDG() == -211) nPimSisters++;
603 if (d->getPDG() == 211) nPipSisters++;
604 if (d->getPDG() == 111) nPizSisters++;
607 "nOmegaDaughters = " << nOmegaDaughters <<
" "
608 "nPimSisters = " << nPimSisters <<
" "
609 "nPipSisters = " << nPipSisters <<
" "
610 "nPizSisters = " << nPizSisters);
611 if (nOmegaDaughters >= 2 && nPimSisters == 1 && nPipSisters == 1 && nPizSisters == 0) {
613 if (chg < 0 && isOmegaPimPipFromTauMinusFirst) {
614 isOmegaPimPipFromTauMinusFirst =
false;
617 if (chg > 0 && isOmegaPimPipFromTauPlusFirst) {
618 isOmegaPimPipFromTauPlusFirst =
false;
625 "isOmegaPimPipFromTauMinusFirst = " << isOmegaPimPipFromTauMinusFirst <<
" "
627 "isOmegaPimPipFromTauPlusFirst = " << isOmegaPimPipFromTauPlusFirst <<
" "
632 map<int, std::vector<int>>::iterator ite ;
633 for (ite = map_vec.begin(); ite != map_vec.end(); ++ite) {
634 if (pdgid == ite->first) {
637 B2DEBUG(1,
"Photon accepted");
638 ite-> second.push_back(i);
641 ite-> second.push_back(i);
652 map<int, std::vector<int>>::iterator itr ;
653 for (itr = map_vec.begin(); itr != map_vec.end(); ++itr) {
654 for (
unsigned int i = 0; i < itr-> second.size(); i++) {
655 int ii = itr-> second[i];
667 for (
unsigned iorder = 0; iorder < 46; ++iorder) {
672 int pdg = p->getPDG();
673 if (pdg == -130) pdg = 130;
674 if (pdg != ii)
continue;
679 pdgname = databasePDG->GetParticle(pdg)->GetName();
689 for (
unsigned iorder = 0; iorder < 46; ++iorder) {
694 int pdg = p->getPDG();
695 if (pdg == -130) pdg = 130;
696 if (pdg != ii)
continue;
701 pdgname = databasePDG->GetParticle(pdg)->GetName();
715 map<std::string, int>::iterator itr ;
716 for (itr = mode_decay.begin(); itr != mode_decay.end(); ++itr) {
717 if (state == itr-> first) {
718 int mode = itr-> second;
745 if (mother ==
nullptr) {
747 }
else if (abs(p->getPDG()) == 11 && mother->
getPDG() == 111) {
749 }
else if (abs(p->getPDG()) == 11 && mother->
getPDG() == 221) {
751 }
else if (abs(p->getPDG()) == 11 && mother->
getPDG() == 113) {
753 }
else if (abs(p->getPDG()) == 11 && mother->
getPDG() == 223) {
755 }
else if (abs(p->getPDG()) == 11 && mother->
getPDG() == 333) {
757 }
else if (abs(p->getPDG()) == 13 && mother->
getPDG() == 221) {
759 }
else if (abs(p->getPDG()) == 13 && mother->
getPDG() == 113) {
761 }
else if (abs(p->getPDG()) == 13 && mother->
getPDG() == 333) {
763 }
else if (mother->
getPDG() == 15) {
765 }
else if (mother->
getPDG() == -15) {
779 for (
int i = 0; i <
MCParticles.getEntries(); i++) {
782 if (p.getStatus() == 1 && p.getPDG() == 15) {
786 if (p.getStatus() == 1 && p.getPDG() == -15) {
800 const vector<MCParticle*> daughters = p.getDaughters();
801 if (daughters.empty())
return ret;
808 if (isChargedFinalState) ret++;
int getPDGCode() const
PDG code.
static const ChargedStable muon
muon particle
static const ParticleType Klong
K^0_L particle.
static const ParticleType photon
photon particle
static const ChargedStable electron
electron particle
Replacement for TDatabasePDG that is filled from EvtGen's evt.pdl.
static EvtGenDatabasePDG * Instance()
Instance method that loads the EvtGen table.
A Class to store the Monte Carlo particle information.
@ c_PrimaryParticle
bit 0: Particle is primary particle.
std::vector< Belle2::MCParticle * > getDaughters() const
Get vector of all daughter particles, empty vector if none.
int getPDG() const
Return PDG code of particle.
void setDescription(const std::string &description)
Sets the description of the module.
std::vector< int > vec_numu
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_em
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_omega
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_k0s
Variable name of the vector where particles identified in the event are stored.
Int_t m_mprong
Prong of the decay channel of tau-.
std::vector< int > vec_b1p
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_f1
Variable name of the vector where particles identified in the event are stored.
int numOfTauPlus
Number of tau+ in the event.
Int_t m_pprong
Prong of the decay channel of tau+.
StoreObjPtr< EventMetaData > m_event_metadata
event number
void IdentifyTauPair()
Identifies if the event is a generated tau pair.
std::vector< int > vec_apro
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_pi0
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_alpha
Variable name of the vector where particles identified in the event are stored.
StoreArray< MCParticle > MCParticles
StoreArray of MCParticles.
std::vector< int > vec_anue
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_nue
Variable name of the vector where particles identified in the event are stored.
virtual void initialize() override
Initializes the module.
std::vector< int > vec_a0p_980
Variable name of the vector where particles identified in the event are stored.
std::string m_file_plus
Alternative mapping for tau+.
std::vector< int > vec_a0m_1450
Variable name of the vector where particles identified in the event are stored.
virtual void event() override
Method is called for each event.
bool m_isEtaPizPizPizFromTauMinus
Flag for eta->pi0pi0pi0 decays from tau-.
std::vector< int > vec_lmb_br
Variable name of the vector where particles identified in the event are stored.
Int_t m_mmode
ID of the decay channel of tau-.
void AnalyzeTauPairEvent()
Analyze a generated tau pair event.
bool m_isOmegaPimPipFromTauMinus
Flag for omega->pi-pi+ decays from tau-.
int getRecursiveMotherCharge(const MCParticle *mc)
Identifies particles coming from tau decays.
std::vector< int > vec_phi
Variable name of the vector where particles identified in the event are stored.
static constexpr int Neutrinos[3]
PDG codes of neutrinos in final state particles in generation: {nu_e, nu_mu, mu_tau}.
int m_taum_no
number of tau- unclassified events
std::string m_tauminusdecaymode
Variable name for the decay mode of the tau-.
std::vector< int > vec_a1p
Variable name of the vector where particles identified in the event are stored.
bool m_isOmegaPimPipFromTauPlus
Flag for omega->pi-pi+ decays from tau+.
bool tauPair
Boolean variable used to identify tau event.
int TauolaBelle2DecayMode(const std::string &s, int chg)
Classifies the decays of the event and assigns a decay mode.
int idOfTauMinus
Index of the generated tau-.
std::vector< int > vec_lambda
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_anut
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_f0
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_mum
Variable name of the vector where particles identified in the event are stored.
Int_t m_pmode
ID of the decay channel of tau+.
static constexpr int OrderedList[46]
PDG codes of ORDERED particles.
int numOfTauMinus
Number of tau- in the event.
std::vector< int > vec_nut
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_kstar0_br
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_a00_1450
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_kstar0
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_a0m_980
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_a00_980
Variable name of the vector where particles identified in the event are stored.
int getProngOfDecay(const MCParticle &mc)
Identifies the number of charged final state particles in the decay.
std::vector< int > vec_a1m
Variable name of the vector where particles identified in the event are stored.
int idOfTauPlus
Index of the generated tau+.
StoreObjPtr< TauPairDecay > m_tauDecay
pointer to tau pair decay objects
std::vector< int > vec_rhop
Variable name of the vector where particles identified in the event are stored.
std::string m_printmode
Parameter passed by the user to indicated the informationt to be printed.
std::vector< int > vec_pro
Variable name of the vector where particles identified in the event are stored.
bool m_isEtaPizPizPizFromTauPlus
Flag for eta->pi0pi0pi0 decays from tau+.
std::string m_tauplusdecaymode
Variable name for the decay mode of the tau+.
std::vector< int > vec_pim
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_mup
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_pip
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_kstarp
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_kstarm
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_etapr
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_ep
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_k0l
Variable name of the vector where particles identified in the event are stored.
static constexpr int finalStatePDGs[5]
PDG codes accepted as charged final state particles in generation: {e, mu, pi, K, p}.
std::vector< int > vec_eta
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_km
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_anumu
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_dau_tauplus
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_rhom
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_gam
Variable name of the vector where particles identified in the event are stored.
std::string m_file_minus
Alternative mapping for tau-.
int m_taup_no
number of tau+ unclassified events
std::vector< int > vec_dau_tauminus
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_kp
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_b1m
Variable name of the vector where particles identified in the event are stored.
std::vector< int > vec_rho0
Variable name of the vector where particles identified in the event are stored.
std::map< std::string, int > mode_decay_minus
Mapping for tau- decays.
std::map< std::string, int > mode_decay_plus
Mapping for tau+ decays.
std::vector< int > vec_a0p_1450
Variable name of the vector where particles identified in the event are stored.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.