Logo ROOT  
Reference Guide
Minimizer.h
Go to the documentation of this file.
1// @(#)root/mathcore:$Id$
2// Author: L. Moneta Fri Sep 22 15:06:47 2006
3
4/**********************************************************************
5 * *
6 * Copyright (c) 2006 LCG ROOT Math Team, CERN/PH-SFT *
7 * *
8 * *
9 **********************************************************************/
10
11// Header file for class Minimizer
12
13#ifndef ROOT_Math_Minimizer
14#define ROOT_Math_Minimizer
15
16#include "Math/IFunction.h"
17
19
20#include "Math/Util.h"
21
22#include "Math/Error.h"
23
24
25#include <string>
26#include <limits>
27#include <cmath>
28
29
30namespace ROOT {
31
32 namespace Fit {
33 class ParameterSettings;
34 }
35
36
37 namespace Math {
38
39/**
40 @defgroup MultiMin Multi-dimensional Minimization
41 @ingroup NumAlgo
42
43 Classes implementing algorithms for multi-dimensional minimization
44 */
45
46
47
48//_______________________________________________________________________________
49/**
50 Abstract Minimizer class, defining the interface for the various minimizer
51 (like Minuit2, Minuit, GSL, etc..)
52 Plug-in's exist in ROOT to be able to instantiate the derived classes like
53 ROOT::Math::GSLMinimizer or ROOT::Math::Minuit2Minimizer via the
54 plug-in manager.
55
56 Provides interface for setting the function to be minimized.
57 The function must implemente the multi-dimensional generic interface
58 ROOT::Math::IBaseFunctionMultiDim.
59 If the function provides gradient calculation
60 (implements the ROOT::Math::IGradientFunctionMultiDim interface) this will be
61 used by the Minimizer.
62
63 It Defines also interface for setting the initial values for the function variables (which are the parameters in
64 of the model function in case of solving for fitting) and especifying their limits.
65
66 It defines the interface to set and retrieve basic minimization parameters
67 (for specific Minimizer parameters one must use the derived classes).
68
69 Then it defines the interface to retrieve the result of minimization ( minimum X values, function value,
70 gradient, error on the mimnimum, etc...)
71
72 @ingroup MultiMin
73*/
74
75class Minimizer {
76
77public:
78
79 /**
80 Default constructor
81 */
83 fValidError(false),
84 fStatus(-1)
85 {}
86
87 /**
88 Destructor (no operations)
89 */
90 virtual ~Minimizer () {}
91
92
93
94
95private:
96 // usually copying is non trivial, so we make this unaccessible
97
98 /**
99 Copy constructor
100 */
102
103 /**
104 Assignment operator
105 */
107 if (this == &rhs) return *this; // time saving self-test
108 return *this;
109 }
110
111public:
112
113 /// reset for consecutive minimizations - implement if needed
114 virtual void Clear() {}
115
116 /// set the function to minimize
117 virtual void SetFunction(const ROOT::Math::IMultiGenFunction & func) = 0;
118
119 /// set a function to minimize using gradient
121 {
122 SetFunction(static_cast<const ::ROOT::Math::IMultiGenFunction &> (func));
123 }
124
125
126 /// add variables . Return number of variables successfully added
127 template<class VariableIterator>
128 int SetVariables(const VariableIterator & begin, const VariableIterator & end) {
129 unsigned int ivar = 0;
130 for ( VariableIterator vitr = begin; vitr != end; ++vitr) {
131 bool iret = false;
132 if (vitr->IsFixed() )
133 iret = SetFixedVariable(ivar, vitr->Name(), vitr->Value() );
134 else if (vitr->IsDoubleBound() )
135 iret = SetLimitedVariable(ivar, vitr->Name(), vitr->Value(), vitr->StepSize(), vitr->LowerLimit(), vitr->UpperLimit() );
136 else if (vitr->HasLowerLimit() )
137 iret = SetLowerLimitedVariable(ivar, vitr->Name(), vitr->Value(), vitr->StepSize(), vitr->LowerLimit() );
138 else if (vitr->HasUpperLimit() )
139 iret = SetUpperLimitedVariable(ivar, vitr->Name(), vitr->Value(), vitr->StepSize(), vitr->UpperLimit() );
140 else
141 iret = SetVariable( ivar, vitr->Name(), vitr->Value(), vitr->StepSize() );
142
143 if (iret) ivar++;
144
145 // an error message should be eventually be reported in the virtual single SetVariable methods
146 }
147 return ivar;
148 }
149 /// set a new free variable
150 virtual bool SetVariable(unsigned int ivar, const std::string & name, double val, double step) = 0;
151 /// set a new lower limit variable (override if minimizer supports them )
152 virtual bool SetLowerLimitedVariable(unsigned int ivar , const std::string & name , double val , double step , double lower ) {
153 return SetLimitedVariable(ivar, name, val, step, lower, std::numeric_limits<double>::infinity() );
154 }
155 /// set a new upper limit variable (override if minimizer supports them )
156 virtual bool SetUpperLimitedVariable(unsigned int ivar , const std::string & name , double val , double step , double upper ) {
157 return SetLimitedVariable(ivar, name, val, step, - std::numeric_limits<double>::infinity(), upper );
158 }
159 /// set a new upper/lower limited variable (override if minimizer supports them ) otherwise as default set an unlimited variable
160 virtual bool SetLimitedVariable(unsigned int ivar , const std::string & name , double val , double step ,
161 double lower , double upper ) {
162 MATH_WARN_MSG("Minimizer::SetLimitedVariable","Setting of limited variable not implemented - set as unlimited");
163 MATH_UNUSED(lower); MATH_UNUSED(upper);
164 return SetVariable(ivar, name, val, step);
165 }
166 /// set a new fixed variable (override if minimizer supports them )
167 virtual bool SetFixedVariable(unsigned int ivar , const std::string & name , double val ) {
168 MATH_ERROR_MSG("Minimizer::SetFixedVariable","Setting of fixed variable not implemented");
170 return false;
171 }
172 /// set the value of an already existing variable
173 virtual bool SetVariableValue(unsigned int ivar , double value) {
174 MATH_ERROR_MSG("Minimizer::SetVariableValue","Set of a variable value not implemented");
175 MATH_UNUSED(ivar); MATH_UNUSED(value);
176 return false;
177 }
178 /// set the values of all existing variables (array must be dimensioned to the size of the existing parameters)
179 virtual bool SetVariableValues(const double * x) {
180 bool ret = true;
181 unsigned int i = 0;
182 while ( i <= NDim() && ret) {
183 ret &= SetVariableValue(i,x[i] ); i++;
184 }
185 return ret;
186 }
187 /// set the step size of an already existing variable
188 virtual bool SetVariableStepSize(unsigned int ivar, double value ) {
189 MATH_ERROR_MSG("Minimizer::SetVariableStepSize","Setting an existing variable step size not implemented");
190 MATH_UNUSED(ivar); MATH_UNUSED(value);
191 return false;
192 }
193 /// set the lower-limit of an already existing variable
194 virtual bool SetVariableLowerLimit(unsigned int ivar, double lower) {
195 MATH_ERROR_MSG("Minimizer::SetVariableLowerLimit","Setting an existing variable limit not implemented");
196 MATH_UNUSED(ivar); MATH_UNUSED(lower);
197 return false;
198 }
199 /// set the upper-limit of an already existing variable
200 virtual bool SetVariableUpperLimit(unsigned int ivar, double upper) {
201 MATH_ERROR_MSG("Minimizer::SetVariableUpperLimit","Setting an existing variable limit not implemented");
202 MATH_UNUSED(ivar); MATH_UNUSED(upper);
203 return false;
204 }
205 /// set the limits of an already existing variable
206 virtual bool SetVariableLimits(unsigned int ivar, double lower, double upper) {
207 return SetVariableLowerLimit(ivar,lower) && SetVariableUpperLimit(ivar,upper);
208 }
209 /// fix an existing variable
210 virtual bool FixVariable(unsigned int ivar) {
211 MATH_ERROR_MSG("Minimizer::FixVariable","Fixing an existing variable not implemented");
212 MATH_UNUSED(ivar);
213 return false;
214 }
215 /// release an existing variable
216 virtual bool ReleaseVariable(unsigned int ivar) {
217 MATH_ERROR_MSG("Minimizer::ReleaseVariable","Releasing an existing variable not implemented");
218 MATH_UNUSED(ivar);
219 return false;
220 }
221 /// query if an existing variable is fixed (i.e. considered constant in the minimization)
222 /// note that by default all variables are not fixed
223 virtual bool IsFixedVariable(unsigned int ivar) const {
224 MATH_ERROR_MSG("Minimizer::IsFixedVariable","Quering an existing variable not implemented");
225 MATH_UNUSED(ivar);
226 return false;
227 }
228 /// get variable settings in a variable object (like ROOT::Fit::ParamsSettings)
229 virtual bool GetVariableSettings(unsigned int ivar, ROOT::Fit::ParameterSettings & pars) const {
230 MATH_ERROR_MSG("Minimizer::GetVariableSettings","Quering an existing variable not implemented");
231 MATH_UNUSED(ivar); MATH_UNUSED(pars);
232 return false;
233 }
234
235
236 /// set the initial range of an existing variable
237 virtual bool SetVariableInitialRange(unsigned int /* ivar */, double /* mininitial */, double /* maxinitial */) {
238 return false;
239 }
240
241 /// method to perform the minimization
242 virtual bool Minimize() = 0;
243
244 /// return minimum function value
245 virtual double MinValue() const = 0;
246
247 /// return pointer to X values at the minimum
248 virtual const double * X() const = 0;
249
250 /// return expected distance reached from the minimum (re-implement if minimizer provides it
251 virtual double Edm() const { return -1; }
252
253 /// return pointer to gradient values at the minimum
254 virtual const double * MinGradient() const { return NULL; }
255
256 /// number of function calls to reach the minimum
257 virtual unsigned int NCalls() const { return 0; }
258
259 /// number of iterations to reach the minimum
260 virtual unsigned int NIterations() const { return NCalls(); }
261
262 /// this is <= Function().NDim() which is the total
263 /// number of variables (free+ constrained ones)
264 virtual unsigned int NDim() const = 0;
265
266 /// number of free variables (real dimension of the problem)
267 /// this is <= Function().NDim() which is the total
268 /// (re-implement if minimizer supports bounded parameters)
269 virtual unsigned int NFree() const { return NDim(); }
270
271 /// minimizer provides error and error matrix
272 virtual bool ProvidesError() const { return false; }
273
274 /// return errors at the minimum
275 virtual const double * Errors() const { return NULL; }
276
277 /** return covariance matrices element for variables ivar,jvar
278 if the variable is fixed the return value is zero
279 The ordering of the variables is the same as in the parameter and errors vectors
280 */
281 virtual double CovMatrix(unsigned int ivar , unsigned int jvar ) const {
282 MATH_UNUSED(ivar); MATH_UNUSED(jvar);
283 return 0;
284 }
285
286 /**
287 Fill the passed array with the covariance matrix elements
288 if the variable is fixed or const the value is zero.
289 The array will be filled as cov[i *ndim + j]
290 The ordering of the variables is the same as in errors and parameter value.
291 This is different from the direct interface of Minuit2 or TMinuit where the
292 values were obtained only to variable parameters
293 */
294 virtual bool GetCovMatrix(double * covMat) const {
295 MATH_UNUSED(covMat);
296 return false;
297 }
298
299 /**
300 Fill the passed array with the Hessian matrix elements
301 The Hessian matrix is the matrix of the second derivatives
302 and is the inverse of the covariance matrix
303 If the variable is fixed or const the values for that variables are zero.
304 The array will be filled as h[i *ndim + j]
305 */
306 virtual bool GetHessianMatrix(double * hMat) const {
307 MATH_UNUSED(hMat);
308 return false;
309 }
310
311
312 ///return status of covariance matrix
313 /// using Minuit convention {0 not calculated 1 approximated 2 made pos def , 3 accurate}
314 /// Minimizer who implements covariance matrix calculation will re-implement the method
315 virtual int CovMatrixStatus() const {
316 return 0;
317 }
318
319 /**
320 return correlation coefficient between variable i and j.
321 If the variable is fixed or const the return value is zero
322 */
323 virtual double Correlation(unsigned int i, unsigned int j ) const {
324 double tmp = CovMatrix(i,i) * CovMatrix(j,j);
325 return ( tmp < 0) ? 0 : CovMatrix(i,j) / std::sqrt( tmp );
326 }
327
328 /**
329 return global correlation coefficient for variable i
330 This is a number between zero and one which gives
331 the correlation between the i-th parameter and that linear combination of all
332 other parameters which is most strongly correlated with i.
333 Minimizer must overload method if implemented
334 */
335 virtual double GlobalCC(unsigned int ivar) const {
336 MATH_UNUSED(ivar);
337 return -1;
338 }
339
340 /**
341 minos error for variable i, return false if Minos failed or not supported
342 and the lower and upper errors are returned in errLow and errUp
343 An extra flag specifies if only the lower (option=-1) or the upper (option=+1) error calculation is run
344 */
345 virtual bool GetMinosError(unsigned int ivar , double & errLow, double & errUp, int option = 0) {
346 MATH_ERROR_MSG("Minimizer::GetMinosError","Minos Error not implemented");
347 MATH_UNUSED(ivar); MATH_UNUSED(errLow); MATH_UNUSED(errUp); MATH_UNUSED(option);
348 return false;
349 }
350
351 /**
352 perform a full calculation of the Hessian matrix for error calculation
353 */
354 virtual bool Hesse() {
355 MATH_ERROR_MSG("Minimizer::Hesse","Hesse not implemented");
356 return false;
357 }
358
359 /**
360 scan function minimum for variable i. Variable and function must be set before using Scan
361 Return false if an error or if minimizer does not support this functionality
362 */
363 virtual bool Scan(unsigned int ivar , unsigned int & nstep , double * x , double * y ,
364 double xmin = 0, double xmax = 0) {
365 MATH_ERROR_MSG("Minimizer::Scan","Scan not implemented");
368 return false;
369 }
370
371 /**
372 find the contour points (xi, xj) of the function for parameter ivar and jvar around the minimum
373 The contour will be find for value of the function = Min + ErrorUp();
374 */
375 virtual bool Contour(unsigned int ivar , unsigned int jvar, unsigned int & npoints,
376 double * xi , double * xj ) {
377 MATH_ERROR_MSG("Minimizer::Contour","Contour not implemented");
378 MATH_UNUSED(ivar); MATH_UNUSED(jvar); MATH_UNUSED(npoints);
379 MATH_UNUSED(xi); MATH_UNUSED(xj);
380 return false;
381 }
382
383 /// return reference to the objective function
384 ///virtual const ROOT::Math::IGenFunction & Function() const = 0;
385
386 /// print the result according to set level (implemented for TMinuit for mantaining Minuit-style printing)
387 virtual void PrintResults() {}
388
389 /// get name of variables (override if minimizer support storing of variable names)
390 /// return an empty string if variable is not found
391 virtual std::string VariableName(unsigned int ivar) const {
392 MATH_UNUSED(ivar);
393 return std::string(); // return empty string
394 }
395
396 /// get index of variable given a variable given a name
397 /// return -1 if variable is not found
398 virtual int VariableIndex(const std::string & name) const {
399 MATH_ERROR_MSG("Minimizer::VariableIndex","Getting variable index from name not implemented");
401 return -1;
402 }
403
404 /** minimizer configuration parameters **/
405
406 /// set print level
407 int PrintLevel() const { return fOptions.PrintLevel(); }
408
409 /// max number of function calls
410 unsigned int MaxFunctionCalls() const { return fOptions.MaxFunctionCalls(); }
411
412 /// max iterations
413 unsigned int MaxIterations() const { return fOptions.MaxIterations(); }
414
415 /// absolute tolerance
416 double Tolerance() const { return fOptions.Tolerance(); }
417
418 /// precision of minimizer in the evaluation of the objective function
419 /// ( a value <=0 corresponds to the let the minimizer choose its default one)
420 double Precision() const { return fOptions.Precision(); }
421
422 /// strategy
423 int Strategy() const { return fOptions.Strategy(); }
424
425 /// status code of minimizer
426 int Status() const { return fStatus; }
427
428 /// status code of Minos (to be re-implemented by the minimizers supporting Minos)
429 virtual int MinosStatus() const { return -1; }
430
431 /// return the statistical scale used for calculate the error
432 /// is typically 1 for Chi2 and 0.5 for likelihood minimization
433 double ErrorDef() const { return fOptions.ErrorDef(); }
434
435 ///return true if Minimizer has performed a detailed error validation (e.g. run Hesse for Minuit)
436 bool IsValidError() const { return fValidError; }
437
438 /// retrieve the minimizer options (implement derived class if needed)
439 virtual MinimizerOptions Options() const {
440 return fOptions;
441 }
442
443 /// set print level
444 void SetPrintLevel(int level) { fOptions.SetPrintLevel(level); }
445
446 ///set maximum of function calls
447 void SetMaxFunctionCalls(unsigned int maxfcn) { if (maxfcn > 0) fOptions.SetMaxFunctionCalls(maxfcn); }
448
449 /// set maximum iterations (one iteration can have many function calls)
450 void SetMaxIterations(unsigned int maxiter) { if (maxiter > 0) fOptions.SetMaxIterations(maxiter); }
451
452 /// set the tolerance
453 void SetTolerance(double tol) { fOptions.SetTolerance(tol); }
454
455 /// set in the minimizer the objective function evaluation precision
456 /// ( a value <=0 means the minimizer will choose its optimal value automatically, i.e. default case)
457 void SetPrecision(double prec) { fOptions.SetPrecision(prec); }
458
459 ///set the strategy
460 void SetStrategy(int strategyLevel) { fOptions.SetStrategy(strategyLevel); }
461
462 /// set scale for calculating the errors
463 void SetErrorDef(double up) { fOptions.SetErrorDef(up); }
464
465 /// flag to check if minimizer needs to perform accurate error analysis (e.g. run Hesse for Minuit)
466 void SetValidError(bool on) { fValidError = on; }
467
468 /// set all options in one go
469 void SetOptions(const MinimizerOptions & opt) {
470 fOptions = opt;
471 }
472
473 /// set only the extra options
474 void SetExtraOptions(const IOptions & extraOptions) { fOptions.SetExtraOptions(extraOptions); }
475
476 /// reset the defaut options (defined in MinimizerOptions)
479 }
480
481protected:
482
483
484//private:
485
486
487 // keep protected to be accessible by the derived classes
488
489
490 bool fValidError; // flag to control if errors have been validated (Hesse has been run in case of Minuit)
491 MinimizerOptions fOptions; // minimizer options
492 int fStatus; // status of minimizer
493};
494
495 } // end namespace Math
496
497} // end namespace ROOT
498
499
500#endif /* ROOT_Math_Minimizer */
#define MATH_ERROR_MSG(loc, str)
Definition: Error.h:83
#define MATH_WARN_MSG(loc, str)
Definition: Error.h:80
char name[80]
Definition: TGX11.cxx:110
float xmin
Definition: THbookFile.cxx:95
float xmax
Definition: THbookFile.cxx:95
#define MATH_UNUSED(var)
Definition: Util.h:34
Class, describing value, limits and step size of the parameters Provides functionality also to set/re...
Documentation for the abstract class IBaseFunctionMultiDim.
Definition: IFunction.h:62
Interface (abstract class) for multi-dimensional functions providing a gradient calculation.
Definition: IFunction.h:343
Generic interface for defining configuration options of a numerical algorithm.
Definition: IOptions.h:31
void SetMaxFunctionCalls(unsigned int maxfcn)
set maximum of function calls
void SetStrategy(int stra)
set the strategy
void SetMaxIterations(unsigned int maxiter)
set maximum iterations (one iteration can have many function calls)
int Strategy() const
strategy
double Tolerance() const
absolute tolerance
double Precision() const
precision in the objective funciton calculation (value <=0 means left to default)
double ErrorDef() const
error definition
void SetExtraOptions(const IOptions &opt)
set extra options (in this case pointer is cloned)
unsigned int MaxIterations() const
max iterations
void SetPrecision(double prec)
set the precision
unsigned int MaxFunctionCalls() const
max number of function calls
void ResetToDefaultOptions()
non-static methods for setting options
int PrintLevel() const
non-static methods for retrieving options
void SetErrorDef(double err)
set error def
void SetPrintLevel(int level)
set print level
void SetTolerance(double tol)
set the tolerance
Abstract Minimizer class, defining the interface for the various minimizer (like Minuit2,...
Definition: Minimizer.h:75
double Tolerance() const
absolute tolerance
Definition: Minimizer.h:416
virtual const double * Errors() const
return errors at the minimum
Definition: Minimizer.h:275
virtual bool GetCovMatrix(double *covMat) const
Fill the passed array with the covariance matrix elements if the variable is fixed or const the value...
Definition: Minimizer.h:294
unsigned int MaxFunctionCalls() const
max number of function calls
Definition: Minimizer.h:410
virtual int VariableIndex(const std::string &name) const
get index of variable given a variable given a name return -1 if variable is not found
Definition: Minimizer.h:398
virtual bool SetLowerLimitedVariable(unsigned int ivar, const std::string &name, double val, double step, double lower)
set a new lower limit variable (override if minimizer supports them )
Definition: Minimizer.h:152
double Precision() const
precision of minimizer in the evaluation of the objective function ( a value <=0 corresponds to the l...
Definition: Minimizer.h:420
virtual const double * X() const =0
return pointer to X values at the minimum
virtual bool FixVariable(unsigned int ivar)
fix an existing variable
Definition: Minimizer.h:210
virtual unsigned int NIterations() const
number of iterations to reach the minimum
Definition: Minimizer.h:260
void SetMaxIterations(unsigned int maxiter)
set maximum iterations (one iteration can have many function calls)
Definition: Minimizer.h:450
virtual void SetFunction(const ROOT::Math::IMultiGradFunction &func)
set a function to minimize using gradient
Definition: Minimizer.h:120
virtual bool SetVariableStepSize(unsigned int ivar, double value)
set the step size of an already existing variable
Definition: Minimizer.h:188
virtual bool SetVariableInitialRange(unsigned int, double, double)
set the initial range of an existing variable
Definition: Minimizer.h:237
void SetErrorDef(double up)
set scale for calculating the errors
Definition: Minimizer.h:463
virtual bool ReleaseVariable(unsigned int ivar)
release an existing variable
Definition: Minimizer.h:216
virtual bool SetVariableLowerLimit(unsigned int ivar, double lower)
set the lower-limit of an already existing variable
Definition: Minimizer.h:194
void SetValidError(bool on)
flag to check if minimizer needs to perform accurate error analysis (e.g. run Hesse for Minuit)
Definition: Minimizer.h:466
int SetVariables(const VariableIterator &begin, const VariableIterator &end)
add variables . Return number of variables successfully added
Definition: Minimizer.h:128
virtual const double * MinGradient() const
return pointer to gradient values at the minimum
Definition: Minimizer.h:254
virtual void SetFunction(const ROOT::Math::IMultiGenFunction &func)=0
set the function to minimize
unsigned int MaxIterations() const
max iterations
Definition: Minimizer.h:413
void SetDefaultOptions()
reset the defaut options (defined in MinimizerOptions)
Definition: Minimizer.h:477
virtual bool GetVariableSettings(unsigned int ivar, ROOT::Fit::ParameterSettings &pars) const
get variable settings in a variable object (like ROOT::Fit::ParamsSettings)
Definition: Minimizer.h:229
virtual double GlobalCC(unsigned int ivar) const
return global correlation coefficient for variable i This is a number between zero and one which give...
Definition: Minimizer.h:335
virtual int MinosStatus() const
status code of Minos (to be re-implemented by the minimizers supporting Minos)
Definition: Minimizer.h:429
virtual bool SetVariableUpperLimit(unsigned int ivar, double upper)
set the upper-limit of an already existing variable
Definition: Minimizer.h:200
virtual bool SetVariableLimits(unsigned int ivar, double lower, double upper)
set the limits of an already existing variable
Definition: Minimizer.h:206
void SetTolerance(double tol)
set the tolerance
Definition: Minimizer.h:453
virtual int CovMatrixStatus() const
return status of covariance matrix using Minuit convention {0 not calculated 1 approximated 2 made po...
Definition: Minimizer.h:315
virtual bool Minimize()=0
method to perform the minimization
int Status() const
status code of minimizer
Definition: Minimizer.h:426
Minimizer(const Minimizer &)
Copy constructor.
Definition: Minimizer.h:101
Minimizer()
Default constructor.
Definition: Minimizer.h:82
virtual double CovMatrix(unsigned int ivar, unsigned int jvar) const
return covariance matrices element for variables ivar,jvar if the variable is fixed the return value ...
Definition: Minimizer.h:281
void SetPrintLevel(int level)
set print level
Definition: Minimizer.h:444
int Strategy() const
strategy
Definition: Minimizer.h:423
virtual unsigned int NCalls() const
number of function calls to reach the minimum
Definition: Minimizer.h:257
virtual bool SetUpperLimitedVariable(unsigned int ivar, const std::string &name, double val, double step, double upper)
set a new upper limit variable (override if minimizer supports them )
Definition: Minimizer.h:156
virtual bool SetVariable(unsigned int ivar, const std::string &name, double val, double step)=0
set a new free variable
void SetStrategy(int strategyLevel)
set the strategy
Definition: Minimizer.h:460
virtual bool ProvidesError() const
minimizer provides error and error matrix
Definition: Minimizer.h:272
virtual bool IsFixedVariable(unsigned int ivar) const
query if an existing variable is fixed (i.e.
Definition: Minimizer.h:223
Minimizer & operator=(const Minimizer &rhs)
Assignment operator.
Definition: Minimizer.h:106
void SetPrecision(double prec)
set in the minimizer the objective function evaluation precision ( a value <=0 means the minimizer wi...
Definition: Minimizer.h:457
virtual MinimizerOptions Options() const
retrieve the minimizer options (implement derived class if needed)
Definition: Minimizer.h:439
virtual double Correlation(unsigned int i, unsigned int j) const
return correlation coefficient between variable i and j.
Definition: Minimizer.h:323
virtual ~Minimizer()
Destructor (no operations)
Definition: Minimizer.h:90
virtual std::string VariableName(unsigned int ivar) const
get name of variables (override if minimizer support storing of variable names) return an empty strin...
Definition: Minimizer.h:391
double ErrorDef() const
return the statistical scale used for calculate the error is typically 1 for Chi2 and 0....
Definition: Minimizer.h:433
MinimizerOptions fOptions
Definition: Minimizer.h:491
virtual bool SetFixedVariable(unsigned int ivar, const std::string &name, double val)
set a new fixed variable (override if minimizer supports them )
Definition: Minimizer.h:167
void SetMaxFunctionCalls(unsigned int maxfcn)
set maximum of function calls
Definition: Minimizer.h:447
bool IsValidError() const
return true if Minimizer has performed a detailed error validation (e.g. run Hesse for Minuit)
Definition: Minimizer.h:436
virtual bool Contour(unsigned int ivar, unsigned int jvar, unsigned int &npoints, double *xi, double *xj)
find the contour points (xi, xj) of the function for parameter ivar and jvar around the minimum The c...
Definition: Minimizer.h:375
virtual double Edm() const
return expected distance reached from the minimum (re-implement if minimizer provides it
Definition: Minimizer.h:251
void SetOptions(const MinimizerOptions &opt)
set all options in one go
Definition: Minimizer.h:469
virtual bool SetVariableValues(const double *x)
set the values of all existing variables (array must be dimensioned to the size of the existing param...
Definition: Minimizer.h:179
virtual bool Scan(unsigned int ivar, unsigned int &nstep, double *x, double *y, double xmin=0, double xmax=0)
scan function minimum for variable i.
Definition: Minimizer.h:363
virtual bool SetVariableValue(unsigned int ivar, double value)
set the value of an already existing variable
Definition: Minimizer.h:173
virtual bool SetLimitedVariable(unsigned int ivar, const std::string &name, double val, double step, double lower, double upper)
set a new upper/lower limited variable (override if minimizer supports them ) otherwise as default se...
Definition: Minimizer.h:160
virtual void Clear()
reset for consecutive minimizations - implement if needed
Definition: Minimizer.h:114
void SetExtraOptions(const IOptions &extraOptions)
set only the extra options
Definition: Minimizer.h:474
virtual double MinValue() const =0
return minimum function value
int PrintLevel() const
minimizer configuration parameters
Definition: Minimizer.h:407
virtual bool Hesse()
perform a full calculation of the Hessian matrix for error calculation
Definition: Minimizer.h:354
virtual void PrintResults()
return reference to the objective function virtual const ROOT::Math::IGenFunction & Function() const ...
Definition: Minimizer.h:387
virtual unsigned int NDim() const =0
this is <= Function().NDim() which is the total number of variables (free+ constrained ones)
virtual unsigned int NFree() const
number of free variables (real dimension of the problem) this is <= Function().NDim() which is the to...
Definition: Minimizer.h:269
virtual bool GetMinosError(unsigned int ivar, double &errLow, double &errUp, int option=0)
minos error for variable i, return false if Minos failed or not supported and the lower and upper err...
Definition: Minimizer.h:345
virtual bool GetHessianMatrix(double *hMat) const
Fill the passed array with the Hessian matrix elements The Hessian matrix is the matrix of the second...
Definition: Minimizer.h:306
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
TFitResultPtr Fit(FitObject *h1, TF1 *f1, Foption_t &option, const ROOT::Math::MinimizerOptions &moption, const char *goption, ROOT::Fit::DataRange &range)
Definition: HFitImpl.cxx:133
Namespace for new Math classes and functions.
VecExpr< UnaryOp< Sqrt< T >, VecExpr< A, T, D >, T >, T, D > sqrt(const VecExpr< A, T, D > &rhs)
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...