CMS 3D CMS Logo

StGenEvent.cc
Go to the documentation of this file.
1 //
2 //
3 
8 
10 {
11 }
12 
14 {
15  parts_ = parts;
16  initPartons_= inits;
17 }
18 
20 {
21 }
22 
23 const reco::GenParticle*
25 {
26  const reco::GenParticle* cand=0;
27  if (singleLepton()) {
28  const reco::GenParticleCollection & partsColl = *parts_;
29  const reco::GenParticle & singleLep = *singleLepton();
30  for (unsigned int i = 0; i < parts_->size(); ++i) {
31  if (std::abs(partsColl[i].pdgId())==TopDecayID::bID &&
32  reco::flavour(singleLep)== - reco::flavour(partsColl[i])) {
33  // ... but it should be the opposite!
34  cand = &partsColl[i];
35  }
36  }
37  }
38  return cand;
39 }
40 
41 const reco::GenParticle*
43 {
44  const reco::GenParticle* cand=0;
45  if (singleLepton()) {
46  const reco::GenParticleCollection & partsColl = *parts_;
47  const reco::GenParticle & singleLep = *singleLepton();
48  for (unsigned int i = 0; i < parts_->size(); ++i) {
49  if (std::abs(partsColl[i].pdgId())==TopDecayID::bID &&
50  reco::flavour(singleLep)== reco::flavour(partsColl[i])) {
51  // ... but it should be the opposite!
52  cand = &partsColl[i];
53  }
54  }
55  }
56  return cand;
57 }
58 
59 const reco::GenParticle*
61 {
62  const reco::GenParticle* cand = 0;
63  const reco::GenParticleCollection& partsColl = *parts_;
64  for (unsigned int i = 0; i < partsColl.size(); ++i) {
65  if (reco::isLepton(partsColl[i]) && partsColl[i].mother() &&
66  std::abs(partsColl[i].mother()->pdgId())==TopDecayID::WID) {
67  cand = &partsColl[i];
68  }
69  }
70  return cand;
71 }
72 
73 const reco::GenParticle*
75 {
76  const reco::GenParticle* cand=0;
77  const reco::GenParticleCollection & partsColl = *parts_;
78  for (unsigned int i = 0; i < partsColl.size(); ++i) {
79  if (reco::isNeutrino(partsColl[i]) && partsColl[i].mother() &&
80  std::abs(partsColl[i].mother()->pdgId())==TopDecayID::WID) {
81  cand = &partsColl[i];
82  }
83  }
84  return cand;
85 }
86 
87 const reco::GenParticle*
89 {
90  const reco::GenParticle* cand=0;
91  if (singleLepton()) {
92  const reco::GenParticleCollection & partsColl = *parts_;
93  const reco::GenParticle & singleLep = *singleLepton();
94  for (unsigned int i = 0; i < partsColl.size(); ++i) {
95  if (std::abs(partsColl[i].pdgId())==TopDecayID::WID &&
96  reco::flavour(singleLep) == - reco::flavour(partsColl[i])){
97  // PDG Id:13=mu- 24=W+ (+24)->(-13) (-24)->(+13) opposite sign
98  cand = &partsColl[i];
99  }
100  }
101  }
102  return cand;
103 }
104 
105 const reco::GenParticle*
107 {
108  const reco::GenParticle* cand=0;
109  if (singleLepton()) {
110  const reco::GenParticleCollection & partsColl = *parts_;
111  const reco::GenParticle & singleLep = *singleLepton();
112  for (unsigned int i = 0; i < partsColl.size(); ++i) {
113  if (std::abs(partsColl[i].pdgId())==TopDecayID::tID &&
114  reco::flavour(singleLep)!=reco::flavour(partsColl[i])) {
115  cand = &partsColl[i];
116  }
117  }
118  }
119  return cand;
120 }
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
const reco::GenParticle * singleNeutrino() const
return single neutrino if available; 0 else
Definition: StGenEvent.cc:74
reco::GenParticleRefProd parts_
reference to the top decay chain (has to be kept in the event!)
Definition: TopGenEvent.h:115
StGenEvent()
empty constructor
Definition: StGenEvent.cc:9
static const int bID
Definition: TopGenEvent.h:14
const reco::GenParticle * singleLepton() const
return single lepton if available; 0 else
Definition: StGenEvent.cc:60
const reco::GenParticle * associatedB() const
return associated b
Definition: StGenEvent.cc:42
bool isLepton(const Candidate &part)
Definition: pdgIdUtils.h:19
reco::GenParticleRefProd initPartons_
reference to the list of initial partons (has to be kept in the event!)
Definition: TopGenEvent.h:117
static const int tID
Definition: TopGenEvent.h:13
virtual ~StGenEvent()
default destructor
Definition: StGenEvent.cc:19
bool isNeutrino(const Candidate &part)
Definition: pdgIdUtils.h:25
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const reco::GenParticle * singleTop() const
return single Top
Definition: StGenEvent.cc:106
const reco::GenParticle * decayB() const
return decay b
Definition: StGenEvent.cc:24
static const int WID
Definition: TopGenEvent.h:18
int flavour(const Candidate &part)
Definition: pdgIdUtils.h:31
const reco::GenParticle * singleW() const
return single W
Definition: StGenEvent.cc:88