70#if (__GNUC__==3&&__GNUC_MINOR__==2&&__GNUC_PATCHLEVEL__==3)
151 <<
" from list because it is not of type RooRealVar" << endl ;
427 if (minosParamList.
getSize()>0) {
435 arglist[nMinosPar]=index+1;
638 if (!oldpar) continue ;
648 constStatChange=
kTRUE ;
658 constValChange=
kTRUE ;
661 <<
" changed from " << oldpar->
getVal() <<
" to " << par->
getVal() << endl ;
672 for(index= 0; index <
_nPar; index++) {
685 <<
" is not of type RooRealVar, skipping" << endl ;
700 pstep= 0.1*(pmax-pmin);
703 if (pmax - par->
getVal() < 2*pstep) {
704 pstep = (pmax - par->
getVal())/2 ;
705 }
else if (par->
getVal() - pmin < 2*pstep) {
706 pstep = (par->
getVal() - pmin )/2 ;
711 pstep= 0.1*(pmax-pmin);
718 coutW(
Minimization) <<
"RooMinuit::synchronize: WARNING: no initial error estimate available for "
719 << par->
GetName() <<
": using " << pstep << endl;
728 Double_t oldVar,oldVerr,oldVlo,oldVhi ;
729 char oldParname[100] ;
745 if (oldVar!=par->
getVal()) {
747 arglist[0] = index+1 ;
748 arglist[1] = par->
getVal() ;
751 coutI(
Minimization) <<
"RooMinuit::synchronize: value of parameter " << par->
GetName() <<
" changed from " << oldVar <<
" to " << par->
getVal() << endl ;
756 constStatChange=
kTRUE ;
764 if (oldVar!=par->
getVal()) {
766 arglist[0] = index+1 ;
767 arglist[1] = par->
getVal() ;
769 constValChange=
kTRUE ;
772 coutI(
Minimization) <<
"RooMinuit::synchronize: value of fixed parameter " << par->
GetName() <<
" changed from " << oldVar <<
" to " << par->
getVal() << endl ;
780 constStatChange=
kTRUE ;
788 if (oldVar!=par->
getVal() || oldVlo!=pmin || oldVhi != pmax || oldVerr!=pstep) {
796 if (oldVar!=par->
getVal()) {
797 coutI(
Minimization) <<
"RooMinuit::synchronize: value of parameter " << par->
GetName() <<
" changed from " << oldVar <<
" to " << par->
getVal() << endl ;
799 if (oldVlo!=pmin || oldVhi!=pmax) {
800 coutI(
Minimization) <<
"RooMinuit::synchronize: limits of parameter " << par->
GetName() <<
" changed from [" << oldVlo <<
"," << oldVhi
801 <<
"] to [" << pmin <<
"," << pmax <<
"]" << endl ;
805 if (oldVerr!=pstep && oldVerr!=0) {
806 coutI(
Minimization) <<
"RooMinuit::synchronize: error/step size of parameter " << par->
GetName() <<
" changed from " << oldVerr <<
" to " << pstep << endl ;
818 if (constStatChange) {
822 coutI(
Minimization) <<
"RooMinuit::synchronize: set of constant parameters changed, rerunning const optimizer" << endl ;
824 }
else if (constValChange) {
825 coutI(
Minimization) <<
"RooMinuit::synchronize: constant parameter values changed, rerunning const optimizer" << endl ;
907 saveFloatFinalList.
remove(*par) ;
908 saveConstList.
add(*par) ;
911 saveConstList.
sort() ;
954 <<
") ERROR: " << var1.
GetName() <<
" is not a floating parameter of " <<
_func->
GetName() << endl ;
961 <<
") ERROR: " << var2.
GetName() <<
" is not a floating parameter of PDF " <<
_func->
GetName() << endl ;
976 n[0] = n1 ;
n[1] = n2 ;
n[2] = n3 ;
n[3] = n4 ;
n[4] = n5 ;
n[5] = n6 ;
979 for (
Int_t ic = 0 ; ic<6 ; ic++) {
986 coutE(
Minimization) <<
"RooMinuit::contour(" <<
GetName() <<
") ERROR: MINUIT did not return a contour graph for n=" <<
n[ic] << endl ;
989 graph->SetLineStyle(ic+1) ;
990 graph->SetLineWidth(2) ;
1018 coutI(
Minimization) <<
"RooMinuit::setLogFile: closing previous log file" << endl ;
1023 _logfile =
new ofstream(inLogfile) ;
1025 coutI(
Minimization) <<
"RooMinuit::setLogFile: cannot open file " << inLogfile << endl ;
1063 if (par->
getVal()!=value) {
1142 for(index= 0; index <
_nPar; index++) {
1150 if(
eplus > 0 || eminus < 0) {
1170 while((arg=iter.
next())) {
1193 cout <<
"setting parameter " << i <<
" error to " <<
sqrt((*
_extV)(i,i)) << endl ;
1209 ofstream* logf = context->
logfile() ;
1215 for(
Int_t index= 0; index < nPar; index++) {
1216 if (logf) (*logf) << par[index] <<
" " ;
1230 oocoutW(context,
Minimization) <<
"RooMinuitGlue: Minimized function has error status." << endl
1231 <<
"Returning maximum FCN so far (" << maxFCN
1232 <<
") to force MIGRAD to back out of this region. Error log follows" << endl ;
1234 oocoutW(context,
Minimization) <<
"RooMinuitGlue: Minimized function has error status but is ignored" << endl ;
1259 }
else if (
f>maxFCN) {
1264 if (logf) (*logf) << setprecision(15) <<
f << setprecision(4) << endl;
1266 cout <<
"\nprevFCN" << (context->
_func->
isOffsetting()?
"-offset":
"") <<
" = " << setprecision(10) <<
f << setprecision(4) <<
" " ;
void RooMinuitGlue(Int_t &, Double_t *, Double_t &f, Double_t *par, Int_t)
R__EXTERN TMinuit * gMinuit
char * Form(const char *fmt,...)
TString operator+(const TString &s1, const TString &s2)
Use the special concatenation constructor.
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
virtual void constOptimizeTestStatistic(ConstOpCode opcode, Bool_t doAlsoTrackingOpt=kTRUE)
Interface function signaling a request to perform constant term optimization.
Bool_t isConstant() const
RooFIter fwdIterator() const R__SUGGEST_ALTERNATIVE("begin()
One-time forward iterator.
void sort(Bool_t reverse=false)
Sort collection using std::sort and name comparison.
RooAbsCollection * snapshot(Bool_t deepCopy=kTRUE) const
Take a snap shot of current collection contents: An owning collection is returned containing clones o...
virtual RooAbsArg * addClone(const RooAbsArg &var, Bool_t silent=kFALSE)
Add a clone of the specified argument to list.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
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...
TIterator * createIterator(Bool_t dir=kIterForward) const R__SUGGEST_ALTERNATIVE("begin()
TIterator-style iteration over contained elements.
void setName(const char *name)
virtual Bool_t remove(const RooAbsArg &var, Bool_t silent=kFALSE, Bool_t matchByNameOnly=kFALSE)
Remove the specified argument from our list.
RooAbsArg * find(const char *name) const
Find object with given name in list.
static Bool_t evalError()
Return the evaluation error flag.
static void clearEvalError()
Clear the evaluation error flag.
virtual Double_t getMax(const char *name=0) const
Get maximum of currently defined range.
Bool_t hasMax(const char *name=0) const
Check if variable has an upper bound.
Bool_t hasMin(const char *name=0) const
Check if variable has a lower bound.
virtual Double_t getMin(const char *name=0) const
Get miniminum of currently defined range.
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.
virtual void enableOffsetting(Bool_t)
static Int_t numEvalErrors()
Return the number of logged evaluation errors since the last clearing.
static void setEvalErrorLoggingMode(ErrorLoggingMode m)
Set evaluation error logging mode.
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.
RooAbsArg * at(Int_t idx) const
Return object at given index, or nullptr if index is out of range.
Int_t index(const RooAbsArg *arg) const
Returns index of given arg, or -1 if arg is not in list.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
A one-time forward iterator working on RooLinkedList or RooAbsCollection.
RooAbsArg * next()
Return next element or nullptr if at end.
RooFitResult is a container class to hold the input and output of a PDF fit to a dataset.
void fillCorrMatrix()
Internal utility method to extract the correlation matrix and the global correlation coefficients fro...
void setCovQual(Int_t val)
void setMinNLL(Double_t val)
void setNumInvalidNLL(Int_t val)
void setStatus(Int_t val)
void setConstParList(const RooArgList &list)
Fill the list of constant parameters.
void setCovarianceMatrix(TMatrixDSym &V)
Store externally provided correlation matrix in this RooFitResult ;.
void setEDM(Double_t val)
void setStatusHistory(std::vector< std::pair< std::string, int > > &hist)
void setInitParList(const RooArgList &list)
Fill the list of initial values of the floating parameters.
void setFinalParList(const RooArgList &list)
Fill the list of final values of the floating parameters.
RooMinuit is a wrapper class around TFitter/TMinuit that provides a seamless interface between the MI...
void setPdfParamErr(Int_t index, Double_t value)
Modify PDF parameter error by ordinal index (needed by MINUIT)
Int_t hesse()
Execute HESSE.
Bool_t setLogFile(const char *logfile=0)
Change the file name for logging of a RooMinuit of all MINUIT steppings through the parameter space.
RooMinuit(RooAbsReal &function)
Construct MINUIT interface to given function.
void setVerbose(Bool_t flag=kTRUE)
RooArgList * _floatParamList
Bool_t _handleLocalErrors
void setProfile(Bool_t flag=kTRUE)
void optimizeConst(Int_t flag)
If flag is true, perform constant term optimization on function being minimized.
RooFitResult * save(const char *name=0, const char *title=0)
Save and return a RooFitResult snaphot of current minimizer status.
void setOffsetting(Bool_t flag)
Enable internal likelihood offsetting for enhanced numeric precision.
static void cleanup()
Cleanup method called by atexit handler installed by RooSentinel to delete all global heap objects wh...
Int_t seek()
Execute SEEK.
Int_t simplex()
Execute SIMPLEX.
Bool_t synchronize(Bool_t verbose)
Internal function to synchronize TMinuit with current information in RooAbsReal function parameters.
void setErrorLevel(Double_t level)
Set the level for MINUIT error analysis to the given value.
friend void RooMinuitGlue(Int_t &np, Double_t *gin, Double_t &f, Double_t *par, Int_t flag)
RooPlot * contour(RooRealVar &var1, RooRealVar &var2, Double_t n1=1, Double_t n2=2, Double_t n3=0, Double_t n4=0, Double_t n5=0, Double_t n6=0)
Create and draw a TH2 with the error contours in parameters var1 and v2 at up to 6 'sigma' settings w...
virtual Bool_t setPdfParamVal(Int_t index, Double_t value, Bool_t verbose=kFALSE)
Modify PDF parameter value by ordinal index (needed by MINUIT)
void saveStatus(const char *label, Int_t status)
void setStrategy(Int_t strat)
Change MINUIT strategy to istrat.
Int_t setPrintLevel(Int_t newLevel)
Change the MINUIT internal printing level.
std::vector< std::pair< std::string, int > > _statusHistory
std::vector< RooAbsArg * > _floatParamVec
Int_t migrad()
Execute MIGRAD.
std::ofstream * logfile() const
Int_t setWarnLevel(Int_t newLevel)
Set MINUIT warning level to given level.
void applyCovarianceMatrix(TMatrixDSym &V)
Apply results of given external covariance matrix.
void backProp()
Transfer MINUIT fit results back into RooFit objects.
Double_t getPdfParamErr(Int_t index)
Access PDF parameter error by ordinal index (needed by MINUIT)
RooArgList * _initConstParamList
void setEps(Double_t eps)
Change MINUIT epsilon.
RooArgList * _initFloatParamList
void profileStop()
Stop profiling timer and report results of last session.
Int_t minos()
Execute MINOS.
void clearPdfParamAsymErr(Int_t index)
Modify PDF parameter error by ordinal index (needed by MINUIT)
Int_t improve()
Execute IMPROVE.
void profileStart()
Start profiling timer.
void setNoWarn()
Instruct MINUIT to suppress warnings.
RooArgList * _constParamList
virtual ~RooMinuit()
Destructor.
RooFitResult * fit(const char *options)
Parse traditional RooAbsPdf::fitTo driver options.
Double_t getPdfParamVal(Int_t index)
Access PDF parameter value by ordinal index (needed by MINUIT)
static TVirtualFitter * _theFitter
static RooMsgService & instance()
Return reference to singleton instance.
A RooPlot is a plot frame and a container for graphics objects within that frame.
void addObject(TObject *obj, Option_t *drawOptions="", Bool_t invisible=kFALSE)
Add a generic object to this plot.
RooRealVar represents a fundamental (non-derived) real valued object.
Double_t getError() const
virtual void setVal(Double_t value)
Set value of variable to 'value'.
static void activate()
Install atexit handler that calls CleanupRooFitAtExit() on program termination.
A Graph is a graphics object made of two arrays X and Y with npoints each.
Iterator abstract base class.
virtual TObject * Next()=0
virtual Int_t SetErrorDef(Double_t up)
To get the n-sigma contour the error def parameter "up" has to set to n^2.
virtual TObject * Contour(Int_t npoints=10, Int_t pa1=0, Int_t pa2=1)
Creates a TGraph object describing the n-sigma contour of a TMinuit fit.
virtual const char * GetTitle() const
Returns title of object.
virtual const char * GetName() const
Returns name of object.
virtual const char * GetName() const
Returns name of object.
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
void Stop()
Stop the stopwatch.
void Print(Option_t *option="") const
Print the real and cpu time passed between the start and stop events.
void ToLower()
Change string to lower-case.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Abstract Base Class for Fitting.
virtual Int_t GetStats(Double_t &amin, Double_t &edm, Double_t &errdef, Int_t &nvpar, Int_t &nparx) const =0
virtual void SetObjectFit(TObject *obj)
virtual void ReleaseParameter(Int_t ipar)=0
virtual void SetFCN(void(*fcn)(Int_t &, Double_t *, Double_t &f, Double_t *, Int_t))
To set the address of the minimization objective function called by the native compiler (see function...
virtual Int_t SetParameter(Int_t ipar, const char *parname, Double_t value, Double_t verr, Double_t vlow, Double_t vhigh)=0
virtual void Clear(Option_t *option="")=0
Set name and title to empty strings ("").
virtual Int_t ExecuteCommand(const char *command, Double_t *args, Int_t nargs)=0
virtual Double_t GetParameter(Int_t ipar) const =0
virtual void FixParameter(Int_t ipar)=0
virtual Int_t GetErrors(Int_t ipar, Double_t &eplus, Double_t &eminus, Double_t &eparab, Double_t &globcc) const =0
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
static constexpr double eplus