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 }
PdtPdgMini.h
muons2muons_cfi.photon
photon
Definition: muons2muons_cfi.py:28
mps_fire.i
i
Definition: mps_fire.py:355
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
PdtPdgMini::gamma
Definition: PdtPdgMini.h:40
reco::GenParticle
Definition: GenParticle.h:21
TauDecay::isTauParticleCounter
bool isTauParticleCounter(int pdgid)
Definition: TauDecay.cc:64
TauDecay_GenParticle::~TauDecay_GenParticle
~TauDecay_GenParticle()
Definition: TauDecay_GenParticle.cc:9
gather_cfg.cout
cout
Definition: gather_cfg.py:144
TauDecay_GenParticle.h
Tau
Definition: Tau.py:1
TauDecay
Definition: TauDecay.h:21
TauDecay_GenParticle::TauDecayProducts
std::vector< const reco::GenParticle * > TauDecayProducts
Definition: TauDecay_GenParticle.h:40
TauDecay::Reset
void Reset()
Definition: TauDecay.cc:11
TauDecay_GenParticle::Analyze
void Analyze(const reco::GenParticle *Particle, unsigned int midx, bool dores, bool dopi0)
Definition: TauDecay_GenParticle.cc:30
TauDecay_GenParticle::MODE_ID
unsigned int MODE_ID
Definition: TauDecay_GenParticle.h:42
TauDecay_GenParticle::AnalyzeTau
bool AnalyzeTau(const reco::GenParticle *Tau, unsigned int &MODE_ID, unsigned int &TauBitMask, bool dores, bool dopi0)
Definition: TauDecay_GenParticle.cc:11
TauDecay_GenParticle::MotherIdx
std::vector< unsigned int > MotherIdx
Definition: TauDecay_GenParticle.h:41
TauDecay::ClassifyDecayMode
void ClassifyDecayMode(unsigned int &MODE_ID, unsigned int &TauBitMask)
Definition: TauDecay.cc:150
TauDecay_GenParticle::TauBitMask
unsigned int TauBitMask
Definition: TauDecay_GenParticle.h:42
PdtPdgMini::pi0
Definition: PdtPdgMini.h:55
TauDecay::isTauFinalStateParticle
bool isTauFinalStateParticle(int pdgid)
Definition: TauDecay.cc:32
TauDecay_GenParticle::TauDecay_GenParticle
TauDecay_GenParticle()
Definition: TauDecay_GenParticle.cc:7
reco::Candidate::pdgId
virtual int pdgId() const =0
PDG identifier.
reco::Candidate
Definition: Candidate.h:27
TauDecay_GenParticle::AddRadInfo
bool AddRadInfo(const reco::GenParticle *Particle, unsigned int midx)
Definition: TauDecay_GenParticle.cc:73
TauDecay_GenParticle::AddPi0Info
void AddPi0Info(const reco::GenParticle *Particle, unsigned int midx)
Definition: TauDecay_GenParticle.cc:61
Particle
Definition: Particle.py:1
TauDecay::isTauResonanceCounter
bool isTauResonanceCounter(int pdgid)
Definition: TauDecay.cc:116
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
EgammaValidation_cff.pdgid
pdgid
Definition: EgammaValidation_cff.py:30
PdtPdgMini::tau_minus
Definition: PdtPdgMini.h:32