BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
ROOT::Fit::FitConfig Class Reference

Description

Class describing the configuration of the fit, options and parameter settings using the ROOT::Fit::ParameterSettings class

Definition at line 46 of file FitConfig.h.

Collaboration diagram for ROOT::Fit::FitConfig:
[legend]

Public Member Functions

 FitConfig (const FitConfig &rhs)
 
 FitConfig (unsigned int npar=0)
 
 ~FitConfig ()
 
ROOT::Math::MinimizerCreateMinimizer ()
 
template<class T >
void CreateParamsSettings (const ROOT::Math::IParamMultiFunctionTempl< T > &func)
 
const std::string & MinimizerAlgoType () const
 
ROOT::Math::MinimizerOptionsMinimizerOptions ()
 
const std::string & MinimizerType () const
 
bool MinosErrors () const
 do minos errros analysis on the parameters More...
 
const std::vector< unsigned int > & MinosParams () const
 return vector of parameter indeces for which the Minos Error will be computed More...
 
bool NormalizeErrors () const
 
unsigned int NPar () const
 
FitConfigoperator= (const FitConfig &rhs)
 
bool ParabErrors () const
 do analysis for parabolic errors More...
 
std::vector< ROOT::Fit::ParameterSettings > & ParamsSettings ()
 
const std::vector< ROOT::Fit::ParameterSettings > & ParamsSettings () const
 
std::vector< double > ParamsValues () const
 
ParameterSettingsParSettings (unsigned int i)
 
const ParameterSettingsParSettings (unsigned int i) const
 
void SetFromFitResult (const FitResult &rhs)
 
void SetMinimizer (const char *type, const char *algo=0)
 
void SetMinimizerOptions (const ROOT::Math::MinimizerOptions &minopt)
 
void SetMinosErrors (bool on=true)
 set Minos erros computation to be performed after fitting More...
 
void SetMinosErrors (const std::vector< unsigned int > &paramInd)
 set parameter indeces for running Minos this can be used for running Minos on a subset of parameters - otherwise is run on all of them if MinosErrors() is set More...
 
void SetNormErrors (bool on=true)
 
void SetParabErrors (bool on=true)
 set parabolic erros More...
 
void SetParamsSettings (const std::vector< ROOT::Fit::ParameterSettings > &pars)
 
void SetParamsSettings (unsigned int npar, const double *params, const double *vstep=0)
 
void SetUpdateAfterFit (bool on=true)
 Update configuration after a fit using the FitResult. More...
 
void SetWeightCorrection (bool on=true)
 apply the weight correction for error matric computation More...
 
bool UpdateAfterFit () const
 Update configuration after a fit using the FitResult. More...
 
bool UseWeightCorrection () const
 Apply Weight correction for error matrix computation. More...
 

Static Public Member Functions

static void SetDefaultMinimizer (const char *type, const char *algo=0)
 

Private Attributes

ROOT::Math::MinimizerOptions fMinimizerOpts
 
bool fMinosErrors
 
std::vector< unsigned int > fMinosParams
 
bool fNormErrors
 
bool fParabErrors
 
std::vector< ROOT::Fit::ParameterSettingsfSettings
 
bool fUpdateAfterFit
 
bool fWeightCorr
 

Constructor & Destructor Documentation

◆ FitConfig() [1/2]

ROOT::Fit::FitConfig::FitConfig ( unsigned int  npar = 0)

Default constructor

◆ FitConfig() [2/2]

ROOT::Fit::FitConfig::FitConfig ( const FitConfig rhs)

◆ ~FitConfig()

ROOT::Fit::FitConfig::~FitConfig ( )

Destructor

Member Function Documentation

◆ CreateMinimizer()

ROOT::Math::Minimizer* ROOT::Fit::FitConfig::CreateMinimizer ( )

create a new minimizer according to chosen configuration

◆ CreateParamsSettings()

