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 
12 
36 
37 
38 namespace hitfit {
39 
40 
42  int type,
43  const Vector_Resolution& res)
44 //
45 // Purpose: Constructor.
46 //
47 // Inputs:
48 // p - The 4-momentum.
49 // type - The type code.
50 // res - The resolution.
51 //
52  : _p (p),
53  _type (type),
54  _res (res)
55 {
56 }
57 
58 
60 //
61 // Purpose: Access the 4-momentum.
62 //
63 // Returns:
64 // The 4-momentum.
65 //
66 {
67  return _p;
68 }
69 
70 
72 //
73 // Purpose: Access the 4-momentum.
74 //
75 // Returns:
76 // The 4-momentum.
77 //
78 {
79  return _p;
80 }
81 
82 
84 //
85 // Purpose: Access the type code.
86 //
87 // Returns:
88 // The type code.
89 //
90 {
91  return _type;
92 }
93 
94 
96 //
97 // Purpose: Access the type code.
98 //
99 // Returns:
100 // The type code.
101 //
102 {
103  return _type;
104 }
105 
106 
108 //
109 // Purpose: Access the resolutions.
110 //
111 // Returns:
112 // The resolutions.
113 //
114 {
115  return _res;
116 }
117 
118 
120 //
121 // Purpose: Access the resolutions.
122 //
123 // Returns:
124 // The resolutions.
125 //
126 {
127  return _res;
128 }
129 
130 
132 //
133 // Purpose: Return the momentum (or 1/p) resolution for this object.
134 //
135 // Returns:
136 // The momentum (or 1/p) resolution for this object.
137 //
138 {
139  return _res.p_sigma (_p);
140 }
141 
142 
144 //
145 // Purpose: Return the eta resolution for this object.
146 //
147 // Returns:
148 // The eta resolution for this object.
149 //
150 {
151  return _res.eta_sigma (_p);
152 }
153 
154 
156 //
157 // Purpose: Return the phi resolution for this object.
158 //
159 // Returns:
160 // The phi resolution for this object.
161 //
162 {
163  return _res.phi_sigma (_p);
164 }
165 
166 
167 void Lepjets_Event_Lep::smear (CLHEP::HepRandomEngine& engine,
168  bool smear_dir /*= false*/)
169 //
170 // Purpose: Smear this object according to its resolutions.
171 //
172 // Inputs:
173 // engine - The underlying RNG.
174 // smear_dir - If false, smear the momentum only.
175 //
176 {
177  _res.smear (_p, engine, smear_dir);
178 }
179 
180 
181 std::ostream& Lepjets_Event_Lep::dump (std::ostream& s,
182  bool full /*= false*/) const
183 //
184 // Purpose: Dump out this object.
185 //
186 // Inputs:
187 // s - The stream to which to write.
188 // full - If true, dump the resolutions too.
189 //
190 // Returns:
191 // The stream S.
192 //
193 {
194  s << "[" << _type << "] " << _p << "; pt: " << _p.perp() << ", eta: " << _p.eta() << ", phi: " << _p.phi() ;
195  if (full) {
196  s << "\n " << _res;
197  }
198  return s;
199 }
200 
201 
210 std::ostream& operator<< (std::ostream& s, const Lepjets_Event_Lep& l)
211 //
212 // Purpose: Dump out this object.
213 //
214 // Inputs:
215 // s - The stream to which to write.
216 // l - The object to dump.
217 //
218 // Returns:
219 // The stream S.
220 //
221 {
222  return l.dump (s);
223 }
224 
225 
227 //
228 // Purpose: Sort objects by pt.
229 //
230 // Retruns:
231 // True if this object's pt is less than that of x.
232 {
233  return p().perp2() < x.p().perp2();
234 }
235 
236 
237 } // namespace hitfit
type
Definition: HCALResponse.h:21
std::ostream & dump(std::ostream &s, bool full=false) const
Print the content of this object.
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 phi_sigma(const Fourvec &v) const
Calculate the azimuthal angle resolution of a four-momentum.
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
double eta_sigma() const
Return the uncertainty in pseudorapidity .
double p_sigma(const Fourvec &v) const
Calculate the momentum resolution of a four-momentum.
int & type()
Return a reference to the type code.
const Vector_Resolution & res() const
Return a constant reference to the resolution.
double phi_sigma() const
Return the uncertainty in azimuthal angle .
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).
Definition: GenABIO.cc:168
CLHEP::HepLorentzVector Fourvec
Typedef for a HepLorentzVector.
Definition: fourvec.h:57
void smear(Fourvec &v, CLHEP::HepRandomEngine &engine, bool do_smear_dir=false) const
Smear a four-momentum according to the resolutions.
Represent a lepton in an instance of Lepjets_Event class.
std::ostream & operator<<(std::ostream &s, const Constraint_Intermed &ci)
Output stream operator, print the content of this Constraint_Intermed to an output stream...
Fourvec & p()
Return a reference to the four-momentum.
bool operator<(const Lepjets_Event_Lep &x) const
Comparison operator for sorting purpose, based on $p_{T}$.
Calculate and represent resolution for a vector of , pseudorapidity , and azimuthal angle ...