ROOT logo
ROOT » ROOFIT » ROOFITCORE » RooMinuit

class RooMinuit: public TObject



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.


Function Members (Methods)

public:
RooMinuit(RooAbsReal& function)
virtual~RooMinuit()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
static voidcleanup()
virtual voidTObject::Clear(Option_t* = "")
virtual TObject*TObject::Clone(const char* newname = "") const
virtual Int_tTObject::Compare(const TObject* obj) const
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)
virtual voidTObject::Copy(TObject& object) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
Int_tevalCounter() const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
RooFitResult*fit(const char* options)
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual const char*TObject::GetIconName() const
virtual const char*TObject::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
virtual const char*TObject::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTObject::Hash() const
Int_thesse()
Int_timprove()
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTObject::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTObject::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
Int_tmigrad()
Int_tminos()
Int_tminos(const RooArgSet& minosParamList)
virtual Bool_tTObject::Notify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
RooMinuit&operator=(const RooMinuit&)
voidoptimizeConst(Int_t flag)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTObject::Print(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidTObject::ResetBit(UInt_t f)
RooFitResult*save(const char* name = 0, const char* title = 0)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(ostream& out, Option_t* option = "")
Int_tseek()
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
voidsetEps(Double_t eps)
voidsetErrorLevel(Double_t level)
voidsetEvalErrorWall(Bool_t flag)
Bool_tsetLogFile(const char* logfile = 0)
voidsetMaxEvalMultiplier(Int_t n)
voidsetNoWarn()
static voidTObject::SetObjectStat(Bool_t stat)
voidsetOffsetting(Bool_t flag)
voidsetPrintEvalErrors(Int_t numEvalErrors)
Int_tsetPrintLevel(Int_t newLevel)
voidsetProfile(Bool_t flag = kTRUE)
voidsetStrategy(Int_t strat)
virtual voidTObject::SetUniqueID(UInt_t uid)
voidsetVerbose(Bool_t flag = kTRUE)
Int_tsetWarnLevel(Int_t newLevel)
virtual voidShowMembers(TMemberInspector&)
Int_tsimplex()
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
voidzeroEvalCount()
protected:
voidapplyCovarianceMatrix(TMatrixDSym& V)
voidbackProp()
voidclearPdfParamAsymErr(Int_t index)
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
Int_tgetNPar() const
Double_tgetPdfParamErr(Int_t index)
Double_tgetPdfParamVal(Int_t index)
ofstream*logfile() const
voidTObject::MakeZombie()
Double_t&maxFCN()
voidprofileStart()
voidprofileStop()
voidsaveStatus(const char* label, Int_t status)
voidsetPdfParamErr(Int_t index, Double_t value)
voidsetPdfParamErr(Int_t index, Double_t loVal, Double_t hiVal)
virtual Bool_tsetPdfParamVal(Int_t index, Double_t value, Bool_t verbose = kFALSE)
Bool_tsynchronize(Bool_t verbose)
voidupdateFloatVec()
private:
RooMinuit(const RooMinuit&)

Data Members

public:
enum Strategy { Speed
Balance
Robustness
};
enum PrintLevel { None
Reduced
Normal
ExtraForProblem
Maximum
};
enum TObject::EStatusBits { kCanDelete
kMustCleanup
kObjInCanvas
kIsReferenced
kHasUUID
kCannotPick
kNoContextMenu
kInvalidObject
};
enum TObject::[unnamed] { kIsOnHeap
kNotDeleted
kZombie
kBitMask
kSingleKey
kOverwrite
kWriteDelete
};
private:
RooArgList*_constParamList
TStopwatch_cumulTimer
Bool_t_doEvalErrorWall
Int_t_evalCounter
TMatrixDSym*_extV
RooArgList*_floatParamList
vector<RooAbsArg*>_floatParamVec
RooAbsReal*_func
Bool_t_handleLocalErrors
RooArgList*_initConstParamList
RooArgList*_initFloatParamList
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
vector<std::pair<std::string,int> >_statusHistory
static TVirtualFitter*_theFitter
TStopwatch_timer
Bool_t_verbose
Int_t_warnLevel

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

void cleanup()
 Cleanup method called by atexit handler installed by RooSentinel
 to delete all global heap objects when the program is terminated
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.
~RooMinuit()
 Destructor
void setStrategy(Int_t strat)
 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)
