45 fUpdateAfterFit(true),
65 if (
this == &rhs)
return *
this;
87 unsigned int npar = result.
NPar();
93 for (
unsigned int i = 0; i < npar; ++i) {
102 if (lower == -std::numeric_limits<double>::infinity())
fSettings[i].SetUpperLimit(upper);
103 else if (upper == std::numeric_limits<double>::infinity())
fSettings[i].SetLowerLimit(lower);
104 else fSettings[i].SetLimits(lower,upper);
124 size_t pos = minname.find(
" / ");
125 if (pos != std::string::npos) {
126 std::string minimType = minname.substr(0,pos);
127 std::string algoType = minname.substr(pos+3,minname.length() );
140 fSettings = std::vector<ParameterSettings>(npar);
144 bool createNew =
false;
151 const double * end = params+npar;
152 for (
const double * ipar = params; ipar != end; ++ipar) {
158 if (val == 0) step = 0.3;
177 unsigned int npar = func.
NPar();
180 fSettings = std::vector<ParameterSettings>(npar);
186 const double * end = begin+npar;
188 for (
const double * ipar = begin; ipar != end; ++ipar) {
192 if (val == 0) step = 0.3;
196 std::cout <<
"FitConfig: add parameter " << func.
ParameterName(i) <<
" val = " << val << std::endl;
218 std::string minim2 =
"Minuit";
219 if (minimType ==
"Minuit") minim2 =
"Minuit2";
220 if (minimType != minim2 ) {
221 std::string msg =
"Could not create the " + minimType +
" minimizer. Try using the minimizer " + minim2;
225 MATH_ERROR_MSG(
"FitConfig::CreateMinimizer",
"Could not create the Minuit2 minimizer");
231 std::string msg =
"Could not create the Minimizer " + minimType;
241 int maxfcn = 1000 + 100*npar + 5*npar*npar;
FitConfig(unsigned int npar=0)
Default constructor.
virtual const double * Parameters() const =0
Access the parameter values.
std::string ParName(unsigned int i) const
name of the parameter
unsigned int MaxFunctionCalls() const
max number of function calls
const std::string & MinimizerAlgorithm() const
type of algorithm
void SetMaxIterations(unsigned int maxiter)
set maximum iterations (one iteration can have many function calls)
void SetErrorDef(double up)
set scale for calculating the errors
This namespace contains pre-defined functions to be used in conjuction with TExecutor::Map and TExecu...
void SetMinimizerType(const char *type)
set minimizer type
ROOT::Math::Minimizer * CreateMinimizer()
create a new minimizer according to chosen configuration
double Error(unsigned int i) const
parameter error by index
unsigned int NPar() const
total number of parameters (abbreviation)
Class, describing value, limits and step size of the parameters Provides functionality also to set/re...
double Value(unsigned int i) const
parameter value by index
static ROOT::Math::Minimizer * CreateMinimizer(const std::string &minimizerType="", const std::string &algoType="")
static method to create the corrisponding Minimizer given the string Supported Minimizers types are: ...
ROOT::Math::MinimizerOptions fMinimizerOpts
void SetValidError(bool on)
flag to check if minimizer needs to perform accurate error analysis (e.g. run Hesse for Minuit) ...
#define MATH_WARN_MSG(loc, str)
unsigned int MaxIterations() const
max iterations
const std::string & MinimizerType() const
type of minimizer
FitConfig & operator=(const FitConfig &rhs)
bool HasMinosError(unsigned int i) const
query if parameter i has the Minos error
void CreateParamsSettings(const ROOT::Math::IParamMultiFunction &func)
set the parameter settings from a model function.
Abstract Minimizer class, defining the interface for the various minimizer (like Minuit2, Minuit, GSL, etc..) Plug-in's exist in ROOT to be able to instantiate the derived classes like ROOT::Math::GSLMinimizer or ROOT::Math::Minuit2Minimizer via the plug-in manager.
int PrintLevel() const
non-static methods for retrieving options
static void SetDefaultMinimizer(const char *type, const char *algo=0)
static function to control default minimizer type and algorithm
#define MATH_ERROR_MSG(loc, str)
int Strategy() const
strategy
bool NormalizedErrors() const
flag to chek if errors are normalized
double Precision() const
precision in the objective funciton calculation (value <=0 means left to default) ...
virtual unsigned int NPar() const =0
Return the number of Parameters.
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
void SetMinimizer(const char *type, const char *algo=0)
set minimizer type
void SetMaxFunctionCalls(unsigned int maxfcn)
set maximum of function calls
IParamFunction interface (abstract class) describing multi-dimensional parameteric functions It is a ...
static const std::string & DefaultMinimizerType()
void SetMinimizerOptions(const ROOT::Math::MinimizerOptions &minopt)
set all the minimizer options using class MinimizerOptions
const std::string & MinimizerType() const
minimization quantities
void SetMaxFunctionCalls(unsigned int maxfcn)
set maximum of function calls
class containg the result of the fit and all the related information (fitted parameter values...
double Tolerance() const
absolute tolerance
void SetTolerance(double tol)
set the tolerance
TFitResultPtr Fit(FitObject *h1, TF1 *f1, Foption_t &option, const ROOT::Math::MinimizerOptions &moption, const char *goption, ROOT::Fit::DataRange &range)
bool IsParameterFixed(unsigned int ipar) const
query if a parameter is fixed
double func(double *x, double *p)
void SetStrategy(int strategyLevel)
set the strategy
std::string ToString(const T &val)
Utility function for conversion to strings.
void SetParamsSettings(unsigned int npar, const double *params, const double *vstep=0)
set the parameter settings from number of parameters and a vector of values and optionally step value...
void SetNormErrors(bool on=true)
set the option to normalize the error on the result according to chi2/ndf
double ErrorDef() const
error definition
void SetFromFitResult(const FitResult &rhs)
std::vector< ROOT::Fit::ParameterSettings > fSettings
bool ParameterBounds(unsigned int ipar, double &lower, double &upper) const
retrieve parameter bounds - return false if parameter is not bound
void SetPrecision(double prec)
set in the minimizer the objective function evaluation precision ( a value <=0 means the minimizer wi...
void SetPrintLevel(int level)
set print level
virtual std::string ParameterName(unsigned int i) const
Return the name of the i-th parameter (starting from zero) Overwrite if want to avoid the default nam...
static void SetDefaultMinimizer(const char *type, const char *algo=0)
std::vector< unsigned int > fMinosParams
Class describing the configuration of the fit, options and parameter settings using the ROOT::Fit::Pa...