test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TauDecay_CMSSW.cc
Go to the documentation of this file.
3 
4 #include <iomanip>
5 #include <cstdlib>
6 
8  TauDecay()
9 {
10 
11 }
12 
14 
15 }
16 
17 bool TauDecay_CMSSW::AnalyzeTau(HepMC::GenParticle *Tau,unsigned int &MODE_ID,unsigned int &TauBitMask,bool dores, bool dopi0){
18  Reset();
19  MotherIdx.clear();
20  TauDecayProducts.clear();
21  if(abs(Tau->pdg_id())==PdtPdgMini::tau_minus){ // check that it is a tau
22  unsigned int Tauidx=TauDecayProducts.size();
23  HepMC::GenVertex::particle_iterator des;
24  if( Tau->end_vertex()){
25  for(des = Tau->end_vertex()->particles_begin(HepMC::children);
26  des!= Tau->end_vertex()->particles_end(HepMC::children);++des ) {
27  Analyze((*des),Tauidx,dores,dopi0);
28  }
29  ClassifyDecayMode(MODE_ID,TauBitMask);
30  return true;
31  }
32  }
33  return false;
34 }
35 
36 
37 
38 
39 void TauDecay_CMSSW::Analyze(HepMC::GenParticle *Particle,unsigned int midx, bool dores, bool dopi0){
40  unsigned int pdgid=abs(Particle->pdg_id());
41  isTauResonanceCounter(pdgid);
42  if(isTauFinalStateParticle(pdgid)){
43  if(!isTauParticleCounter(pdgid)) std::cout << "TauDecay_CMSSW::Analyze WARNING: Unknow Final State Particle in Tau Decay... " << pdgid << std::endl;
44  TauDecayProducts.push_back(Particle);
45  MotherIdx.push_back(midx);
46  return;
47  }
48  HepMC::GenVertex::particle_iterator des;
49  if(Particle->end_vertex()){
50  for(des = Particle->end_vertex()->particles_begin(HepMC::children);
51  des!= Particle->end_vertex()->particles_end(HepMC::children) && Particle->end_vertex()-> particles_out_size()>0;++des ) {
52  Analyze((*des),midx,dores,dopi0);
53  }
54  }
55  else {
56  std::cout << "Unstable particle that is undecayed in Tau decay tree. PDG ID: " << pdgid << std::endl;
57  }
58 }
59 
60 
62  if(Particle->status()==1){
63  TauDecayProducts.push_back(Particle);
64  MotherIdx.push_back(midx);
65  return;
66  }
67  HepMC::GenVertex::particle_iterator des;
68  for(des = Particle->end_vertex()->particles_begin(HepMC::children);
69  des!= Particle->end_vertex()->particles_end(HepMC::children);++des ) {
70  AddPi0Info((*des),midx);
71  }
72 }
void Reset()
Definition: TauDecay.cc:15
std::vector< HepMC::GenParticle * > TauDecayProducts
bool AnalyzeTau(HepMC::GenParticle *Tau, unsigned int &MODE_ID, unsigned int &TauBitMask, bool dores=true, bool dopi0=true)
bool isTauFinalStateParticle(int pdgid)
Definition: TauDecay.cc:36
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool isTauResonanceCounter(int pdgid)
Definition: TauDecay.cc:75
void ClassifyDecayMode(unsigned int &MODE_ID, unsigned int &TauBitMask)
Definition: TauDecay.cc:89
void Analyze(HepMC::GenParticle *Particle, unsigned int midx, bool dores, bool dopi0)
std::vector< unsigned int > MotherIdx
tuple cout
Definition: gather_cfg.py:145
void AddPi0Info(HepMC::GenParticle *Particle, unsigned int midx)
bool isTauParticleCounter(int pdgid)
Definition: TauDecay.cc:55