ROOT logo
ROOT » ROOFIT » ROOFITCORE » RooMinimizer

class RooMinimizer: public TObject



RooMinimizer is a wrapper class around ROOT::Fit:Fitter that provides a seamless interface between the minimizer functionality and the native RooFit interface.

By default the Minimizer is MINUIT.

RooMinimizer can minimize any RooAbsReal function with respect to its parameters. Usual choices for minimization are RooNLLVar and RooChi2Var

RooMinimizer 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:
RooMinimizer(RooAbsReal& function)
virtual~RooMinimizer()
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
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
static RooFitResult*lastMinuitFit(const RooArgList& varList = RooArgList())
virtual voidTObject::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
Int_tmigrad()
Int_tminimize(const char* type, const char* alg = 0)
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)
RooMinimizer&operator=(const RooMinimizer&)
voidoptimizeConst(Bool_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* logf = 0)
voidsetMinimizerType(const char* type)
static voidTObject::SetObjectStat(Bool_t stat)
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)
virtual voidShowMembers(TMemberInspector& insp)
Int_tsimplex()
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& 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
protected:
voidapplyCovarianceMatrix(TMatrixDSym& V)
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
Int_tgetNPar() const
ofstream*logfile() const
voidTObject::MakeZombie()
Double_t&maxFCN()
voidprofileStart()
voidprofileStop()
private:
RooMinimizer(const RooMinimizer&)

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:
TStopwatch_cumulTimer
TMatrixDSym*_extV
RooMinimizerFcn*_fcn
RooAbsReal*_func
string_minimizerType
Bool_t_optConst
Int_t_printLevel
Bool_t_profile
Int_t_status
static ROOT::Fit::Fitter*_theFitter
TStopwatch_timer
Bool_t_verbose

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
RooMinimizer(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.
~RooMinimizer()
 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 RooMinimizer constructor from
 the defaultErrorLevel() method of the input function
void setEps(Double_t eps)
 Change MINUIT epsilon
void setMinimizerType(const char* type)
 Choose the minimzer algorithm.
RooFitResult* fit(const char* options)
 Parse traditional RooAbsPdf::fitTo driver options

  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 minimize(const char* type, const char* alg = 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 optimizeConst(Bool_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 RooMinimizer 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
void profileStart()
 Start profiling timer
void profileStop()
 Stop profiling timer and report results of last session
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
RooFitResult* lastMinuitFit(const RooArgList& varList = RooArgList())
 Import the results of the last fit performed, interpreting
 the fit parameters as the given varList of parameters.
RooMinimizer(RooAbsReal& function)
void setEvalErrorWall(Bool_t flag)
void setPrintEvalErrors(Int_t numEvalErrors)
{ _fcn->SetPrintEvalErrors(numEvalErrors); }
void setVerbose(Bool_t flag = kTRUE)
{ _verbose = flag ; _fcn->SetVerbose(flag); }
void setProfile(Bool_t flag = kTRUE)
{ _profile = flag ; }
Bool_t setLogFile(const char* logf = 0)
{ return _fcn->SetLogFile(logf); }
Int_t getNPar() const
{ return _fcn->NDim() ; }
ofstream* logfile() const
{ return _fcn->GetLogFile(); }
Double_t& maxFCN()
{ return _fcn->GetMaxFCN() ; }