CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Fourvec_Event.h
Go to the documentation of this file.
1 //
2 //
3 // File: hitfit/Fourvec_Event.h
4 // Purpose: Represent an event for kinematic fitting as a collection
5 // of 4-vectors.
6 // Created: Jul, 2000, sss, based on run 1 mass analysis code.
7 //
8 // This class represents an `event' for kinematic fitting by
9 // Fourvec_Constrainer. Each object in the event has the following
10 // attributes:
11 //
12 // 4-vector
13 // mass
14 // The kinematic fit assumes a fixed mass for each object.
15 // That is specified by the `mass' attribute here.
16 //
17 // p, phi, eta uncertainties
18 // muon flag
19 // If this is set, the `p' uncertainty is really in 1/p.
20 //
21 // label
22 // An integer that can be used to identify the object type.
23 // I.e., lepton, b-jet from hadronic top, etc.
24 //
25 // There may be an object for a neutrino.
26 // If so, it is always at the end of the object list.
27 // It is not included in the count returned by nobjs() (but is included
28 // in nobjs_all()).
29 //
30 // We can also record one other `x' momentum, that will be added
31 // into the kt sum. This can be used to store a missing Et that
32 // is not attributed to a neutrino (but is instead due to mismeasurement).
33 // Typically, this will be set to zero in events that have a neutrino,
34 // and to the measured missing Et in events that do not.
35 //
36 // CMSSW File : interface/Fourvec_Event.h
37 // Original Author : Scott Stuart Snyder <snyder@bnl.gov> for D0
38 // Imported to CMSSW by Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
39 //
40 
62 #ifndef HITFIT_FOURVEC_EVENT_H
63 #define HITFIT_FOURVEC_EVENT_H
64 
66 #include <vector>
67 #include <iosfwd>
68 
69 namespace hitfit {
70 
90  struct FE_Obj
91  //
92  // Purpose: Represent a single object in a Fourvec_Event.
93  // This is just a dumb data container.
94  //
95  {
96  // The 4-momentum of the object.
101 
102  // The mass of the object.
103  // The kinematic fit will fix the mass to this.
108  double mass;
109 
110  // A label to identify the object type.
114  int label;
115 
116  // p, phi, and eta uncertainties.
120  double p_error;
121 
125  double phi_error;
126 
130  double eta_error;
131 
132  // If this is true, then p_error is really an uncertainty in 1/p,
133  // rather than p (and we should use 1/p as the fit variable).
139  bool muon_p;
140 
141  // Constructor, for convenience.
160  FE_Obj(const Fourvec& the_p,
161  double the_mass,
162  int the_label,
163  double the_p_error,
164  double the_phi_error,
165  double the_eta_error,
166  bool the_muon_p);
167  };
168 
169  // Print it out.
170  std::ostream& operator<<(std::ostream& s, const FE_Obj& o);
171 
172  //************************************************************************
173 
174  // The special label used for a neutrino.
178  const int nu_label = -1;
179 
194  //
195  // Purpose: Represent an event for kinematic fitting as a collection
196  // of 4-vectors.
197  //
198  {
199  public:
200  // Constructor.
204  Fourvec_Event();
205 
206  //****************************
207  // Accessors.
208  //
209 
210  // Return true if this event contains a neutrino.
215  bool has_neutrino() const;
216 
217  // Return the number of objects in the event, not including any neutrino.
222  int nobjs() const;
223 
224  // Return the number of objects in the event, including any neutrino.
228  int nobjs_all() const;
229 
230  // Access object I. (Indexing starts with 0.)
238 
239  // Access the neutrino 4-momentum.
243  const Fourvec& nu() const;
244 
245  // Access the kt 4-momentum.
249  const Fourvec& kt() const;
250 
251  // Access the X 4-momentum.
255  const Fourvec& x() const;
256 
257  // Access the kt uncertainties.
261  double kt_x_error() const;
262 
266  double kt_y_error() const;
267 
271  double kt_xy_covar() const;
272 
273  // Print out the contents.
274  friend std::ostream& operator<<(std::ostream& s, const Fourvec_Event& fe);
275 
276  //****************************
277  // Modifiers.
278  //
279 
280  // Add an object to the event.
281  // (This should not be a neutrino --- use set_nu_p for that.)
288  void add(const FE_Obj& obj);
289 
290  // Set the neutrino 4-momentum to P.
291  // This adds a neutrino if there wasn't already one.
298  void set_nu_p(const Fourvec& p);
299 
300  // Set the 4-momentum of object I to P.
309 
310  // Set the 4-momentum of the X object.
316  void set_x_p(const Fourvec& p);
317 
318  // Set the kt uncertainties.
330  void set_kt_error(double kt_x_error, double kt_y_error, double kt_xy_covar);
331 
332  private:
333  // The list of contained objects.
337  std::vector<FE_Obj> _objs;
338 
339  // Cached kt. This should always be equal to the sum of all the
340  // object momenta, including x.
346 
347  // Momemtum of the X object.
352 
353  // The kt uncertainties.
356  double _kt_x_error;
357 
360  double _kt_y_error;
361 
366  double _kt_xy_covar;
367 
368  // Flag that a neutrino has been added.
373  };
374 
375 } // namespace hitfit
376 
377 #endif // not HITFIT_FOURVEC_EVENT_H
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:55
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...
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...
FE_Obj(const 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.
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:90
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.