44 fUpdateAfterFit(true),
64 if (
this == &rhs)
return *
this;
86 unsigned int npar =
result.NPar();
92 for (
unsigned int i = 0; i < npar; ++i) {
93 if (
result.IsParameterFixed(i) )
100 if (
result.ParameterBounds(i,lower,upper) ) {
101 if (lower == -std::numeric_limits<double>::infinity())
fSettings[i].SetUpperLimit(upper);
102 else if (upper == std::numeric_limits<double>::infinity())
fSettings[i].SetLowerLimit(lower);
103 else fSettings[i].SetLimits(lower,upper);
107 if (
result.HasMinosError(i) ) {
122 const std::string & minname =
result.MinimizerType();
123 size_t pos = minname.find(
" / ");
124 if (pos != std::string::npos) {
125 std::string minimType = minname.substr(0,pos);
126 std::string algoType = minname.substr(pos+3,minname.length() );
138 if (params ==
nullptr) {
139 fSettings = std::vector<ParameterSettings>(npar);
143 bool createNew =
false;
150 const double * end = params+npar;
151 for (
const double * ipar = params; ipar != end; ++ipar) {
154 if (vstep ==
nullptr) {
155 step = 0.3*std::fabs(val);
157 if (val == 0) step = 0.3;
193 if (min ==
nullptr) {
195 std::string minim2 =
"Minuit";
196 if (minimType ==
"Minuit") minim2 =
"Minuit2";
197 if (minimType != minim2 ) {
198 std::string msg =
"Could not create the " + minimType +
" minimizer. Try using the minimizer " + minim2;
201 if (min ==
nullptr) {
202 MATH_ERROR_MSG(
"FitConfig::CreateMinimizer",
"Could not create the Minuit2 minimizer");
208 std::string msg =
"Could not create the Minimizer " + minimType;
218 int maxfcn = 1000 + 100*npar + 5*npar*npar;
245 if ((
name.find(
"Fumili") == std::string::npos) && (
name.find(
"GSLMultiFit") == std::string::npos)) {
264 std::vector<double> params(
NPar() );
265 for (
unsigned int i = 0; i < params.size(); ++i) {
#define MATH_ERROR_MSG(loc, str)
#define MATH_WARN_MSG(loc, str)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Class describing the configuration of the fit, options and parameter settings using the ROOT::Fit::Pa...
std::vector< unsigned int > fMinosParams
vector with the parameter indices for running Minos
FitConfig(unsigned int npar=0)
Default constructor.
void SetMinimizer(const char *type, const char *algo=nullptr)
set minimizer type
bool fNormErrors
flag for error normalization
std::vector< double > ParamsValues() const
return a vector of stored parameter values (i.e initial fit parameters)
const std::string & MinimizerAlgoType() const
return type of minimizer algorithms
void SetNormErrors(bool on=true)
set the option to normalize the error on the result according to chi2/ndf
void SetMinimizerOptions(const ROOT::Math::MinimizerOptions &minopt)
set all the minimizer options using class MinimizerOptions
unsigned int NPar() const
number of parameters settings
void SetParamsSettings(unsigned int npar, const double *params, const double *vstep=nullptr)
set the parameter settings from number of parameters and a vector of values and optionally step value...
std::vector< ROOT::Fit::ParameterSettings > fSettings
vector with the parameter settings
std::string MinimizerName() const
return Minimizer full name (type / algorithm)
bool fParabErrors
get correct parabolic errors estimate (call Hesse after minimizing)
ROOT::Math::MinimizerOptions fMinimizerOpts
minimizer control parameters including name and algo type
ROOT::Math::Minimizer * CreateMinimizer()
create a new minimizer according to chosen configuration
bool fMinosErrors
do full error analysis using Minos
static void SetDefaultMinimizer(const char *type, const char *algo=nullptr)
static function to control default minimizer type and algorithm
void SetFromFitResult(const FitResult &rhs)
const std::string & MinimizerType() const
return type of minimizer package
bool fWeightCorr
apply correction to errors for weights fits
bool fUpdateAfterFit
update the configuration after a fit using the result
FitConfig & operator=(const FitConfig &rhs)
class containing the result of the fit and all the related information (fitted parameter values,...
Class, describing value, limits and step size of the parameters Provides functionality also to set/re...
static ROOT::Math::Minimizer * CreateMinimizer(const std::string &minimizerType="", const std::string &algoType="")
static method to create the corresponding Minimizer given the string Supported Minimizers types are: ...
void SetMaxFunctionCalls(unsigned int maxfcn)
set maximum of function calls
int Strategy() const
strategy
const IOptions * ExtraOptions() const
return extra options (NULL pointer if they are not present)
double Tolerance() const
absolute tolerance
double Precision() const
precision in the objective function calculation (value <=0 means left to default)
void SetMinimizerType(const char *type)
set minimizer type
const std::string & MinimizerAlgorithm() const
type of algorithm
double ErrorDef() const
error definition
static void SetDefaultMinimizer(const char *type, const char *algo=nullptr)
Set the default Minimizer type and corresponding algorithms.
static const std::string & DefaultMinimizerType()
static const std::string & DefaultMinimizerAlgo()
const std::string & MinimizerType() const
type of minimizer
unsigned int MaxIterations() const
max iterations
unsigned int MaxFunctionCalls() const
max number of function calls
int PrintLevel() const
non-static methods for retrieving options
void SetMinimizerAlgorithm(const char *type)
set minimizer algorithm
Abstract Minimizer class, defining the interface for the various minimizer (like Minuit2,...
TFitResultPtr Fit(FitObject *h1, TF1 *f1, Foption_t &option, const ROOT::Math::MinimizerOptions &moption, const char *goption, ROOT::Fit::DataRange &range)
std::string ToString(const T &val)
Utility function for conversion to strings.
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.