Main Page
Namespaces
Classes
Package Documentation
TopQuarkAnalysis
TopHitFit
interface
Base_Constrainer.h
Go to the documentation of this file.
1
//
2
//
3
// File: hitfit/Base_Constrainer.h
4
// Purpose: Abstract base for the chisq fitter classes.
5
// This allows for different algorithms to be used.
6
// Created: Jul, 2000, sss, based on run 1 mass analysis code.
7
//
8
// CMSSW File : interface/Base_Constrainer.h
9
// Original Author : Scott Stuart Snyder <snyder@bnl.gov> for D0
10
// Imported to CMSSW by Haryo Sumowidagdo <Suharyo.Sumowidagdo@cern.ch>
11
37
#ifndef HITFIT_BASE_CONSTRAINER_H
38
#define HITFIT_BASE_CONSTRAINER_H
39
40
41
#include "
TopQuarkAnalysis/TopHitFit/interface/matutil.h
"
42
#include <iosfwd>
43
44
45
namespace
hitfit
{
46
47
class
Defaults
;
48
49
50
//*************************************************************************
51
52
58
class
Base_Constrainer_Args
59
//
60
// Purpose: Hold on to parameters for the Base_Constrainer class.
61
//
62
// Parameters:
63
// bool test_gradient - If true, check the constraint gradient calculations
64
// by also doing them numerically.
65
// float test_step - When test_gradient is true, the step size to use
66
// for numeric differentiation.
67
// float test_eps - When test_gradient is true, the maximum relative
68
// difference permitted between returned and
69
// numerically calculated gradients.
70
//
71
{
72
public
:
73
// Constructor. Initialize from a Defaults object.
74
84
Base_Constrainer_Args
(
const
Defaults
& defs);
85
86
// Retrieve parameter values.
90
bool
test_gradient
()
const
;
91
95
double
test_step
()
const
;
96
100
double
test_eps
()
const
;
101
102
103
private
:
104
105
// Hold on to parameter values.
106
111
bool
_test_gradient
;
112
117
double
_test_step
;
118
123
double
_test_eps
;
124
125
};
126
127
128
//*************************************************************************
129
130
139
class
Constraint_Calculator
140
//
141
// Purpose: Abstract base class for evaluating constraints.
142
// Derive from this and implement the eval() method.
143
//
144
{
145
public
:
146
// Constructor, destructor. Pass in the number of constraints.
147
152
Constraint_Calculator
(
int
nconstraints);
153
157
virtual
~Constraint_Calculator
() {}
158
159
// Get back the number of constraints.
163
int
nconstraints ()
const
;
164
165
// Evaluate constraints at the point described by X and Y (well-measured
166
// and poorly-measured variables, respectively). The results should
167
// be stored in F. BX and BY should be set to the gradients of F with
168
// respect to X and Y, respectively.
169
//
170
// Return true if the point X, Y is accepted.
171
// Return false if it is rejected (i.e., in an unphysical region).
172
// The constraints need not be evaluated in that case.
173
204
virtual
bool
eval (
const
Column_Vector
&
x
,
205
const
Column_Vector
& y,
206
Row_Vector
&
F
,
207
Matrix
& Bx,
208
Matrix
& By) = 0;
209
210
211
private
:
212
// The number of constraint functions.
216
int
_nconstraints
;
217
218
};
219
220
221
//*************************************************************************
222
223
228
class
Base_Constrainer
229
//
230
// Purpose: Base class for chisq constrained fitter.
231
//
232
{
233
public
:
234
// Constructor, destructor.
235
// ARGS holds the parameter settings for this instance.
236
241
Base_Constrainer
(
const
Base_Constrainer_Args
&
args
);
242
246
virtual
~Base_Constrainer
() {}
247
248
// Do the fit.
249
// Call the number of well-measured variables Nw, the number of
250
// poorly-measured variables Np, and the number of constraints Nc.
251
// Inputs:
252
// CONSTRAINT_CALCULATOR is the object that will be used to evaluate
253
// the constraints.
254
// XM(Nw) and YM(Np) are the measured values of the well- and
255
// poorly-measured variables, respectively.
256
// X(Nw) and Y(Np) are the starting values for the fit.
257
// G_I(Nw,Nw) is the error matrix for the well-measured variables.
258
// Y(Np,Np) is the inverse error matrix for the poorly-measured variables.
259
//
260
// Outputs:
261
// X(Nw) and Y(Np) is the point at the minimum.
262
// PULLX(Nw) and PULLY(Np) are the pull quantities.
263
// Q(Nw,Nw), R(Np,Np), and S(Nw,Np) are the final error matrices
264
// between all the variables.
265
//
266
// The return value is the final chisq. Returns a value < 0 if the
267
// fit failed to converge.
268
320
virtual
double
fit
(
Constraint_Calculator
& constraint_calculator,
321
const
Column_Vector
& xm,
322
Column_Vector
&
x
,
323
const
Column_Vector
& ym,
324
Column_Vector
& y,
325
const
Matrix
& G_i,
326
const
Diagonal_Matrix
& Y,
327
Column_Vector
& pullx,
328
Column_Vector
& pully,
329
Matrix
&
Q
,
330
Matrix
&
R
,
331
Matrix
&
S
) = 0;
332
333
// Print out any internal state to S.
343
virtual
std::ostream&
print
(std::ostream&
s
)
const
;
344
345
// Print out internal state to S.
346
friend
std::ostream&
operator<<
(std::ostream& s,
const
Base_Constrainer
&
f
);
347
348
349
private
:
350
// Parameter settings.
351
355
const
Base_Constrainer_Args
_args
;
356
357
358
protected
:
359
// Helper function to evaluate the constraints.
360
// This takes care of checking what the user function returns against
361
// numerical derivatives, if that was requested.
362
402
bool
call_constraint_fcn (
Constraint_Calculator
& constraint_calculator,
403
const
Column_Vector
& x,
404
const
Column_Vector
& y,
405
Row_Vector
&
F
,
406
Matrix
& Bx,
407
Matrix
& By)
const
;
408
};
409
410
411
}
// namespace hitfit
412
413
414
#endif // not HITFIT_BASE_CONSTRAINER_H
415
hitfit::Base_Constrainer_Args::test_step
double test_step() const
Definition:
Base_Constrainer.cc:124
hitfit::Base_Constrainer_Args::_test_eps
double _test_eps
Definition:
Base_Constrainer.h:123
reco::print
std::string print(const Track &, edm::Verbosity=edm::Concise)
Track print utility.
Definition:
print.cc:10
alignCSCRings.s
s
Definition:
alignCSCRings.py:91
hitfit::Column_Vector
CLHEP::HepVector Column_Vector
Definition:
matutil.h:66
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::Matrix
CLHEP::HepMatrix Matrix
Definition:
matutil.h:65
hitfit::Constraint_Calculator::_nconstraints
int _nconstraints
Definition:
Base_Constrainer.h:216
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::Base_Constrainer::~Base_Constrainer
virtual ~Base_Constrainer()
Definition:
Base_Constrainer.h:246
dttmaxenums::R
Definition:
DTTMax.h:28
f
double f[11][100]
Definition:
MuScleFitUtils.cc:78
hitfit::Constraint_Calculator::~Constraint_Calculator
virtual ~Constraint_Calculator()
Definition:
Base_Constrainer.h:157
hitfit
Definition:
Base_Constrainer.h:45
hitfit::operator<<
std::ostream & operator<<(std::ostream &s, const Constraint_Intermed &ci)
Output stream operator, print the content of this Constraint_Intermed to an output stream...
Definition:
Constraint_Intermed.cc:303
hitfit::Base_Constrainer_Args::Base_Constrainer_Args
Base_Constrainer_Args(const Defaults &defs)
Definition:
Base_Constrainer.cc:100
hitfit::Base_Constrainer_Args
Hold on to parameters for the Base_Constrainer class.
Definition:
Base_Constrainer.h:58
createfilelist.args
args
Definition:
createfilelist.py:13
hitfit::Diagonal_Matrix
CLHEP::HepDiagMatrix Diagonal_Matrix
Definition:
matutil.h:67
S
double S(const TLorentzVector &, const TLorentzVector &)
Definition:
Particle.cc:99
hitfit::Base_Constrainer::_args
const Base_Constrainer_Args _args
Definition:
Base_Constrainer.h:355
hitfit::Base_Constrainer_Args::test_eps
double test_eps() const
Definition:
Base_Constrainer.cc:134
hitfit::Base_Constrainer_Args::_test_gradient
bool _test_gradient
Definition:
Base_Constrainer.h:111
hitfit::Defaults
Define an interface for getting parameter settings.
Definition:
Defaults.h:61
class-composition.Q
Q
Definition:
class-composition.py:81
F
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition:
blowfish.cc:281
trackingPlots.fit
fit
Definition:
trackingPlots.py:1130
hitfit::Base_Constrainer_Args::test_gradient
bool test_gradient() const
Definition:
Base_Constrainer.cc:114
hitfit::Row_Vector
Row-vector class. CLHEP doesn't have a row-vector class, so HitFit uses its own. This is only a simpl...
Definition:
matutil.h:83
hitfit::Base_Constrainer_Args::_test_step
double _test_step
Definition:
Base_Constrainer.h:117
Generated for CMSSW Reference Manual by
1.8.11