CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/TopQuarkAnalysis/TopHitFit/src/Lepjets_Event_Jet.cc

Go to the documentation of this file.
00001 //
00002 // $Id: Lepjets_Event_Jet.cc,v 1.1 2011/05/26 09:47:00 mseidel Exp $
00003 //
00004 // File: src/Lepjets_Event_Jet.cc
00005 // Purpose: Represent a `jet' in a Lepjets_Event.
00006 // Created: Jul, 2000, sss, based on run 1 mass analysis code.
00007 //
00008 // CMSSW File      : src/Lepjets_Event_Jet.cc
00009 // Original Author : Scott Stuart Snyder <snyder@bnl.gov> for D0
00010 // Imported to CMSSW by Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
00011 //
00012 
00013 
00036 #include "TopQuarkAnalysis/TopHitFit/interface/Lepjets_Event_Jet.h"
00037 
00038 
00039 namespace hitfit {
00040 
00041 
00042 Lepjets_Event_Jet::Lepjets_Event_Jet (const Fourvec& p,
00043                                       int type,
00044                                       const Vector_Resolution& res,
00045                                       bool svx_tag /*= false*/,
00046                                       bool slt_tag /*= false*/,
00047                                       const Fourvec& tag_lep /*= Fourvec()*/,
00048                                       double slt_edep /*= 0*/)
00049 //
00050 // Purpose: Constructor.
00051 //
00052 // Inputs:
00053 //   p -           The 4-momentum.
00054 //   type -        The type code.
00055 //   res -         The resolution.
00056 //   svx_tag -     SVX tag flag.
00057 //   slt_tag -     SLT tag flag.
00058 //   tag_lep -     SLT lepton 4-momentum.
00059 //   slt_edep -    SLT lepton energy deposition.
00060 //
00061   : Lepjets_Event_Lep (p, type, res),
00062     _svx_tag (svx_tag),
00063     _slt_tag (slt_tag),
00064     _tag_lep (tag_lep),
00065     _slt_edep (slt_edep),
00066     _e0 (p.e())
00067 {
00068 }
00069 
00070 
00071 bool Lepjets_Event_Jet::svx_tag () const
00072 //
00073 // Purpose: Access the SVX tag flag.
00074 //
00075 // Returns:
00076 //   The SVX tag flag.
00077 //
00078 {
00079   return _svx_tag;
00080 }
00081 
00082 
00083 bool& Lepjets_Event_Jet::svx_tag ()
00084 //
00085 // Purpose: Access the SVX tag flag.
00086 //
00087 // Returns:
00088 //   The SVX tag flag.
00089 //
00090 {
00091   return _svx_tag;
00092 }
00093 
00094 
00095 bool Lepjets_Event_Jet::slt_tag () const
00096 //
00097 // Purpose: Access the SLT tag flag.
00098 //
00099 // Returns:
00100 //   The SLT tag flag.
00101 //
00102 {
00103   return _slt_tag;
00104 }
00105 
00106 
00107 bool& Lepjets_Event_Jet::slt_tag ()
00108 //
00109 // Purpose: Access the SLT tag flag.
00110 //
00111 // Returns:
00112 //   The SLT tag flag.
00113 //
00114 {
00115   return _slt_tag;
00116 }
00117 
00118 
00119 const Fourvec& Lepjets_Event_Jet::tag_lep () const
00120 //
00121 // Purpose: Access the tag lepton 4-momentum.
00122 //
00123 // Returns:
00124 //   The tag lepton 4-momentum.
00125 //
00126 {
00127   return _tag_lep;
00128 }
00129 
00130 
00131 Fourvec& Lepjets_Event_Jet::tag_lep ()
00132 //
00133 // Purpose: Access the tag lepton 4-momentum.
00134 //
00135 // Returns:
00136 //   The tag lepton 4-momentum.
00137 //
00138 {
00139   return _tag_lep;
00140 }
00141 
00142 
00143 double Lepjets_Event_Jet::slt_edep () const
00144 //
00145 // Purpose: Access the tag lepton energy deposition.
00146 //
00147 // Returns:
00148 //   The tag lepton energy deposition.
00149 //
00150 {
00151   return _slt_edep;
00152 }
00153 
00154 
00155 double& Lepjets_Event_Jet::slt_edep ()
00156 //
00157 // Purpose: Access the tag lepton energy deposition.
00158 //
00159 // Returns:
00160 //   The tag lepton energy deposition.
00161 //
00162 {
00163   return _slt_edep;
00164 }
00165 
00166 
00167 double Lepjets_Event_Jet::e0 () const
00168 //
00169 // Purpose: Access the uncorrected jet energy.
00170 //
00171 // Returns:
00172 //   The uncorrected jet energy.
00173 //
00174 {
00175   return _e0;
00176 }
00177 
00178 
00179 double& Lepjets_Event_Jet::e0 ()
00180 //
00181 // Purpose: Access the uncorrected jet energy.
00182 //
00183 // Returns:
00184 //   The uncorrected jet energy.
00185 //
00186 {
00187   return _e0;
00188 }
00189 
00190 
00191 std::ostream& Lepjets_Event_Jet::dump (std::ostream& s,
00192                                        bool full /*= false*/) const
00193 //
00194 // Purpose: Dump out this object.
00195 //
00196 // Inputs:
00197 //   s -           The stream to which to write.
00198 //   full -        If true, dump all information for this object.
00199 //
00200 // Returns:
00201 //   The stream S.
00202 //
00203 {
00204   Lepjets_Event_Lep::dump (s, full);
00205   if (_svx_tag)
00206     s << " (svx)";
00207   if (_slt_tag)
00208     s << " (slt)";
00209   if (full) {
00210     if (_slt_tag) {
00211       s << "    tag lep: " << _tag_lep;
00212       s << " edep: " << _slt_edep;
00213     }
00214     s << "\n";
00215   }
00216   return s;
00217 }
00218 
00219 
00228 std::ostream& operator<< (std::ostream& s, const Lepjets_Event_Jet& l)
00229 //
00230 // Purpose: Dump out this object.
00231 //
00232 // Inputs:
00233 //   s -           The stream to which to write.
00234 //   l -           The object to dump.
00235 //
00236 // Returns:
00237 //   The stream S.
00238 //
00239 {
00240   return l.dump (s);
00241 }
00242 
00243 
00244 char
00245 jetTypeChar(int j)
00246 //
00247 // Purpose: Translate numeric jet type into char
00248 //
00249 // Inputs:
00250 //   j -          jet type in integer
00251 //
00252 // Returns:
00253 //   the jet type in char
00254 //
00255 {
00256 
00257 
00258     switch (j) {
00259 
00260     case hitfit::isr_label:
00261         return 'g';
00262     case hitfit::lepb_label:
00263         return 'b';
00264     case hitfit::hadb_label:
00265         return 'B';
00266     case hitfit::hadw1_label:
00267         return 'W';
00268     case hitfit::hadw2_label:
00269         return 'W';
00270     case hitfit::higgs_label:
00271         return 'h';
00272     case hitfit::unknown_label:
00273         return '?';
00274     default:
00275         return '?';
00276     }
00277 
00278     return '?';
00279 
00280 }
00281 
00282 std::string
00283 jetTypeString(int j)
00284 //
00285 // Purpose: Translate numeric jet type into string
00286 //
00287 // Inputs:
00288 //   j -          jet type in integer
00289 //
00290 // Returns:
00291 //   the jet type in string
00292 //
00293 {
00294 
00295 
00296     switch (j) {
00297 
00298     case hitfit::isr_label:
00299         return std::string("g");
00300     case hitfit::lepb_label:
00301         return std::string("b");
00302     case hitfit::hadb_label:
00303         return std::string("B");
00304     case hitfit::hadw1_label:
00305         return std::string("W");
00306     case hitfit::hadw2_label:
00307         return std::string("W");
00308     case hitfit::higgs_label:
00309         return std::string("h");
00310     case hitfit::unknown_label:
00311         return std::string("?");
00312     default:
00313         return std::string("?");
00314     }
00315 
00316     return std::string("?"); 
00317 
00318 }
00319 
00320 } // namespace hitfit