CMS 3D CMS Logo

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