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;
 
   79   : _context(other._context), _maxFCN(other._maxFCN), _funcOffset(other._funcOffset), _numBadNLL(other._numBadNLL),
 
   80     _evalCounter(other._evalCounter), _nDim(other._nDim), _optConst(other._optConst),
 
   81     _floatParamList(new 
RooArgList(*other._floatParamList)), _constParamList(new 
RooArgList(*other._constParamList)),
 
   82     _initFloatParamList(std::make_unique<
RooArgList>()), _initConstParamList(std::make_unique<
RooArgList>()),
 
   83     _logfile(other._logfile)
 
   94   bool constValChange(
false);
 
   95   bool constStatChange(
false);
 
  118         constStatChange = 
true;
 
  123               << 
"RooAbsMinimizerFcn::synchronize: parameter " << par->
GetName() << 
" is now floating." << endl;
 
  129         constValChange = 
true;
 
  132               << 
"RooAbsMinimizerFcn::synchronize: value of constant parameter " << par->
GetName() << 
" changed from " 
  157            oocoutW(
_context, Minimization) << 
"RooAbsMinimizerFcn::fit: Error, non-constant parameter " 
  158                                            << par->
GetName() << 
" is not of type RooRealVar, skipping" << endl;
 
  180               pstep = 0.1 * (pmax - pmin);
 
  183               if (pmax - par->
getVal() < 2 * pstep) {
 
  184                  pstep = (pmax - par->
getVal()) / 2;
 
  185               } 
else if (par->
getVal() - pmin < 2 * pstep) {
 
  186                  pstep = (par->
getVal() - pmin) / 2;
 
  191                  pstep = 0.1 * (pmax - pmin);
 
  199                  << 
"RooAbsMinimizerFcn::synchronize: WARNING: no initial error estimate available for " 
  200                  << par->
GetName() << 
": using " << pstep << endl;
 
  209      if (
index >= 
int(parameters.size())) {
 
  212            parameters.emplace_back(par->
GetName(), par->
getVal(), pstep, pmin, pmax);
 
  214            parameters.emplace_back(par->
GetName(), par->
getVal(), pstep);
 
  216               parameters.back().SetLowerLimit(pmin);
 
  218               parameters.back().SetUpperLimit(pmax);
 
  224      bool oldFixed = parameters[
index].IsFixed();
 
  225      double oldVar = parameters[
index].Value();
 
  226      double oldVerr = parameters[
index].StepSize();
 
  227      double oldVlo = parameters[
index].LowerLimit();
 
  228      double oldVhi = parameters[
index].UpperLimit();
 
  233         if (oldVar != par->
getVal()) {
 
  237                  << 
"RooAbsMinimizerFcn::synchronize: value of parameter " << par->
GetName() << 
" changed from " 
  238                  << oldVar << 
" to " << par->
getVal() << endl;
 
  241         parameters[
index].Fix();
 
  242         constStatChange = 
true;
 
  245               << 
"RooAbsMinimizerFcn::synchronize: parameter " << par->
GetName() << 
" is now fixed." << endl;
 
  251         if (oldVar != par->
getVal()) {
 
  253            constValChange = 
true;
 
  257                  << 
"RooAbsMinimizerFcn::synchronize: value of fixed parameter " << par->
GetName() << 
" changed from " 
  258                  << oldVar << 
" to " << par->
getVal() << endl;
 
  265            parameters[
index].Release();
 
  266            constStatChange = 
true;
 
  270                  << 
"RooAbsMinimizerFcn::synchronize: parameter " << par->
GetName() << 
" is now floating." << endl;
 
  275         if (oldVar != par->
getVal() || oldVlo != pmin || oldVhi != pmax || oldVerr != pstep) {
 
  277            parameters[
index].SetStepSize(pstep);
 
  279               parameters[
index].SetLimits(pmin, pmax);
 
  281               parameters[
index].SetLowerLimit(pmin);
 
  283               parameters[
index].SetUpperLimit(pmax);
 
  290            if (oldVar != par->
getVal()) {
 
  292                  << 
"RooAbsMinimizerFcn::synchronize: value of parameter " << par->
GetName() << 
" changed from " 
  293                  << oldVar << 
" to " << par->
getVal() << endl;
 
  295            if (oldVlo != pmin || oldVhi != pmax) {
 
  297                  << 
"RooAbsMinimizerFcn::synchronize: limits of parameter " << par->
GetName() << 
" changed from [" 
  298                  << oldVlo << 
"," << oldVhi << 
"] to [" << pmin << 
"," << pmax << 
"]" << endl;
 
  302            if (oldVerr != pstep && oldVerr != 0) {
 
  304                  << 
"RooAbsMinimizerFcn::synchronize: error/step size of parameter " << par->
GetName()
 
  305                  << 
" changed from " << oldVerr << 
" to " << pstep << endl;
 
  355      if (eplus > 0 || eminus < 0) {
 
  371      oocoutI(
_context, Minimization) << 
"RooAbsMinimizerFcn::setLogFile: closing previous log file" << endl;
 
  378      oocoutI(
_context, Minimization) << 
"RooAbsMinimizerFcn::setLogFile: cannot open file " << inLogfile << endl;
 
  392   for (
unsigned int i = 0; i < 
_nDim; i++) {
 
  406   if (par->getVal() != 
value) {
 
  425   std::ostringstream msg;
 
  426   if (
cfg().doEEWall) {
 
  427      msg << 
"RooAbsMinimizerFcn: Minimized function has error status." << endl
 
  428          << 
"Returning maximum FCN so far (" << 
_maxFCN 
  429          << 
") to force MIGRAD to back out of this region. Error log follows.\n";
 
  431      msg << 
"RooAbsMinimizerFcn: Minimized function has error status but is ignored.\n";
 
  434   msg << 
"Parameter values: ";
 
  436      auto var = 
static_cast<const RooRealVar *
>(par);
 
  437      msg << 
"\t" << var->
GetName() << 
"=" << var->getVal();
 
  451         const char *
name = 
"minimizer_log_dataset";
 
  467         oocoutI(
_context, Minimization) << 
"RooAbsMinimizerFcn::setOptimizeConst: deactivating const optimization" 
  473         oocoutI(
_context, Minimization) << 
"RooAbsMinimizerFcn::setOptimizeConst: activating const optimization" 
  479         oocoutI(
_context, Minimization) << 
"RooAbsMinimizerFcn::setOptimizeConst: const optimization already active" 
  483         oocoutI(
_context, Minimization) << 
"RooAbsMinimizerFcn::setOptimizeConst: const optimization wasn't active" 
  492   if (constStatChange) {
 
  495         << 
"RooAbsMinimizerFcn::optimizeConstantTerms: set of constant parameters changed, rerunning const optimizer" 
  498   } 
else if (constValChange) {
 
  500         << 
"RooAbsMinimizerFcn::optimizeConstantTerms: constant parameter values changed, rerunning const optimizer" 
  509   std::vector<double> values;
 
  510   values.reserve(
_nDim);
 
  514      values.push_back(par->
getVal());
 
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
Common abstract base class for objects that represent a value and a "shape" in RooFit.
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