14 #ifndef __ROOFIT_NOROOMINIMIZER 45 _funct(funct), _context(context),
47 _maxFCN(-1e30), _numBadNLL(0),
48 _printEvalErrors(10), _doEvalErrorWall(
kTRUE),
49 _nDim(0), _logfile(0),
79 <<
" from list because it is not of type RooRealVar" << endl;
161 constStatChange=
kTRUE ;
166 << par->
GetName() <<
" is now floating." << endl ;
172 constValChange=
kTRUE ;
176 <<
" changed from " << oldpar->
getVal() <<
" to " 177 << par->
getVal() << endl ;
203 <<
" is not of type RooRealVar, skipping" << endl ;
221 pstep= 0.1*(pmax-pmin);
224 if (pmax - par->
getVal() < 2*pstep) {
225 pstep = (pmax - par->
getVal())/2 ;
226 }
else if (par->
getVal() - pmin < 2*pstep) {
227 pstep = (par->
getVal() - pmin )/2 ;
232 pstep= 0.1*(pmax-pmin);
240 << par->
GetName() <<
": using " << pstep << endl;
249 if (index>=
Int_t(parameters.size())) {
262 parameters.back().SetLowerLimit(pmin);
264 parameters.back().SetUpperLimit(pmax);
271 Bool_t oldFixed = parameters[index].IsFixed();
272 Double_t oldVar = parameters[index].Value();
273 Double_t oldVerr = parameters[index].StepSize();
274 Double_t oldVlo = parameters[index].LowerLimit();
275 Double_t oldVhi = parameters[index].UpperLimit();
280 if (oldVar!=par->
getVal()) {
281 parameters[index].SetValue(par->
getVal());
284 << par->
GetName() <<
" changed from " << oldVar
285 <<
" to " << par->
getVal() << endl ;
288 parameters[index].Fix();
289 constStatChange=
kTRUE ;
292 << par->
GetName() <<
" is now fixed." << endl ;
298 if (oldVar!=par->
getVal()) {
299 parameters[index].SetValue(par->
getVal());
300 constValChange=
kTRUE ;
304 << par->
GetName() <<
" changed from " << oldVar
305 <<
" to " << par->
getVal() << endl ;
312 parameters[index].Release();
313 constStatChange=
kTRUE ;
317 << par->
GetName() <<
" is now floating." << endl ;
322 if (oldVar!=par->
getVal() || oldVlo!=pmin || oldVhi != pmax || oldVerr!=pstep) {
323 parameters[index].SetValue(par->
getVal());
324 parameters[index].SetStepSize(pstep);
326 parameters[index].SetLimits(pmin,pmax);
328 parameters[index].SetLowerLimit(pmin);
330 parameters[index].SetUpperLimit(pmax);
337 if (oldVar!=par->
getVal()) {
339 << par->
GetName() <<
" changed from " << oldVar <<
" to " 340 << par->
getVal() << endl ;
342 if (oldVlo!=pmin || oldVhi!=pmax) {
344 << par->
GetName() <<
" changed from [" << oldVlo <<
"," << oldVhi
345 <<
"] to [" << pmin <<
"," << pmax <<
"]" << endl ;
349 if (oldVerr!=pstep && oldVerr!=0) {
351 << par->
GetName() <<
" changed from " << oldVerr <<
" to " << pstep << endl ;
358 if (constStatChange) {
362 oocoutI(
_context,
Minimization) <<
"RooMinimizerFcn::synchronize: set of constant parameters changed, rerunning const optimizer" << endl ;
364 }
else if (constValChange) {
365 oocoutI(
_context,
Minimization) <<
"RooMinimizerFcn::synchronize: constant parameter values changed, rerunning const optimizer" << endl ;
422 for (
Int_t index= 0; index <
_nDim; index++) {
433 if(eplus > 0 || eminus < 0) {
456 _logfile =
new ofstream(inLogfile) ;
491 if (par->
getVal()!=value) {
512 while((arg=iter.
next())) {
523 for (
int index = 0; index <
_nDim; index++) {
524 if (
_logfile) (*_logfile) << x[index] <<
" " ;
539 <<
"Returning maximum FCN so far (" <<
_maxFCN 540 <<
") to force MIGRAD to back out of this region. Error log follows" << endl ;
573 (*_logfile) << setprecision(15) << fvalue << setprecision(4) << endl;
575 cout <<
"\nprevFCN" << (
_funct->
isOffsetting()?
"-offset":
"") <<
" = " << setprecision(10)
576 << fvalue << setprecision(4) <<
" " ;
RooMinimizerFcn(RooAbsReal *funct, RooMinimizer *context, bool verbose=false)
virtual Double_t getMin(const char *name=0) const
virtual const char * GetName() const
Returns name of object.
TIterator * createIterator(Bool_t dir=kIterForward) const
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
void sort(Bool_t reverse=kFALSE)
Bool_t hasMin(const char *name=0) const
virtual Double_t getMax(const char *name=0) const
virtual RooAbsArg * addClone(const RooAbsArg &var, Bool_t silent=kFALSE)
Add a clone of the specified argument to list.
This namespace contains pre-defined functions to be used in conjuction with TExecutor::Map and TExecu...
double Error(unsigned int i) const
parameter error by index
Bool_t SetLogFile(const char *inLogfile)
Double_t getVal(const RooArgSet *set=0) const
void BackProp(const ROOT::Fit::FitResult &results)
Class, describing value, limits and step size of the parameters Provides functionality also to set/re...
double Value(unsigned int i) const
parameter value by index
RooArgList * _initConstParamList
Bool_t hasMax(const char *name=0) const
static void clearEvalErrorLog()
Clear the stack of evaluation error messages.
virtual double DoEval(const double *x) const
Implementation of the evaluation function.
virtual ROOT::Math::IBaseFunctionMultiDim * Clone() const
Clone a function.
static void setHideOffset(Bool_t flag)
void SetPdfParamErr(Int_t index, Double_t value)
Iterator abstract base class.
RooArgList * _floatParamList
RooArgList * _initFloatParamList
static void setEvalErrorLoggingMode(ErrorLoggingMode m)
Set evaluation error logging mode.
RooAbsCollection * selectByAttrib(const char *name, Bool_t value) const
Create a subset of the current collection, consisting only of those elements with the specified attri...
if on multiple lines(like in C++). **The " * configuration fragment. * * The "import myobject continue
Parses the configuration file.
RooArgList * _constParamList
double LowerError(unsigned int i) const
lower Minos error. If Minos has not run for parameter i return the parabolic error ...
void ApplyCovarianceMatrix(TMatrixDSym &V)
Double_t GetPdfParamErr(Int_t index)
static void clearEvalError()
Clear the evaluation error flag.
RooRealVar represents a fundamental (non-derived) real valued object.
virtual void setVal(Double_t value)
Set value of variable to 'value'.
RooAbsCollection * snapshot(Bool_t deepCopy=kTRUE) const
Take a snap shot of current collection contents: An owning collection is returned containing clones o...
static Int_t numEvalErrors()
Return the number of logged evaluation errors since the last clearing.
RooAbsArg * at(Int_t idx) const
Bool_t Synchronize(std::vector< ROOT::Fit::ParameterSettings > ¶meters, Bool_t optConst, Bool_t verbose)
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
static void printEvalErrors(std::ostream &os=std::cout, Int_t maxPerNode=10000000)
Print all outstanding logged evaluation error on the given ostream.
double UpperError(unsigned int i) const
upper Minos error. If Minos has not run for parameter i return the parabolic error ...
void ClearPdfParamAsymErr(Int_t index)
class containg the result of the fit and all the related information (fitted parameter values...
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
RooFIter fwdIterator() const
RooArgSet * getParameters(const RooAbsData *data, Bool_t stripDisconnected=kTRUE) const
Create a list of leaf nodes in the arg tree starting with ourself as top node that don't match any of...
Double_t GetPdfParamVal(Int_t index)
Namespace for new Math classes and functions.
virtual ~RooMinimizerFcn()
virtual Bool_t remove(const RooAbsArg &var, Bool_t silent=kFALSE, Bool_t matchByNameOnly=kFALSE)
Remove the specified argument from our list.
RooMinimizer is a wrapper class around ROOT::Fit:Fitter that provides a seamless interface between th...
virtual void constOptimizeTestStatistic(ConstOpCode opcode, Bool_t doAlsoTrackingOpt=kTRUE)
Interface function signaling a request to perform constant term optimization.
static Bool_t evalError()
Return the evaluation error flag.
virtual TObject * Next()=0
void setName(const char *name)
std::vector< RooAbsArg * > _floatParamVec
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
Documentation for the abstract class IBaseFunctionMultiDim.
Double_t getError() const
virtual Bool_t isOffsetting() const
Bool_t SetPdfParamVal(const Int_t &index, const Double_t &value) const
Bool_t isConstant() const