ROOT logo
ROOT » MATH » MINUIT » TMinuitMinimizer

class TMinuitMinimizer: public ROOT::Math::Minimizer


  TMinuitMinimizer class implementing the ROOT::Math::Minimizer interface using
  TMinuit.
  This class is normally instantiates using the plug-in manager
  (plug-in with name Minuit or TMinuit)
  In addition the user can choose the minimizer algorithm: Migrad (the default one), Simplex, or Minimize (combined Migrad + Simplex)


Function Members (Methods)

public:
TMinuitMinimizer(ROOT::Minuit::EMinimizerType type = ROOT::Minuit::kMigrad, unsigned int ndim = 0)
TMinuitMinimizer(const char* type, unsigned int ndim = 0)
virtual~TMinuitMinimizer()
static TClass*Class()
virtual voidROOT::Math::Minimizer::Clear()
virtual boolContour(unsigned int i, unsigned int j, unsigned int& npoints, double* xi, double* xj)
virtual doubleROOT::Math::Minimizer::Correlation(unsigned int i, unsigned int j) const
virtual doubleCovMatrix(unsigned int i, unsigned int j) const
virtual intCovMatrixStatus() const
virtual doubleEdm() const
doubleROOT::Math::Minimizer::ErrorDef() const
virtual const double*Errors() const
virtual boolGetCovMatrix(double* cov) const
virtual boolGetHessianMatrix(double* h) const
virtual boolGetMinosError(unsigned int i, double& errLow, double& errUp, int = 0)
virtual doubleGlobalCC(unsigned int) const
virtual boolHesse()
virtual TClass*IsA() const
boolROOT::Math::Minimizer::IsValidError() const
unsigned intROOT::Math::Minimizer::MaxFunctionCalls() const
unsigned intROOT::Math::Minimizer::MaxIterations() const
virtual const double*MinGradient() const
virtual boolMinimize()
virtual doubleMinValue() const
virtual unsigned intNCalls() const
virtual unsigned intNDim() const
virtual unsigned intNFree() const
virtual ROOT::Math::MinimizerOptionsROOT::Math::Minimizer::Options() const
doubleROOT::Math::Minimizer::Precision() const
intROOT::Math::Minimizer::PrintLevel() const
virtual voidPrintResults()
virtual boolProvidesError() const
virtual boolScan(unsigned int i, unsigned int& nstep, double* x, double* y, double xmin = 0, double xmax = 0)
voidROOT::Math::Minimizer::SetDefaultOptions()
voidROOT::Math::Minimizer::SetErrorDef(double up)
virtual boolSetFixedVariable(unsigned int, const string&, double)
virtual voidSetFunction(const ROOT::Math::IMultiGenFunction& func)
virtual voidSetFunction(const ROOT::Math::IMultiGradFunction& func)
virtual boolSetLimitedVariable(unsigned int ivar, const string& name, double val, double step, double, double)
virtual boolROOT::Math::Minimizer::SetLowerLimitedVariable(unsigned int ivar, const string& name, double val, double step, double lower)
voidROOT::Math::Minimizer::SetMaxFunctionCalls(unsigned int maxfcn)
voidROOT::Math::Minimizer::SetMaxIterations(unsigned int maxiter)
voidROOT::Math::Minimizer::SetOptions(const ROOT::Math::MinimizerOptions& opt)
voidROOT::Math::Minimizer::SetPrecision(double prec)
voidROOT::Math::Minimizer::SetPrintLevel(int level)
voidROOT::Math::Minimizer::SetStrategy(int strategyLevel)
voidROOT::Math::Minimizer::SetTolerance(double tol)
virtual boolROOT::Math::Minimizer::SetUpperLimitedVariable(unsigned int ivar, const string& name, double val, double step, double upper)
voidROOT::Math::Minimizer::SetValidError(bool on)
virtual boolSetVariable(unsigned int ivar, const string& name, double val, double step)
virtual boolSetVariableValue(unsigned int, double)
virtual boolROOT::Math::Minimizer::SetVariableValues(const double* x)
virtual voidShowMembers(TMemberInspector& insp)
intROOT::Math::Minimizer::Status() const
intROOT::Math::Minimizer::Strategy() const
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
voidSuppressMinuitWarnings(bool nowarn = true)
doubleROOT::Math::Minimizer::Tolerance() const
static boolUseStaticMinuit(bool on = true)
virtual intVariableIndex(const string& name) const
virtual stringVariableName(unsigned int ivar) const
virtual const double*X() const
protected:
voidDoClear()
voidDoReleaseFixParameter(int ivar)
static voidFcn(int&, double*, double& f, double*, int)
static voidFcnGrad(int&, double* g, double& f, double*, int)
voidInitTMinuit(int ndim)
voidRetrieveErrorMatrix()
voidRetrieveParams()

