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 &JAK_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(JAK_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); des!= Particle->end_vertex()->particles_end(HepMC::children) && Particle->end_vertex()-> particles_out_size()>0;++des ) {
51  Analyze((*des),midx,dores,dopi0);
52  }
53  }
54  else {
55  std::cout << "Unstable particle that is undecayed in Tau decay tree. PDG ID: " << pdgid << std::endl;
56  }
57 }
58 
59 
60 
61 void TauDecay_CMSSW::AddPi0Info(HepMC::GenParticle *Particle,unsigned int midx){
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:17
#define abs(x)
Definition: mlp_lapack.h:159
std::vector< HepMC::GenParticle * > TauDecayProducts
bool isTauFinalStateParticle(int pdgid)
Definition: TauDecay.cc:38
bool isTauResonanceCounter(int pdgid)
Definition: TauDecay.cc:71
void Analyze(HepMC::GenParticle *Particle, unsigned int midx, bool dores, bool dopi0)
std::vector< unsigned int > MotherIdx
void ClassifyDecayMode(unsigned int &JAK_ID, unsigned int &TauBitMask)
Definition: TauDecay.cc:88
tuple cout
Definition: gather_cfg.py:121
void AddPi0Info(HepMC::GenParticle *Particle, unsigned int midx)
bool AnalyzeTau(HepMC::GenParticle *Tau, unsigned int &JAK_ID, unsigned int &TauBitMask, bool dores=true, bool dopi0=true)
bool isTauParticleCounter(int pdgid)
Definition: TauDecay.cc:54