CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/TopQuarkAnalysis/TopHitFit/src/Fit_Result.cc

Go to the documentation of this file.
00001 //
00002 // $Id: Fit_Result.cc,v 1.1 2011/05/26 09:47:00 mseidel Exp $
00003 //
00004 // File: src/Fit_Result.cc
00005 // Purpose: Hold the result from a single kinematic fit.
00006 // Created: Jul, 2000, sss, based on run 1 mass analysis code.
00007 //
00008 // CMSSW File      : src/Fit_Result.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 
00035 #include "TopQuarkAnalysis/TopHitFit/interface/Fit_Result.h"
00036 #include <ostream>
00037 #include <cmath>
00038 
00039 
00040 using std::ostream;
00041 using std::abs;
00042 
00043 
00044 namespace hitfit {
00045 
00046 
00047 Fit_Result::Fit_Result (double chisq,
00048                         const Lepjets_Event& ev,
00049                         const Column_Vector& pullx,
00050                         const Column_Vector& pully,
00051                         double umwhad,
00052                         double utmass,
00053                         double mt,
00054                         double sigmt)
00055 //
00056 // Purpose: Constructor.
00057 //
00058 // Inputs:
00059 //   chisq -       The fit chisq.
00060 //   ev -          The event kinematics.
00061 //   pullx -       The pull quantities for the well-measured variables.
00062 //   pully -       The pull quantities for the poorly-measured variables.
00063 //   umwhad -      The hadronic W mass before the fit.
00064 //   utmass -      The top quark mass before the fit.
00065 //   mt -          The top quark mass after the fit.
00066 //   sigmt -       The top quark mass uncertainty after the fit.
00067 //
00068   : _chisq (chisq),
00069     _umwhad (umwhad),
00070     _utmass (utmass),
00071     _mt (mt),
00072     _sigmt (sigmt),
00073     _pullx (pullx),
00074     _pully (pully),
00075     _ev (ev)
00076 {
00077 }
00078 
00079 
00080 double Fit_Result::chisq () const
00081 //
00082 // Purpose: Return the fit chisq.
00083 //
00084 // Returns:
00085 //   Return the fit chisq.
00086 //
00087 {
00088   return _chisq;
00089 }
00090 
00091 
00092 double Fit_Result::umwhad () const
00093 //
00094 // Purpose: Return the hadronic W mass before the fit.
00095 //
00096 // Returns:
00097 //   The hadronic W mass before the fit.
00098 //
00099 {
00100   return _umwhad;
00101 }
00102 
00103 
00104 double Fit_Result::utmass () const
00105 //
00106 // Purpose: Return the top mass before the fit.
00107 //
00108 // Returns:
00109 //   The top mass before the fit.
00110 //
00111 {
00112   return _utmass;
00113 }
00114 
00115 
00116 double Fit_Result::mt () const
00117 //
00118 // Purpose: Return the top mass after the fit.
00119 //
00120 // Returns:
00121 //   The top mass after the fit.
00122 //
00123 {
00124   return _mt;
00125 }
00126 
00127 
00128 double Fit_Result::sigmt () const
00129 //
00130 // Purpose: Return the top mass uncertainty after the fit.
00131 //
00132 // Returns:
00133 //   The top mass uncertainty after the fit.
00134 //
00135 {
00136   return _sigmt;
00137 }
00138 
00139 
00140 const Column_Vector& Fit_Result::pullx () const
00141 //
00142 // Purpose: Return the pull quantities for the well-measured variables.
00143 //
00144 // Returns:
00145 //   The pull quantities for the well-measured variables.
00146 //
00147 {
00148   return _pullx;
00149 }
00150 
00151 
00152 const Column_Vector& Fit_Result::pully () const
00153 //
00154 // Purpose: Return the pull quantities for the poorly-measured variables.
00155 //
00156 // Returns:
00157 //   The pull quantities for the poorly-measured variables.
00158 //
00159 {
00160   return _pully;
00161 }
00162 
00163 
00164 std::vector<int> Fit_Result::jet_types () 
00165 //
00166 // Purpose: Returns the jet types of the fit
00167 //
00168 {
00169   return _ev.jet_types();
00170 }
00171 
00172 const Lepjets_Event& Fit_Result::ev () const
00173 //
00174 // Purpose: Return the event kinematic quantities after the fit.
00175 //
00176 // Returns:
00177 //   The event kinematic quantities after the fit.
00178 //
00179 {
00180   return _ev;
00181 }
00182 
00183 
00196 bool operator< (const Fit_Result& a, const Fit_Result& b)
00197 //
00198 // Purpose: Compare two objects by chisq.
00199 //          The use of abs() is to make sure that the -1000 flags
00200 //          go to the end.
00201 //
00202 // Inputs:
00203 //   a -           The first object to compare.
00204 //   b -           The second object to compare.
00205 //
00206 // Returns:
00207 //   The result of the comparison.
00208 //
00209 {
00210   return abs (a._chisq) < abs (b._chisq);
00211 }
00212 
00213 
00222 std::ostream& operator<< (std::ostream& s, const Fit_Result& res)
00223 //
00224 // Purpose: Print the object to S.
00225 //
00226 // Inputs:
00227 //   s -           The stream to which to write.
00228 //   res -         The object to write.
00229 //
00230 // Returns:
00231 //   The stream S.
00232 //
00233 {
00234   s << "chisq: "  << res._chisq  << "\n";
00235   s << "umwhad: " << res._umwhad << "\n";
00236   s << "utmass: " << res._utmass << "\n";
00237   s << "mt: "     << res._mt     << "\n";
00238   s << "sigmt: "  << res._sigmt << "\n";
00239   s << res._ev;
00240   s << "pullx: " << res._pullx.T();
00241   s << "pully: " << res._pully.T();
00242   return s;
00243 }
00244 
00245 
00246 
00247 } // namespace hitfit