template<class T >
void ROOT::Fit::FitConfig::CreateParamsSettings ( const ROOT::Math::IParamMultiFunctionTempl< T > &  func)
inline

set the parameter settings from a model function. Create always new parameter setting list from a given model function

Definition at line 108 of file FitConfig.h.

108  {
109  // initialize from model function
110  // set the parameters values from the function
111  unsigned int npar = func.NPar();
112  const double *begin = func.Parameters();
113  if (begin == 0) {
114  fSettings = std::vector<ParameterSettings>(npar);
115  return;
116  }
117 
118  fSettings.clear();
119  fSettings.reserve(npar);
120  const double *end = begin + npar;
121  unsigned int i = 0;
122  for (const double *ipar = begin; ipar != end; ++ipar) {
123  double val = *ipar;
124  double step = 0.3 * fabs(val); // step size is 30% of par value
125  // double step = 2.0*fabs(val); // step size is 30% of par value
126  if (val == 0) step = 0.3;
127 
128  fSettings.push_back(ParameterSettings(func.ParameterName(i), val, step));
129 #ifdef DEBUG
130  std::cout << "FitConfig: add parameter " << func.ParameterName(i) << " val = " << val << std::endl;
131 #endif
132  i++;
133  }
134  }
std::vector< ROOT::Fit::ParameterSettings > fSettings
Definition: FitConfig.h:262
virtual std::string ParameterName(unsigned int i) const
virtual const double * Parameters() const =0
virtual unsigned int NPar() const =0

References fSettings, ROOT::Math::IBaseParam::NPar(), ROOT::Math::IBaseParam::ParameterName(), and ROOT::Math::IBaseParam::Parameters().

Here is the call graph for this function:

◆ MinimizerAlgoType()

const std::string& ROOT::Fit::FitConfig::MinimizerAlgoType ( ) const
inline

return type of minimizer algorithms

Definition at line 193 of file FitConfig.h.

ROOT::Math::MinimizerOptions fMinimizerOpts
Definition: FitConfig.h:265
const std::string & MinimizerAlgorithm() const
type of algorithm

References fMinimizerOpts, and ROOT::Math::MinimizerOptions::MinimizerAlgorithm().

Here is the call graph for this function:

◆ MinimizerOptions()

ROOT::Math::MinimizerOptions& ROOT::Fit::FitConfig::MinimizerOptions ( )
inline

access to the minimizer control parameter (non const method)

Definition at line 166 of file FitConfig.h.

166 { return fMinimizerOpts; }

References fMinimizerOpts.

◆ MinimizerType()

const std::string& ROOT::Fit::FitConfig::MinimizerType ( ) const
inline

return type of minimizer package

Definition at line 188 of file FitConfig.h.

188 { return fMinimizerOpts.MinimizerType(); }
const std::string & MinimizerType() const
type of minimizer

References fMinimizerOpts, and ROOT::Math::MinimizerOptions::MinimizerType().

Here is the call graph for this function:

◆ MinosErrors()

bool ROOT::Fit::FitConfig::MinosErrors ( ) const
inline

do minos errros analysis on the parameters

Definition at line 205 of file FitConfig.h.

205 { return fMinosErrors; }

References fMinosErrors.

◆ MinosParams()

const std::vector<unsigned int>& ROOT::Fit::FitConfig::MinosParams ( ) const
inline

return vector of parameter indeces for which the Minos Error will be computed

Definition at line 215 of file FitConfig.h.

215 { return fMinosParams; }
std::vector< unsigned int > fMinosParams
Definition: FitConfig.h:263

References fMinosParams.

◆ NormalizeErrors()

bool ROOT::Fit::FitConfig::NormalizeErrors ( ) const
inline

flag to check if resulting errors are be normalized according to chi2/ndf

Definition at line 199 of file FitConfig.h.

199 { return fNormErrors; }

References fNormErrors.

◆ NPar()

unsigned int ROOT::Fit::FitConfig::NPar ( ) const
inline

