CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Lepjets_Event_Lep.cc
Go to the documentation of this file.
1 //
2 // $Id: Lepjets_Event_Lep.cc,v 1.1 2011/05/26 09:47:00 mseidel Exp $
3 //
4 // File: src/Lepjets_Event_Lep.cc
5 // Purpose: Represent a `lepton' in a Lepjets_Event.
6 // Created: Jul, 2000, sss, based on run 1 mass analysis code.
7 //
8 // CMSSW File : src/Lepjets_Event_Lep.cc
9 // Original Author : Scott Stuart Snyder <snyder@bnl.gov> for D0
10 // Imported to CMSSW by Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
11 //
12 
13 
37 
38 
39 namespace hitfit {
40 
41 
43  int type,
44  const Vector_Resolution& res)
45 //
46 // Purpose: Constructor.
47 //
48 // Inputs:
49 // p - The 4-momentum.
50 // type - The type code.
51 // res - The resolution.
52 //
53  : _p (p),
54  _type (type),
55  _res (res)
56 {
57 }
58 
59 
61 //
62 // Purpose: Access the 4-momentum.
63 //
64 // Returns:
65 // The 4-momentum.
66 //
67 {
68  return _p;
69 }
70 
71 
73 //
74 // Purpose: Access the 4-momentum.
75 //
76 // Returns:
77 // The 4-momentum.
78 //
79 {
80  return _p;
81 }
82 
83 
85 //
86 // Purpose: Access the type code.
87 //
88 // Returns:
89 // The type code.
90 //
91 {
92  return _type;
93 }
94 
95 
97 //
98 // Purpose: Access the type code.
99 //
100 // Returns:
101 // The type code.
102 //
103 {
104  return _type;
105 }
106 
107 
109 //
110 // Purpose: Access the resolutions.
111 //
112 // Returns:
113 // The resolutions.
114 //
115 {
116  return _res;
117 }
118 
119 
121 //
122 // Purpose: Access the resolutions.
123 //
124 // Returns:
125 // The resolutions.
126 //
127 {
128  return _res;
129 }
130 
131 
133 //
134 // Purpose: Return the momentum (or 1/p) resolution for this object.
135 //
136 // Returns:
137 // The momentum (or 1/p) resolution for this object.
138 //
139 {
140  return _res.p_sigma (_p);
141 }
142 
143 
145 //
146 // Purpose: Return the eta resolution for this object.
147 //
148 // Returns:
149 // The eta resolution for this object.
150 //
151 {
152  return _res.eta_sigma (_p);
153 }
154 
155 
157 //
158 // Purpose: Return the phi resolution for this object.
159 //
160 // Returns:
161 // The phi resolution for this object.
162 //
163 {
164  return _res.phi_sigma (_p);
165 }
166 
167 
168 void Lepjets_Event_Lep::smear (CLHEP::HepRandomEngine& engine,
169  bool smear_dir /*= false*/)
170 //
171 // Purpose: Smear this object according to its resolutions.
172 //
173 // Inputs:
174 // engine - The underlying RNG.
175 // smear_dir - If false, smear the momentum only.
176 //
177 {
178  _res.smear (_p, engine, smear_dir);
179 }
180 
181 
182 std::ostream& Lepjets_Event_Lep::dump (std::ostream& s,
183  bool full /*= false*/) const
184 //
185 // Purpose: Dump out this object.
186 //
187 // Inputs:
188 // s - The stream to which to write.
189 // full - If true, dump the resolutions too.
190 //
191 // Returns:
192 // The stream S.
193 //
194 {
195  s << "[" << _type << "] " << _p << "; pt: " << _p.perp() << ", eta: " << _p.eta() << ", phi: " << _p.phi() ;
196  if (full) {
197  s << "\n " << _res;
198  }
199  return s;
200 }
201 
202 
211 std::ostream& operator<< (std::ostream& s, const Lepjets_Event_Lep& l)
212 //
213 // Purpose: Dump out this object.
214 //
215 // Inputs:
216 // s - The stream to which to write.
217 // l - The object to dump.
218 //
219 // Returns:
220 // The stream S.
221 //
222 {
223  return l.dump (s);
224 }
225 
226 
228 //
229 // Purpose: Sort objects by pt.
230 //
231 // Retruns:
232 // True if this object's pt is less than that of x.
233 {
234  return p().perp2() < x.p().perp2();
235 }
236 
237 
238 } // namespace hitfit
type
Definition: HCALResponse.h:22
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.
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:193
CLHEP::HepLorentzVector Fourvec
Typedef for a HepLorentzVector.
Definition: fourvec.h:58
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.
string const
Definition: compareJSON.py:14
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}$.
std::ostream & operator<<(std::ostream &s, const Constraint_Intermed &ci)
Output stream operator, print the content of this Constraint_Intermed to an output stream...
Calculate and represent resolution for a vector of , pseudorapidity , and azimuthal angle ...
x
Definition: VDTMath.h:216