void setErrorLevel(Double_t level)
 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
void setEps(Double_t eps)
 Change MINUIT epsilon
void setOffsetting(Bool_t flag)
 Enable internal likelihood offsetting for enhanced numeric precision
RooFitResult* 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
Int_t migrad()
 Execute MIGRAD. Changes in parameter values
 and calculated errors are automatically
 propagated back the RooRealVars representing
 the floating parameters in the MINUIT operation
Int_t hesse()
 Execute HESSE. Changes in parameter values
 and calculated errors are automatically
 propagated back the RooRealVars representing
 the floating parameters in the MINUIT operation
Int_t minos()
 Execute MINOS. Changes in parameter values
 and calculated errors are automatically
 propagated back the RooRealVars representing
 the floating parameters in the MINUIT operation
Int_t minos(const RooArgSet& minosParamList)
 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
Int_t seek()
 Execute SEEK. Changes in parameter values
 and calculated errors are automatically
 propagated back the RooRealVars representing
 the floating parameters in the MINUIT operation
Int_t simplex()
 Execute SIMPLEX. Changes in parameter values
 and calculated errors are automatically
 propagated back the RooRealVars representing
 the floating parameters in the MINUIT operation
Int_t improve()
 Execute IMPROVE. Changes in parameter values
 and calculated errors are automatically
 propagated back the RooRealVars representing
 the floating parameters in the MINUIT operation
Int_t setPrintLevel(Int_t newLevel)
 Change the MINUIT internal printing level
void setNoWarn()
 Instruct MINUIT to suppress warnings
Int_t setWarnLevel(Int_t newLevel)
 Set MINUIT warning level to given level
Bool_t synchronize(Bool_t verbose)
 Internal function to synchronize TMinuit with current
 information in RooAbsReal function parameters
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.
 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
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
Bool_t setLogFile(const char* logfile = 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.
Double_t getPdfParamVal(Int_t index)
 Access PDF parameter value by ordinal index (needed by MINUIT)
Double_t getPdfParamErr(Int_t index)
 Access PDF parameter error by ordinal index (needed by MINUIT)
Bool_t setPdfParamVal(Int_t index, Double_t value, Bool_t verbose = kFALSE)
 Modify PDF parameter value by ordinal index (needed by MINUIT)
void setPdfParamErr(Int_t index, Double_t value)
 Modify PDF parameter error by ordinal index (needed by MINUIT)
void clearPdfParamAsymErr(Int_t index)
 Modify PDF parameter error by ordinal index (needed by MINUIT)
void setPdfParamErr(Int_t index, Double_t loVal, Double_t hiVal)
 Modify PDF parameter error by ordinal index (needed by MINUIT)
void profileStart()
 Start profiling timer
void profileStop()
 Stop profiling timer and report results of last session
void backProp()
 Transfer MINUIT fit results back into RooFit objects
void updateFloatVec()
void applyCovarianceMatrix(TMatrixDSym& V)
 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
RooMinuit(RooAbsReal& function)
void setEvalErrorWall(Bool_t flag)
{ _doEvalErrorWall = flag ; }
void setPrintEvalErrors(Int_t numEvalErrors)
{ _printEvalErrors = numEvalErrors ; }
void setVerbose(Bool_t flag = kTRUE)
{ _verbose = flag ; }
void setProfile(Bool_t flag = kTRUE)
{ _profile = flag ; }
void setMaxEvalMultiplier(Int_t n)
{ _maxEvalMult = n ; }
Int_t evalCounter() const
{ return _evalCounter ; }
void zeroEvalCount()
{ _evalCounter = 0 ; }
Int_t getNPar() const
{ return _nPar ; }
std::ofstream* logfile() const
{ return _logfile ; }
Double_t& maxFCN()
{ return _maxFCN ; }
void saveStatus(const char* label, Int_t status)
{ _statusHistory.push_back(std::pair<std::string,int>(label,status)) ; }