number of parameters settings

Definition at line 95 of file FitConfig.h.

95 { return fSettings.size(); }

References fSettings.

◆ operator=()

FitConfig& ROOT::Fit::FitConfig::operator= ( const FitConfig rhs)

◆ ParabErrors()

bool ROOT::Fit::FitConfig::ParabErrors ( ) const
inline

do analysis for parabolic errors

Definition at line 202 of file FitConfig.h.

202 { return fParabErrors; }

References fParabErrors.

◆ ParamsSettings() [1/2]

std::vector<ROOT::Fit::ParameterSettings>& ROOT::Fit::FitConfig::ParamsSettings ( )
inline

get the vector of parameter settings (non-const method)

Definition at line 90 of file FitConfig.h.

90 { return fSettings; }

References fSettings.

◆ ParamsSettings() [2/2]

const std::vector<ROOT::Fit::ParameterSettings>& ROOT::Fit::FitConfig::ParamsSettings ( ) const
inline

get the vector of parameter settings (const method)

Definition at line 85 of file FitConfig.h.

85 { return fSettings; }

References fSettings.

◆ ParamsValues()

std::vector<double> ROOT::Fit::FitConfig::ParamsValues ( ) const

return a vector of stored parameter values (i.e initial fit parameters)

◆ ParSettings() [1/2]

ParameterSettings& ROOT::Fit::FitConfig::ParSettings ( unsigned int  i)
inline

get the parameter settings for the i-th parameter (non-const method)

Definition at line 80 of file FitConfig.h.

80 { return fSettings.at(i); }

References fSettings.

◆ ParSettings() [2/2]

const ParameterSettings& ROOT::Fit::FitConfig::ParSettings ( unsigned int  i) const
inline

get the parameter settings for the i-th parameter (const method)

Definition at line 75 of file FitConfig.h.

75 { return fSettings.at(i); }

References fSettings.

◆ SetDefaultMinimizer()

static void ROOT::Fit::FitConfig::SetDefaultMinimizer ( const char *  type,
const char *  algo = 0 
)
static

static function to control default minimizer type and algorithm

◆ SetFromFitResult()

void ROOT::Fit::FitConfig::SetFromFitResult ( const FitResult rhs)

◆ SetMinimizer()

void ROOT::Fit::FitConfig::SetMinimizer ( const char *  type,
const char *  algo = 0 
)
inline

set minimizer type

Definition at line 180 of file FitConfig.h.

180  {
181  if (type) fMinimizerOpts.SetMinimizerType(type);
182  if (algo) fMinimizerOpts.SetMinimizerAlgorithm(algo);
183  }
void SetMinimizerType(const char *type)
set minimizer type
void SetMinimizerAlgorithm(const char *type)
set minimizer algorithm

References fMinimizerOpts, ROOT::Math::MinimizerOptions::SetMinimizerAlgorithm(), and ROOT::Math::MinimizerOptions::SetMinimizerType().

Here is the call graph for this function:

◆ SetMinimizerOptions()

void ROOT::Fit::FitConfig::SetMinimizerOptions ( const ROOT::Math::MinimizerOptions minopt)

set all the minimizer options using class MinimizerOptions

◆ SetMinosErrors() [1/2]

void ROOT::Fit::FitConfig::SetMinosErrors ( bool  on = true)
inline

set Minos erros computation to be performed after fitting

Definition at line 226 of file FitConfig.h.

226 { fMinosErrors = on; }

References fMinosErrors.

◆ SetMinosErrors() [2/2]

void ROOT::Fit::FitConfig::SetMinosErrors ( const std::vector< unsigned int > &  paramInd)
inline

set parameter indeces for running Minos this can be used for running Minos on a subset of parameters - otherwise is run on all of them if MinosErrors() is set

Definition at line 234 of file FitConfig.h.

234  {
235  fMinosErrors = true;
236  fMinosParams = paramInd;
237  }