Data Members

protected:
intROOT::Math::Minimizer::fDebugprint level
unsigned intROOT::Math::Minimizer::fMaxCallsmax number of function calls
unsigned intROOT::Math::Minimizer::fMaxItermax number or iterations used to find the minimum
doubleROOT::Math::Minimizer::fPrecprecision
intROOT::Math::Minimizer::fStatusstatus of minimizer
intROOT::Math::Minimizer::fStrategyminimizer strategy
doubleROOT::Math::Minimizer::fToltolerance (absolute)
doubleROOT::Math::Minimizer::fUperror scale
boolROOT::Math::Minimizer::fValidErrorflag to control if errors have been validated (Hesse has been run in case of Minuit)
private:
vector<double>fCovar
unsigned intfDim
vector<double>fErrors
boolfMinosRun
TMinuit*fMinuit
vector<double>fParams
unsigned intfStrategy
ROOT::Minuit::EMinimizerTypefType
boolfUsed
static ROOT::Math::IBaseFunctionMultiDim*fgFunc
static TMinuit*fgMinuit
static boolfgUseStaticMinuitflag to control if using global TMInuit instance (gMinuit)
static boolfgUsedflag to control if static instance has done minimization

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TMinuitMinimizer(ROOT::Minuit::EMinimizerType type = ROOT::Minuit::kMigrad, unsigned int ndim = 0)
 Constructor for TMinuitMinimier class via an enumeration specifying the minimization
 algorithm type. Supported types are : kMigrad, kSimplex, kCombined (a combined
 Migrad + Simplex minimization) and kMigradImproved (a Migrad mininimization folloed by an
 improved search for global minima). The default type is Migrad (kMigrad).
TMinuitMinimizer(const char* type, unsigned int ndim = 0)
 constructor from a char * for the algorithm type, used by the plug-in manager
 The names supported (case unsensitive) are:
  Migrad (default), Simplex, Minimize (for the combined Migrad+ Simplex) and Migrad_imp
~TMinuitMinimizer()
 Destructor implementation.
TMinuitMinimizer(const TMinuitMinimizer& )
 Implementation of copy constructor (it is private).
bool UseStaticMinuit(bool on = true)
 static method to control usage of global TMinuit instance
void InitTMinuit(int ndim)
void SetFunction(const ROOT::Math::IMultiGenFunction & func)
 Set the objective function to be minimized, by passing a function object implement the
 basic multi-dim Function interface. In this case the derivatives will be
 calculated by Minuit
 Here a TMinuit instance is created since only at this point we know the number of parameters
void SetFunction(const ROOT::Math::IMultiGradFunction & func)
 Set the objective function to be minimized, by passing a function object implement the
 multi-dim gradient Function interface. In this case the function derivatives are provided
 by the user via this interface and there not calculated by Minuit.
void Fcn(int& , double* , double& f, double* , int )
 implementation of FCN static function used internally by TMinuit.
 Adapt IMultiGenFunction interface to TMinuit FCN static function
