Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:31:19

0001 //
0002 //
0003 // File: src/Lepjets_Event_Jet.cc
0004 // Purpose: Represent a `jet' in a Lepjets_Event.
0005 // Created: Jul, 2000, sss, based on run 1 mass analysis code.
0006 //
0007 // CMSSW File      : src/Lepjets_Event_Jet.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_Jet.cc
0014 
0015     @brief Represent a jet in an instance of Lepjets_Event class.
0016     See the documentation for the header file Lepjets_Event_Jet.h for details.
0017 
0018     @author Scott Stuart Snyder <snyder@bnl.gov>
0019 
0020     @par Creation date:
0021     July 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_Jet.h"
0035 
0036 namespace hitfit {
0037 
0038   Lepjets_Event_Jet::Lepjets_Event_Jet(const Fourvec& p,
0039                                        int type,
0040                                        const Vector_Resolution& res,
0041                                        bool svx_tag /*= false*/,
0042                                        bool slt_tag /*= false*/,
0043                                        const Fourvec& tag_lep /*= Fourvec()*/,
0044                                        double slt_edep /*= 0*/)
0045       //
0046       // Purpose: Constructor.
0047       //
0048       // Inputs:
0049       //   p -           The 4-momentum.
0050       //   type -        The type code.
0051       //   res -         The resolution.
0052       //   svx_tag -     SVX tag flag.
0053       //   slt_tag -     SLT tag flag.
0054       //   tag_lep -     SLT lepton 4-momentum.
0055       //   slt_edep -    SLT lepton energy deposition.
0056       //
0057       : Lepjets_Event_Lep(p, type, res),
0058         _svx_tag(svx_tag),
0059         _slt_tag(slt_tag),
0060         _tag_lep(tag_lep),
0061         _slt_edep(slt_edep),
0062         _e0(p.e()) {}
0063 
0064   bool Lepjets_Event_Jet::svx_tag() const
0065   //
0066   // Purpose: Access the SVX tag flag.
0067   //
0068   // Returns:
0069   //   The SVX tag flag.
0070   //
0071   {
0072     return _svx_tag;
0073   }
0074 
0075   bool& Lepjets_Event_Jet::svx_tag()
0076   //
0077   // Purpose: Access the SVX tag flag.
0078   //
0079   // Returns:
0080   //   The SVX tag flag.
0081   //
0082   {
0083     return _svx_tag;
0084   }
0085 
0086   bool Lepjets_Event_Jet::slt_tag() const
0087   //
0088   // Purpose: Access the SLT tag flag.
0089   //
0090   // Returns:
0091   //   The SLT tag flag.
0092   //
0093   {
0094     return _slt_tag;
0095   }
0096 
0097   bool& Lepjets_Event_Jet::slt_tag()
0098   //
0099   // Purpose: Access the SLT tag flag.
0100   //
0101   // Returns:
0102   //   The SLT tag flag.
0103   //
0104   {
0105     return _slt_tag;
0106   }
0107 
0108   const Fourvec& Lepjets_Event_Jet::tag_lep() const
0109   //
0110   // Purpose: Access the tag lepton 4-momentum.
0111   //
0112   // Returns:
0113   //   The tag lepton 4-momentum.
0114   //
0115   {
0116     return _tag_lep;
0117   }
0118 
0119   Fourvec& Lepjets_Event_Jet::tag_lep()
0120   //
0121   // Purpose: Access the tag lepton 4-momentum.
0122   //
0123   // Returns:
0124   //   The tag lepton 4-momentum.
0125   //
0126   {
0127     return _tag_lep;
0128   }
0129 
0130   double Lepjets_Event_Jet::slt_edep() const
0131   //
0132   // Purpose: Access the tag lepton energy deposition.
0133   //
0134   // Returns:
0135   //   The tag lepton energy deposition.
0136   //
0137   {
0138     return _slt_edep;
0139   }
0140 
0141   double& Lepjets_Event_Jet::slt_edep()
0142   //
0143   // Purpose: Access the tag lepton energy deposition.
0144   //
0145   // Returns:
0146   //   The tag lepton energy deposition.
0147   //
0148   {
0149     return _slt_edep;
0150   }
0151 
0152   double Lepjets_Event_Jet::e0() const
0153   //
0154   // Purpose: Access the uncorrected jet energy.
0155   //
0156   // Returns:
0157   //   The uncorrected jet energy.
0158   //
0159   {
0160     return _e0;
0161   }
0162 
0163   double& Lepjets_Event_Jet::e0()
0164   //
0165   // Purpose: Access the uncorrected jet energy.
0166   //
0167   // Returns:
0168   //   The uncorrected jet energy.
0169   //
0170   {
0171     return _e0;
0172   }
0173 
0174   std::ostream& Lepjets_Event_Jet::dump(std::ostream& s, bool full /*= false*/) const
0175   //
0176   // Purpose: Dump out this object.
0177   //
0178   // Inputs:
0179   //   s -           The stream to which to write.
0180   //   full -        If true, dump all information for this object.
0181   //
0182   // Returns:
0183   //   The stream S.
0184   //
0185   {
0186     Lepjets_Event_Lep::dump(s, full);
0187     if (_svx_tag)
0188       s << " (svx)";
0189     if (_slt_tag)
0190       s << " (slt)";
0191     if (full) {
0192       if (_slt_tag) {
0193         s << "    tag lep: " << _tag_lep;
0194         s << " edep: " << _slt_edep;
0195       }
0196       s << "\n";
0197     }
0198     return s;
0199   }
0200 
0201   /**
0202     @brief Output stream operator, print the content of this Lepjets_Event_Jet
0203     to an output stream.
0204 
0205     @param s The stream to which to write.
0206 
0207     @param l The instance of Lepjets_Event_Jet to be printed.
0208  */
0209   std::ostream& operator<<(std::ostream& s, const Lepjets_Event_Jet& l)
0210   //
0211   // Purpose: Dump out this object.
0212   //
0213   // Inputs:
0214   //   s -           The stream to which to write.
0215   //   l -           The object to dump.
0216   //
0217   // Returns:
0218   //   The stream S.
0219   //
0220   {
0221     return l.dump(s);
0222   }
0223 
0224   char jetTypeChar(int j)
0225   //
0226   // Purpose: Translate numeric jet type into char
0227   //
0228   // Inputs:
0229   //   j -          jet type in integer
0230   //
0231   // Returns:
0232   //   the jet type in char
0233   //
0234   {
0235     switch (j) {
0236       case hitfit::isr_label:
0237         return 'g';
0238       case hitfit::lepb_label:
0239         return 'b';
0240       case hitfit::hadb_label:
0241         return 'B';
0242       case hitfit::hadw1_label:
0243         return 'W';
0244       case hitfit::hadw2_label:
0245         return 'W';
0246       case hitfit::higgs_label:
0247         return 'h';
0248       case hitfit::unknown_label:
0249         return '?';
0250       default:
0251         return '?';
0252     }
0253 
0254     return '?';
0255   }
0256 
0257   std::string jetTypeString(int j)
0258   //
0259   // Purpose: Translate numeric jet type into string
0260   //
0261   // Inputs:
0262   //   j -          jet type in integer
0263   //
0264   // Returns:
0265   //   the jet type in string
0266   //
0267   {
0268     switch (j) {
0269       case hitfit::isr_label:
0270         return std::string("g");
0271       case hitfit::lepb_label:
0272         return std::string("b");
0273       case hitfit::hadb_label:
0274         return std::string("B");
0275       case hitfit::hadw1_label:
0276         return std::string("W");
0277       case hitfit::hadw2_label:
0278         return std::string("W");
0279       case hitfit::higgs_label:
0280         return std::string("h");
0281       case hitfit::unknown_label:
0282         return std::string("?");
0283       default:
0284         return std::string("?");
0285     }
0286 
0287     return std::string("?");
0288   }
0289 
0290 }  // namespace hitfit