CMS 3D CMS Logo

Fit_Result.cc
Go to the documentation of this file.
1 //
2 //
3 // File: src/Fit_Result.cc
4 // Purpose: Hold the result from a single kinematic fit.
5 // Created: Jul, 2000, sss, based on run 1 mass analysis code.
6 //
7 // CMSSW File : src/Fit_Result.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 
35 #include <ostream>
36 #include <cmath>
37 
38 
39 using std::ostream;
40 using std::abs;
41 
42 
43 namespace hitfit {
44 
45 
46 Fit_Result::Fit_Result (double chisq,
47  const Lepjets_Event& ev,
48  const Column_Vector& pullx,
49  const Column_Vector& pully,
50  double umwhad,
51  double utmass,
52  double mt,
53  double sigmt)
54 //
55 // Purpose: Constructor.
56 //
57 // Inputs:
58 // chisq - The fit chisq.
59 // ev - The event kinematics.
60 // pullx - The pull quantities for the well-measured variables.
61 // pully - The pull quantities for the poorly-measured variables.
62 // umwhad - The hadronic W mass before the fit.
63 // utmass - The top quark mass before the fit.
64 // mt - The top quark mass after the fit.
65 // sigmt - The top quark mass uncertainty after the fit.
66 //
67  : _chisq (chisq),
68  _umwhad (umwhad),
69  _utmass (utmass),
70  _mt (mt),
71  _sigmt (sigmt),
72  _pullx (pullx),
73  _pully (pully),
74  _ev (ev)
75 {
76 }
77 
78 
79 double Fit_Result::chisq () const
80 //
81 // Purpose: Return the fit chisq.
82 //
83 // Returns:
84 // Return the fit chisq.
85 //
86 {
87  return _chisq;
88 }
89 
90 
91 double Fit_Result::umwhad () const
92 //
93 // Purpose: Return the hadronic W mass before the fit.
94 //
95 // Returns:
96 // The hadronic W mass before the fit.
97 //
98 {
99  return _umwhad;
100 }
101 
102 
103 double Fit_Result::utmass () const
104 //
105 // Purpose: Return the top mass before the fit.
106 //
107 // Returns:
108 // The top mass before the fit.
109 //
110 {
111  return _utmass;
112 }
113 
114 
115 double Fit_Result::mt () const
116 //
117 // Purpose: Return the top mass after the fit.
118 //
119 // Returns:
120 // The top mass after the fit.
121 //
122 {
123  return _mt;
124 }
125 
126 
127 double Fit_Result::sigmt () const
128 //
129 // Purpose: Return the top mass uncertainty after the fit.
130 //
131 // Returns:
132 // The top mass uncertainty after the fit.
133 //
134 {
135  return _sigmt;
136 }
137 
138 
140 //
141 // Purpose: Return the pull quantities for the well-measured variables.
142 //
143 // Returns:
144 // The pull quantities for the well-measured variables.
145 //
146 {
147  return _pullx;
148 }
149 
150 
152 //
153 // Purpose: Return the pull quantities for the poorly-measured variables.
154 //
155 // Returns:
156 // The pull quantities for the poorly-measured variables.
157 //
158 {
159  return _pully;
160 }
161 
162 
163 std::vector<int> Fit_Result::jet_types ()
164 //
165 // Purpose: Returns the jet types of the fit
166 //
167 {
168  return _ev.jet_types();
169 }
170 
172 //
173 // Purpose: Return the event kinematic quantities after the fit.
174 //
175 // Returns:
176 // The event kinematic quantities after the fit.
177 //
178 {
179  return _ev;
180 }
181 
182 
195 bool operator< (const Fit_Result& a, const Fit_Result& b)
196 //
197 // Purpose: Compare two objects by chisq.
198 // The use of abs() is to make sure that the -1000 flags
199 // go to the end.
200 //
201 // Inputs:
202 // a - The first object to compare.
203 // b - The second object to compare.
204 //
205 // Returns:
206 // The result of the comparison.
207 //
208 {
209  return abs (a._chisq) < abs (b._chisq);
210 }
211 
212 
221 std::ostream& operator<< (std::ostream& s, const Fit_Result& res)
222 //
223 // Purpose: Print the object to S.
224 //
225 // Inputs:
226 // s - The stream to which to write.
227 // res - The object to write.
228 //
229 // Returns:
230 // The stream S.
231 //
232 {
233  s << "chisq: " << res._chisq << "\n";
234  s << "umwhad: " << res._umwhad << "\n";
235  s << "utmass: " << res._utmass << "\n";
236  s << "mt: " << res._mt << "\n";
237  s << "sigmt: " << res._sigmt << "\n";
238  s << res._ev;
239  s << "pullx: " << res._pullx.T();
240  s << "pully: " << res._pully.T();
241  return s;
242 }
243 
244 
245 
246 } // namespace hitfit
Hold the result of one kinematic fit.
Definition: Fit_Result.h:52
Column_Vector _pully
Definition: Fit_Result.h:171
const Column_Vector & pullx() const
Return the pull quantities for the well-measured variables.
Definition: Fit_Result.cc:139
Fit_Result(double chisq, const Lepjets_Event &ev, const Column_Vector &pullx, const Column_Vector &pully, double umwhad, double utmass, double mt, double sigmt)
Constructor, provide the results of the fit.
Definition: Fit_Result.cc:46
const Lepjets_Event & ev() const
Return the event kinematics quantities after the fit.
Definition: Fit_Result.cc:171
double sigmt() const
Return the top quark mass uncertainty after the fit.
Definition: Fit_Result.cc:127
Hold the result of one kinematic fit.
CLHEP::HepVector Column_Vector
Definition: matutil.h:66
bool ev
Definition: Electron.h:6
double umwhad() const
Return the hadronic boson mass before the fit.
Definition: Fit_Result.cc:91
std::vector< int > jet_types()
Return the list of jet types for this event.
Definition: Fit_Result.cc:163
double utmass() const
Return the top quark mass before the fit.
Definition: Fit_Result.cc:103
friend std::ostream & operator<<(std::ostream &s, const Fit_Result &res)
Output stream operator, print the content of this Fit_Result to an output stream. ...
Definition: Fit_Result.cc:221
const Column_Vector & pully() const
Return the pull quantities for the poorly-measured variables.
Definition: Fit_Result.cc:151
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< int > jet_types() const
Return the jet types in the event.
Lepjets_Event _ev
Definition: Fit_Result.h:176
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Column_Vector _pullx
Definition: Fit_Result.h:166
friend bool operator<(const Fit_Result &a, const Fit_Result &b)
Sort fit results based on their .
Definition: Fit_Result.cc:195
double b
Definition: hdecay.h:120
double mt() const
Return the top quark mass after the fit.
Definition: Fit_Result.cc:115
double a
Definition: hdecay.h:121
double chisq() const
Return the of the fit.
Definition: Fit_Result.cc:79