42 _grad(getNDim()), _grad_params(getNDim()), _funct(funct),
43 has_been_calculated(getNDim())
54 :
RooAbsMinimizerFcn(other), _grad(other._grad), _grad_params(other._grad_params), _gradf(other._gradf), _funct(other._funct),
55 has_been_calculated(other.has_been_calculated), none_have_been_calculated(other.none_have_been_calculated)
65 std::vector<ROOT::Fit::ParameterSettings> ¶meter_settings)
const
77 for (
unsigned index = 0; index <
NDim(); index++) {
87 if (!parameters_changed) {
97 <<
"RooGradMinimizerFcn: Minimized function has error status." << std::endl
98 <<
"Returning maximum FCN so far (" <<
_maxFCN
99 <<
") to force MIGRAD to back out of this region. Error log follows" << std::endl;
102 <<
"RooGradMinimizerFcn: Minimized function has error status but is ignored" << std::endl;
135 std::cout <<
"\nprevFCN" << (
_funct->
isOffsetting() ?
"-offset" :
"") <<
" = " << std::setprecision(10) << fvalue
136 << std::setprecision(4) <<
" ";
160 if (parameter_has_changed) {
171 return parameter_has_changed;
176 bool has_been_synced =
false;
178 for (std::size_t ix = 0; ix <
NDim(); ++ix) {
181 if (parameter_has_changed) {
188 has_been_synced |= parameter_has_changed;
191 if (has_been_synced) {
195 return has_been_synced;
215 return _grad[i_component].derivative;
219 double *previous_grad,
double *previous_g2,
220 double *previous_gstep)
const
223 _grad[i_component] = {previous_grad[i_component], previous_g2[i_component], previous_gstep[i_component]};
225 previous_grad[i_component] =
_grad[i_component].derivative;
226 previous_g2[i_component] =
_grad[i_component].second_derivative;
227 previous_gstep[i_component] =
_grad[i_component].step_size;
228 return _grad[i_component].derivative;
const std::vector< ROOT::Fit::ParameterSettings > & ParamsSettings() const
get the vector of parameter settings (const method)
ROOT::Math::MinimizerOptions & MinimizerOptions()
access to the minimizer control parameter (non const method)
const FitConfig & Config() const
access to the fit configuration (const method)
Interface (abstract class) for multi-dimensional functions providing a gradient calculation.
int Strategy() const
strategy
double ErrorDef() const
error definition
static int DefaultStrategy()
static double DefaultErrorDef()
API class for defining three levels of strategies: low (0), medium (1), high (>=2); acts on: Migrad (...
double GradientStepTolerance() const
double GradientTolerance() const
unsigned int GradientNCycles() const
DerivatorElement PartialDerivative(const ROOT::Math::IBaseFunctionMultiDim *function, const double *x, const std::vector< ROOT::Fit::ParameterSettings > ¶meters, unsigned int i_component, DerivatorElement previous)
void SetInitialGradient(const ROOT::Math::IBaseFunctionMultiDim *function, const std::vector< ROOT::Fit::ParameterSettings > ¶meters, std::vector< DerivatorElement > &gradient)
This function was not implemented as in Minuit2.
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Bool_t SetPdfParamVal(int index, double value) const
Set value of parameter i.
std::unique_ptr< RooArgList > _floatParamList
Bool_t synchronizeParameterSettings(std::vector< ROOT::Fit::ParameterSettings > ¶meters, Bool_t optConst, Bool_t verbose)
Informs Minuit through its parameter_settings vector of RooFit parameter properties.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
virtual Bool_t isOffsetting() const
static void setHideOffset(Bool_t flag)
Double_t getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
static Int_t numEvalErrors()
Return the number of logged evaluation errors since the last clearing.
static void printEvalErrors(std::ostream &os=std::cout, Int_t maxPerNode=10000000)
Print all outstanding logged evaluation error on the given ostream.
static void clearEvalErrorLog()
Clear the stack of evaluation error messages.
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
void synchronizeGradientParameterSettings(std::vector< ROOT::Fit::ParameterSettings > ¶meter_settings) const
void setErrorLevel(double error_level) const
double DoDerivativeWithPrevResult(const double *x, unsigned int i_component, double *previous_grad, double *previous_g2, double *previous_gstep) const override
bool none_have_been_calculated
Bool_t Synchronize(std::vector< ROOT::Fit::ParameterSettings > ¶meter_settings, Bool_t optConst, Bool_t verbose=kFALSE) override
Like synchronizeParameterSettings, Synchronize informs Minuit through its parameter_settings vector o...
unsigned int NDim() const override
Retrieve the dimension of the function.
void resetHasBeenCalculatedFlags() const
void setStrategy(int istrat)
void setNcycles(unsigned int ncycles) const
double DoEval(const double *x) const override
void setGradTolerance(double grad_tolerance) const
std::vector< bool > has_been_calculated
RooGradMinimizerFcn(RooAbsReal *funct, RooMinimizer *context, bool verbose=false)
void runDerivator(unsigned int i_component) const
std::vector< double > _grad_params
void setStepTolerance(double step_tolerance) const
ROOT::Math::IMultiGradFunction * Clone() const override
Clone a function.
std::vector< ROOT::Minuit2::DerivatorElement > _grad
bool syncParameter(double x, std::size_t ix) const
ROOT::Minuit2::NumericalDerivator _gradf
bool syncParameters(const double *x) const
double DoDerivative(const double *x, unsigned int icoord) const override
RooMinimizer is a wrapper class around ROOT::Fit:Fitter that provides a seamless interface between th...
ROOT::Math::IMultiGenFunction * getMultiGenFcn() const
ROOT::Fit::Fitter * fitter()
Return underlying ROOT fitter object.
RooRealVar represents a variable that can be changed from the outside.
Iterator abstract base class.
virtual TObject * Next()=0
virtual const char * GetName() const
Returns name of object.