Logo ROOT  
Reference Guide
ROOT::Math::MinimizerOptions Class Reference

Minimizer options.

Class defining the options for the minimizer. It contains also static methods for setting the default Minimizer option values that will be used by default by all Minimizer instances. To see the current default options do:


Definition at line 40 of file MinimizerOptions.h.

Public Member Functions

 MinimizerOptions ()
 MinimizerOptions (const MinimizerOptions &opt)
 ~MinimizerOptions ()
double ErrorDef () const
 error definition More...
const IOptionsExtraOptions () const
 return extra options (NULL pointer if they are not present) More...
unsigned int MaxFunctionCalls () const
 max number of function calls More...
unsigned int MaxIterations () const
 max iterations More...
const std::string & MinimizerAlgorithm () const
 type of algorithm More...
const std::string & MinimizerType () const
 type of minimizer More...
MinimizerOptionsoperator= (const MinimizerOptions &opt)
 assignment operators More...
double Precision () const
 precision in the objective function calculation (value <=0 means left to default) More...
void Print (std::ostream &os=std::cout) const
 print all the options More...
int PrintLevel () const
 non-static methods for retrieving options More...
void ResetToDefaultOptions ()
 non-static methods for setting options More...
void SetErrorDef (double err)
 set error def More...
void SetExtraOptions (const IOptions &opt)
 set extra options (in this case pointer is cloned) More...
void SetMaxFunctionCalls (unsigned int maxfcn)
 set maximum of function calls More...
void SetMaxIterations (unsigned int maxiter)
 set maximum iterations (one iteration can have many function calls) More...
void SetMinimizerAlgorithm (const char *type)
 set minimizer algorithm More...
void SetMinimizerType (const char *type)
 set minimizer type More...
void SetPrecision (double prec)
 set the precision More...
void SetPrintLevel (int level)
 set print level More...
void SetStrategy (int stra)
 set the strategy More...
void SetTolerance (double tol)
 set the tolerance More...
int Strategy () const
 strategy More...
double Tolerance () const
 absolute tolerance More...

Static Public Member Functions

static ROOT::Math::IOptionsDefault (const char *name)
 Retrieve extra options for a given minimizer name. More...
static double DefaultErrorDef ()
static IOptionsDefaultExtraOptions ()
static int DefaultMaxFunctionCalls ()
static int DefaultMaxIterations ()
static const std::string & DefaultMinimizerAlgo ()
static const std::string & DefaultMinimizerType ()
static double DefaultPrecision ()
static int DefaultPrintLevel ()
static int DefaultStrategy ()
static double DefaultTolerance ()
static ROOT::Math::IOptionsFindDefault (const char *name)
 Find an extra options and return a nullptr if it is not existing. More...
static void PrintDefault (const char *name=nullptr, std::ostream &os=std::cout)
 Print all the default options including the extra one specific for a given minimizer name. More...
static void SetDefaultErrorDef (double up)
 Set the default level for computing the parameter errors. More...
static void SetDefaultExtraOptions (const IOptions *extraoptions)
 Set additional minimizer options as pair of (string,value). More...
static void SetDefaultMaxFunctionCalls (int maxcall)
 Set the maximum number of function calls. More...
static void SetDefaultMaxIterations (int maxiter)
 Set the maximum number of iterations. More...
static void SetDefaultMinimizer (const char *type, const char *algo=0)
 Set the the default Minimizer type and corresponding algorithms. More...
static void SetDefaultPrecision (double prec)
 Set the default Minimizer precision. More...
static void SetDefaultPrintLevel (int level)
 Set the default Print Level. More...
static void SetDefaultStrategy (int strat)
 Set the default strategy. More...
static void SetDefaultTolerance (double tol)
 Set the Minimization tolerance. More...

Private Attributes

std::string fAlgoType
 Minimizer algorithmic specification (Migrad, Minimize, ...) More...
