Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:31:15

0001 //
0002 //
0003 // File: hitfit/Fourvec_Event.h
0004 // Purpose: Represent an event for kinematic fitting as a collection
0005 //           of 4-vectors.
0006 // Created: Jul, 2000, sss, based on run 1 mass analysis code.
0007 //
0008 // This class represents an `event' for kinematic fitting by
0009 // Fourvec_Constrainer.  Each object in the event has the following
0010 // attributes:
0011 //
0012 //   4-vector
0013 //   mass
0014 //     The kinematic fit assumes a fixed mass for each object.
0015 //     That is specified by the `mass' attribute here.
0016 //
0017 //   p, phi, eta uncertainties
0018 //   muon flag
0019 //     If this is set, the `p' uncertainty is really in 1/p.
0020 //
0021 //   label
0022 //     An integer that can be used to identify the object type.
0023 //     I.e., lepton, b-jet from hadronic top, etc.
0024 //
0025 // There may be an object for a neutrino.
0026 // If so, it is always at the end of the object list.
0027 // It is not included in the count returned by nobjs() (but is included
0028 // in nobjs_all()).
0029 //
0030 // We can also record one other `x' momentum, that will be added
0031 // into the kt sum.  This can be used to store a missing Et that
0032 // is not attributed to a neutrino (but is instead due to mismeasurement).
0033 // Typically, this will be set to zero in events that have a neutrino,
0034 // and to the measured missing Et in events that do not.
0035 //
0036 // CMSSW File      : interface/Fourvec_Event.h
0037 // Original Author : Scott Stuart Snyder <snyder@bnl.gov> for D0
0038 // Imported to CMSSW by Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
0039 //
0040 
0041 /**
0042     @file Fourvec_Event.h
0043 
0044     @brief Represent an event for kinematic fitting as a collection of
0045     four-momenta.
0046 
0047     @author Scott Stuart Snyder <snyder@bnl.gov>
0048 
0049     @par Creation date:
0050     Jul 2000.
0051 
0052     @par Modification History:
0053     Apr 2009: Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>:
0054     Imported to CMSSW.<br>
0055     Nov 2009: Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>:
0056     Added doxygen tags for automatic generation of documentation.
0057 
0058     @par Terms of Usage:
0059     With consent for the original author (Scott Snyder).
0060 
0061  */
0062 #ifndef HITFIT_FOURVEC_EVENT_H
0063 #define HITFIT_FOURVEC_EVENT_H
0064 
0065 #include "TopQuarkAnalysis/TopHitFit/interface/fourvec.h"
0066 #include <vector>
0067 #include <iosfwd>
0068 
0069 namespace hitfit {
0070 
0071   /**
0072     @class FE_Obj
0073 
0074     @brief Represent a single object in a Fourvec_Event,
0075     this is just a dumb data container. Each object in a Fourvec_Event
0076     has the following attributes:
0077 
0078     - Four-momenta.
0079     - Mass. The kinematic fit assumes a fixed mass for each object,
0080     this is specified by the mass attribute.
0081     - Uncertainty in momentum \f$p\f$.
0082     - Uncertainty in azimuthal angle \f$\phi\f$.
0083     - Uncertainty in pseudorapidity \f$\eta\f$.
0084     - Muon/inverse momentum flag.  If the flag is set to true,
0085     then the uncertainty is interpreted as uncertainty in \f$1/p\f$ instead
0086     of \f$p\f$.
0087     - Label, an integer label that can be used to identify the object type:
0088     e.g. lepton, b-jet from hadronic top, etc.
0089  */
0090   struct FE_Obj
0091   //
0092   // Purpose: Represent a single object in a Fourvec_Event.
0093   //          This is just a dumb data container.
0094   //
0095   {
0096     // The 4-momentum of the object.
0097     /**
0098      The four-momentum of the object.
0099    */
0100     Fourvec p;
0101 
0102     // The mass of the object.
0103     // The kinematic fit will fix the mass to this.
0104     /**
0105      The mass of the object. The kinematic fitting algorithm will fix the
0106      mass to this.
0107    */
0108     double mass;
0109 
0110     // A label to identify the object type.
0111     /**
0112      An integer label to identify the object type.
0113    */
0114     int label;
0115 
0116     // p, phi, and eta uncertainties.
0117     /**
0118     Uncertainty in momentum \f$p\f$.
0119    */
0120     double p_error;
0121 
0122     /**
0123     Uncertainty in azimuthal angle \f$\phi\f$.
0124    */
0125     double phi_error;
0126 
0127     /**
0128     Uncertainty in pseudorapidity \f$\eta\f$.
0129    */
0130     double eta_error;
0131 
0132     // If this is true, then p_error is really an uncertainty in 1/p,
0133     // rather than p (and we should use 1/p as the fit variable).
0134     /**
0135      Muon/inverse momentum flag.  If the flag is set to TRUE,
0136      then the uncertainty is interpreted as uncertainty in \f$1/p\f$ instead
0137      of \f$p\f$.
0138    */
0139     bool muon_p;
0140 
0141     // Constructor, for convenience.
0142     /**
0143      @brief Constructor.
0144 
0145      @param the_p The four-momentum.
0146 
0147      @param the_mass The mass of the object.
0148 
0149      @param the_label An integer label to identify the object type.
0150 
0151      @param the_p_error Uncertainty in momentum \f$p\f$ or \f$1/p\f$
0152      if the muon flag is set to TRUE.
0153 
0154      @param the_phi_error Uncertainty in azimuthal angle \f$\phi\f$.
0155 
0156      @param the_eta_error Uncertainty in pseudorapidity \f$\eta\f$.
0157 
0158      @param the_muon_p Muon/inverse momentum flag.
0159   */
0160     FE_Obj(const Fourvec& the_p,
0161            double the_mass,
0162            int the_label,
0163            double the_p_error,
0164            double the_phi_error,
0165            double the_eta_error,
0166            bool the_muon_p);
0167   };
0168 
0169   // Print it out.
0170   std::ostream& operator<<(std::ostream& s, const FE_Obj& o);
0171 
0172   //************************************************************************
0173 
0174   // The special label used for a neutrino.
0175   /**
0176     A special label used for neutrino.
0177  */
0178   const int nu_label = -1;
0179 
0180   /**
0181     @brief Represent an event for kinematic fitting as a collection
0182     of four-momenta.  Each object is represented as an instance of FE_Obj.
0183     There may be an object for a neutrino.  If that is the case, it is always
0184     at the end of the object list.  It is not included in the count
0185     returned by nobjs().  But is is included in nobjs_all().
0186 
0187     We can also record the other \f$x\f$ momentum, that will be added into
0188     the \f$k_{T}\f$ sum. This can be used to store a missing transverse energy
0189     that is not attributed to a neutrino but is instead due to mismeasurement.
0190     Typically this will be set to zero in events that have a neutrino,
0191     and to the measured missing transverse energy in events that do not.
0192  */
0193   class Fourvec_Event
0194   //
0195   // Purpose: Represent an event for kinematic fitting as a collection
0196   //           of 4-vectors.
0197   //
0198   {
0199   public:
0200     // Constructor.
0201     /**
0202      @brief Default constructor.
0203    */
0204     Fourvec_Event();
0205 
0206     //****************************
0207     // Accessors.
0208     //
0209 
0210     // Return true if this event contains a neutrino.
0211     /**
0212      @brief Return TRUE is this event contains a neutrino, otherwise returns
0213       FALSE.
0214    */
0215     bool has_neutrino() const;
0216 
0217     // Return the number of objects in the event, not including any neutrino.
0218     /**
0219      @brief Return the number of objects in the event not including any
0220      neutrinos.
0221    */
0222     int nobjs() const;
0223 
0224     // Return the number of objects in the event, including any neutrino.
0225     /**
0226      @brief Return the number of objects in the event including any neutrinos.
0227    */
0228     int nobjs_all() const;
0229 
0230     // Access object I.  (Indexing starts with 0.)
0231     /**
0232      @brief Access object at index <i>i</i>, with the convention that the
0233      index starts at 0.
0234 
0235      @param i The index of the desired object.
0236    */
0237     const FE_Obj& obj(std::vector<FE_Obj>::size_type i) const;
0238 
0239     // Access the neutrino 4-momentum.
0240     /**
0241      @brief Access the neutrino four-momentum.
0242    */
0243     const Fourvec& nu() const;
0244 
0245     // Access the kt 4-momentum.
0246     /**
0247      @brief Access the \f$k_{T}\f$ four-momentum.
0248    */
0249     const Fourvec& kt() const;
0250 
0251     // Access the X 4-momentum.
0252     /**
0253      @brief Access the \f$x\f$ four-momentum.
0254    */
0255     const Fourvec& x() const;
0256 
0257     // Access the kt uncertainties.
0258     /**
0259      @brief Return the x uncertainty in \f$k_{T}\f$.
0260    */
0261     double kt_x_error() const;
0262 
0263     /**
0264      @brief Return the y uncertainty in \f$k_{T}\f$.
0265    */
0266     double kt_y_error() const;
0267 
0268     /**
0269      @brief Return the xy covariance in \f$k_{T}\f$.
0270    */
0271     double kt_xy_covar() const;
0272 
0273     // Print out the contents.
0274     friend std::ostream& operator<<(std::ostream& s, const Fourvec_Event& fe);
0275 
0276     //****************************
0277     // Modifiers.
0278     //
0279 
0280     // Add an object to the event.
0281     // (This should not be a neutrino --- use set_nu_p for that.)
0282     /**
0283      @brief Add an object to the event.  The object should not be a neutrino,
0284      use the method set_nu_p for that.
0285 
0286      @param obj The FE_Obj to add.
0287    */
0288     void add(const FE_Obj& obj);
0289 
0290     // Set the neutrino 4-momentum to P.
0291     // This adds a neutrino if there wasn't already one.
0292     /**
0293      @brief Set the neutrino four-momentum to \f$p\f$.  This method
0294      adds a neutrino if there wasn't already one.
0295 
0296      @param p The new four-momentum of the neutrino.
0297    */
0298     void set_nu_p(const Fourvec& p);
0299 
0300     // Set the 4-momentum of object I to P.
0301     /**
0302      @brief Set the four-momentum of object at index <i>i</i> to \f$p\f$.
0303 
0304      @param i The position index of the object to change.
0305 
0306      @param p The new four-momentum of object at index <i>i</i>.
0307    */
0308     void set_obj_p(std::vector<FE_Obj>::size_type i, const Fourvec& p);
0309 
0310     // Set the 4-momentum of the X object.
0311     /**
0312      @brief Set the four-momentum of the \f$x\f$ object.
0313 
0314      @param p The new four-momentum of the \f$x\f$ object.
0315    */
0316     void set_x_p(const Fourvec& p);
0317 
0318     // Set the kt uncertainties.
0319     /**
0320      @brief Set the uncertainties on \f$k_{T}\f$.
0321 
0322      @param kt_x_error The uncertainty in the \f$x-\f$component of \f$k_{T}\f$.
0323 
0324      @param kt_y_error The uncertainty in the \f$y-\f$component of \f$k_{T}\f$.
0325 
0326      @param kt_xy_covar The covariance between the \f$x-\f$ and
0327      \f$y-\f$component of \f$k_{T}\f$.
0328 
0329    */
0330     void set_kt_error(double kt_x_error, double kt_y_error, double kt_xy_covar);
0331 
0332   private:
0333     // The list of contained objects.
0334     /**
0335      The list of contained objects in the event.
0336    */
0337     std::vector<FE_Obj> _objs;
0338 
0339     // Cached kt.  This should always be equal to the sum of all the
0340     // object momenta, including x.
0341     /**
0342      Cached \f$k_{T}\f$, this should always be equal to the sum of all the
0343      object momenta, including \f$x\f$.
0344    */
0345     Fourvec _kt;
0346 
0347     // Momemtum of the X object.
0348     /**
0349      Four-momentum of the \f$x\f$ object.
0350    */
0351     Fourvec _x;
0352 
0353     // The kt uncertainties.
0354     /**
0355      The uncertainty in the \f$x-\f$component of \f$k_{T}\f$.   */
0356     double _kt_x_error;
0357 
0358     /**
0359      The uncertainty in the \f$y-\f$component of \f$k_{T}\f$.   */
0360     double _kt_y_error;
0361 
0362     /**
0363      The covariance between the \f$x-\f$ and
0364      \f$y-\f$component of \f$k_{T}\f$.
0365   */
0366     double _kt_xy_covar;
0367 
0368     // Flag that a neutrino has been added.
0369     /**
0370      Flag that a neutrino has been added to the event.
0371    */
0372     bool _has_neutrino;
0373   };
0374 
0375 }  // namespace hitfit
0376 
0377 #endif  // not HITFIT_FOURVEC_EVENT_H