13#ifndef ROOT_Math_Minimizer
14#define ROOT_Math_Minimizer
32 class ParameterSettings;
147 template<
class VariableIterator>
149 unsigned int ivar = 0;
152 if (
vitr->IsFixed() )
154 else if (
vitr->IsDoubleBound() )
156 else if (
vitr->HasLowerLimit() )
158 else if (
vitr->HasUpperLimit() )
233 virtual const double *
X()
const = 0;
236 virtual double Edm()
const {
return -1; }
242 virtual unsigned int NCalls()
const {
return 0; }
249 virtual unsigned int NDim()
const = 0;
260 virtual const double *
Errors()
const {
return nullptr; }
280 return ( tmp < 0) ? 0 :
CovMatrix(i,
j) / std::sqrt( tmp );
286 virtual bool Hesse();
287 virtual bool Scan(
unsigned int ivar ,
unsigned int &
nstep ,
double *
x ,
double *
y ,
290 double * xi ,
double *
xj );
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Class, describing value, limits and step size of the parameters Provides functionality also to set/re...
Documentation for the abstract class IBaseFunctionMultiDim.
Generic interface for defining configuration options of a numerical algorithm.
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 function 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,...
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 set...
double Tolerance() const
Absolute tolerance.
virtual const double * Errors() const
virtual int VariableIndex(const std::string &name) const
Get index of variable given a variable given a name.
unsigned int MaxFunctionCalls() const
Max number of function calls.
virtual bool GetCovMatrix(double *covMat) const
Fill the passed array with the covariance matrix elements if the variable is fixed or const the value...
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), leave upper bound unlimited.
virtual bool SetVariableStepSize(unsigned int ivar, double value)
Set the step size of an already existing variable.
double Precision() const
Precision of minimizer in the evaluation of the objective function.
virtual void SetHessianFunction(std::function< bool(std::span< const double >, double *)>)
Set the function implementing Hessian computation (re-implemented by Minimizer using it).
virtual bool SetCovarianceDiag(std::span< const double > d2, unsigned int n)
Set initial second derivatives.
virtual const double * X() const =0
virtual unsigned int NIterations() const
Number of iterations to reach the minimum.
void SetMaxIterations(unsigned int maxiter)
Set maximum iterations (one iteration can have many function calls).
virtual bool SetVariableInitialRange(unsigned int, double, double)
Set the initial range of an existing variable.
void SetErrorDef(double up)
Set scale for calculating the errors.
virtual bool GetVariableSettings(unsigned int ivar, ROOT::Fit::ParameterSettings &pars) const
Get variable settings in a variable object (like ROOT::Fit::ParamsSettings).
void SetValidError(bool on)
Flag to check if minimizer needs to perform accurate error analysis (e.g. run Hesse for Minuit).
int SetVariables(const VariableIterator &begin, const VariableIterator &end)
Add variables.
virtual double GlobalCC(unsigned int ivar) const
virtual const double * MinGradient() const
Minimizer(Minimizer &&)=delete
int fStatus
status of minimizer
virtual bool SetVariableValue(unsigned int ivar, double value)
Set the value of an already existing variable.
virtual void SetFunction(const ROOT::Math::IMultiGenFunction &func)=0
Set the function to minimize.
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.
unsigned int MaxIterations() const
Max iterations.
void SetDefaultOptions()
Reset the default options (defined in MinimizerOptions).
bool fValidError
flag to control if errors have been validated (Hesse has been run in case of Minuit)
virtual int MinosStatus() const
Status code of Minos (to be re-implemented by the minimizers supporting Minos).
virtual bool SetVariableLimits(unsigned int ivar, double lower, double upper)
Set the limits of an already existing variable.
void SetTolerance(double tol)
Set the tolerance.
Minimizer(Minimizer const &)=delete
virtual int CovMatrixStatus() const
virtual bool Minimize()=0
Method to perform the minimization.
int Status() const
Status code of minimizer.
virtual bool SetVariableUpperLimit(unsigned int ivar, double upper)
Set the upper-limit of an already existing variable.
virtual bool SetCovariance(std::span< const double > cov, unsigned int nrow)
Set initial covariance matrix.
Minimizer()
Default constructor.
virtual std::string VariableName(unsigned int ivar) const
Get name of variables (override if minimizer support storing of variable names).
void SetPrintLevel(int level)
Set print level.
virtual double CovMatrix(unsigned int ivar, unsigned int jvar) const
virtual bool GetHessianMatrix(double *hMat) const
Fill the passed array with the Hessian matrix elements The Hessian matrix is the matrix of the second...
int Strategy() const
Strategy.
virtual unsigned int NCalls() const
Number of function calls to reach the minimum.
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), leave lower bound unlimited.
Minimizer & operator=(Minimizer &&)=delete
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.
virtual bool ProvidesError() const
Minimizer provides error and error matrix.
virtual bool FixVariable(unsigned int ivar)
Fix an existing variable.
void SetPrecision(double prec)
Set in the minimizer the objective function evaluation precision.
virtual MinimizerOptions Options() const
Retrieve the minimizer options (implement derived class if needed).
virtual double Correlation(unsigned int i, unsigned int j) const
virtual ~Minimizer()
Destructor (no operations).
MinimizerOptions fOptions
minimizer options
Minimizer & operator=(Minimizer const &)=delete
virtual bool SetFixedVariable(unsigned int ivar, const std::string &name, double val)
Set a new fixed variable (override if minimizer supports them).
void SetMaxFunctionCalls(unsigned int maxfcn)
Set maximum of function calls.
bool IsValidError() const
virtual double Edm() const
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...
void SetOptions(const MinimizerOptions &opt)
Set all options in one go.
virtual bool SetVariableValues(const double *x)
Set the values of all existing variables (array must be dimensioned to the size of the existing param...
virtual void Clear()
Reset for consecutive minimization - implement if needed.
void SetExtraOptions(const IOptions &extraOptions)
Set only the extra options.
virtual double MinValue() const =0
int PrintLevel() const
Set print level.
virtual void PrintResults()
Print the result according to set level (implemented for TMinuit for maintaining Minuit-style printin...
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).
virtual bool SetVariableLowerLimit(unsigned int ivar, double lower)
Set the lower-limit of an already existing variable.
virtual bool IsFixedVariable(unsigned int ivar) const
Query if an existing variable is fixed (i.e.
virtual bool ReleaseVariable(unsigned int ivar)
Release an existing variable.
virtual bool Hesse()
Perform a full calculation of the Hessian matrix for error calculation.
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.
TFitResultPtr Fit(FitObject *h1, TF1 *f1, Foption_t &option, const ROOT::Math::MinimizerOptions &moption, const char *goption, ROOT::Fit::DataRange &range)
Namespace for new Math classes and functions.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...