CMS 3D CMS Logo

TtGenEvent.cc
Go to the documentation of this file.
1 //
2 //
3 
8 
13  if (top() && topBar())
15 }
16 
18  const reco::GenParticleCollection& initPartsColl = *initPartons_;
19  if (initPartsColl.size() == 2)
20  if (initPartsColl[0].pdgId() == 21 && initPartsColl[1].pdgId() == 21)
21  return true;
22  return false;
23 }
24 
26  const reco::GenParticleCollection& initPartsColl = *initPartons_;
27  if (initPartsColl.size() == 2)
28  if (std::abs(initPartsColl[0].pdgId()) < TopDecayID::tID && initPartsColl[0].pdgId() == -initPartsColl[1].pdgId())
29  return true;
30  return false;
31 }
32 
35  if (isSemiLeptonic() && singleLepton()) {
42  }
43  return type;
44 }
45 
46 std::pair<WDecay::LeptonType, WDecay::LeptonType> TtGenEvent::fullLeptonicChannel() const {
48  if (isFullLeptonic()) {
49  if (lepton()) {
51  typeA = WDecay::kElec;
53  typeA = WDecay::kMuon;
55  typeA = WDecay::kTau;
56  }
57  if (leptonBar()) {
59  typeB = WDecay::kElec;
61  typeB = WDecay::kMuon;
63  typeB = WDecay::kTau;
64  }
65  }
66  return (std::pair<WDecay::LeptonType, WDecay::LeptonType>(typeA, typeB));
67 }
68 
69 const reco::GenParticle* TtGenEvent::lepton(bool excludeTauLeptons) const {
70  const reco::GenParticle* cand = nullptr;
71  const reco::GenParticleCollection& partsColl = *parts_;
72  for (unsigned int i = 0; i < partsColl.size(); ++i) {
73  if (reco::isLepton(partsColl[i]) && partsColl[i].mother() &&
74  std::abs(partsColl[i].mother()->pdgId()) == TopDecayID::WID) {
75  if (reco::flavour(partsColl[i]) > 0) {
76  cand = &partsColl[i];
77  }
78  }
79  }
80  return cand;
81 }
82 
83 const reco::GenParticle* TtGenEvent::leptonBar(bool excludeTauLeptons) const {
84  const reco::GenParticle* cand = nullptr;
85  const reco::GenParticleCollection& partsColl = *parts_;
86  for (unsigned int i = 0; i < partsColl.size(); ++i) {
87  if (reco::isLepton(partsColl[i]) && partsColl[i].mother() &&
88  std::abs(partsColl[i].mother()->pdgId()) == TopDecayID::WID) {
89  if (reco::flavour(partsColl[i]) < 0) {
90  cand = &partsColl[i];
91  }
92  }
93  }
94  return cand;
95 }
96 
97 const reco::GenParticle* TtGenEvent::singleLepton(bool excludeTauLeptons) const {
98  const reco::GenParticle* cand = nullptr;
99  if (isSemiLeptonic(excludeTauLeptons)) {
100  const reco::GenParticleCollection& partsColl = *parts_;
101  for (unsigned int i = 0; i < partsColl.size(); ++i) {
102  if (reco::isLepton(partsColl[i]) && partsColl[i].mother() &&
103  std::abs(partsColl[i].mother()->pdgId()) == TopDecayID::WID) {
104  cand = &partsColl[i];
105  }
106  }
107  }
108  return cand;
109 }
110 
111 const reco::GenParticle* TtGenEvent::neutrino(bool excludeTauLeptons) const {
112  const reco::GenParticle* cand = nullptr;
113  const reco::GenParticleCollection& partsColl = *parts_;
114  for (unsigned int i = 0; i < partsColl.size(); ++i) {
115  if (reco::isNeutrino(partsColl[i]) && partsColl[i].mother() &&
116  std::abs(partsColl[i].mother()->pdgId()) == TopDecayID::WID) {
117  if (reco::flavour(partsColl[i]) > 0) {
118  cand = &partsColl[i];
119  }
120  }
121  }
122  return cand;
123 }
124 
125 const reco::GenParticle* TtGenEvent::neutrinoBar(bool excludeTauLeptons) const {
126  const reco::GenParticle* cand = nullptr;
127  const reco::GenParticleCollection& partsColl = *parts_;
128  for (unsigned int i = 0; i < partsColl.size(); ++i) {
129  if (reco::isNeutrino(partsColl[i]) && partsColl[i].mother() &&
130  std::abs(partsColl[i].mother()->pdgId()) == TopDecayID::WID) {
131  if (reco::flavour(partsColl[i]) < 0) {
132  cand = &partsColl[i];
133  }
134  }
135  }
136  return cand;
137 }
138 
139 const reco::GenParticle* TtGenEvent::singleNeutrino(bool excludeTauLeptons) const {
140  const reco::GenParticle* cand = nullptr;
141  if (isSemiLeptonic(excludeTauLeptons)) {
142  const reco::GenParticleCollection& partsColl = *parts_;
143  for (unsigned int i = 0; i < partsColl.size(); ++i) {
144  if (reco::isNeutrino(partsColl[i]) && partsColl[i].mother() &&
145  std::abs(partsColl[i].mother()->pdgId()) == TopDecayID::WID) {
146  cand = &partsColl[i];
147  }
148  }
149  }
150  return cand;
151 }
152 
153 const reco::GenParticle* TtGenEvent::hadronicDecayQuark(bool invertFlavor) const {
154  const reco::GenParticle* cand = nullptr;
155  // catch W boson and check its daughters for a quark;
156  // make sure the decay is semi-leptonic first; this
157  // only makes sense if taus are not excluded from the
158  // decision
159  if (singleLepton(false)) {
160  for (reco::GenParticleCollection::const_iterator w = parts_->begin(); w != parts_->end(); ++w) {
161  if (std::abs(w->pdgId()) == TopDecayID::WID) {
162  // make sure that the particle is a W daughter
163  for (reco::GenParticle::const_iterator wd = w->begin(); wd != w->end(); ++wd) {
164  // make sure that the parton is a quark
165  if (std::abs(wd->pdgId()) < TopDecayID::tID) {
166  if (invertFlavor ? reco::flavour(*wd) < 0 : reco::flavour(*wd) > 0) {
167  cand = dynamic_cast<const reco::GenParticle*>(&(*wd));
168  if (cand == nullptr) {
169  throw edm::Exception(edm::errors::InvalidReference, "Not a GenParticle");
170  }
171  break;
172  }
173  }
174  }
175  }
176  }
177  }
178  return cand;
179 }
180 
181 const reco::GenParticle* TtGenEvent::hadronicDecayB(bool excludeTauLeptons) const {
182  const reco::GenParticle* cand = nullptr;
183  if (singleLepton(excludeTauLeptons)) {
184  const reco::GenParticleCollection& partsColl = *parts_;
185  const reco::GenParticle& singleLep = *singleLepton(excludeTauLeptons);
186  for (unsigned int i = 0; i < partsColl.size(); ++i) {
187  if (std::abs(partsColl[i].pdgId()) == TopDecayID::bID &&
188  reco::flavour(singleLep) == reco::flavour(partsColl[i])) {
189  cand = &partsColl[i];
190  }
191  }
192  }
193  return cand;
194 }
195 
196 const reco::GenParticle* TtGenEvent::hadronicDecayW(bool excludeTauLeptons) const {
197  const reco::GenParticle* cand = nullptr;
198  if (singleLepton(excludeTauLeptons)) {
199  const reco::GenParticleCollection& partsColl = *parts_;
200  const reco::GenParticle& singleLep = *singleLepton(excludeTauLeptons);
201  for (unsigned int i = 0; i < partsColl.size(); ++i) {
202  if (std::abs(partsColl[i].pdgId()) == TopDecayID::WID &&
203  reco::flavour(singleLep) != -reco::flavour(partsColl[i])) {
204  // PDG Id:13=mu- 24=W+ (+24)->(-13) (-24)->(+13) opposite sign
205  cand = &partsColl[i];
206  }
207  }
208  }
209  return cand;
210 }
211 
212 const reco::GenParticle* TtGenEvent::hadronicDecayTop(bool excludeTauLeptons) const {
213  const reco::GenParticle* cand = nullptr;
214  if (singleLepton(excludeTauLeptons)) {
215  const reco::GenParticleCollection& partsColl = *parts_;
216  const reco::GenParticle& singleLep = *singleLepton(excludeTauLeptons);
217  for (unsigned int i = 0; i < partsColl.size(); ++i) {
218  if (std::abs(partsColl[i].pdgId()) == TopDecayID::tID &&
219  reco::flavour(singleLep) == reco::flavour(partsColl[i])) {
220  cand = &partsColl[i];
221  }
222  }
223  }
224  return cand;
225 }
226 
227 const reco::GenParticle* TtGenEvent::leptonicDecayB(bool excludeTauLeptons) const {
228  const reco::GenParticle* cand = nullptr;
229  if (singleLepton(excludeTauLeptons)) {
230  const reco::GenParticleCollection& partsColl = *parts_;
231  const reco::GenParticle& singleLep = *singleLepton(excludeTauLeptons);
232  for (unsigned int i = 0; i < partsColl.size(); ++i) {
233  if (std::abs(partsColl[i].pdgId()) == TopDecayID::bID &&
234  reco::flavour(singleLep) != reco::flavour(partsColl[i])) {
235  cand = &partsColl[i];
236  }
237  }
238  }
239  return cand;
240 }
241 
242 const reco::GenParticle* TtGenEvent::leptonicDecayW(bool excludeTauLeptons) const {
243  const reco::GenParticle* cand = nullptr;
244  if (singleLepton(excludeTauLeptons)) {
245  const reco::GenParticleCollection& partsColl = *parts_;
246  const reco::GenParticle& singleLep = *singleLepton(excludeTauLeptons);
247  for (unsigned int i = 0; i < partsColl.size(); ++i) {
248  if (std::abs(partsColl[i].pdgId()) == TopDecayID::WID &&
249  reco::flavour(singleLep) == -reco::flavour(partsColl[i])) {
250  // PDG Id:13=mu- 24=W+ (+24)->(-13) (-24)->(+13) opposite sign
251  cand = &partsColl[i];
252  }
253  }
254  }
255  return cand;
256 }
257 
258 const reco::GenParticle* TtGenEvent::leptonicDecayTop(bool excludeTauLeptons) const {
259  const reco::GenParticle* cand = nullptr;
260  if (singleLepton(excludeTauLeptons)) {
261  const reco::GenParticleCollection& partsColl = *parts_;
262  const reco::GenParticle& singleLep = *singleLepton(excludeTauLeptons);
263  for (unsigned int i = 0; i < partsColl.size(); ++i) {
264  if (std::abs(partsColl[i].pdgId()) == TopDecayID::tID &&
265  reco::flavour(singleLep) != reco::flavour(partsColl[i])) {
266  cand = &partsColl[i];
267  }
268  }
269  }
270  return cand;
271 }
272 
273 std::vector<const reco::GenParticle*> TtGenEvent::leptonicDecayTopRadiation(bool excludeTauLeptons) const {
274  if (leptonicDecayTop(excludeTauLeptons)) {
275  return (leptonicDecayTop(excludeTauLeptons)->pdgId() > 0 ? radiatedGluons(TopDecayID::tID)
277  }
278  std::vector<const reco::GenParticle*> rad;
279  return (rad);
280 }
281 
282 std::vector<const reco::GenParticle*> TtGenEvent::hadronicDecayTopRadiation(bool excludeTauLeptons) const {
283  if (hadronicDecayTop(excludeTauLeptons)) {
284  return (hadronicDecayTop(excludeTauLeptons)->pdgId() > 0 ? radiatedGluons(TopDecayID::tID)
286  }
287  std::vector<const reco::GenParticle*> rad;
288  return (rad);
289 }
edm::RefProd< GenParticleCollection >
TtGenEvent::neutrino
const reco::GenParticle * neutrino(bool excludeTauLeptons=false) const
get neutrino for semi-leptonic or full leptonic decays
Definition: TtGenEvent.cc:111
mps_fire.i
i
Definition: mps_fire.py:355
TtGenEvent::leptonicDecayTop
const reco::GenParticle * leptonicDecayTop(bool excludeTauLeptons=false) const
get top of leptonic decay branch
Definition: TtGenEvent.cc:258
edm::errors::InvalidReference
Definition: EDMException.h:39
TtGenEvent::topPair_
math::XYZTLorentzVector topPair_
combined 4-vector of top and topBar
Definition: TtGenEvent.h:93
reco::GenParticle
Definition: GenParticle.h:21
reco::flavour
int flavour(const Candidate &part)
Definition: pdgIdUtils.h:21
TtGenEvent::leptonicDecayW
const reco::GenParticle * leptonicDecayW(bool excludeTauLeptons=false) const
get W of leptonic decay branch
Definition: TtGenEvent.cc:242
TtGenEvent::fromGluonFusion
bool fromGluonFusion() const
check if the tops were produced from a pair of gluons
Definition: TtGenEvent.cc:17
TtGenEvent::fullLeptonicChannel
std::pair< WDecay::LeptonType, WDecay::LeptonType > fullLeptonicChannel() const
Definition: TtGenEvent.cc:46
TopDecayID::bID
static const int bID
Definition: TopGenEvent.h:13
reco::GenParticleCollection
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
Definition: GenParticleFwd.h:13
reco::candidate::const_iterator
Definition: const_iterator.h:14
TopGenEvent::initPartons_
reco::GenParticleRefProd initPartons_
reference to the list of initial partons (has to be kept in the event!)
Definition: TopGenEvent.h:113
TtGenEvent::lepton
const reco::GenParticle * lepton(bool excludeTauLeptons=false) const
get lepton for semi-leptonic or full leptonic decays
Definition: TtGenEvent.cc:69
TtGenEvent::hadronicDecayTop
const reco::GenParticle * hadronicDecayTop(bool excludeTauLeptons=false) const
get top of hadronic decay branch
Definition: TtGenEvent.cc:212
TopGenEvent::radiatedGluons
std::vector< const reco::GenParticle * > radiatedGluons(int pdgId) const
return radiated gluons from particle with pdgId
Definition: TopGenEvent.cc:177
TtGenEvent::fromQuarkAnnihilation
bool fromQuarkAnnihilation() const
check if the tops were produced from qqbar
Definition: TtGenEvent.cc:25
TopDecayID::elecID
static const int elecID
Definition: TopGenEvent.h:18
TtGenEvent::hadronicDecayW
const reco::GenParticle * hadronicDecayW(bool excludeTauLeptons=false) const
get W of hadronic decay branch
Definition: TtGenEvent.cc:196
reco::isNeutrino
bool isNeutrino(const Candidate &part)
Definition: pdgIdUtils.h:17
reco::isLepton
bool isLepton(const Candidate &part)
Definition: pdgIdUtils.h:13
TopGenEvent::topBar
const reco::GenParticle * topBar() const
return anti-top if available; 0 else
Definition: TopGenEvent.h:103
GenParticle.h
EDMException.h
TopDecayID::muonID
static const int muonID
Definition: TopGenEvent.h:19
TtGenEvent::semiLeptonicChannel
WDecay::LeptonType semiLeptonicChannel() const
return decay channel; all leptons including taus are allowed
Definition: TtGenEvent.cc:33
TtGenEvent::singleNeutrino
const reco::GenParticle * singleNeutrino(bool excludeTauLeptons=false) const
return single neutrino if available; 0 else
Definition: TtGenEvent.cc:139
TtGenEvent::isSemiLeptonic
bool isSemiLeptonic(bool excludeTauLeptons=false) const
check if the event can be classified as semi-laptonic
Definition: TtGenEvent.h:38
TopDecaySubset_cfi.decaySubset
decaySubset
Definition: TopDecaySubset_cfi.py:7
w
const double w
Definition: UKUtility.cc:23
TopDecayID::tID
static const int tID
Definition: TopGenEvent.h:12
TtGenEvent::leptonicDecayTopRadiation
std::vector< const reco::GenParticle * > leptonicDecayTopRadiation(bool excludeTauLeptons=false) const
gluons as radiated from the leptonicly decaying top quark
Definition: TtGenEvent.cc:273
TtGenEvent::singleLepton
const reco::GenParticle * singleLepton(bool excludeTauLeptons=false) const
return single lepton if available; 0 else
Definition: TtGenEvent.cc:97
TopGenEvent::top
const reco::GenParticle * top() const
return top if available; 0 else
Definition: TopGenEvent.h:101
TtGenEvent.h
TtGenEvent::isFullLeptonic
bool isFullLeptonic(bool excludeTauLeptons=false) const
check if the event can be classified as full leptonic
Definition: TtGenEvent.h:42
cand
Definition: decayParser.h:34
p4
double p4[4]
Definition: TauolaWrapper.h:92
EgammaValidation_cff.pdgId
pdgId
Definition: EgammaValidation_cff.py:118
pdgIdUtils.h
WDecay::kTau
Definition: TopGenEvent.h:27
TopDecayID::WID
static const int WID
Definition: TopGenEvent.h:17
TopDecayID::tauID
static const int tauID
Definition: TopGenEvent.h:20
TtGenEvent::hadronicDecayB
const reco::GenParticle * hadronicDecayB(bool excludeTauLeptons=false) const
get b of hadronic decay branch
Definition: TtGenEvent.cc:181
WDecay::LeptonType
LeptonType
Definition: TopGenEvent.h:27
TtGenEvent::leptonBar
const reco::GenParticle * leptonBar(bool excludeTauLeptons=false) const
get anti-lepton for semi-leptonic or full leptonic decays
Definition: TtGenEvent.cc:83
WDecay::kNone
Definition: TopGenEvent.h:27
TtGenEvent::hadronicDecayTopRadiation
std::vector< const reco::GenParticle * > hadronicDecayTopRadiation(bool excludeTauLeptons=false) const
gluons as radiated from the hadronicly decaying top quark
Definition: TtGenEvent.cc:282
type
type
Definition: HCALResponse.h:21
TopInitSubset_cfi.initSubset
initSubset
Definition: TopInitSubset_cfi.py:7
TtGenEvent::leptonicDecayB
const reco::GenParticle * leptonicDecayB(bool excludeTauLeptons=false) const
get b of leptonic decay branch
Definition: TtGenEvent.cc:227
WDecay::kMuon
Definition: TopGenEvent.h:27
math::XYZTLorentzVector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
Exception
Definition: hltDiff.cc:246
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
TopGenEvent::parts_
reco::GenParticleRefProd parts_
reference to the top decay chain (has to be kept in the event!)
Definition: TopGenEvent.h:111
WDecay::kElec
Definition: TopGenEvent.h:27
TtGenEvent::neutrinoBar
const reco::GenParticle * neutrinoBar(bool excludeTauLeptons=false) const
get anti-neutrino for semi-leptonic or full leptonic decays
Definition: TtGenEvent.cc:125
TtGenEvent::TtGenEvent
TtGenEvent()
empty constructor
Definition: TtGenEvent.h:21
TtGenEvent::hadronicDecayQuark
const reco::GenParticle * hadronicDecayQuark(bool invertFlavor=false) const
get light quark of hadronic decay branch
Definition: TtGenEvent.cc:153