CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_4/src/TopQuarkAnalysis/TopHitFit/interface/Fourvec_Event.h

Go to the documentation of this file.
00001 //
00002 // $Id: Fourvec_Event.h,v 1.1 2011/05/26 09:46:53 mseidel Exp $
00003 //
00004 // File: hitfit/Fourvec_Event.h
00005 // Purpose: Represent an event for kinematic fitting as a collection
00006 //           of 4-vectors.
00007 // Created: Jul, 2000, sss, based on run 1 mass analysis code.
00008 //
00009 // This class represents an `event' for kinematic fitting by
00010 // Fourvec_Constrainer.  Each object in the event has the following
00011 // attributes:
00012 //
00013 //   4-vector
00014 //   mass
00015 //     The kinematic fit assumes a fixed mass for each object.
00016 //     That is specified by the `mass' attribute here.
00017 //
00018 //   p, phi, eta uncertainties
00019 //   muon flag
00020 //     If this is set, the `p' uncertainty is really in 1/p.
00021 //
00022 //   label
00023 //     An integer that can be used to identify the object type.
00024 //     I.e., lepton, b-jet from hadronic top, etc.
00025 //
00026 // There may be an object for a neutrino.
00027 // If so, it is always at the end of the object list.
00028 // It is not included in the count returned by nobjs() (but is included
00029 // in nobjs_all()).
00030 //
00031 // We can also record one other `x' momentum, that will be added
00032 // into the kt sum.  This can be used to store a missing Et that
00033 // is not attributed to a neutrino (but is instead due to mismeasurement).
00034 // Typically, this will be set to zero in events that have a neutrino,
00035 // and to the measured missing Et in events that do not.
00036 //
00037 // CMSSW File      : interface/Fourvec_Event.h
00038 // Original Author : Scott Stuart Snyder <snyder@bnl.gov> for D0
00039 // Imported to CMSSW by Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
00040 //
00041 
00042 
00064 #ifndef HITFIT_FOURVEC_EVENT_H
00065 #define HITFIT_FOURVEC_EVENT_H
00066 
00067 
00068 #include "TopQuarkAnalysis/TopHitFit/interface/fourvec.h"
00069 #include <vector>
00070 #include <iosfwd>
00071 
00072 
00073 namespace hitfit {
00074 
00075 
00095 struct FE_Obj
00096 //
00097 // Purpose: Represent a single object in a Fourvec_Event.
00098 //          This is just a dumb data container.
00099 //
00100 {
00101   // The 4-momentum of the object.
00105   Fourvec p;
00106 
00107   // The mass of the object.
00108   // The kinematic fit will fix the mass to this.
00113   double mass;
00114 
00115   // A label to identify the object type.
00119   int label;
00120 
00121   // p, phi, and eta uncertainties.
00125   double p_error;
00126 
00130   double phi_error;
00131 
00135   double eta_error;
00136 
00137   // If this is true, then p_error is really an uncertainty in 1/p,
00138   // rather than p (and we should use 1/p as the fit variable).
00144   bool muon_p;
00145 
00146   // Constructor, for convenience.
00165   FE_Obj (Fourvec the_p,
00166           double the_mass,
00167           int the_label,
00168           double the_p_error,
00169           double the_phi_error,
00170           double the_eta_error,
00171           bool the_muon_p);
00172 };
00173 
00174 
00175 // Print it out.
00176 std::ostream& operator<< (std::ostream& s, const FE_Obj& o);
00177 
00178 
00179 //************************************************************************
00180 
00181 
00182 // The special label used for a neutrino.
00186 const int nu_label = -1;
00187 
00188 
00202 class Fourvec_Event
00203 //
00204 // Purpose: Represent an event for kinematic fitting as a collection
00205 //           of 4-vectors.
00206 //
00207 {
00208 public:
00209   // Constructor.
00213   Fourvec_Event ();
00214 
00215 
00216   //****************************
00217   // Accessors.
00218   //
00219 
00220   // Return true if this event contains a neutrino.
00225   bool has_neutrino () const;
00226 
00227   // Return the number of objects in the event, not including any neutrino.
00232   int nobjs () const;
00233 
00234   // Return the number of objects in the event, including any neutrino.
00238   int nobjs_all () const;
00239 
00240   // Access object I.  (Indexing starts with 0.)
00247   const FE_Obj& obj (std::vector<FE_Obj>::size_type i) const;
00248 
00249   // Access the neutrino 4-momentum.
00253   const Fourvec& nu () const;
00254 
00255   // Access the kt 4-momentum.
00259   const Fourvec& kt () const;
00260 
00261   // Access the X 4-momentum.
00265   const Fourvec& x () const;
00266 
00267   // Access the kt uncertainties.
00271   double kt_x_error () const;
00272 
00276   double kt_y_error () const;
00277 
00281   double kt_xy_covar () const;
00282 
00283   // Print out the contents.
00284   friend std::ostream& operator<< (std::ostream& s,
00285                                    const Fourvec_Event& fe);
00286 
00287 
00288   //****************************
00289   // Modifiers.
00290   //
00291 
00292   // Add an object to the event.
00293   // (This should not be a neutrino --- use set_nu_p for that.)
00300   void add (const FE_Obj& obj);
00301 
00302   // Set the neutrino 4-momentum to P.
00303   // This adds a neutrino if there wasn't already one.
00310   void set_nu_p (const Fourvec& p);
00311 
00312   // Set the 4-momentum of object I to P.
00320   void set_obj_p (std::vector<FE_Obj>::size_type i, const Fourvec& p);
00321 
00322   // Set the 4-momentum of the X object.
00328   void set_x_p (const Fourvec& p);
00329 
00330   // Set the kt uncertainties.
00342   void set_kt_error (double kt_x_error, double kt_y_error, double kt_xy_covar);
00343 
00344 
00345 private:
00346   // The list of contained objects.
00350   std::vector<FE_Obj> _objs;
00351 
00352   // Cached kt.  This should always be equal to the sum of all the
00353   // object momenta, including x.
00358   Fourvec _kt;
00359 
00360   // Momemtum of the X object.
00364   Fourvec _x;
00365 
00366   // The kt uncertainties.
00369   double _kt_x_error;
00370 
00373   double _kt_y_error;
00374 
00379   double _kt_xy_covar;
00380 
00381   // Flag that a neutrino has been added.
00385   bool _has_neutrino;
00386 };
00387 
00388 
00389 } // namespace hitfit
00390 
00391 
00392 #endif // not HITFIT_FOURVEC_EVENT_H