CMS 3D CMS Logo

TauDecay_GenParticle.cc
Go to the documentation of this file.
3 
4 #include <iomanip>
5 #include <cstdlib>
6 
8 
10 
12  const reco::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->pdgId()) == PdtPdgMini::tau_minus) { // check that it is a tau
17  unsigned int Tauidx = TauDecayProducts.size();
18  TauDecayProducts.push_back(Tau);
19  MotherIdx.push_back(Tauidx);
20  for (unsigned int i = 0; i < Tau->numberOfDaughters(); i++) {
21  const reco::Candidate *dau = Tau->daughter(i);
22  Analyze(static_cast<const reco::GenParticle *>(dau), Tauidx, dores, dopi0);
23  }
25  return true;
26  }
27  return false;
28 }
29 
30 void TauDecay_GenParticle::Analyze(const reco::GenParticle *Particle, unsigned int midx, bool dores, bool dopi0) {
31  unsigned int pdgid = abs(Particle->pdgId());
34  std::cout << "TauDecay_GenParticle::Analyze WARNING: Unknow Final State Particle in Tau Decay... " << std::endl;
35 
36  if (!AddRadInfo(static_cast<const reco::GenParticle *>(Particle), midx)) {
37  TauDecayProducts.push_back(Particle);
38  MotherIdx.push_back(midx);
39  }
40  // store information on pi0 decay products even though a pi0 is a finsal state particle (for 3PiPi0 studies)
41  if (pdgid == PdtPdgMini::pi0 && dopi0) {
42  midx = MotherIdx.size() - 1;
43  for (unsigned int i = 0; i < Particle->numberOfDaughters(); i++) {
44  const reco::Candidate *dau = Particle->daughter(i);
45  AddPi0Info(static_cast<const reco::GenParticle *>(dau), midx);
46  }
47  }
48  return;
49  }
50  if (Particle->status() == 1 || (isTauResonanceCounter(pdgid) && dores)) {
51  TauDecayProducts.push_back(Particle);
52  MotherIdx.push_back(midx);
53  midx = MotherIdx.size() - 1;
54  }
55  for (unsigned int i = 0; i < Particle->numberOfDaughters(); i++) {
56  const reco::Candidate *dau = Particle->daughter(i);
57  Analyze(static_cast<const reco::GenParticle *>(dau), midx, dores, dopi0);
58  }
59 }
60 
62  if (Particle->status() == 1) {
63  TauDecayProducts.push_back(Particle);
64  MotherIdx.push_back(midx);
65  return;
66  }
67  for (unsigned int i = 0; i < Particle->numberOfDaughters(); i++) {
68  const reco::Candidate *dau = Particle->daughter(i);
69  AddPi0Info(static_cast<const reco::GenParticle *>(dau), midx);
70  }
71 }
72 
74  bool same(false), photon(false);
75  int n = 0;
76  for (unsigned int i = 0; i < Particle->numberOfDaughters(); i++) {
77  const reco::Candidate *dau = Particle->daughter(i);
78  if (Particle->pdgId() == dau->pdgId()) {
79  same = true;
80  }
81  if (dau->pdgId() == PdtPdgMini::gamma)
82  photon = true;
83  n++;
84  }
85  if (same && photon && n == 2) {
86  for (unsigned int i = 0; i < Particle->numberOfDaughters(); i++) {
87  const reco::Candidate *dau = Particle->daughter(i);
88  if (Particle->pdgId() == dau->pdgId()) {
89  if (!AddRadInfo(static_cast<const reco::GenParticle *>(dau), midx)) {
90  TauDecayProducts.push_back(static_cast<const reco::GenParticle *>(dau));
91  MotherIdx.push_back(midx);
92  }
93  }
94  if (dau->pdgId() == PdtPdgMini::gamma) {
95  TauDecayProducts.push_back(static_cast<const reco::GenParticle *>(dau));
96  MotherIdx.push_back(midx);
97  }
98  }
99  return true;
100  }
101  return false;
102 }
void Reset()
Definition: TauDecay.cc:11
bool isTauFinalStateParticle(int pdgid)
Definition: TauDecay.cc:32
void AddPi0Info(const reco::GenParticle *Particle, unsigned int midx)
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:116
void ClassifyDecayMode(unsigned int &MODE_ID, unsigned int &TauBitMask)
Definition: TauDecay.cc:150
virtual int pdgId() const =0
PDG identifier.
Definition: Tau.py:1
bool AnalyzeTau(const reco::GenParticle *Tau, unsigned int &MODE_ID, unsigned int &TauBitMask, bool dores, bool dopi0)
std::vector< const reco::GenParticle * > TauDecayProducts
bool isTauParticleCounter(int pdgid)
Definition: TauDecay.cc:64