CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 
14 #include <ostream>
15 #include <cassert>
16 
39 using std::ostream;
40 
41 namespace hitfit {
42 
44  //
45  // Purpose: Constructor.
46  //
47  // Inputs:
48  // max_len - The maximum length of each list.
49  // n_lists - The number of lists.
50  //
51  : _v(n_lists, Fit_Result_Vec(max_len)) {}
52 
54  assert(i < _v.size());
55  return _v[i];
56  }
57 
58  void Fit_Results::push(double chisq,
59  const Lepjets_Event& ev,
60  const Column_Vector& pullx,
61  const Column_Vector& pully,
62  double umwhad,
63  double utmass,
64  double mt,
65  double sigmt,
66  const std::vector<int>& list_flags)
67  //
68  // Purpose: Add a new fit result.
69  //
70  // Inputs:
71  // chisq - The fit chisq.
72  // ev - The event kinematics.
73  // pullx - The pull quantities for the well-measured variables.
74  // pully - The pull quantities for the poorly-measured variables.
75  // umwhad - The hadronic W mass before the fit.
76  // utmass - The top quark mass before the fit.
77  // mt - The top quark mass after the fit.
78  // sigmt - The top quark mass uncertainty after the fit.
79  // list_flags - Vector indicating to which lists the result should
80  // be added.
81  // This vector should have a length of N_SIZE.
82  // Each element should be either 0 or 1, depending
83  // on whether or not the result should be added
84  // to the corresponding list.
85  //
86  {
87  assert(list_flags.size() == _v.size());
88 
89  auto res = std::make_shared<Fit_Result>(chisq, ev, pullx, pully, umwhad, utmass, mt, sigmt);
90  for (std::vector<Fit_Result_Vec>::size_type i = 0; i < _v.size(); i++) {
91  if (list_flags[i])
92  _v[i].push(res);
93  }
94  }
95 
104  std::ostream& operator<<(std::ostream& s, const Fit_Results& res)
105  //
106  // Purpose: Print the object to S.
107  //
108  // Inputs:
109  // s - The stream to which to write.
110  // res - The object to write.
111  //
112  // Returns:
113  // The stream S.
114  //
115  {
116  for (std::vector<Fit_Result_Vec>::size_type i = 0; i < res._v.size(); i++)
117  s << "List " << i << "\n" << res._v[i];
118  return s;
119  }
120 
121 } // namespace hitfit
Hold the result of one kinematic fit.
CLHEP::HepVector Column_Vector
Definition: matutil.h:63
bool ev
assert(be >=bs)
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:58
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:62
std::vector< Fit_Result_Vec > _v
Definition: Fit_Results.h:119
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:53
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:43
Holds set(s) of results from more than one kinematic fits.
Definition: Fit_Results.h:55