Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 10:05:24

0001 //
0002 //
0003 // File: src/Lepjets_Event_Lep.cc
0004 // Purpose: Represent a `lepton' in a Lepjets_Event.
0005 // Created: Jul, 2000, sss, based on run 1 mass analysis code.
0006 //
0007 // CMSSW File      : src/Lepjets_Event_Lep.cc
0008 // Original Author : Scott Stuart Snyder <snyder@bnl.gov> for D0
0009 // Imported to CMSSW by Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
0010 //
0011 
0012 /**
0013     @file Lepjets_Event_Lep.cc
0014 
0015     @brief Represent a lepton in an instance of Lepjets_Event class.
0016     See the header file Lepjets_Event_Lep for details.
0017 
0018     @author Scott Stuart Snyder <snyder@bnl.gov>
0019 
0020     @par Creation date:
0021     Jul 2000.
0022 
0023     @par Modification History:
0024     Apr 2009: Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>:
0025     Imported to CMSSW.<br>
0026     Nov 2009: Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>:
0027     Added doxygen tags for automatic generation of documentation.
0028 
0029     @par Terms of Usage:
0030     With consent for the original author (Scott Snyder).
0031 
0032  */
0033 
0034 #include "TopQuarkAnalysis/TopHitFit/interface/Lepjets_Event_Lep.h"
0035 
0036 namespace hitfit {
0037 
0038   Lepjets_Event_Lep::Lepjets_Event_Lep(const Fourvec& p, int type, const Vector_Resolution& res)
0039       //
0040       // Purpose: Constructor.
0041       //
0042       // Inputs:
0043       //   p -           The 4-momentum.
0044       //   type -        The type code.
0045       //   res -         The resolution.
0046       //
0047       : _p(p), _type(type), _res(res) {}
0048 
0049   Fourvec& Lepjets_Event_Lep::p()
0050   //
0051   // Purpose: Access the 4-momentum.
0052   //
0053   // Returns:
0054   //   The 4-momentum.
0055   //
0056   {
0057     return _p;
0058   }
0059 
0060   const Fourvec& Lepjets_Event_Lep::p() const
0061   //
0062   // Purpose: Access the 4-momentum.
0063   //
0064   // Returns:
0065   //   The 4-momentum.
0066   //
0067   {
0068     return _p;
0069   }
0070 
0071   int& Lepjets_Event_Lep::type()
0072   //
0073   // Purpose: Access the type code.
0074   //
0075   // Returns:
0076   //   The type code.
0077   //
0078   {
0079     return _type;
0080   }
0081 
0082   int Lepjets_Event_Lep::type() const
0083   //
0084   // Purpose: Access the type code.
0085   //
0086   // Returns:
0087   //   The type code.
0088   //
0089   {
0090     return _type;
0091   }
0092 
0093   const Vector_Resolution& Lepjets_Event_Lep::res() const
0094   //
0095   // Purpose: Access the resolutions.
0096   //
0097   // Returns:
0098   //   The resolutions.
0099   //
0100   {
0101     return _res;
0102   }
0103 
0104   Vector_Resolution& Lepjets_Event_Lep::res()
0105   //
0106   // Purpose: Access the resolutions.
0107   //
0108   // Returns:
0109   //   The resolutions.
0110   //
0111   {
0112     return _res;
0113   }
0114 
0115   double Lepjets_Event_Lep::p_sigma() const
0116   //
0117   // Purpose: Return the momentum (or 1/p) resolution for this object.
0118   //
0119   // Returns:
0120   //   The momentum (or 1/p) resolution for this object.
0121   //
0122   {
0123     return _res.p_sigma(_p);
0124   }
0125 
0126   double Lepjets_Event_Lep::eta_sigma() const
0127   //
0128   // Purpose: Return the eta resolution for this object.
0129   //
0130   // Returns:
0131   //   The eta resolution for this object.
0132   //
0133   {
0134     return _res.eta_sigma(_p);
0135   }
0136 
0137   double Lepjets_Event_Lep::phi_sigma() const
0138   //
0139   // Purpose: Return the phi resolution for this object.
0140   //
0141   // Returns:
0142   //   The phi resolution for this object.
0143   //
0144   {
0145     return _res.phi_sigma(_p);
0146   }
0147 
0148   void Lepjets_Event_Lep::smear(CLHEP::HepRandomEngine& engine, bool smear_dir /*= false*/)
0149   //
0150   // Purpose: Smear this object according to its resolutions.
0151   //
0152   // Inputs:
0153   //   engine -      The underlying RNG.
0154   //   smear_dir -   If false, smear the momentum only.
0155   //
0156   {
0157     _res.smear(_p, engine, smear_dir);
0158   }
0159 
0160   std::ostream& Lepjets_Event_Lep::dump(std::ostream& s, bool full /*= false*/) const
0161   //
0162   // Purpose: Dump out this object.
0163   //
0164   // Inputs:
0165   //   s -           The stream to which to write.
0166   //   full -        If true, dump the resolutions too.
0167   //
0168   // Returns:
0169   //   The stream S.
0170   //
0171   {
0172     s << "[" << _type << "] " << _p << "; pt: " << _p.perp() << ", eta: " << _p.eta() << ", phi: " << _p.phi();
0173     if (full) {
0174       s << "\n    " << _res;
0175     }
0176     return s;
0177   }
0178 
0179   /**
0180     @brief Output stream operator, print the content of this Lepjets_Event_Lep
0181     to an output stream.
0182 
0183     @param s The stream to which to write.
0184 
0185     @param l The instance of Lepjets_Event_Lep to be printed.
0186  */
0187   std::ostream& operator<<(std::ostream& s, const Lepjets_Event_Lep& l)
0188   //
0189   // Purpose: Dump out this object.
0190   //
0191   // Inputs:
0192   //   s -           The stream to which to write.
0193   //   l -           The object to dump.
0194   //
0195   // Returns:
0196   //   The stream S.
0197   //
0198   {
0199     return l.dump(s);
0200   }
0201 
0202   bool Lepjets_Event_Lep::operator<(const Lepjets_Event_Lep& x) const
0203   //
0204   // Purpose: Sort objects by pt.
0205   //
0206   // Retruns:
0207   //   True if this object's pt is less than that of x.
0208   {
0209     return p().perp2() < x.p().perp2();
0210   }
0211 
0212 }  // namespace hitfit