CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TauDecay_GenParticle.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_GenParticle::AnalyzeTau(const reco::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->pdgId())==PdtPdgMini::tau_minus){ // check that it is a tau
22  unsigned int Tauidx=TauDecayProducts.size();
23  TauDecayProducts.push_back(Tau);
24  MotherIdx.push_back(Tauidx);
25  for (unsigned int i=0; i< Tau->numberOfDaughters(); i++){
26  const reco::Candidate *dau=Tau->daughter(i);
27  Analyze(static_cast<const reco::GenParticle*>(dau),Tauidx,dores,dopi0);
28  }
29  ClassifyDecayMode(MODE_ID,TauBitMask);
30  return true;
31  }
32  return false;
33 }
34 
35 
36 
37 
38 void TauDecay_GenParticle::Analyze(const reco::GenParticle *Particle,unsigned int midx,bool dores, bool dopi0){
39  unsigned int pdgid=abs(Particle->pdgId());
40  if(isTauFinalStateParticle(pdgid)){
41  if(!isTauParticleCounter(pdgid)) std::cout << "TauDecay_GenParticle::Analyze WARNING: Unknow Final State Particle in Tau Decay... " << std::endl;
42 
43  if(!AddRadInfo(static_cast<const reco::GenParticle*>(Particle),midx)){
44  TauDecayProducts.push_back(Particle);
45  MotherIdx.push_back(midx);
46  }
47  if(pdgid==PdtPdgMini::pi0 && dopi0){// store information on pi0 decay products even though a pi0 is a finsal state particle (for 3PiPi0 studies)
48  midx=MotherIdx.size()-1;
49  for (unsigned int i=0; i< Particle->numberOfDaughters(); i++){
50  const reco::Candidate *dau=Particle->daughter(i);
51  AddPi0Info(static_cast<const reco::GenParticle*>(dau),midx);
52  }
53  }
54  return;
55  }
56  if(Particle->status()==1 || (isTauResonanceCounter(pdgid) && dores)){
57  TauDecayProducts.push_back(Particle);
58  MotherIdx.push_back(midx);
59  midx=MotherIdx.size()-1;
60  }
61  for (unsigned int i=0; i< Particle->numberOfDaughters(); i++){
62  const reco::Candidate *dau=Particle->daughter(i);
63  Analyze(static_cast<const reco::GenParticle*>(dau),midx,dores,dopi0);
64  }
65 }
66 
67 
69  if(Particle->status()==1){
70  TauDecayProducts.push_back(Particle);
71  MotherIdx.push_back(midx);
72  return;
73  }
74  for (unsigned int i=0; i< Particle->numberOfDaughters(); i++){
75  const reco::Candidate *dau=Particle->daughter(i);
76  AddPi0Info(static_cast<const reco::GenParticle*>(dau),midx);
77  }
78 }
79 
81  bool same(false), photon(false);
82  int n=0;
83  for (unsigned int i=0; i< Particle->numberOfDaughters(); i++){
84  const reco::Candidate *dau=Particle->daughter(i);
85  if(Particle->pdgId()==dau->pdgId()){ same=true;}
86  if(dau->pdgId()==PdtPdgMini::gamma) photon=true;
87  n++;
88  }
89  if(same && photon && n==2){
90  for (unsigned int i=0; i< Particle->numberOfDaughters(); i++){
91  const reco::Candidate *dau=Particle->daughter(i);
92  if(Particle->pdgId()==dau->pdgId()){
93  if(!AddRadInfo(static_cast<const reco::GenParticle*>(dau),midx)){
94  TauDecayProducts.push_back(static_cast<const reco::GenParticle*>(dau));
95  MotherIdx.push_back(midx);
96  }
97  }
98  if(dau->pdgId()==PdtPdgMini::gamma){
99  TauDecayProducts.push_back(static_cast<const reco::GenParticle*>(dau));
100  MotherIdx.push_back(midx);
101  }
102  }
103  return true;
104  }
105  return false;
106 }
int i
Definition: DBlmapReader.cc:9
void Reset()
Definition: TauDecay.cc:15
std::vector< const reco::GenParticle * > TauDecayProducts
bool isTauFinalStateParticle(int pdgid)
Definition: TauDecay.cc:36
virtual int status() const final
status word
void AddPi0Info(const reco::GenParticle *Particle, unsigned int midx)
virtual size_t numberOfDaughters() const
number of daughters
virtual const Candidate * daughter(size_type) const
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< unsigned int > MotherIdx
bool AddRadInfo(const reco::GenParticle *Particle, unsigned int midx)
void Analyze(const reco::GenParticle *Particle, unsigned int midx, bool dores, bool dopi0)
bool isTauResonanceCounter(int pdgid)
Definition: TauDecay.cc:75
void ClassifyDecayMode(unsigned int &MODE_ID, unsigned int &TauBitMask)
Definition: TauDecay.cc:89
virtual int pdgId() const =0
PDG identifier.
virtual int pdgId() const final
PDG identifier.
tuple cout
Definition: gather_cfg.py:145
bool AnalyzeTau(const reco::GenParticle *Tau, unsigned int &MODE_ID, unsigned int &TauBitMask, bool dores, bool dopi0)
bool isTauParticleCounter(int pdgid)
Definition: TauDecay.cc:55