59 const RooAbsArg *arg = (*_floatParamList).at(i);
61 oocoutW(
_context, Minimization) <<
"RooAbsMinimizerFcn::RooAbsMinimizerFcn: removing parameter "
62 << arg->
GetName() <<
" from list because it is not of type RooRealVar" << endl;
90 bool constValChange(
false);
91 bool constStatChange(
false);
114 constStatChange =
true;
119 <<
"RooAbsMinimizerFcn::synchronize: parameter " << par->
GetName() <<
" is now floating." << endl;
125 constValChange =
true;
128 <<
"RooAbsMinimizerFcn::synchronize: value of constant parameter " << par->
GetName() <<
" changed from "
153 oocoutW(
_context, Minimization) <<
"RooAbsMinimizerFcn::fit: Error, non-constant parameter "
154 << par->
GetName() <<
" is not of type RooRealVar, skipping" << endl;
176 pstep = 0.1 * (pmax - pmin);
179 if (pmax - par->
getVal() < 2 * pstep) {
180 pstep = (pmax - par->
getVal()) / 2;
181 }
else if (par->
getVal() - pmin < 2 * pstep) {
182 pstep = (par->
getVal() - pmin) / 2;
187 pstep = 0.1 * (pmax - pmin);
195 <<
"RooAbsMinimizerFcn::synchronize: WARNING: no initial error estimate available for "
196 << par->
GetName() <<
": using " << pstep << endl;
205 if (
index >=
int(parameters.size())) {
208 parameters.emplace_back(par->
GetName(), par->
getVal(), pstep, pmin, pmax);
210 parameters.emplace_back(par->
GetName(), par->
getVal(), pstep);
212 parameters.back().SetLowerLimit(pmin);
214 parameters.back().SetUpperLimit(pmax);
220 bool oldFixed = parameters[
index].IsFixed();
221 double oldVar = parameters[
index].Value();
222 double oldVerr = parameters[
index].StepSize();
223 double oldVlo = parameters[
index].LowerLimit();
224 double oldVhi = parameters[
index].UpperLimit();
229 if (oldVar != par->
getVal()) {
233 <<
"RooAbsMinimizerFcn::synchronize: value of parameter " << par->
GetName() <<
" changed from "
234 << oldVar <<
" to " << par->
getVal() << endl;
237 parameters[
index].Fix();
238 constStatChange =
true;
241 <<
"RooAbsMinimizerFcn::synchronize: parameter " << par->
GetName() <<
" is now fixed." << endl;
247 if (oldVar != par->
getVal()) {
249 constValChange =
true;
253 <<
"RooAbsMinimizerFcn::synchronize: value of fixed parameter " << par->
GetName() <<
" changed from "
254 << oldVar <<
" to " << par->
getVal() << endl;
261 parameters[
index].Release();
262 constStatChange =
true;
266 <<
"RooAbsMinimizerFcn::synchronize: parameter " << par->
GetName() <<
" is now floating." << endl;
271 if (oldVar != par->
getVal() || oldVlo != pmin || oldVhi != pmax || oldVerr != pstep) {
273 parameters[
index].SetStepSize(pstep);
275 parameters[
index].SetLimits(pmin, pmax);
277 parameters[
index].SetLowerLimit(pmin);
279 parameters[
index].SetUpperLimit(pmax);
286 if (oldVar != par->
getVal()) {
288 <<
"RooAbsMinimizerFcn::synchronize: value of parameter " << par->
GetName() <<
" changed from "
289 << oldVar <<
" to " << par->
getVal() << endl;
291 if (oldVlo != pmin || oldVhi != pmax) {
293 <<
"RooAbsMinimizerFcn::synchronize: limits of parameter " << par->
GetName() <<
" changed from ["
294 << oldVlo <<
"," << oldVhi <<
"] to [" << pmin <<
"," << pmax <<
"]" << endl;
298 if (oldVerr != pstep && oldVerr != 0) {
300 <<
"RooAbsMinimizerFcn::synchronize: error/step size of parameter " << par->
GetName()
301 <<
" changed from " << oldVerr <<
" to " << pstep << endl;
351 if (eplus > 0 || eminus < 0) {
367 oocoutI(
_context, Minimization) <<
"RooAbsMinimizerFcn::setLogFile: closing previous log file" << endl;
374 oocoutI(
_context, Minimization) <<
"RooAbsMinimizerFcn::setLogFile: cannot open file " << inLogfile << endl;
388 for (
unsigned int i = 0; i <
_nDim; i++) {
402 if (par->getVal() !=
value) {
421 std::ostringstream msg;
422 if (
cfg().doEEWall) {
423 msg <<
"RooAbsMinimizerFcn: Minimized function has error status." << endl
424 <<
"Returning maximum FCN so far (" <<
_maxFCN
425 <<
") to force MIGRAD to back out of this region. Error log follows.\n";
427 msg <<
"RooAbsMinimizerFcn: Minimized function has error status but is ignored.\n";
430 msg <<
"Parameter values: ";
432 auto var =
static_cast<const RooRealVar *
>(par);
433 msg <<
"\t" << var->
GetName() <<
"=" << var->getVal();
447 const char *
name =
"minimizer_log_dataset";
463 oocoutI(
_context, Minimization) <<
"RooAbsMinimizerFcn::setOptimizeConst: deactivating const optimization"
469 oocoutI(
_context, Minimization) <<
"RooAbsMinimizerFcn::setOptimizeConst: activating const optimization"
475 oocoutI(
_context, Minimization) <<
"RooAbsMinimizerFcn::setOptimizeConst: const optimization already active"
479 oocoutI(
_context, Minimization) <<
"RooAbsMinimizerFcn::setOptimizeConst: const optimization wasn't active"
488 if (constStatChange) {
491 <<
"RooAbsMinimizerFcn::optimizeConstantTerms: set of constant parameters changed, rerunning const optimizer"
494 }
else if (constValChange) {
496 <<
"RooAbsMinimizerFcn::optimizeConstantTerms: constant parameter values changed, rerunning const optimizer"
505 std::vector<double> values;
506 values.reserve(
_nDim);
510 values.push_back(par->
getVal());
RooArgList * _floatParamList
RooArgList * _initConstParamList
RooArgList * _constParamList
RooArgList * _initFloatParamList
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
class containing the result of the fit and all the related information (fitted parameter values,...
double UpperError(unsigned int i) const
upper Minos error. If Minos has not run for parameter i return the parabolic error
double Error(unsigned int i) const
parameter error by index
double Value(unsigned int i) const
parameter value by index
double LowerError(unsigned int i) const
lower Minos error. If Minos has not run for parameter i return the parabolic error
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
bool isConstant() const
Check if the "Constant" attribute is set.
void setValueDirty()
Mark the element dirty. This forces a re-evaluation when a value is requested.
RooAbsCollection * selectByAttrib(const char *name, bool value) const
Create a subset of the current collection, consisting only of those elements with the specified attri...
void setOptimizeConst(Int_t flag)
std::unique_ptr< RooArgList > _floatParamList
bool SetLogFile(const char *inLogfile)
Change the file name for logging of a RooMinimizer of all MINUIT steppings through the parameter spac...
RooAbsMinimizerFcn(RooArgList paramList, RooMinimizer *context)
virtual bool Synchronize(std::vector< ROOT::Fit::ParameterSettings > ¶meters)
Like synchronizeParameterSettings, Synchronize informs Minuit through its parameter_settings vector o...
virtual void setOptimizeConstOnFunction(RooAbsArg::ConstOpCode opcode, bool doAlsoTrackingOpt)=0
This function must be overridden in the derived class to pass on constant term optimization configura...
void BackProp(const ROOT::Fit::FitResult &results)
Put Minuit results back into RooFit objects.
RooMinimizer::Config const & cfg() const
void finishDoEval() const
void optimizeConstantTerms(bool constStatChange, bool constValChange)
void printEvalErrors() const
Print information about why evaluation failed.
void ClearPdfParamAsymErr(Int_t index)
Modify PDF parameter error by ordinal index (needed by MINUIT)
std::vector< double > getParameterValues() const
void SetPdfParamErr(Int_t index, double value)
Modify PDF parameter error by ordinal index (needed by MINUIT)
bool synchronizeParameterSettings(std::vector< ROOT::Fit::ParameterSettings > ¶meters, bool optConst)
Informs Minuit through its parameter_settings vector of RooFit parameter properties.
void ApplyCovarianceMatrix(TMatrixDSym &V)
Set different external covariance matrix.
std::unique_ptr< RooArgList > _initConstParamList
std::unique_ptr< RooArgList > _constParamList
bool SetPdfParamVal(int index, double value) const
Set value of parameter i.
std::unique_ptr< RooArgList > _initFloatParamList
virtual double getMax(const char *name=nullptr) const
Get maximum of currently defined range.
bool hasMax(const char *name=nullptr) const
Check if variable has an upper bound.
virtual double getMin(const char *name=nullptr) const
Get minimum of currently defined range.
bool hasMin(const char *name=nullptr) const
Check if variable has a lower bound.
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
static void printEvalErrors(std::ostream &os=std::cout, Int_t maxPerNode=10000000)
Print all outstanding logged evaluation error on the given ostream.
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooMinimizer is a wrapper class around ROOT::Fit:Fitter that provides a seamless interface between th...
static int getPrintLevel()
Get the MINUIT internal printing level.
std::unique_ptr< RooDataSet > _logDataSet
std::unique_ptr< RooAbsReal::EvalErrorContext > makeEvalErrorContext() const
RooRealVar represents a variable that can be changed from the outside.
TClass * IsA() const override
Bool_t InheritsFrom(const char *cl) const override
Return kTRUE if this class inherits from a class with name "classname".
const char * GetName() const override
Returns name of object.
TClass * IsA() const override