CMS 3D CMS Logo

SimTauCPLink.h
Go to the documentation of this file.
1 #ifndef SimDataFormats_SimTauCPLink_h
2 #define SimDataFormats_SimTauCPLink_h
3 
9 
10 class SimTauCPLink {
11 public:
14  struct DecayNav {
15  int pdgId_;
19  int pdgId() const { return pdgId_; }
20  int resonance_idx() const { return resonance_idx_; }
21  int calo_particle_idx() const { return calo_particle_idx_; }
22  int gen_particle_idx() const { return gen_particle_idx_; }
23 
24  private:
25  };
26 
27  std::vector<std::pair<int, int>> resonances;
28  std::vector<DecayNav> leaves;
30  int decayMode;
31 
32  enum decayModes {
33  kNull = -1,
52  };
53 
54  void dump(void) const {
55  for (auto const &l : leaves) {
56  LogDebug("SimTauProducer")
57  .format(
58  "L {} {} CP: {} GenP idx: {}", l.pdgId(), l.resonance_idx(), l.calo_particle_idx(), l.gen_particle_idx());
59  }
60  for (auto const &r : resonances) {
61  LogDebug("SimTauProducer").format("R {} {}", r.first, r.second);
62  }
63  }
64 
65  void dumpDecay(const std::pair<int, int> &entry) const {
66  if (entry.second == -1) { // No intermediate mother.
67  LogDebug("SimTauProducer").format("{} {}", entry.first, entry.second);
68  } else {
69  LogDebug("SimTauProducer").format("{} {} coming from: ", entry.first, entry.second);
70  auto const &mother = resonances[entry.second];
71  dumpDecay(mother);
72  }
73  }
74 
75  void dumpFullDecay(void) const {
76  for (auto const &leaf : leaves) {
77  dumpDecay({leaf.pdgId(), leaf.resonance_idx()});
78  }
79  }
80 
82  int numElectrons = 0;
83  int numMuons = 0;
84  int numHadrons = 0;
85  int numPhotons = 0;
86  for (auto leaf : leaves) {
87  int pdg_id = abs(leaf.pdgId());
88  switch (pdg_id) {
89  case 22:
90  numPhotons++;
91  break;
92  case 11:
93  numElectrons++;
94  break;
95  case 13:
96  numMuons++;
97  break;
98  case 16:
99  break;
100  default:
101  numHadrons++;
102  }
103  }
104 
105  if (numElectrons == 1)
106  return kElectron;
107  else if (numMuons == 1)
108  return kMuon;
109  switch (numHadrons) {
110  case 1:
111  switch (numPhotons) {
112  case 0:
113  return kOneProng0PiZero;
114  case 2:
115  return kOneProng1PiZero;
116  case 4:
117  return kOneProng2PiZero;
118  case 6:
119  return kOneProng3PiZero;
120  default:
121  return kOneProngNPiZero;
122  }
123  case 2:
124  switch (numPhotons) {
125  case 0:
126  return kTwoProng0PiZero;
127  case 2:
128  return kTwoProng1PiZero;
129  case 4:
130  return kTwoProng2PiZero;
131  case 6:
132  return kTwoProng3PiZero;
133  default:
134  return kTwoProngNPiZero;
135  }
136  case 3:
137  switch (numPhotons) {
138  case 0:
139  return kThreeProng0PiZero;
140  case 2:
141  return kThreeProng1PiZero;
142  case 4:
143  return kThreeProng2PiZero;
144  case 6:
145  return kThreeProng3PiZero;
146  default:
147  return kThreeProngNPiZero;
148  }
149  default:
150  return kRareDecayMode;
151  }
152  }
153 
154 private:
155 };
156 
157 #endif //SimTauCPLink
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static const int numHadrons
#define LogDebug(id)