CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Fit_Results.cc
Go to the documentation of this file.
1 //
2 //
3 // File: src/Fit_Results.cc
4 // Purpose: Hold the results from kinematic fitting.
5 // Created: Jul, 2000, sss, based on run 1 mass analysis code.
6 //
7 // CMSSW File : src/Fit_Results.cc
8 // Original Author : Scott Stuart Snyder <snyder@bnl.gov> for D0
9 // Imported to CMSSW by Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
10 //
11 
12 
15 #include <ostream>
16 #include <cassert>
17 
18 
41 using std::ostream;
42 
43 
44 namespace hitfit {
45 
46 
48 //
49 // Purpose: Constructor.
50 //
51 // Inputs:
52 // max_len - The maximum length of each list.
53 // n_lists - The number of lists.
54 //
55  : _v (n_lists, Fit_Result_Vec (max_len))
56 {
57 }
58 
59 
61 {
62  assert (i < _v.size());
63  return _v[i];
64 }
65 
66 
67 void Fit_Results::push (double chisq,
68  const Lepjets_Event& ev,
69  const Column_Vector& pullx,
70  const Column_Vector& pully,
71  double umwhad,
72  double utmass,
73  double mt,
74  double sigmt,
75  const std::vector<int>& list_flags)
76 //
77 // Purpose: Add a new fit result.
78 //
79 // Inputs:
80 // chisq - The fit chisq.
81 // ev - The event kinematics.
82 // pullx - The pull quantities for the well-measured variables.
83 // pully - The pull quantities for the poorly-measured variables.
84 // umwhad - The hadronic W mass before the fit.
85 // utmass - The top quark mass before the fit.
86 // mt - The top quark mass after the fit.
87 // sigmt - The top quark mass uncertainty after the fit.
88 // list_flags - Vector indicating to which lists the result should
89 // be added.
90 // This vector should have a length of N_SIZE.
91 // Each element should be either 0 or 1, depending
92 // on whether or not the result should be added
93 // to the corresponding list.
94 //
95 {
96  assert (list_flags.size() == _v.size());
97 
98  Fit_Result* res = new Fit_Result (chisq, ev, pullx, pully,
99  umwhad, utmass, mt, sigmt);
100  res->incref ();
101  for (std::vector<Fit_Result_Vec>::size_type i=0; i < _v.size(); i++) {
102  if (list_flags[i])
103  _v[i].push (res);
104  }
105  res->decref ();
106 }
107 
108 
117 std::ostream& operator<< (std::ostream& s, const Fit_Results& res)
118 //
119 // Purpose: Print the object to S.
120 //
121 // Inputs:
122 // s - The stream to which to write.
123 // res - The object to write.
124 //
125 // Returns:
126 // The stream S.
127 //
128 {
129  for (std::vector<Fit_Result_Vec>::size_type i=0; i < res._v.size(); i++)
130  s << "List " << i << "\n" << res._v[i];
131  return s;
132 }
133 
134 
135 } // namespace hitfit
int i
Definition: DBlmapReader.cc:9
Hold the result of one kinematic fit.
Definition: Fit_Result.h:53
Hold the result of one kinematic fit.
CLHEP::HepVector Column_Vector
Definition: matutil.h:66
bool ev
void push(double chisq, const Lepjets_Event &ev, const Column_Vector &pullx, const Column_Vector &pully, double umwhad, double utmass, double mt, double sigmt, const std::vector< int > &list_flags)
Add a new fit result.
Definition: Fit_Results.cc:67
uint16_t size_type
Represent a simple event consisting of lepton(s) and jet(s). An instance of this class holds a list o...
Definition: Lepjets_Event.h:66
std::vector< Fit_Result_Vec > _v
Definition: Fit_Results.h:124
Holds pointers to a set of Fit_Result objects, resulting from different jet permutation with some con...
Hold set(s) of results from more than one kinematic fits. Each set correspond to some subset of jet p...
const Fit_Result_Vec & operator[](std::vector< Fit_Result_Vec >::size_type i) const
Access the i-th list.
Definition: Fit_Results.cc:60
std::ostream & operator<<(std::ostream &s, const Constraint_Intermed &ci)
Output stream operator, print the content of this Constraint_Intermed to an output stream...
Fit_Results(int max_len, int n_lists)
Constructor, make n_list of lists, each of maximum length max_len.
Definition: Fit_Results.cc:47
Holds set(s) of results from more than one kinematic fits.
Definition: Fit_Results.h:59