References fMinosErrors, and fMinosParams.

◆ SetNormErrors()

void ROOT::Fit::FitConfig::SetNormErrors ( bool  on = true)
inline

set the option to normalize the error on the result according to chi2/ndf

Definition at line 220 of file FitConfig.h.

220 { fNormErrors= on; }

References fNormErrors.

◆ SetParabErrors()

void ROOT::Fit::FitConfig::SetParabErrors ( bool  on = true)
inline

set parabolic erros

Definition at line 223 of file FitConfig.h.

223 { fParabErrors = on; }

References fParabErrors.

◆ SetParamsSettings() [1/2]

void ROOT::Fit::FitConfig::SetParamsSettings ( const std::vector< ROOT::Fit::ParameterSettings > &  pars)
inline

Definition at line 144 of file FitConfig.h.

144  {
145  fSettings = pars;
146  }

References fSettings.

◆ SetParamsSettings() [2/2]

void ROOT::Fit::FitConfig::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 values. If there are not existing or number of parameters does not match existing one, create a new parameter setting list.

◆ SetUpdateAfterFit()

void ROOT::Fit::FitConfig::SetUpdateAfterFit ( bool  on = true)
inline

Update configuration after a fit using the FitResult.

Definition at line 240 of file FitConfig.h.

240 { fUpdateAfterFit = on; }

References fUpdateAfterFit.

◆ SetWeightCorrection()

void ROOT::Fit::FitConfig::SetWeightCorrection ( bool  on = true)
inline

apply the weight correction for error matric computation

Definition at line 229 of file FitConfig.h.

229 { fWeightCorr = on; }

References fWeightCorr.

◆ UpdateAfterFit()

bool ROOT::Fit::FitConfig::UpdateAfterFit ( ) const
inline

Update configuration after a fit using the FitResult.

Definition at line 208 of file FitConfig.h.

208 { return fUpdateAfterFit; }

References fUpdateAfterFit.

◆ UseWeightCorrection()

bool ROOT::Fit::FitConfig::UseWeightCorrection ( ) const
inline

Apply Weight correction for error matrix computation.

Definition at line 211 of file FitConfig.h.

211 { return fWeightCorr; }

References fWeightCorr.

Member Data Documentation

◆ fMinimizerOpts

ROOT::Math::MinimizerOptions ROOT::Fit::FitConfig::fMinimizerOpts
private

Definition at line 265 of file FitConfig.h.

Referenced by MinimizerAlgoType(), MinimizerOptions(), MinimizerType(), and SetMinimizer().

◆ fMinosErrors

bool ROOT::Fit::FitConfig::fMinosErrors
private

Definition at line 258 of file FitConfig.h.

Referenced by MinosErrors(), and SetMinosErrors().

◆ fMinosParams

std::vector<unsigned int> ROOT::Fit::FitConfig::fMinosParams
private

Definition at line 263 of file FitConfig.h.

Referenced by MinosParams(), and SetMinosErrors().

◆ fNormErrors

bool ROOT::Fit::FitConfig::fNormErrors
private

Definition at line 256 of file FitConfig.h.

Referenced by NormalizeErrors(), and SetNormErrors().

◆ fParabErrors

bool ROOT::Fit::FitConfig::fParabErrors
private

Definition at line 257 of file FitConfig.h.

Referenced by ParabErrors(), and SetParabErrors().

◆ fSettings

std::vector<ROOT::Fit::ParameterSettings> ROOT::Fit::FitConfig::fSettings
private

◆ fUpdateAfterFit

bool ROOT::Fit::FitConfig::fUpdateAfterFit
private

Definition at line 259 of file FitConfig.h.

Referenced by SetUpdateAfterFit(), and UpdateAfterFit().

◆ fWeightCorr

bool ROOT::Fit::FitConfig::fWeightCorr
private

Definition at line 260 of file FitConfig.h.

Referenced by SetWeightCorrection(), and UseWeightCorrection().


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