void FcnGrad(int& , double* g, double& f, double* , int )
 implementation of FCN static function used internally by TMinuit.
 Adapt IMultiGradFunction interface to TMinuit FCN static function in the case of user
 provided gradient.
bool SetVariable(unsigned int ivar, const string& name, double val, double step)
 set a free variable.
bool SetLimitedVariable(unsigned int ivar, const string& name, double val, double step, double , double )
 set a limited variable.
bool SetFixedVariable(unsigned int , const string& , double )
 set a fixed variable.
bool SetVariableValue(unsigned int , double )
 set the value of an existing variable
 parameter must exist or return false
std::string VariableName(unsigned int ivar) const
 return the variable name
int VariableIndex(const string& name) const
 return variable index
bool Minimize()
 perform the minimization using the algorithm chosen previously by the user
 By default Migrad is used.
 Return true if the found minimum is valid and update internal chached values of
 minimum values, errors and covariance matrix.
 Status of minimizer is set to:
 migradResult + 10*minosResult + 100*hesseResult + 1000*improveResult
void RetrieveParams()
 retrieve from TMinuit minimum parameter values
 and errors
void RetrieveErrorMatrix()
 get covariance error matrix from TMinuit
 when some parameters are fixed filled the corresponding rows and column with zero's
unsigned int NCalls() const
 return total number of function calls
double MinValue() const
 return minimum function value
double Edm() const
 return expected distance from the minimum
unsigned int NFree() const
 return number of free parameters
bool GetCovMatrix(double* cov) const
 get covariance matrix
bool GetHessianMatrix(double* h) const
 get Hessian - inverse of covariance matrix
 just invert it
 but need to get the compact form to avoid the zero for the fixed parameters
int CovMatrixStatus() const
 return status of covariance matrix
           status:  0= not calculated at all
                    1= approximation only, not accurate
                    2= full matrix, but forced positive-definite
                    3= full accurate covariance matrix
double GlobalCC(unsigned int ) const
 global correlation coefficient for parameter i
bool GetMinosError(unsigned int i, double& errLow, double& errUp, int = 0)
 Perform Minos analysis for the given parameter  i
void DoClear()
 reset TMinuit
void DoReleaseFixParameter(int ivar)
 check if a parameter is defined and in case it was fixed released
 TMinuit is not able to release free parameters by redefining them
 so we need to force the release
void PrintResults()
 print-out results using classic Minuit format (mnprin)
void SuppressMinuitWarnings(bool nowarn = true)
 suppress Minuit2 warnings
bool Contour(unsigned int i, unsigned int j, unsigned int& npoints, double* xi, double* xj)
 contour plot for parameter i and j
 need a valid FunctionMinimum otherwise exits
bool Scan(unsigned int i, unsigned int& nstep, double* x, double* y, double xmin = 0, double xmax = 0)
 scan a parameter (variable) around the minimum value
 the parameters must have been set before
 if xmin=0 && xmax == 0  by default scan around 2 sigma of the error
 if the errors  are also zero then scan from min and max of parameter range
 (if parameters are limited Minuit scan from min and max instead of 2 sigma by default)
 (force in that case to use errors)
bool Hesse()
 perform calculation of Hessian
const double * X() const
 return  pointer to X values at the minimum
{ return &fParams.front(); }
const double * MinGradient() const
 return pointer to gradient values at the minimum
{ return 0; }
unsigned int NDim() const
 this is <= Function().NDim() which is the total
 number of variables (free+ constrained ones)
{ return fDim; }
bool ProvidesError() const
 minimizer provides error and error matrix
{ return true; }
const double * Errors() const
 return errors at the minimum
{ return &fErrors.front(); }
double CovMatrix(unsigned int i, unsigned int j) const
 return covariance matrices elements
       if the variable is fixed the matrix is zero
       The ordering of the variables is the same as in errors