test
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 //
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 
41 
63 #ifndef HITFIT_FOURVEC_EVENT_H
64 #define HITFIT_FOURVEC_EVENT_H
65 
66 
68 #include <vector>
69 #include <iosfwd>
70 
71 
72 namespace hitfit {
73 
74 
94 struct FE_Obj
95 //
96 // Purpose: Represent a single object in a Fourvec_Event.
97 // This is just a dumb data container.
98 //
99 {
100  // The 4-momentum of the object.
105 
106  // The mass of the object.
107  // The kinematic fit will fix the mass to this.
112  double mass;
113 
114  // A label to identify the object type.
118  int label;
119 
120  // p, phi, and eta uncertainties.
124  double p_error;
125 
129  double phi_error;
130 
134  double eta_error;
135 
136  // If this is true, then p_error is really an uncertainty in 1/p,
137  // rather than p (and we should use 1/p as the fit variable).
143  bool muon_p;
144 
145  // Constructor, for convenience.
164  FE_Obj (const Fourvec& the_p,
165  double the_mass,
166  int the_label,
167  double the_p_error,
168  double the_phi_error,
169  double the_eta_error,
170  bool the_muon_p);
171 };
172 
173 
174 // Print it out.
175 std::ostream& operator<< (std::ostream& s, const FE_Obj& o);
176 
177 
178 //************************************************************************
179 
180 
181 // The special label used for a neutrino.
185 const int nu_label = -1;
186 
187 
202 //
203 // Purpose: Represent an event for kinematic fitting as a collection
204 // of 4-vectors.
205 //
206 {
207 public:
208  // Constructor.
212  Fourvec_Event ();
213 
214 
215  //****************************
216  // Accessors.
217  //
218 
219  // Return true if this event contains a neutrino.
224  bool has_neutrino () const;
225 
226  // Return the number of objects in the event, not including any neutrino.
231  int nobjs () const;
232 
233  // Return the number of objects in the event, including any neutrino.
237  int nobjs_all () const;
238 
239  // Access object I. (Indexing starts with 0.)
247 
248  // Access the neutrino 4-momentum.
252  const Fourvec& nu () const;
253 
254  // Access the kt 4-momentum.
258  const Fourvec& kt () const;
259 
260  // Access the X 4-momentum.
264  const Fourvec& x () const;
265 
266  // Access the kt uncertainties.
270  double kt_x_error () const;
271 
275  double kt_y_error () const;
276 
280  double kt_xy_covar () const;
281 
282  // Print out the contents.
283  friend std::ostream& operator<< (std::ostream& s,
284  const Fourvec_Event& fe);
285 
286 
287  //****************************
288  // Modifiers.
289  //
290 
291  // Add an object to the event.
292  // (This should not be a neutrino --- use set_nu_p for that.)
299  void add (const FE_Obj& obj);
300 
301  // Set the neutrino 4-momentum to P.
302  // This adds a neutrino if there wasn't already one.
309  void set_nu_p (const Fourvec& p);
310 
311  // Set the 4-momentum of object I to P.
320 
321  // Set the 4-momentum of the X object.
327  void set_x_p (const Fourvec& p);
328 
329  // Set the kt uncertainties.
341  void set_kt_error (double kt_x_error, double kt_y_error, double kt_xy_covar);
342 
343 
344 private:
345  // The list of contained objects.
349  std::vector<FE_Obj> _objs;
350 
351  // Cached kt. This should always be equal to the sum of all the
352  // object momenta, including x.
358 
359  // Momemtum of the X object.
364 
365  // The kt uncertainties.
368  double _kt_x_error;
369 
372  double _kt_y_error;
373 
378  double _kt_xy_covar;
379 
380  // Flag that a neutrino has been added.
385 };
386 
387 
388 } // namespace hitfit
389 
390 
391 #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:57
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:94
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.