double fErrorDef
 error definition (=1. for getting 1 sigma error for chi2 fits) More...
int fLevel
 debug print level More...
int fMaxCalls
 maximum number of function calls More...
int fMaxIter
 maximum number of iterations More...
std::string fMinimType
 Minimizer type (Minuit, Minuit2, etc.. More...
double fPrecision
 precision of the objective function evaluation (value <=0 means left to default) More...
int fStrategy
 minimizer strategy (used by Minuit) More...
double fTolerance
 minimize tolerance to reach solution More...

#include <Math/MinimizerOptions.h>

Constructor & Destructor Documentation

◆ MinimizerOptions() [1/2]

ROOT::Math::MinimizerOptions::MinimizerOptions ( )

Definition at line 133 of file MinimizerOptions.cxx.

◆ ~MinimizerOptions()

ROOT::Math::MinimizerOptions::~MinimizerOptions ( )

Definition at line 166 of file MinimizerOptions.cxx.

◆ MinimizerOptions() [2/2]

ROOT::Math::MinimizerOptions::MinimizerOptions ( const MinimizerOptions opt)

Definition at line 142 of file MinimizerOptions.cxx.

Member Function Documentation

◆ Default()

IOptions & ROOT::Math::MinimizerOptions::Default ( const char *  name)

Retrieve extra options for a given minimizer name.

If the extra options already exist in a global map of (Minimizer name, options) it will return a reference to that options, otherwise it will create a new one and return the corresponding reference

Definition at line 230 of file MinimizerOptions.cxx.

◆ DefaultErrorDef()

double ROOT::Math::MinimizerOptions::DefaultErrorDef ( )

Definition at line 91 of file MinimizerOptions.cxx.

◆ DefaultExtraOptions()

IOptions * ROOT::Math::MinimizerOptions::DefaultExtraOptions ( )

Definition at line 98 of file MinimizerOptions.cxx.

◆ DefaultMaxFunctionCalls()

int ROOT::Math::MinimizerOptions::DefaultMaxFunctionCalls ( )

Definition at line 94 of file MinimizerOptions.cxx.

◆ DefaultMaxIterations()

int ROOT::Math::MinimizerOptions::DefaultMaxIterations ( )

Definition at line 95 of file MinimizerOptions.cxx.

◆ DefaultMinimizerAlgo()

const std::string & ROOT::Math::MinimizerOptions::DefaultMinimizerAlgo ( )

Definition at line 85 of file MinimizerOptions.cxx.

◆ DefaultMinimizerType()

const std::string & ROOT::Math::MinimizerOptions::DefaultMinimizerType ( )

Definition at line 100 of file MinimizerOptions.cxx.

◆ DefaultPrecision()

double ROOT::Math::MinimizerOptions::DefaultPrecision ( )

Definition at line 93 of file MinimizerOptions.cxx.

◆ DefaultPrintLevel()

int ROOT::Math::MinimizerOptions::DefaultPrintLevel ( )

Definition at line 97 of file MinimizerOptions.cxx.

◆ DefaultStrategy()

int ROOT::Math::MinimizerOptions::DefaultStrategy ( )

Definition at line 96 of file MinimizerOptions.cxx.

◆ DefaultTolerance()

double ROOT::Math::MinimizerOptions::DefaultTolerance ( )

Definition at line 92 of file MinimizerOptions.cxx.

◆ ErrorDef()

double ROOT::Math::MinimizerOptions::ErrorDef ( ) const

error definition

Definition at line 192 of file MinimizerOptions.h.

◆ ExtraOptions()

const IOptions * ROOT::Math::MinimizerOptions::ExtraOptions ( ) const

return extra options (NULL pointer if they are not present)

Definition at line 195 of file MinimizerOptions.h.

◆ FindDefault()

IOptions * ROOT::Math::MinimizerOptions::FindDefault ( const char *  name)

Find an extra options and return a nullptr if it is not existing.

Same as above but it will not create a new one

Definition at line 235 of file MinimizerOptions.cxx.

◆ MaxFunctionCalls()

unsigned int ROOT::Math::MinimizerOptions::MaxFunctionCalls ( ) const

max number of function calls

Definition at line 177 of file MinimizerOptions.h.

◆ MaxIterations()

unsigned int ROOT::Math::MinimizerOptions::MaxIterations ( ) const

max iterations

Definition at line 180 of file MinimizerOptions.h.

◆ MinimizerAlgorithm()

const std::string & ROOT::Math::MinimizerOptions::MinimizerAlgorithm ( ) const

type of algorithm

Definition at line 201 of file MinimizerOptions.h.

◆ MinimizerType()

const std::string & ROOT::Math::MinimizerOptions::MinimizerType ( ) const

type of minimizer

Definition at line 198 of file MinimizerOptions.h.

◆ operator=()

MinimizerOptions & ROOT::Math::MinimizerOptions::operator= ( const MinimizerOptions opt)

assignment operators

Definition at line 147 of file MinimizerOptions.cxx.

◆ Precision()

double ROOT::Math::MinimizerOptions::Precision ( ) const

precision in the objective function calculation (value <=0 means left to default)

Definition at line 189 of file MinimizerOptions.h.

◆ Print()

void ROOT::Math::MinimizerOptions::Print ( std::ostream &  os = std::cout) const

print all the options

Definition at line 212 of file MinimizerOptions.cxx.

◆ PrintDefault()

void ROOT::Math::MinimizerOptions::PrintDefault ( const char *  name = nullptr,
std::ostream &  os = std::cout 

Print all the default options including the extra one specific for a given minimizer name.

If no minimizer name is given, all the extra default options, which have been set and configured will be printed

Definition at line 240 of file MinimizerOptions.cxx.

◆ PrintLevel()

int ROOT::Math::MinimizerOptions::PrintLevel ( ) const

non-static methods for retrieving options

set print level

Definition at line 174 of file MinimizerOptions.h.

◆ ResetToDefaultOptions()

void ROOT::Math::MinimizerOptions::ResetToDefaultOptions ( )

non-static methods for setting options

Definition at line 170 of file MinimizerOptions.cxx.

◆ SetDefaultErrorDef()

void ROOT::Math::MinimizerOptions::SetDefaultErrorDef ( double  up)

Set the default level for computing the parameter errors.

For example for 1-sigma parameter errors

  • up = 1 for a chi-squared function
  • up = 0.5 for a negative log-likelihood function

The value will be used also by Minos when computing the confidence interval

Definition at line 51 of file MinimizerOptions.cxx.

◆ SetDefaultExtraOptions()

void ROOT::Math::MinimizerOptions::SetDefaultExtraOptions ( const IOptions extraoptions)

Set additional minimizer options as pair of (string,value).

Extra option defaults can be configured for a specific algorithm and then if a matching with the correct option name exists it will be used whenever creating a new minimizer instance. For example for changing the default number of steps of the Genetic minimizer from 100 to 500 do

 auto extraOpt = ROOT::Math::MinimizerOptions::Default("Genetic")

and when creating the Genetic minimizer you will have the new value for the option:

auto gmin = ROOT::Math::Factory::CreateMinimizer("Genetic");

Definition at line 79 of file MinimizerOptions.cxx.

◆ SetDefaultMaxFunctionCalls()

void ROOT::Math::MinimizerOptions::SetDefaultMaxFunctionCalls ( int  maxcall)

Set the maximum number of function calls.

Definition at line 63 of file MinimizerOptions.cxx.

◆ SetDefaultMaxIterations()

void ROOT::Math::MinimizerOptions::SetDefaultMaxIterations ( int  maxiter)

Set the maximum number of iterations.

Used by the GSL minimizers and Genetic. Not used by Minuit,Minuit2.

Definition at line 67 of file MinimizerOptions.cxx.

◆ SetDefaultMinimizer()

void ROOT::Math::MinimizerOptions::SetDefaultMinimizer ( const char *  type,
const char *  algo = 0 

Set the the default Minimizer type and corresponding algorithms.

Here is the list of the available minimizers and their corresponding algorithms. For some minimizers (e.g. Fumili) there are no specific algorithms available, then there is no need to specify it.

ROOT Minimizers

  • Minuit Minimizer based on TMinuit, the legacy Minuit implementation. Here are the available algorithms:
    • Migrad default algorithm based on the variable metric minimizer
    • Minimize combination of Simplex and Migrad
    • Simplex minimization algorithm not using the gradient information
    • Scan brute function scan
  • Minuit2 New C++ implementation of Minuit (the recommended one)
    • Migrad (default)
    • Minimize
    • Simplex
    • Fumili2 new implementation of Fumili integrated in Minuit2
  • Fumili Minimizer using an approximation for the Hessian based on first derivatives of the model function (see TFumili). Works only for chi-squared and likelihood functions.
  • Linear Linear minimizer (fitter) working only for linear functions (see TLinearFitter and TLinearMinimizer)
  • GSLMultiMin Minimizer from GSL based on the ROOT::Math::GSLMinimizer. Available algorithms are:
    • BFGS2 (default)
    • BFGS
    • ConjugateFR
    • ConjugatePR
    • SteepestDescent
  • GSLMultiFit Minimizer based on GSL for minimizing only non linear least-squared functions (using an approximation similar to Fumili). See ROOT::Math::GSLMultiFit.
  • GSLSimAn Simulated annealing minimizer from GSL (see ROOT::Math::GSLSimAnMinimizer). It is a stochastic minimization algorithm using only function values and not the gradient.
  • Genetic Genetic minimization algorithms (see TMVA::Genetic)

Definition at line 43 of file MinimizerOptions.cxx.

◆ SetDefaultPrecision()

void ROOT::Math::MinimizerOptions::SetDefaultPrecision ( double  prec)

Set the default Minimizer precision.

(used only by MInuit and Minuit2) It is used to specify the numerical precision used for computing the objective function. It should be left to the default value found by the Minimizer (typically double precision)

Definition at line 59 of file MinimizerOptions.cxx.

◆ SetDefaultPrintLevel()

void ROOT::Math::MinimizerOptions::SetDefaultPrintLevel ( int  level)

Set the default Print Level.

Possible levels are from 0 (minimal printing) to 3 (maximum printing)

Definition at line 75 of file MinimizerOptions.cxx.

◆ SetDefaultStrategy()

void ROOT::Math::MinimizerOptions::SetDefaultStrategy ( int  strat)

Set the default strategy.

The strategy is a parameter used only by Minuit and Minuit2. Possible values are:

  • strat = 0 : rough approximation of Hessian using the gradient. Avoid computing the full Hessian matrix
  • strat = 1 (default and recommended one) - Use Hessian approximation but compute full Hessian at the end of minimization if needed.
  • strat = 2 Perform several full Hessian computations during the minimization. Slower and not always working better than strat=1.

Definition at line 71 of file MinimizerOptions.cxx.

◆ SetDefaultTolerance()

void ROOT::Math::MinimizerOptions::SetDefaultTolerance ( double  tol)

Set the Minimization tolerance.

The Default value for Minuit and Minuit2 is 0.01

Definition at line 55 of file MinimizerOptions.cxx.

◆ SetErrorDef()

void ROOT::Math::MinimizerOptions::SetErrorDef ( double  err)

set error def

Definition at line 228 of file MinimizerOptions.h.

◆ SetExtraOptions()

void ROOT::Math::MinimizerOptions::SetExtraOptions ( const IOptions opt)

set extra options (in this case pointer is cloned)

Definition at line 206 of file MinimizerOptions.cxx.

◆ SetMaxFunctionCalls()

void ROOT::Math::MinimizerOptions::SetMaxFunctionCalls ( unsigned int  maxfcn)

set maximum of function calls

Definition at line 213 of file MinimizerOptions.h.

◆ SetMaxIterations()

void ROOT::Math::MinimizerOptions::SetMaxIterations ( unsigned int  maxiter)

set maximum iterations (one iteration can have many function calls)

Definition at line 216 of file MinimizerOptions.h.

◆ SetMinimizerAlgorithm()

void ROOT::Math::MinimizerOptions::SetMinimizerAlgorithm ( const char *  type)

set minimizer algorithm

Definition at line 234 of file MinimizerOptions.h.

◆ SetMinimizerType()

void ROOT::Math::MinimizerOptions::SetMinimizerType ( const char *  type)

set minimizer type

Definition at line 231 of file MinimizerOptions.h.

◆ SetPrecision()

void ROOT::Math::MinimizerOptions::SetPrecision ( double  prec)

set the precision

Definition at line 222 of file MinimizerOptions.h.

◆ SetPrintLevel()

void ROOT::Math::MinimizerOptions::SetPrintLevel ( int  level)

set print level

Definition at line 210 of file MinimizerOptions.h.

◆ SetStrategy()

void ROOT::Math::MinimizerOptions::SetStrategy ( int  stra)

set the strategy

Definition at line 225 of file MinimizerOptions.h.

◆ SetTolerance()

void ROOT::Math::MinimizerOptions::SetTolerance ( double  tol)

set the tolerance

Definition at line 219 of file MinimizerOptions.h.

◆ Strategy()

int ROOT::Math::MinimizerOptions::Strategy ( ) const


Definition at line 183 of file MinimizerOptions.h.

◆ Tolerance()

double ROOT::Math::MinimizerOptions::Tolerance ( ) const

absolute tolerance

Definition at line 186 of file MinimizerOptions.h.

Member Data Documentation

◆ fAlgoType

std::string ROOT::Math::MinimizerOptions::fAlgoType

Minimizer algorithmic specification (Migrad, Minimize, ...)

Definition at line 250 of file MinimizerOptions.h.

◆ fErrorDef

double ROOT::Math::MinimizerOptions::fErrorDef

error definition (=1. for getting 1 sigma error for chi2 fits)

Definition at line 246 of file MinimizerOptions.h.

◆ fExtraOptions

ROOT::Math::IOptions* ROOT::Math::MinimizerOptions::fExtraOptions

Definition at line 253 of file MinimizerOptions.h.

◆ fLevel

int ROOT::Math::MinimizerOptions::fLevel

debug print level

Definition at line 242 of file MinimizerOptions.h.

◆ fMaxCalls

int ROOT::Math::MinimizerOptions::fMaxCalls

maximum number of function calls

Definition at line 243 of file MinimizerOptions.h.

◆ fMaxIter

int ROOT::Math::MinimizerOptions::fMaxIter

maximum number of iterations

Definition at line 244 of file MinimizerOptions.h.

◆ fMinimType

std::string ROOT::Math::MinimizerOptions::fMinimType

Minimizer type (Minuit, Minuit2, etc..

Definition at line 249 of file MinimizerOptions.h.

◆ fPrecision

double ROOT::Math::MinimizerOptions::fPrecision

precision of the objective function evaluation (value <=0 means left to default)

Definition at line 248 of file MinimizerOptions.h.

◆ fStrategy

int ROOT::Math::MinimizerOptions::fStrategy

minimizer strategy (used by Minuit)

Definition at line 245 of file MinimizerOptions.h.

◆ fTolerance

double ROOT::Math::MinimizerOptions::fTolerance

minimize tolerance to reach solution

Definition at line 247 of file MinimizerOptions.h.

Libraries for ROOT::Math::MinimizerOptions:

The documentation for this class was generated from the following files: