CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
StGenEvent.cc
Go to the documentation of this file.
1 //
2 // $Id: StGenEvent.cc,v 1.11 2010/10/15 22:44:30 wmtan Exp $
3 //
4 
9 
11 {
12 }
13 
15 {
16  parts_ = parts;
17  initPartons_= inits;
18 }
19 
21 {
22 }
23 
24 const reco::GenParticle*
26 {
27  const reco::GenParticle* cand=0;
28  if (singleLepton()) {
29  const reco::GenParticleCollection & partsColl = *parts_;
30  const reco::GenParticle & singleLep = *singleLepton();
31  for (unsigned int i = 0; i < parts_->size(); ++i) {
32  if (std::abs(partsColl[i].pdgId())==TopDecayID::bID &&
33  reco::flavour(singleLep)== - reco::flavour(partsColl[i])) {
34  // ... but it should be the opposite!
35  cand = &partsColl[i];
36  }
37  }
38  }
39  return cand;
40 }
41 
42 const reco::GenParticle*
44 {
45  const reco::GenParticle* cand=0;
46  if (singleLepton()) {
47  const reco::GenParticleCollection & partsColl = *parts_;
48  const reco::GenParticle & singleLep = *singleLepton();
49  for (unsigned int i = 0; i < parts_->size(); ++i) {
50  if (std::abs(partsColl[i].pdgId())==TopDecayID::bID &&
51  reco::flavour(singleLep)== reco::flavour(partsColl[i])) {
52  // ... but it should be the opposite!
53  cand = &partsColl[i];
54  }
55  }
56  }
57  return cand;
58 }
59 
60 const reco::GenParticle*
62 {
63  const reco::GenParticle* cand = 0;
64  const reco::GenParticleCollection& partsColl = *parts_;
65  for (unsigned int i = 0; i < partsColl.size(); ++i) {
66  if (reco::isLepton(partsColl[i]) && partsColl[i].mother() &&
67  std::abs(partsColl[i].mother()->pdgId())==TopDecayID::WID) {
68  cand = &partsColl[i];
69  }
70  }
71  return cand;
72 }
73 
74 const reco::GenParticle*
76 {
77  const reco::GenParticle* cand=0;
78  const reco::GenParticleCollection & partsColl = *parts_;
79  for (unsigned int i = 0; i < partsColl.size(); ++i) {
80  if (reco::isNeutrino(partsColl[i]) && partsColl[i].mother() &&
81  std::abs(partsColl[i].mother()->pdgId())==TopDecayID::WID) {
82  cand = &partsColl[i];
83  }
84  }
85  return cand;
86 }
87 
88 const reco::GenParticle*
90 {
91  const reco::GenParticle* cand=0;
92  if (singleLepton()) {
93  const reco::GenParticleCollection & partsColl = *parts_;
94  const reco::GenParticle & singleLep = *singleLepton();
95  for (unsigned int i = 0; i < partsColl.size(); ++i) {
96  if (std::abs(partsColl[i].pdgId())==TopDecayID::WID &&
97  reco::flavour(singleLep) == - reco::flavour(partsColl[i])){
98  // PDG Id:13=mu- 24=W+ (+24)->(-13) (-24)->(+13) opposite sign
99  cand = &partsColl[i];
100  }
101  }
102  }
103  return cand;
104 }
105 
106 const reco::GenParticle*
108 {
109  const reco::GenParticle* cand=0;
110  if (singleLepton()) {
111  const reco::GenParticleCollection & partsColl = *parts_;
112  const reco::GenParticle & singleLep = *singleLepton();
113  for (unsigned int i = 0; i < partsColl.size(); ++i) {
114  if (std::abs(partsColl[i].pdgId())==TopDecayID::tID &&
115  reco::flavour(singleLep)!=reco::flavour(partsColl[i])) {
116  cand = &partsColl[i];
117  }
118  }
119  }
120  return cand;
121 }
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
const reco::GenParticle * singleNeutrino() const
return single neutrino if available; 0 else
Definition: StGenEvent.cc:75
int i
Definition: DBlmapReader.cc:9
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:10
static const int bID
Definition: TopGenEvent.h:14
const reco::GenParticle * singleLepton() const
return single lepton if available; 0 else
Definition: StGenEvent.cc:61
const reco::GenParticle * associatedB() const
return associated b
Definition: StGenEvent.cc:43
#define abs(x)
Definition: mlp_lapack.h:159
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:20
bool isNeutrino(const Candidate &part)
Definition: pdgIdUtils.h:25
const reco::GenParticle * singleTop() const
return single Top
Definition: StGenEvent.cc:107
const reco::GenParticle * decayB() const
return decay b
Definition: StGenEvent.cc:25
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:89