CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Fourvec_Event.h
Go to the documentation of this file.
1 //
2 // $Id: Fourvec_Event.h,v 1.1 2011/05/26 09:46:53 mseidel Exp $
3 //
4 // File: hitfit/Fourvec_Event.h
5 // Purpose: Represent an event for kinematic fitting as a collection
6 // of 4-vectors.
7 // Created: Jul, 2000, sss, based on run 1 mass analysis code.
8 //
9 // This class represents an `event' for kinematic fitting by
10 // Fourvec_Constrainer. Each object in the event has the following
11 // attributes:
12 //
13 // 4-vector
14 // mass
15 // The kinematic fit assumes a fixed mass for each object.
16 // That is specified by the `mass' attribute here.
17 //
18 // p, phi, eta uncertainties
19 // muon flag
20 // If this is set, the `p' uncertainty is really in 1/p.
21 //
22 // label
23 // An integer that can be used to identify the object type.
24 // I.e., lepton, b-jet from hadronic top, etc.
25 //
26 // There may be an object for a neutrino.
27 // If so, it is always at the end of the object list.
28 // It is not included in the count returned by nobjs() (but is included
29 // in nobjs_all()).
30 //
31 // We can also record one other `x' momentum, that will be added
32 // into the kt sum. This can be used to store a missing Et that
33 // is not attributed to a neutrino (but is instead due to mismeasurement).
34 // Typically, this will be set to zero in events that have a neutrino,
35 // and to the measured missing Et in events that do not.
36 //
37 // CMSSW File : interface/Fourvec_Event.h
38 // Original Author : Scott Stuart Snyder <snyder@bnl.gov> for D0
39 // Imported to CMSSW by Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
40 //
41 
42 
64 #ifndef HITFIT_FOURVEC_EVENT_H
65 #define HITFIT_FOURVEC_EVENT_H
66 
67 
69 #include <vector>
70 #include <iosfwd>
71 
72 
73 namespace hitfit {
74 
75 
95 struct FE_Obj
96 //
97 // Purpose: Represent a single object in a Fourvec_Event.
98 // This is just a dumb data container.
99 //
100 {
101  // The 4-momentum of the object.
106 
107  // The mass of the object.
108  // The kinematic fit will fix the mass to this.
113  double mass;
114 
115  // A label to identify the object type.
119  int label;
120 
121  // p, phi, and eta uncertainties.
125  double p_error;
126 
130  double phi_error;
131 
135  double eta_error;
136 
137  // If this is true, then p_error is really an uncertainty in 1/p,
138  // rather than p (and we should use 1/p as the fit variable).
144  bool muon_p;
145 
146  // Constructor, for convenience.
165  FE_Obj (Fourvec the_p,
166  double the_mass,
167  int the_label,
168  double the_p_error,
169  double the_phi_error,
170  double the_eta_error,
171  bool the_muon_p);
172 };
173 
174 
175 // Print it out.
176 std::ostream& operator<< (std::ostream& s, const FE_Obj& o);
177 
178 
179 //************************************************************************
180 
181 
182 // The special label used for a neutrino.
186 const int nu_label = -1;
187 
188 
203 //
204 // Purpose: Represent an event for kinematic fitting as a collection
205 // of 4-vectors.
206 //
207 {
208 public:
209  // Constructor.
213  Fourvec_Event ();
214 
215 
216  //****************************
217  // Accessors.
218  //
219 
220  // Return true if this event contains a neutrino.
225  bool has_neutrino () const;
226 
227  // Return the number of objects in the event, not including any neutrino.
232  int nobjs () const;
233 
234  // Return the number of objects in the event, including any neutrino.
238  int nobjs_all () const;
239 
240  // Access object I. (Indexing starts with 0.)
248 
249  // Access the neutrino 4-momentum.
253  const Fourvec& nu () const;
254 
255  // Access the kt 4-momentum.
259  const Fourvec& kt () const;
260 
261  // Access the X 4-momentum.
265  const Fourvec& x () const;
266 
267  // Access the kt uncertainties.
271  double kt_x_error () const;
272 
276  double kt_y_error () const;
277 
281  double kt_xy_covar () const;
282 
283  // Print out the contents.
284  friend std::ostream& operator<< (std::ostream& s,
285  const Fourvec_Event& fe);
286 
287 
288  //****************************
289  // Modifiers.
290  //
291 
292  // Add an object to the event.
293  // (This should not be a neutrino --- use set_nu_p for that.)
300  void add (const FE_Obj& obj);
301 
302  // Set the neutrino 4-momentum to P.
303  // This adds a neutrino if there wasn't already one.
310  void set_nu_p (const Fourvec& p);
311 
312  // Set the 4-momentum of object I to P.
321 
322  // Set the 4-momentum of the X object.
328  void set_x_p (const Fourvec& p);
329 
330  // Set the kt uncertainties.
342  void set_kt_error (double kt_x_error, double kt_y_error, double kt_xy_covar);
343 
344 
345 private:
346  // The list of contained objects.
350  std::vector<FE_Obj> _objs;
351 
352  // Cached kt. This should always be equal to the sum of all the
353  // object momenta, including x.
359 
360  // Momemtum of the X object.
365 
366  // The kt uncertainties.
369  double _kt_x_error;
370 
373  double _kt_y_error;
374 
379  double _kt_xy_covar;
380 
381  // Flag that a neutrino has been added.
386 };
387 
388 
389 } // namespace hitfit
390 
391 
392 #endif // not HITFIT_FOURVEC_EVENT_H
int i
Definition: DBlmapReader.cc:9
Fourvec_Event()
Default constructor.
Define three-vector and four-vector classes for the HitFit package, and supply a few additional opera...
void set_kt_error(double kt_x_error, double kt_y_error, double kt_xy_covar)
Set the uncertainties on .
Represent an event for kinematic fitting as a collection of four-momenta. Each object is represented ...
void add(const FE_Obj &obj)
Add an object to the event. The object should not be a neutrino, use the method set_nu_p for that...
const int nu_label
const FE_Obj & obj(std::vector< FE_Obj >::size_type i) const
Access object at index i, with the convention that the index starts at 0.
uint16_t size_type
int nobjs() const
Return the number of objects in the event not including any neutrinos.
std::vector< FE_Obj > _objs
double kt_y_error() const
Return the y uncertainty in .
double kt_xy_covar() const
Return the xy covariance in .
CLHEP::HepLorentzVector Fourvec
Typedef for a HepLorentzVector.
Definition: fourvec.h:58
int nobjs_all() const
Return the number of objects in the event including any neutrinos.
friend std::ostream & operator<<(std::ostream &s, const Fourvec_Event &fe)
Output stream operator, print the content of this Fourvec_Event object to an output stream...
FE_Obj(Fourvec the_p, double the_mass, int the_label, double the_p_error, double the_phi_error, double the_eta_error, bool the_muon_p)
Constructor.
void set_nu_p(const Fourvec &p)
Set the neutrino four-momentum to . This method adds a neutrino if there wasn&#39;t already one...
void set_obj_p(std::vector< FE_Obj >::size_type i, const Fourvec &p)
Set the four-momentum of object at index i to .
void set_x_p(const Fourvec &p)
Set the four-momentum of the object.
const Fourvec & kt() const
Access the four-momentum.
std::ostream & operator<<(std::ostream &s, const Constraint_Intermed &ci)
Output stream operator, print the content of this Constraint_Intermed to an output stream...
double kt_x_error() const
Return the x uncertainty in .
Represent a single object in a Fourvec_Event, this is just a dumb data container. Each object in a Fo...
Definition: Fourvec_Event.h:95
const Fourvec & x() const
Access the four-momentum.
const Fourvec & nu() const
Access the neutrino four-momentum.
bool has_neutrino() const
Return TRUE is this event contains a neutrino, otherwise returns FALSE.