CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/TopQuarkAnalysis/TopHitFit/src/Fit_Results.cc

Go to the documentation of this file.
00001 //
00002 // $Id: Fit_Results.cc,v 1.1 2011/05/26 09:47:00 mseidel Exp $
00003 //
00004 // File: src/Fit_Results.cc
00005 // Purpose: Hold the results from kinematic fitting.
00006 // Created: Jul, 2000, sss, based on run 1 mass analysis code.
00007 //
00008 // CMSSW File      : src/Fit_Results.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 
00014 #include "TopQuarkAnalysis/TopHitFit/interface/Fit_Results.h"
00015 #include "TopQuarkAnalysis/TopHitFit/interface/Fit_Result.h"
00016 #include <ostream>
00017 #include <cassert>
00018 
00019 
00042 using std::ostream;
00043 
00044 
00045 namespace hitfit {
00046 
00047 
00048 Fit_Results::Fit_Results (int max_len, int n_lists)
00049 //
00050 // Purpose: Constructor.
00051 //
00052 // Inputs:
00053 //   max_len -     The maximum length of each list.
00054 //   n_lists -     The number of lists.
00055 //
00056   : _v (n_lists, Fit_Result_Vec (max_len))
00057 {
00058 }
00059 
00060 
00061 const Fit_Result_Vec& Fit_Results::operator[] (std::vector<Fit_Result_Vec>::size_type i) const
00062 {
00063   assert (i < _v.size());
00064   return _v[i];
00065 }
00066 
00067 
00068 void Fit_Results::push (double chisq,
00069                         const Lepjets_Event& ev,
00070                         const Column_Vector& pullx,
00071                         const Column_Vector& pully,
00072                         double umwhad,
00073                         double utmass,
00074                         double mt,
00075                         double sigmt,
00076                         const std::vector<int>& list_flags)
00077 //
00078 // Purpose: Add a new fit result.
00079 //
00080 // Inputs:
00081 //   chisq -       The fit chisq.
00082 //   ev -          The event kinematics.
00083 //   pullx -       The pull quantities for the well-measured variables.
00084 //   pully -       The pull quantities for the poorly-measured variables.
00085 //   umwhad -      The hadronic W mass before the fit.
00086 //   utmass -      The top quark mass before the fit.
00087 //   mt -          The top quark mass after the fit.
00088 //   sigmt -       The top quark mass uncertainty after the fit.
00089 //   list_flags -  Vector indicating to which lists the result should
00090 //                 be added.
00091 //                 This vector should have a length of N_SIZE.
00092 //                 Each element should be either 0 or 1, depending
00093 //                 on whether or not the result should be added
00094 //                 to the corresponding list.
00095 //
00096 {
00097   assert (list_flags.size() == _v.size());
00098 
00099   Fit_Result* res = new Fit_Result (chisq, ev, pullx, pully,
00100                                     umwhad, utmass, mt, sigmt);
00101   res->incref ();
00102   for (std::vector<Fit_Result_Vec>::size_type i=0; i < _v.size(); i++) {
00103     if (list_flags[i])
00104       _v[i].push (res);
00105   }
00106   res->decref ();
00107 }
00108 
00109 
00118 std::ostream& operator<< (std::ostream& s, const Fit_Results& res)
00119 //
00120 // Purpose: Print the object to S.
00121 //
00122 // Inputs:
00123 //   s -           The stream to which to write.
00124 //   res -         The object to write.
00125 //
00126 // Returns:
00127 //   The stream S.
00128 //
00129 {
00130   for (std::vector<Fit_Result_Vec>::size_type i=0; i < res._v.size(); i++)
00131     s << "List " << i << "\n" << res._v[i];
00132   return s;
00133 }
00134 
00135 
00136 } // namespace hitfit