ROOT 6.14/05 Reference Guide |
RooMinuit is a wrapper class around TFitter/TMinuit that provides a seamless interface between the MINUIT functionality and the native RooFit interface.
RooMinuit can minimize any RooAbsReal function with respect to its parameters. Usual choices for minimization are RooNLLVar and RooChi2Var RooMinuit has methods corresponding to MINUIT functions like hesse(), migrad(), minos() etc. In each of these function calls the state of the MINUIT engine is synchronized with the state of the RooFit variables: any change in variables, change in the constant status etc is forwarded to MINUIT prior to execution of the MINUIT call. Afterwards the RooFit objects are resynchronized with the output state of MINUIT: changes parameter values, errors are propagated. Various methods are available to control verbosity, profiling, automatic PDF optimization.
Definition at line 39 of file RooMinuit.h.
Public Types | |
enum | PrintLevel { None =-1, Reduced =0, Normal =1, ExtraForProblem =2, Maximum =3 } |
enum | Strategy { Speed =0, Balance =1, Robustness =2 } |
Public Types inherited from TObject | |
enum | { kIsOnHeap = 0x01000000, kNotDeleted = 0x02000000, kZombie = 0x04000000, kInconsistent = 0x08000000, kBitMask = 0x00ffffff } |
enum | { kSingleKey = BIT(0), kOverwrite = BIT(1), kWriteDelete = BIT(2) } |
enum | EDeprecatedStatusBits { kObjInCanvas = BIT(3) } |
enum | EStatusBits { kCanDelete = BIT(0), kMustCleanup = BIT(3), kIsReferenced = BIT(4), kHasUUID = BIT(5), kCannotPick = BIT(6), kNoContextMenu = BIT(8), kInvalidObject = BIT(13) } |
Public Member Functions | |
RooMinuit (RooAbsReal &function) | |
Construct MINUIT interface to given function. More... | |
virtual | ~RooMinuit () |
Destructor. More... | |
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 where 'sigma' is calculated as n*n*errorLevel. More... | |
Int_t | evalCounter () const |
RooFitResult * | fit (const char *options) |
Parse traditional RooAbsPdf::fitTo driver options. More... | |
Int_t | hesse () |
Execute HESSE. More... | |
Int_t | improve () |
Execute IMPROVE. More... | |
Int_t | migrad () |
Execute MIGRAD. More... | |
Int_t | minos () |
Execute MINOS. More... | |
Int_t | minos (const RooArgSet &minosParamList) |
Execute MINOS for given list of parameters. More... | |
void | optimizeConst (Int_t flag) |
If flag is true, perform constant term optimization on function being minimized. More... | |
RooFitResult * | save (const char *name=0, const char *title=0) |
Save and return a RooFitResult snaphot of current minimizer status. More... | |
Int_t | seek () |
Execute SEEK. More... | |
void | setEps (Double_t eps) |
Change MINUIT epsilon. More... | |
void | setErrorLevel (Double_t level) |
Set the level for MINUIT error analysis to the given value. More... | |
void | setEvalErrorWall (Bool_t flag) |
Bool_t | setLogFile (const char *logfile=0) |
Change the file name for logging of a RooMinuit of all MINUIT steppings through the parameter space. More... | |
void | setMaxEvalMultiplier (Int_t n) |
void | setNoWarn () |
Instruct MINUIT to suppress warnings. More... | |
void | setOffsetting (Bool_t flag) |
Enable internal likelihood offsetting for enhanced numeric precision. More... | |
void | setPrintEvalErrors (Int_t numEvalErrors) |
Int_t | setPrintLevel (Int_t newLevel) |
Change the MINUIT internal printing level. More... | |
void | setProfile (Bool_t flag=kTRUE) |
void | setStrategy (Int_t strat) |
Change MINUIT strategy to istrat. More... | |
void | setVerbose (Bool_t flag=kTRUE) |
Int_t | setWarnLevel (Int_t newLevel) |
Set MINUIT warning level to given level. More... | |
Int_t | simplex () |
Execute SIMPLEX. More... | |
void | zeroEvalCount () |
Public Member Functions inherited from TObject | |
TObject () | |
TObject constructor. More... | |
TObject (const TObject &object) | |
TObject copy ctor. More... | |
virtual | ~TObject () |
TObject destructor. More... | |
void | AbstractMethod (const char *method) const |
Use this method to implement an "abstract" method that you don't want to leave purely abstract. More... | |
virtual void | AppendPad (Option_t *option="") |
Append graphics object to current pad. More... | |
virtual void | Browse (TBrowser *b) |
Browse object. May be overridden for another default action. More... | |
ULong_t | CheckedHash () |
Checked and record whether for this class has a consistent Hash/RecursiveRemove setup (*) and then return the regular Hash value for this object. More... | |
virtual const char * | ClassName () const |
Returns name of class to which the object belongs. More... | |
virtual void | Clear (Option_t *="") |
virtual TObject * | Clone (const char *newname="") const |
Make a clone of an object using the Streamer facility. More... | |
virtual Int_t | Compare (const TObject *obj) const |
Compare abstract method. More... | |
virtual void | Copy (TObject &object) const |
Copy this to obj. More... | |
virtual void | Delete (Option_t *option="") |
Delete this object. More... | |
virtual Int_t | DistancetoPrimitive (Int_t px, Int_t py) |
Computes distance from point (px,py) to the object. More... | |
virtual void | Draw (Option_t *option="") |
Default Draw method for all objects. More... | |
virtual void | DrawClass () const |
Draw class inheritance tree of the class to which this object belongs. More... | |
virtual TObject * | DrawClone (Option_t *option="") const |
Draw a clone of this object in the current selected pad for instance with: gROOT->SetSelectedPad(gPad) . More... | |
virtual void | Dump () const |
Dump contents of object on stdout. More... | |
virtual void | Error (const char *method, const char *msgfmt,...) const |
Issue error message. More... | |
virtual void | Execute (const char *method, const char *params, Int_t *error=0) |
Execute method on this object with the given parameter string, e.g. More... | |
virtual void | Execute (TMethod *method, TObjArray *params, Int_t *error=0) |
Execute method on this object with parameters stored in the TObjArray. More... | |
virtual void | ExecuteEvent (Int_t event, Int_t px, Int_t py) |
Execute action corresponding to an event at (px,py). More... | |
virtual void | Fatal (const char *method, const char *msgfmt,...) const |
Issue fatal error message. More... | |
virtual TObject * | FindObject (const char *name) const |
Must be redefined in derived classes. More... | |
virtual TObject * | FindObject (const TObject *obj) const |
Must be redefined in derived classes. More... | |
virtual Option_t * | GetDrawOption () const |
Get option used by the graphics system to draw this object. More... | |
virtual const char * | GetIconName () const |
Returns mime type name of object. More... | |
virtual const char * | GetName () const |
Returns name of object. More... | |
virtual char * | GetObjectInfo (Int_t px, Int_t py) const |
Returns string containing info about the object at position (px,py). More... | |
virtual Option_t * | GetOption () const |
virtual const char * | GetTitle () const |
Returns title of object. More... | |
virtual UInt_t | GetUniqueID () const |
Return the unique object id. More... | |
virtual Bool_t | HandleTimer (TTimer *timer) |
Execute action in response of a timer timing out. More... | |
virtual ULong_t | Hash () const |
Return hash value for this object. More... | |
Bool_t | HasInconsistentHash () const |
Return true is the type of this object is known to have an inconsistent setup for Hash and RecursiveRemove (i.e. More... | |
virtual void | Info (const char *method, const char *msgfmt,...) const |
Issue info message. More... | |
virtual Bool_t | InheritsFrom (const char *classname) const |
Returns kTRUE if object inherits from class "classname". More... | |
virtual Bool_t | InheritsFrom (const TClass *cl) const |
Returns kTRUE if object inherits from TClass cl. More... | |
virtual void | Inspect () const |
Dump contents of this object in a graphics canvas. More... | |
void | InvertBit (UInt_t f) |
virtual Bool_t | IsEqual (const TObject *obj) const |
Default equal comparison (objects are equal if they have the same address in memory). More... | |
virtual Bool_t | IsFolder () const |
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects). More... | |
R__ALWAYS_INLINE Bool_t | IsOnHeap () const |
virtual Bool_t | IsSortable () const |
R__ALWAYS_INLINE Bool_t | IsZombie () const |
virtual void | ls (Option_t *option="") const |
The ls function lists the contents of a class on stdout. More... | |
void | MayNotUse (const char *method) const |
Use this method to signal that a method (defined in a base class) may not be called in a derived class (in principle against good design since a child class should not provide less functionality than its parent, however, sometimes it is necessary). More... | |
virtual Bool_t | Notify () |
This method must be overridden to handle object notification. More... | |
void | Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const |
Use this method to declare a method obsolete. More... | |
void | operator delete (void *ptr) |
Operator delete. More... | |
void | operator delete[] (void *ptr) |
Operator delete []. More... | |
void * | operator new (size_t sz) |
void * | operator new (size_t sz, void *vp) |
void * | operator new[] (size_t sz) |
void * | operator new[] (size_t sz, void *vp) |
TObject & | operator= (const TObject &rhs) |
TObject assignment operator. More... | |
virtual void | Paint (Option_t *option="") |
This method must be overridden if a class wants to paint itself. More... | |
virtual void | Pop () |
Pop on object drawn in a pad to the top of the display list. More... | |
virtual void | Print (Option_t *option="") const |
This method must be overridden when a class wants to print itself. More... | |
virtual Int_t | Read (const char *name) |
Read contents of object with specified name from the current directory. More... | |
virtual void | RecursiveRemove (TObject *obj) |
Recursively remove this object from a list. More... | |
void | ResetBit (UInt_t f) |
virtual void | SaveAs (const char *filename="", Option_t *option="") const |
Save this object in the file specified by filename. More... | |
virtual void | SavePrimitive (std::ostream &out, Option_t *option="") |
Save a primitive as a C++ statement(s) on output stream "out". More... | |
void | SetBit (UInt_t f, Bool_t set) |
Set or unset the user status bits as specified in f. More... | |
void | SetBit (UInt_t f) |
virtual void | SetDrawOption (Option_t *option="") |
Set drawing option for object. More... | |
virtual void | SetUniqueID (UInt_t uid) |
Set the unique object id. More... | |
virtual void | SysError (const char *method, const char *msgfmt,...) const |
Issue system error message. More... | |
R__ALWAYS_INLINE Bool_t | TestBit (UInt_t f) const |
Int_t | TestBits (UInt_t f) const |
virtual void | UseCurrentStyle () |
Set current style settings in this object This function is called when either TCanvas::UseCurrentStyle or TROOT::ForceStyle have been invoked. More... | |
virtual void | Warning (const char *method, const char *msgfmt,...) const |
Issue warning message. More... | |
virtual Int_t | Write (const char *name=0, Int_t option=0, Int_t bufsize=0) |
Write this object to the current directory. More... | |
virtual Int_t | Write (const char *name=0, Int_t option=0, Int_t bufsize=0) const |
Write this object to the current directory. More... | |
Static Public Member Functions | |
static void | cleanup () |
Cleanup method called by atexit handler installed by RooSentinel to delete all global heap objects when the program is terminated. More... | |
Static Public Member Functions inherited from TObject | |
static Long_t | GetDtorOnly () |
Return destructor only flag. More... | |
static Bool_t | GetObjectStat () |
Get status of object stat flag. More... | |
static void | SetDtorOnly (void *obj) |
Set destructor only flag. More... | |
static void | SetObjectStat (Bool_t stat) |
Turn on/off tracking of objects in the TObjectTable. More... | |
Protected Member Functions | |
void | applyCovarianceMatrix (TMatrixDSym &V) |
Apply results of given external covariance matrix. More... | |
void | backProp () |
Transfer MINUIT fit results back into RooFit objects. More... | |
void | clearPdfParamAsymErr (Int_t index) |
Modify PDF parameter error by ordinal index (needed by MINUIT) More... | |
Int_t | getNPar () const |
Double_t | getPdfParamErr (Int_t index) |
Access PDF parameter error by ordinal index (needed by MINUIT) More... | |
Double_t | getPdfParamVal (Int_t index) |
Access PDF parameter value by ordinal index (needed by MINUIT) More... | |
std::ofstream * | logfile () const |
Double_t & | maxFCN () |
void | profileStart () |
Start profiling timer. More... | |
void | profileStop () |
Stop profiling timer and report results of last session. More... | |
void | saveStatus (const char *label, Int_t status) |
void | setPdfParamErr (Int_t index, Double_t value) |
Modify PDF parameter error by ordinal index (needed by MINUIT) More... | |
void | setPdfParamErr (Int_t index, Double_t loVal, Double_t hiVal) |
Modify PDF parameter error by ordinal index (needed by MINUIT) More... | |
virtual Bool_t | setPdfParamVal (Int_t index, Double_t value, Bool_t verbose=kFALSE) |
Modify PDF parameter value by ordinal index (needed by MINUIT) More... | |
Bool_t | synchronize (Bool_t verbose) |
Internal function to synchronize TMinuit with current information in RooAbsReal function parameters. More... | |
void | updateFloatVec () |
Protected Member Functions inherited from TObject | |
virtual void | DoError (int level, const char *location, const char *fmt, va_list va) const |
Interface to ErrorHandler (protected). More... | |
void | MakeZombie () |
Private Member Functions | |
RooMinuit (const RooMinuit &) | |
Private Attributes | |
RooArgList * | _constParamList |
TStopwatch | _cumulTimer |
Bool_t | _doEvalErrorWall |
Int_t | _evalCounter |
TMatrixDSym * | _extV |
RooArgList * | _floatParamList |
std::vector< RooAbsArg * > | _floatParamVec |
RooAbsReal * | _func |
Bool_t | _handleLocalErrors |
RooArgList * | _initConstParamList |
RooArgList * | _initFloatParamList |
std::ofstream * | _logfile |
Int_t | _maxEvalMult |
Double_t | _maxFCN |
Int_t | _nPar |
Int_t | _numBadNLL |
Int_t | _optConst |
Int_t | _printEvalErrors |
Int_t | _printLevel |
Bool_t | _profile |
Int_t | _status |
std::vector< std::pair< std::string, int > > | _statusHistory |
TStopwatch | _timer |
Bool_t | _verbose |
Int_t | _warnLevel |
Static Private Attributes | |
static TVirtualFitter * | _theFitter = 0 |
Friends | |
class | RooAbsPdf |
void | RooMinuitGlue (Int_t &np, Double_t *gin, Double_t &f, Double_t *par, Int_t flag) |
#include <RooMinuit.h>
Enumerator | |
---|---|
None | |
Reduced | |
Normal | |
ExtraForProblem | |
Maximum |
Definition at line 46 of file RooMinuit.h.
enum RooMinuit::Strategy |
Enumerator | |
---|---|
Speed | |
Balance | |
Robustness |
Definition at line 45 of file RooMinuit.h.
RooMinuit::RooMinuit | ( | RooAbsReal & | function | ) |
Construct MINUIT interface to given function.
Function can be anything, but is typically a -log(likelihood) implemented by RooNLLVar or a chi^2 (implemented by RooChi2Var). Other frequent use cases are a RooAddition of a RooNLLVar plus a penalty or constraint term. This class propagates all RooFit information (floating parameters, their values and errors) to MINUIT before each MINUIT call and propagates all MINUIT information back to the RooFit object at the end of each call (updated parameter values, their (asymmetric errors) etc. The default MINUIT error level for HESSE and MINOS error analysis is taken from the defaultErrorLevel() value of the input function.
Definition at line 109 of file RooMinuit.cxx.
|
virtual |
Destructor.
Definition at line 202 of file RooMinuit.cxx.
|
private |
|
protected |
Apply results of given external covariance matrix.
i.e. propagate its errors to all RRV parameter representations and give this matrix instead of the HESSE matrix at the next save() call
Definition at line 1182 of file RooMinuit.cxx.
|
protected |
Transfer MINUIT fit results back into RooFit objects.
Definition at line 1137 of file RooMinuit.cxx.
|
static |
Cleanup method called by atexit handler installed by RooSentinel to delete all global heap objects when the program is terminated.
Definition at line 87 of file RooMinuit.cxx.
Modify PDF parameter error by ordinal index (needed by MINUIT)
Definition at line 1087 of file RooMinuit.cxx.
RooPlot * RooMinuit::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 where 'sigma' is calculated as n*n*errorLevel.
Definition at line 943 of file RooMinuit.cxx.
|
inline |
Definition at line 80 of file RooMinuit.h.
RooFitResult * RooMinuit::fit | ( | const char * | options | ) |
Parse traditional RooAbsPdf::fitTo driver options.
s - Run Hesse first to estimate initial step size m - Run Migrad only h - Run Hesse to estimate errors v - Verbose mode l - Log parameters after each Minuit steps to file t - Activate profile timer r - Save fit result 0 - Run Migrad with strategy 0
Definition at line 273 of file RooMinuit.cxx.
|
inlineprotected |
Definition at line 96 of file RooMinuit.h.
Access PDF parameter error by ordinal index (needed by MINUIT)
Definition at line 1048 of file RooMinuit.cxx.
Access PDF parameter value by ordinal index (needed by MINUIT)
Definition at line 1038 of file RooMinuit.cxx.
Int_t RooMinuit::hesse | ( | ) |
Execute HESSE.
Changes in parameter values and calculated errors are automatically propagated back the RooRealVars representing the floating parameters in the MINUIT operation
Definition at line 343 of file RooMinuit.cxx.
Int_t RooMinuit::improve | ( | ) |
Execute IMPROVE.
Changes in parameter values and calculated errors are automatically propagated back the RooRealVars representing the floating parameters in the MINUIT operation
Definition at line 539 of file RooMinuit.cxx.
|
inlineprotected |
Definition at line 97 of file RooMinuit.h.
|
inlineprotected |
Definition at line 98 of file RooMinuit.h.
Int_t RooMinuit::migrad | ( | ) |
Execute MIGRAD.
Changes in parameter values and calculated errors are automatically propagated back the RooRealVars representing the floating parameters in the MINUIT operation
Definition at line 309 of file RooMinuit.cxx.
Int_t RooMinuit::minos | ( | ) |
Execute MINOS.
Changes in parameter values and calculated errors are automatically propagated back the RooRealVars representing the floating parameters in the MINUIT operation
Definition at line 376 of file RooMinuit.cxx.
Execute MINOS for given list of parameters.
Changes in parameter values and calculated errors are automatically propagated back the RooRealVars representing the floating parameters in the MINUIT operation
Definition at line 416 of file RooMinuit.cxx.
If flag is true, perform constant term optimization on function being minimized.
Definition at line 845 of file RooMinuit.cxx.
|
protected |
Start profiling timer.
Definition at line 1106 of file RooMinuit.cxx.
|
protected |
Stop profiling timer and report results of last session.
Definition at line 1120 of file RooMinuit.cxx.
RooFitResult * RooMinuit::save | ( | const char * | userName = 0 , |
const char * | userTitle = 0 |
||
) |
Save and return a RooFitResult snaphot of current minimizer status.
This snapshot contains the values of all constant parameters, the value of all floating parameters at RooMinuit construction and after the last MINUIT operation, the MINUIT status, variance quality, EDM setting, number of calls with evaluation problems, the minimized function value and the full correlation matrix
Definition at line 877 of file RooMinuit.cxx.
Definition at line 107 of file RooMinuit.h.
Int_t RooMinuit::seek | ( | ) |
Execute SEEK.
Changes in parameter values and calculated errors are automatically propagated back the RooRealVars representing the floating parameters in the MINUIT operation
Definition at line 472 of file RooMinuit.cxx.
Change MINUIT epsilon.
Definition at line 245 of file RooMinuit.cxx.
Set the level for MINUIT error analysis to the given value.
This function overrides the default value that is taken in the RooMinuit constructor from the defaultErrorLevel() method of the input function
Definition at line 235 of file RooMinuit.cxx.
Definition at line 51 of file RooMinuit.h.
Bool_t RooMinuit::setLogFile | ( | const char * | inLogfile = 0 | ) |
Change the file name for logging of a RooMinuit of all MINUIT steppings through the parameter space.
If inLogfile is null, the current log file is closed and logging is stopped.
Definition at line 1015 of file RooMinuit.cxx.
Definition at line 75 of file RooMinuit.h.
void RooMinuit::setNoWarn | ( | ) |
Instruct MINUIT to suppress warnings.
Definition at line 583 of file RooMinuit.cxx.
Enable internal likelihood offsetting for enhanced numeric precision.
Definition at line 255 of file RooMinuit.cxx.
Modify PDF parameter error by ordinal index (needed by MINUIT)
Definition at line 1077 of file RooMinuit.cxx.
Modify PDF parameter error by ordinal index (needed by MINUIT)
Definition at line 1096 of file RooMinuit.cxx.
|
protectedvirtual |
Modify PDF parameter value by ordinal index (needed by MINUIT)
Definition at line 1058 of file RooMinuit.cxx.
Definition at line 72 of file RooMinuit.h.
Change the MINUIT internal printing level.
Definition at line 569 of file RooMinuit.cxx.
Definition at line 74 of file RooMinuit.h.
Change MINUIT strategy to istrat.
Accepted codes are 0,1,2 and represent MINUIT strategies for dealing most efficiently with fast FCNs (0), expensive FCNs (2) and 'intermediate' FCNs (1)
Definition at line 221 of file RooMinuit.cxx.
Definition at line 73 of file RooMinuit.h.
Set MINUIT warning level to given level.
Definition at line 595 of file RooMinuit.cxx.
Int_t RooMinuit::simplex | ( | ) |
Execute SIMPLEX.
Changes in parameter values and calculated errors are automatically propagated back the RooRealVars representing the floating parameters in the MINUIT operation
Definition at line 505 of file RooMinuit.cxx.
Internal function to synchronize TMinuit with current information in RooAbsReal function parameters.
Definition at line 621 of file RooMinuit.cxx.
|
protected |
Definition at line 1163 of file RooMinuit.cxx.
|
inline |
Definition at line 81 of file RooMinuit.h.
|
friend |
Definition at line 85 of file RooMinuit.h.
Definition at line 1202 of file RooMinuit.cxx.
|
private |
Definition at line 128 of file RooMinuit.h.
|
private |
Definition at line 136 of file RooMinuit.h.
|
private |
Definition at line 123 of file RooMinuit.h.
|
private |
Definition at line 113 of file RooMinuit.h.
|
private |
Definition at line 138 of file RooMinuit.h.
|
private |
Definition at line 125 of file RooMinuit.h.
|
private |
Definition at line 126 of file RooMinuit.h.
|
private |
Definition at line 130 of file RooMinuit.h.
|
private |
Definition at line 119 of file RooMinuit.h.
|
private |
Definition at line 129 of file RooMinuit.h.
|
private |
Definition at line 127 of file RooMinuit.h.
|
private |
Definition at line 133 of file RooMinuit.h.
|
private |
Definition at line 124 of file RooMinuit.h.
|
private |
Definition at line 132 of file RooMinuit.h.
|
private |
Definition at line 121 of file RooMinuit.h.
|
private |
Definition at line 120 of file RooMinuit.h.
|
private |
Definition at line 117 of file RooMinuit.h.
|
private |
Definition at line 122 of file RooMinuit.h.
|
private |
Definition at line 114 of file RooMinuit.h.
|
private |
Definition at line 118 of file RooMinuit.h.
|
private |
Definition at line 116 of file RooMinuit.h.
|
private |
Definition at line 142 of file RooMinuit.h.
|
staticprivate |
Definition at line 140 of file RooMinuit.h.
|
private |
Definition at line 135 of file RooMinuit.h.
|
private |
Definition at line 134 of file RooMinuit.h.
|
private |
Definition at line 115 of file RooMinuit.h.