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 // $Id: Fit_Results.cc,v 1.1 2011/05/26 09:47:00 mseidel Exp $
3 //
4 // File: src/Fit_Results.cc
5 // Purpose: Hold the results from kinematic fitting.
6 // Created: Jul, 2000, sss, based on run 1 mass analysis code.
7 //
8 // CMSSW File : src/Fit_Results.cc
9 // Original Author : Scott Stuart Snyder <snyder@bnl.gov> for D0
10 // Imported to CMSSW by Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
11 //
12 
13 
16 #include <ostream>
17 #include <cassert>
18 
19 
42 using std::ostream;
43 
44 
45 namespace hitfit {
46 
47 
49 //
50 // Purpose: Constructor.
51 //
52 // Inputs:
53 // max_len - The maximum length of each list.
54 // n_lists - The number of lists.
55 //
56  : _v (n_lists, Fit_Result_Vec (max_len))
57 {
58 }
59 
60 
62 {
63  assert (i < _v.size());
64  return _v[i];
65 }
66 
67 
68 void Fit_Results::push (double chisq,
69  const Lepjets_Event& ev,
70  const Column_Vector& pullx,
71  const Column_Vector& pully,
72  double umwhad,
73  double utmass,
74  double mt,
75  double sigmt,
76  const std::vector<int>& list_flags)
77 //
78 // Purpose: Add a new fit result.
79 //
80 // Inputs:
81 // chisq - The fit chisq.
82 // ev - The event kinematics.
83 // pullx - The pull quantities for the well-measured variables.
84 // pully - The pull quantities for the poorly-measured variables.
85 // umwhad - The hadronic W mass before the fit.
86 // utmass - The top quark mass before the fit.
87 // mt - The top quark mass after the fit.
88 // sigmt - The top quark mass uncertainty after the fit.
89 // list_flags - Vector indicating to which lists the result should
90 // be added.
91 // This vector should have a length of N_SIZE.
92 // Each element should be either 0 or 1, depending
93 // on whether or not the result should be added
94 // to the corresponding list.
95 //
96 {
97  assert (list_flags.size() == _v.size());
98 
99  Fit_Result* res = new Fit_Result (chisq, ev, pullx, pully,
100  umwhad, utmass, mt, sigmt);
101  res->incref ();
102  for (std::vector<Fit_Result_Vec>::size_type i=0; i < _v.size(); i++) {
103  if (list_flags[i])
104  _v[i].push (res);
105  }
106  res->decref ();
107 }
108 
109 
118 std::ostream& operator<< (std::ostream& s, const Fit_Results& res)
119 //
120 // Purpose: Print the object to S.
121 //
122 // Inputs:
123 // s - The stream to which to write.
124 // res - The object to write.
125 //
126 // Returns:
127 // The stream S.
128 //
129 {
130  for (std::vector<Fit_Result_Vec>::size_type i=0; i < res._v.size(); i++)
131  s << "List " << i << "\n" << res._v[i];
132  return s;
133 }
134 
135 
136 } // namespace hitfit
int i
Definition: DBlmapReader.cc:9
Hold the result of one kinematic fit.
Definition: Fit_Result.h:54
Hold the result of one kinematic fit.
CLHEP::HepVector Column_Vector
Definition: matutil.h:67
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:68
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:67
std::vector< Fit_Result_Vec > _v
Definition: Fit_Results.h:125
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:61
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:48
Holds set(s) of results from more than one kinematic fits.
Definition: Fit_Results.h:60