CMS 3D CMS Logo

Lepjets_Event_Lep.cc
Go to the documentation of this file.
1 //
2 //
3 // File: src/Lepjets_Event_Lep.cc
4 // Purpose: Represent a `lepton' in a Lepjets_Event.
5 // Created: Jul, 2000, sss, based on run 1 mass analysis code.
6 //
7 // CMSSW File : src/Lepjets_Event_Lep.cc
8 // Original Author : Scott Stuart Snyder <snyder@bnl.gov> for D0
9 // Imported to CMSSW by Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
10 //
11 
35 
36 namespace hitfit {
37 
39  //
40  // Purpose: Constructor.
41  //
42  // Inputs:
43  // p - The 4-momentum.
44  // type - The type code.
45  // res - The resolution.
46  //
47  : _p(p), _type(type), _res(res) {}
48 
50  //
51  // Purpose: Access the 4-momentum.
52  //
53  // Returns:
54  // The 4-momentum.
55  //
56  {
57  return _p;
58  }
59 
61  //
62  // Purpose: Access the 4-momentum.
63  //
64  // Returns:
65  // The 4-momentum.
66  //
67  {
68  return _p;
69  }
70 
72  //
73  // Purpose: Access the type code.
74  //
75  // Returns:
76  // The type code.
77  //
78  {
79  return _type;
80  }
81 
83  //
84  // Purpose: Access the type code.
85  //
86  // Returns:
87  // The type code.
88  //
89  {
90  return _type;
91  }
92 
94  //
95  // Purpose: Access the resolutions.
96  //
97  // Returns:
98  // The resolutions.
99  //
100  {
101  return _res;
102  }
103 
105  //
106  // Purpose: Access the resolutions.
107  //
108  // Returns:
109  // The resolutions.
110  //
111  {
112  return _res;
113  }
114 
116  //
117  // Purpose: Return the momentum (or 1/p) resolution for this object.
118  //
119  // Returns:
120  // The momentum (or 1/p) resolution for this object.
121  //
122  {
123  return _res.p_sigma(_p);
124  }
125 
127  //
128  // Purpose: Return the eta resolution for this object.
129  //
130  // Returns:
131  // The eta resolution for this object.
132  //
133  {
134  return _res.eta_sigma(_p);
135  }
136 
138  //
139  // Purpose: Return the phi resolution for this object.
140  //
141  // Returns:
142  // The phi resolution for this object.
143  //
144  {
145  return _res.phi_sigma(_p);
146  }
147 
148  void Lepjets_Event_Lep::smear(CLHEP::HepRandomEngine& engine, bool smear_dir /*= false*/)
149  //
150  // Purpose: Smear this object according to its resolutions.
151  //
152  // Inputs:
153  // engine - The underlying RNG.
154  // smear_dir - If false, smear the momentum only.
155  //
156  {
157  _res.smear(_p, engine, smear_dir);
158  }
159 
160  std::ostream& Lepjets_Event_Lep::dump(std::ostream& s, bool full /*= false*/) const
161  //
162  // Purpose: Dump out this object.
163  //
164  // Inputs:
165  // s - The stream to which to write.
166  // full - If true, dump the resolutions too.
167  //
168  // Returns:
169  // The stream S.
170  //
171  {
172  s << "[" << _type << "] " << _p << "; pt: " << _p.perp() << ", eta: " << _p.eta() << ", phi: " << _p.phi();
173  if (full) {
174  s << "\n " << _res;
175  }
176  return s;
177  }
178 
187  std::ostream& operator<<(std::ostream& s, const Lepjets_Event_Lep& l)
188  //
189  // Purpose: Dump out this object.
190  //
191  // Inputs:
192  // s - The stream to which to write.
193  // l - The object to dump.
194  //
195  // Returns:
196  // The stream S.
197  //
198  {
199  return l.dump(s);
200  }
201 
203  //
204  // Purpose: Sort objects by pt.
205  //
206  // Retruns:
207  // True if this object's pt is less than that of x.
208  {
209  return p().perp2() < x.p().perp2();
210  }
211 
212 } // namespace hitfit
bool operator<(const Lepjets_Event_Lep &x) const
Comparison operator for sorting purpose, based on $p_{T}$.
const Vector_Resolution & res() const
Return a constant reference to the resolution.
double phi_sigma() const
Return the uncertainty in azimuthal angle .
Represent a lepton in an instance of Lepjets_Event class. This class hold the following information: ...
void smear(CLHEP::HepRandomEngine &engine, bool smear_dir=false)
Smear this object.
double eta_sigma(const Fourvec &v) const
Calculate the pseudorapidity resolution of a four-momentum.
double p_sigma() const
Return the uncertainty in momentum or ( or if the lepton is a tracking object).
Lepjets_Event_Lep(const Fourvec &p, int type, const Vector_Resolution &res)
Constructor, create a new instance of Lepjets_Event_Lep.
Definition: Electron.h:6
void smear(Fourvec &v, CLHEP::HepRandomEngine &engine, bool do_smear_dir=false) const
Smear a four-momentum according to the resolutions.
int & type()
Return a reference to the type code.
double phi_sigma(const Fourvec &v) const
Calculate the azimuthal angle resolution of a four-momentum.
Definition: GenABIO.cc:168
CLHEP::HepLorentzVector Fourvec
Typedef for a HepLorentzVector.
Definition: fourvec.h:55
Represent a lepton in an instance of Lepjets_Event class.
std::ostream & dump(std::ostream &s, bool full=false) const
Print the content of this object.
Fourvec & p()
Return a reference to the four-momentum.
double eta_sigma() const
Return the uncertainty in pseudorapidity .
std::ostream & operator<<(std::ostream &s, const Constraint_Intermed &ci)
Output stream operator, print the content of this Constraint_Intermed to an output stream...
float x
Calculate and represent resolution for a vector of , pseudorapidity , and azimuthal angle ...
double p_sigma(const Fourvec &v) const
Calculate the momentum resolution of a four-momentum.