Main Page
Namespaces
Classes
Package Documentation
TopQuarkAnalysis
TopHitFit
interface
Chisq_Constrainer.h
Go to the documentation of this file.
1
//
2
//
3
// File: hitfit/Chisq_Constrainer.h
4
// Purpose: Minimize a chisq subject to a set of constraints.
5
// Based on the SQUAW algorithm.
6
// Created: Jul, 2000, sss, based on run 1 mass analysis code.
7
//
8
// For full details on the algorithm, see
9
//
10
// @phdthesis{sssthesis,
11
// author = "Scott Snyder",
12
// school = "State University of New York at Stony Brook",
13
// month = may,
14
// year = "1995 (unpublished)"}
15
// @comment{ note = "available from {\tt http://www-d0.fnal.gov/publications\_talks/thesis/ snyder/thesis-ps.html}"
16
// }
17
//
18
// CMSSW File : interface/Chisq_Constrainer.h
19
// Original Author : Scott Stuart Snyder <snyder@bnl.gov> for D0
20
// Imported to CMSSW by Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
21
66
#ifndef HITFIT_CHISQ_CONSTRAINER_H
67
#define HITFIT_CHISQ_CONSTRAINER_H
68
69
#include "
TopQuarkAnalysis/TopHitFit/interface/Base_Constrainer.h
"
70
#include "
TopQuarkAnalysis/TopHitFit/interface/matutil.h
"
71
#include <iosfwd>
72
73
74
namespace
hitfit
{
75
76
77
class
Defaults;
78
79
84
class
Chisq_Constrainer_Args
85
//
86
// Purpose: Hold on to parameters for the Chisq_Constrainer class.
87
//
88
// Parameters controlling the operation of the fitter:
89
// bool printfit - If true, print a trace of the fit to cout.
90
// bool use_G - If true, check the chisq formula by computing
91
// chisq directly from G. This requires that G_i
92
// be invertable.
93
//
94
// Parameters affecting the fit:
95
// float constraint_sum_eps - Convergence threshold for sum of constraints.
96
// float chisq_diff_eps - onvergence threshold for change in chisq.
97
// int maxit - Maximum number of iterations permitted.
98
// int max_cut - Maximum number of cut steps permitted.
99
// float cutsize - Fraction by which to cut steps.
100
// float min_tot_cutsize - Smallest fractional cut step permitted.
101
//
102
// Parameters affecting testing modes:
103
// float chisq_test_eps - When use_G is true, the maximum relative
104
// difference permitted between the two chisq
105
// calculations.
106
//
107
{
108
public
:
109
// Constructor. Initialize from a Defaults object.
110
128
Chisq_Constrainer_Args
(
const
Defaults
& defs);
129
130
// Retrieve parameter values.
131
135
bool
printfit
()
const
;
136
140
bool
use_G
()
const
;
141
145
double
constraint_sum_eps
()
const
;
146
150
double
chisq_diff_eps
()
const
;
151
155
unsigned
maxit
()
const
;
156
160
unsigned
max_cut
()
const
;
161
165
double
cutsize
()
const
;
166
170
double
min_tot_cutsize
()
const
;
171
175
double
chisq_test_eps
()
const
;
176
177
// Arguments for subobjects.
178
182
const
Base_Constrainer_Args
&
base_constrainer_args
()
const
;
183
184
185
private
:
186
// Hold on to parameter values.
187
191
bool
_printfit
;
192
198
bool
_use_G
;
199
203
double
_constraint_sum_eps
;
204
208
double
_chisq_diff_eps
;
209
213
int
_maxit
;
214
218
int
_max_cut
;
219
223
double
_cutsize
;
224
228
double
_min_tot_cutsize
;
229
234
double
_chisq_test_eps
;
235
236
240
const
Base_Constrainer_Args
_base_constrainer_args
;
241
};
242
243
244
//*************************************************************************
245
246
252
class
Chisq_Constrainer
253
//
254
// Purpose: Minimize a chisq subject to a set of constraints.
255
// Based on the SQUAW algorithm.
256
//
257
:
public
Base_Constrainer
258
{
259
public
:
260
// Constructor, destructor.
261
// ARGS holds the parameter settings for this instance.
262
269
Chisq_Constrainer
(
const
Chisq_Constrainer_Args
&
args
);
270
274
virtual
~Chisq_Constrainer
() {}
275
276
// Do the fit.
277
// Call the number of well-measured variables Nw, the number of
278
// poorly-measured variables Np, and the number of constraints Nc.
279
// Inputs:
280
// CONSTRAINT_CALCULATOR is the object that will be used to evaluate
281
// the constraints.
282
// XM(Nw) and YM(Np) are the measured values of the well- and
283
// poorly-measured variables, respectively.
284
// X(Nw) and Y(Np) are the starting values for the fit.
285
// G_I(Nw,Nw) is the error matrix for the well-measured variables.
286
// Y(Np,Np) is the inverse error matrix for the poorly-measured variables.
287
//
288
// Outputs:
289
// X(Nw) and Y(Np) is the point at the minimum.
290
// PULLX(Nw) and PULLY(Np) are the pull quantities.
291
// Q(Nw,Nw), R(Np,Np), and S(Nw,Np) are the final error matrices
292
// between all the variables.
293
//
294
// The return value is the final chisq. Returns a value < 0 if the
295
// fit failed to converge.
296
349
virtual
double
fit
(
Constraint_Calculator
& constraint_calculator,
350
const
Column_Vector
& xm,
351
Column_Vector
&
x
,
352
const
Column_Vector
& ym,
353
Column_Vector
& y,
354
const
Matrix
& G_i,
355
const
Diagonal_Matrix
&
Y
,
356
Column_Vector
& pullx,
357
Column_Vector
& pully,
358
Matrix
&
Q
,
359
Matrix
&
R
,
360
Matrix
&
S
);
361
362
// Print out any internal state to S.
368
virtual
std::ostream&
print
(std::ostream&
s
)
const
;
369
370
371
private
:
372
// Parameter settings.
376
const
Chisq_Constrainer_Args
_args
;
377
};
378
379
}
// namespace hitfit
380
381
382
#endif // not HITFIT_CHISQ_CONSTRAINER_H
383
384
hitfit::Chisq_Constrainer_Args::base_constrainer_args
const Base_Constrainer_Args & base_constrainer_args() const
Definition:
Chisq_Constrainer.cc:173
hitfit::Chisq_Constrainer_Args::cutsize
double cutsize() const
Definition:
Chisq_Constrainer.cc:142
reco::print
std::string print(const Track &, edm::Verbosity=edm::Concise)
Track print utility.
Definition:
print.cc:10
hitfit::Chisq_Constrainer_Args::min_tot_cutsize
double min_tot_cutsize() const
Definition:
Chisq_Constrainer.cc:152
alignCSCRings.s
s
Definition:
alignCSCRings.py:91
hitfit::Column_Vector
CLHEP::HepVector Column_Vector
Definition:
matutil.h:66
hitfit::Chisq_Constrainer_Args::_chisq_test_eps
double _chisq_test_eps
Definition:
Chisq_Constrainer.h:234
hitfit::Chisq_Constrainer_Args::use_G
bool use_G() const
Definition:
Chisq_Constrainer.cc:92
matutil.h
Define matrix types for the HitFit package, and supply a few additional operations.
hitfit::Constraint_Calculator
Abstract base class for evaluating constraints. Users derive from this class and implement the eval()...
Definition:
Base_Constrainer.h:139
hitfit::Chisq_Constrainer_Args::_min_tot_cutsize
double _min_tot_cutsize
Definition:
Chisq_Constrainer.h:228
hitfit::Matrix
CLHEP::HepMatrix Matrix
Definition:
matutil.h:65
hitfit::Chisq_Constrainer_Args::constraint_sum_eps
double constraint_sum_eps() const
Definition:
Chisq_Constrainer.cc:102
x
T x() const
Cartesian x coordinate.
Definition:
Basic3DVectorLD.h:127
hitfit::Base_Constrainer
Base class for constrained fitter.
Definition:
Base_Constrainer.h:228
hitfit::Chisq_Constrainer_Args::_max_cut
int _max_cut
Definition:
Chisq_Constrainer.h:218
hitfit::Chisq_Constrainer_Args::Chisq_Constrainer_Args
Chisq_Constrainer_Args(const Defaults &defs)
Constructor, creates an instance of Chisq_Constrainer_Args from a Defaults object.
Definition:
Chisq_Constrainer.cc:61
dttmaxenums::R
Definition:
DTTMax.h:28
hitfit::Chisq_Constrainer_Args::chisq_diff_eps
double chisq_diff_eps() const
Definition:
Chisq_Constrainer.cc:112
hitfit::Chisq_Constrainer_Args::printfit
bool printfit() const
Definition:
Chisq_Constrainer.cc:82
hitfit::Chisq_Constrainer_Args::_base_constrainer_args
const Base_Constrainer_Args _base_constrainer_args
Definition:
Chisq_Constrainer.h:240
hitfit::Chisq_Constrainer
Minimize a subject to a set of constraints. Based on the SQUAW algorithm.
Definition:
Chisq_Constrainer.h:252
hitfit::Chisq_Constrainer_Args
Hold on to parameters for the Chisq_Constrainer class.
Definition:
Chisq_Constrainer.h:84
Base_Constrainer.h
Abstract base classes for the fitter classes.
hitfit::Chisq_Constrainer_Args::chisq_test_eps
double chisq_test_eps() const
Definition:
Chisq_Constrainer.cc:162
hitfit
Definition:
Base_Constrainer.h:45
hitfit::Chisq_Constrainer::~Chisq_Constrainer
virtual ~Chisq_Constrainer()
Definition:
Chisq_Constrainer.h:274
hitfit::Base_Constrainer_Args
Hold on to parameters for the Base_Constrainer class.
Definition:
Base_Constrainer.h:58
hitfit::Chisq_Constrainer_Args::maxit
unsigned maxit() const
Definition:
Chisq_Constrainer.cc:122
createfilelist.args
args
Definition:
createfilelist.py:13
hitfit::Chisq_Constrainer_Args::_use_G
bool _use_G
Definition:
Chisq_Constrainer.h:198
hitfit::Diagonal_Matrix
CLHEP::HepDiagMatrix Diagonal_Matrix
Definition:
matutil.h:67
S
double S(const TLorentzVector &, const TLorentzVector &)
Definition:
Particle.cc:99
hitfit::Chisq_Constrainer_Args::_printfit
bool _printfit
Definition:
Chisq_Constrainer.h:191
hitfit::Defaults
Define an interface for getting parameter settings.
Definition:
Defaults.h:61
hitfit::Chisq_Constrainer_Args::_cutsize
double _cutsize
Definition:
Chisq_Constrainer.h:223
DOFs::Y
Definition:
AlignPCLThresholdsWriter.cc:39
hitfit::Chisq_Constrainer::_args
const Chisq_Constrainer_Args _args
Definition:
Chisq_Constrainer.h:376
class-composition.Q
Q
Definition:
class-composition.py:81
hitfit::Chisq_Constrainer_Args::_constraint_sum_eps
double _constraint_sum_eps
Definition:
Chisq_Constrainer.h:203
trackingPlots.fit
fit
Definition:
trackingPlots.py:1135
hitfit::Chisq_Constrainer_Args::_chisq_diff_eps
double _chisq_diff_eps
Definition:
Chisq_Constrainer.h:208
hitfit::Chisq_Constrainer_Args::max_cut
unsigned max_cut() const
Definition:
Chisq_Constrainer.cc:132
hitfit::Chisq_Constrainer_Args::_maxit
int _maxit
Definition:
Chisq_Constrainer.h:213
Generated for CMSSW Reference Manual by
1.8.11