13#ifndef ROOT_Minuit2_Minuit2Minimizer
14#define ROOT_Minuit2_Minuit2Minimizer
77 void Clear()
override;
83 void SetHessianFunction(std::function<
bool(std::span<const double>,
double *)> hfunc)
override;
86 bool SetVariable(
unsigned int ivar,
const std::string &
name,
double val,
double step)
override;
96 double ,
double )
override;
98 bool SetFixedVariable(
unsigned int ,
const std::string & ,
double )
override;
121 std::string
VariableName(
unsigned int ivar)
const override;
147 const double *
X()
const override {
return &
fValues.front(); }
157 unsigned int NDim()
const override {
return fDim; }
161 unsigned int NFree()
const override {
return fState.VariableParameters(); }
167 const double *
Errors()
const override;
176 double CovMatrix(
unsigned int i,
unsigned int j)
const override;
211 double Correlation(
unsigned int i,
unsigned int j)
const override;
219 std::vector<double>
GlobalCC()
const override;
228 bool GetMinosError(
unsigned int i,
double &errLow,
double &errUp,
int = 0)
override;
244 bool Scan(
unsigned int i,
unsigned int &nstep,
double *
x,
double *
y,
double xmin = 0,
double xmax = 0)
override;
250 bool Contour(
unsigned int i,
unsigned int j,
unsigned int &npoints,
double *xi,
double *xj)
override;
262 bool Hesse()
override;
283 void SetFCN(
unsigned int nDim, std::unique_ptr<ROOT::Minuit2::FCNBase> fcn);
299 int RunMinosError(
unsigned int i,
double &errLow,
double &errUp,
int runopt);
305 bool SetCovariance(std::span<const double> cov,
unsigned int nrow)
override;
313 std::unique_ptr<ROOT::Minuit2::ModularFunctionMinimizer>
fMinimizer;
315 std::unique_ptr<ROOT::Minuit2::FunctionMinimum>
fMinimum;
Class, describing value, limits and step size of the parameters Provides functionality also to set/re...
Abstract Minimizer class, defining the interface for the various minimizer (like Minuit2,...
Interface (abstract class) defining the function to be minimized, which has to be implemented by the ...
class holding the full result of the minimization; both internal and external (MnUserParameterState) ...
bool ExamineMinimum(const ROOT::Minuit2::FunctionMinimum &min)
examine the minimum result
Minuit2Minimizer(ROOT::Minuit2::EMinimizerType type=ROOT::Minuit2::kMigrad)
Default constructor.
const ROOT::Minuit2::MnUserParameterState & State()
return the minimizer state (containing values, step size , etc..)
void SetStorageLevel(int level)
set storage level = 1 : store all iteration states (default) = 0 : store only first and last state to...
std::vector< double > fValues
bool SetCovariance(std::span< const double > cov, unsigned int nrow) override
set initial covariance matrix
bool SetLimitedVariable(unsigned int ivar, const std::string &name, double val, double step, double, double) override
set upper/lower limited variable (override if minimizer supports them )
bool Contour(unsigned int i, unsigned int j, unsigned int &npoints, double *xi, double *xj) override
find the contour points (xi,xj) of the function for parameter i and j around the minimum The contour ...
virtual bool SetCovarianceDiag(std::span< const double > d2, unsigned int n) override
set initial second derivatives
bool IsFixedVariable(unsigned int ivar) const override
query if an existing variable is fixed (i.e.
bool SetVariableUpperLimit(unsigned int ivar, double upper) override
set the upper-limit of an already existing variable
unsigned int NCalls() const override
number of function calls to reach the minimum
bool SetVariableValues(const double *val) override
Set the values of all existing variables (array must be dimensioned to the size of the existing param...
bool SetVariable(unsigned int ivar, const std::string &name, double val, double step) override
set free variable
const double * X() const override
return pointer to X values at the minimum
const double * Errors() const override
return errors at the minimum
void SetFunction(const ROOT::Math::IMultiGenFunction &func) override
set the function to minimize
double MinValue() const override
return minimum function value
bool SetVariableStepSize(unsigned int ivar, double step) override
set the step size of an already existing variable
bool GetCovMatrix(double *cov) const override
Fill the passed array with the covariance matrix elements if the variable is fixed or const the value...
bool ReleaseVariable(unsigned int ivar) override
release an existing variable
bool GetVariableSettings(unsigned int ivar, ROOT::Fit::ParameterSettings &varObj) const override
get variable settings in a variable object (like ROOT::Fit::ParamsSettings)
const ROOT::Minuit2::FCNBase * GetFCN() const
bool Hesse() override
perform a full calculation of the Hessian matrix for error calculation If a valid minimum exists the ...
std::vector< double > fErrors
bool GetMinosError(unsigned int i, double &errLow, double &errUp, int=0) override
get the minos error for parameter i, return false if Minos failed A minimizaiton must be performed be...
std::string VariableName(unsigned int ivar) const override
get name of variables (override if minimizer support storing of variable names)
int RunMinosError(unsigned int i, double &errLow, double &errUp, int runopt)
bool SetVariableLimits(unsigned int ivar, double lower, double upper) override
set the limits of an already existing variable
bool ProvidesError() const override
minimizer provides error and error matrix
double Correlation(unsigned int i, unsigned int j) const override
return correlation coefficient between variable i and j.
bool SetLowerLimitedVariable(unsigned int ivar, const std::string &name, double val, double step, double lower) override
set lower limit variable (override if minimizer supports them )
void SetTraceObject(MnTraceObject &obj)
set an object to trace operation for each iteration The object must be a (or inherit from) ROOT::Minu...
virtual const ROOT::Minuit2::ModularFunctionMinimizer * GetMinimizer() const
unsigned int NFree() const override
number of free variables (real dimension of the problem) this is <= Function().NDim() which is the to...
double CovMatrix(unsigned int i, unsigned int j) const override
return covariance matrix elements if the variable is fixed or const the value is zero The ordering of...
void SetMinimizerType(ROOT::Minuit2::EMinimizerType type)
std::unique_ptr< ROOT::Minuit2::ModularFunctionMinimizer > fMinimizer
bool SetVariableValue(unsigned int ivar, double val) override
set variable
bool Scan(unsigned int i, unsigned int &nstep, double *x, double *y, double xmin=0, double xmax=0) override
scan a parameter i around the minimum.
int VariableIndex(const std::string &name) const override
get index of variable given a variable given a name return -1 if variable is not found
int MinosStatus() const override
MINOS status code of last Minos run status & 1 > 0 : invalid lower error status & 2 > 0 : invalid upp...
bool SetUpperLimitedVariable(unsigned int ivar, const std::string &name, double val, double step, double upper) override
set upper limit variable (override if minimizer supports them )
ROOT::Minuit2::MnUserParameterState fState
unsigned int NDim() const override
this is <= Function().NDim() which is the total number of variables (free+ constrained ones)
bool SetVariableLowerLimit(unsigned int ivar, double lower) override
set the lower-limit of an already existing variable
bool FixVariable(unsigned int ivar) override
fix an existing variable
double Edm() const override
return expected distance reached from the minimum
void SetHessianFunction(std::function< bool(std::span< const double >, double *)> hfunc) override
set the function implementing Hessian computation
bool Minimize() override
method to perform the minimization.
bool SetFixedVariable(unsigned int, const std::string &, double) override
set fixed variable (override if minimizer supports them )
bool GetHessianMatrix(double *h) const override
Fill the passed array with the Hessian matrix elements The Hessian matrix is the matrix of the second...
ROOT::Minuit2::FCNBase * GetFCN()
const double * MinGradient() const override
return pointer to gradient values at the minimum
void PrintResults() override
return reference to the objective function virtual const ROOT::Math::IGenFunction & Function() const;
void Clear() override
Reset for consecutive minimization - implement if needed.
~Minuit2Minimizer() override
Destructor (no operations).
std::vector< double > GlobalCC() const override
get global correlation coefficient for the variable i.
void SetFCN(unsigned int nDim, std::unique_ptr< ROOT::Minuit2::FCNBase > fcn)
To set the function directly to a Minuit 2 function.
int CovMatrixStatus() const override
return the status of the covariance matrix status = -1 : not available (inversion failed or Hesse fai...
std::unique_ptr< ROOT::Minuit2::FCNBase > fMinuitFCN
std::unique_ptr< ROOT::Minuit2::FunctionMinimum > fMinimum
class which holds the external user and/or internal Minuit representation of the parameters and error...
Base common class providing the API for all the minimizer Various Minimize methods are provided varyi...
IMultiGenFunctionTempl< double > IMultiGenFunction