CMS 3D CMS Logo

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
hitfit::Fourvec_Event::kt
const Fourvec & kt() const
Access the four-momentum.
Definition: Fourvec_Event.cc:163
mps_fire.i
i
Definition: mps_fire.py:428
hitfit::Fourvec_Event::set_kt_error
void set_kt_error(double kt_x_error, double kt_y_error, double kt_xy_covar)
Set the uncertainties on .
Definition: Fourvec_Event.cc:310
hitfit
Definition: Base_Constrainer.h:43
hitfit::Fourvec
CLHEP::HepLorentzVector Fourvec
Typedef for a HepLorentzVector.
Definition: fourvec.h:55
hitfit::FE_Obj::phi_error
double phi_error
Definition: Fourvec_Event.h:125
hitfit::Fourvec_Event::obj
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.
Definition: Fourvec_Event.cc:142
hitfit::Fourvec_Event::_kt
Fourvec _kt
Definition: Fourvec_Event.h:345
hitfit::Fourvec_Event
Represent an event for kinematic fitting as a collection of four-momenta. Each object is represented ...
Definition: Fourvec_Event.h:193
EcalTangentSkim_cfg.o
o
Definition: EcalTangentSkim_cfg.py:42
hitfit::Fourvec_Event::nu
const Fourvec & nu() const
Access the neutrino four-momentum.
Definition: Fourvec_Event.cc:154
hitfit::FE_Obj
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
alignCSCRings.s
s
Definition: alignCSCRings.py:92
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
hitfit::Fourvec_Event::kt_y_error
double kt_y_error() const
Return the y uncertainty in .
Definition: Fourvec_Event.cc:190
hitfit::Fourvec_Event::operator<<
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.
Definition: Fourvec_Event.cc:220
hitfit::Fourvec_Event::set_nu_p
void set_nu_p(const Fourvec &p)
Set the neutrino four-momentum to . This method adds a neutrino if there wasn't already one.
Definition: Fourvec_Event.cc:262
hitfit::operator<<
std::ostream & operator<<(std::ostream &s, const Constraint_Intermed &ci)
Output stream operator, print the content of this Constraint_Intermed to an output stream.
Definition: Constraint_Intermed.cc:268
hitfit::Fourvec_Event::has_neutrino
bool has_neutrino() const
Return TRUE is this event contains a neutrino, otherwise returns FALSE.
Definition: Fourvec_Event.cc:108
hitfit::Fourvec_Event::_objs
std::vector< FE_Obj > _objs
Definition: Fourvec_Event.h:337
hitfit::Fourvec_Event::kt_x_error
double kt_x_error() const
Return the x uncertainty in .
Definition: Fourvec_Event.cc:179
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
hitfit::FE_Obj::label
int label
Definition: Fourvec_Event.h:114
hitfit::Fourvec_Event::_kt_xy_covar
double _kt_xy_covar
Definition: Fourvec_Event.h:366
hitfit::Fourvec_Event::nobjs_all
int nobjs_all() const
Return the number of objects in the event including any neutrinos.
Definition: Fourvec_Event.cc:131
hitfit::FE_Obj::p_error
double p_error
Definition: Fourvec_Event.h:120
hitfit::Fourvec_Event::_kt_x_error
double _kt_x_error
Definition: Fourvec_Event.h:356
hitfit::Fourvec_Event::set_x_p
void set_x_p(const Fourvec &p)
Set the four-momentum of the object.
Definition: Fourvec_Event.cc:297
hitfit::FE_Obj::eta_error
double eta_error
Definition: Fourvec_Event.h:130
hitfit::Fourvec_Event::x
const Fourvec & x() const
Access the four-momentum.
Definition: Fourvec_Event.cc:171
hitfit::Fourvec_Event::add
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.
Definition: Fourvec_Event.cc:240
hitfit::nu_label
const int nu_label
Definition: Fourvec_Event.h:178
hitfit::FE_Obj::p
Fourvec p
Definition: Fourvec_Event.h:100
hitfit::Fourvec_Event::nobjs
int nobjs() const
Return the number of objects in the event not including any neutrinos.
Definition: Fourvec_Event.cc:119
hitfit::Fourvec_Event::kt_xy_covar
double kt_xy_covar() const
Return the xy covariance in .
Definition: Fourvec_Event.cc:201
hitfit::Fourvec_Event::_kt_y_error
double _kt_y_error
Definition: Fourvec_Event.h:360
fourvec.h
Define three-vector and four-vector classes for the HitFit package, and supply a few additional opera...
hitfit::Fourvec_Event::set_obj_p
void set_obj_p(std::vector< FE_Obj >::size_type i, const Fourvec &p)
Set the four-momentum of object at index i to .
Definition: Fourvec_Event.cc:282
hitfit::FE_Obj::FE_Obj
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.
Definition: Fourvec_Event.cc:44
hitfit::Fourvec_Event::Fourvec_Event
Fourvec_Event()
Default constructor.
Definition: Fourvec_Event.cc:102
hitfit::Fourvec_Event::_x
Fourvec _x
Definition: Fourvec_Event.h:351
hitfit::FE_Obj::muon_p
bool muon_p
Definition: Fourvec_Event.h:139
hitfit::Fourvec_Event::_has_neutrino
bool _has_neutrino
Definition: Fourvec_Event.h:372
hitfit::FE_Obj::mass
double mass
Definition: Fourvec_Event.h:108