ROOT  6.06/09
Reference Guide
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
RooMinimizer Class Reference

Definition at line 38 of file RooMinimizer.h.

Public Types

enum  Strategy { Speed =0, Balance =1, Robustness =2 }
 
enum  PrintLevel {
  None =-1, Reduced =0, Normal =1, ExtraForProblem =2,
  Maximum =3
}
 
- Public Types inherited from TObject
enum  EStatusBits {
  kCanDelete = BIT(0), kMustCleanup = BIT(3), kObjInCanvas = BIT(3), kIsReferenced = BIT(4),
  kHasUUID = BIT(5), kCannotPick = BIT(6), kNoContextMenu = BIT(8), kInvalidObject = BIT(13)
}
 
enum  { kIsOnHeap = 0x01000000, kNotDeleted = 0x02000000, kZombie = 0x04000000, kBitMask = 0x00ffffff }
 
enum  { kSingleKey = BIT(0), kOverwrite = BIT(1), kWriteDelete = BIT(2) }
 

Public Member Functions

 RooMinimizer (RooAbsReal &function)
 Construct MINUIT interface to given function. More...
 
virtual ~RooMinimizer ()
 Destructor. More...
 
void setStrategy (Int_t strat)
 Change MINUIT strategy to istrat. More...
 
void setErrorLevel (Double_t level)
 Set the level for MINUIT error analysis to the given value. More...
 
void setEps (Double_t eps)
 Change MINUIT epsilon. More...
 
void optimizeConst (Int_t flag)
 If flag is true, perform constant term optimization on function being minimized. More...
 
void setEvalErrorWall (Bool_t flag)
 
void setOffsetting (Bool_t flag)
 Enable internal likelihood offsetting for enhanced numeric precision. More...
 
void setMaxIterations (Int_t n)
 Change maximum number of MINUIT iterations (RooMinimizer default 500 * #parameters) More...
 
void setMaxFunctionCalls (Int_t n)
 Change maximum number of likelihood function calss from MINUIT (RooMinimizer default 500 * #parameters) More...
 
RooFitResultfit (const char *options)
 Parse traditional RooAbsPdf::fitTo driver options. More...
 
Int_t migrad ()
 Execute MIGRAD. More...
 
Int_t hesse ()
 Execute HESSE. More...
 
Int_t minos ()
 Execute MINOS. More...
 
Int_t minos (const RooArgSet &minosParamList)
 Execute MINOS for given list of parameters. More...
 
Int_t seek ()
 Execute SEEK. More...
 
Int_t simplex ()
 Execute SIMPLEX. More...
 
Int_t improve ()
 Execute IMPROVE. More...
 
Int_t minimize (const char *type, const char *alg=0)
 
RooFitResultsave (const char *name=0, const char *title=0)
 Save and return a RooFitResult snaphot of current minimizer status. More...
 
RooPlotcontour (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 setPrintLevel (Int_t newLevel)
 Change the MINUIT internal printing level. More...
 
void setPrintEvalErrors (Int_t numEvalErrors)
 
void setVerbose (Bool_t flag=kTRUE)
 
void setProfile (Bool_t flag=kTRUE)
 
Bool_t setLogFile (const char *logf=0)
 
void setMinimizerType (const char *type)
 Choose the minimzer algorithm. More...
 
void saveStatus (const char *label, Int_t status)
 
Int_t evalCounter () const
 
void zeroEvalCount ()
 
ROOT::Fit::Fitterfitter ()
 Return underlying ROOT fitter object. More...
 
const ROOT::Fit::Fitterfitter () const
 Return underlying ROOT fitter object. More...
 
- Public Member Functions inherited from TObject
 TObject ()
 
 TObject (const TObject &object)
 TObject copy ctor. More...
 
TObjectoperator= (const TObject &rhs)
 TObject assignment operator. More...
 
virtual ~TObject ()
 TObject destructor. 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...
 
virtual const char * ClassName () const
 Returns name of class to which the object belongs. More...
 
virtual void Clear (Option_t *="")
 
virtual TObjectClone (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 TObjectDrawClone (Option_t *option="") const
 Draw a clone of this object in the current pad. More...
 
virtual void Dump () const
 Dump contents of object on stdout. 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 TObjectFindObject (const char *name) const
 Must be redefined in derived classes. More...
 
virtual TObjectFindObject (const TObject *obj) const
 Must be redefined in derived classes. More...
 
virtual Option_tGetDrawOption () const
 Get option used by the graphics system to draw this object. More...
 
virtual UInt_t GetUniqueID () const
 Return the unique object id. More...
 
virtual const char * GetName () const
 Returns name of object. More...
 
virtual const char * GetIconName () const
 Returns mime type name of object. More...
 
virtual Option_tGetOption () const
 
virtual char * GetObjectInfo (Int_t px, Int_t py) const
 Returns string containing info about the object at position (px,py). More...
 
virtual const char * GetTitle () const
 Returns title of object. 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...
 
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...
 
virtual Bool_t IsFolder () const
 Returns kTRUE in case object contains browsable objects (like containers or lists of other objects). More...
 
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 IsSortable () const
 
Bool_t IsOnHeap () const
 
Bool_t IsZombie () const
 
virtual Bool_t Notify ()
 This method must be overridden to handle object notification. More...
 
virtual void ls (Option_t *option="") const
 The ls function lists the contents of a class on stdout. 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...
 
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...
 
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 UseCurrentStyle ()
 Set current style settings in this object This function is called when either TCanvas::UseCurrentStyle or TROOT::ForceStyle have been invoked. 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...
 
voidoperator new (size_t sz)
 
voidoperator new[] (size_t sz)
 
voidoperator new (size_t sz, void *vp)
 
voidoperator new[] (size_t sz, void *vp)
 
void operator delete (void *ptr)
 Operator delete. More...
 
void operator delete[] (void *ptr)
 Operator delete []. 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)
 
void ResetBit (UInt_t f)
 
Bool_t TestBit (UInt_t f) const
 
Int_t TestBits (UInt_t f) const
 
void InvertBit (UInt_t f)
 
virtual void Info (const char *method, const char *msgfmt,...) const
 Issue info message. More...
 
virtual void Warning (const char *method, const char *msgfmt,...) const
 Issue warning message. More...
 
virtual void Error (const char *method, const char *msgfmt,...) const
 Issue error message. More...
 
virtual void SysError (const char *method, const char *msgfmt,...) const
 Issue system error message. More...
 
virtual void Fatal (const char *method, const char *msgfmt,...) const
 Issue fatal error message. 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...
 
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...
 
void Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const
 Use this method to declare a method obsolete. 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 RooFitResultlastMinuitFit (const RooArgList &varList=RooArgList())
 
- Static Public Member Functions inherited from TObject
static Long_t GetDtorOnly ()
 Return destructor only flag. More...
 
static void SetDtorOnly (void *obj)
 Set destructor only flag. More...
 
static Bool_t GetObjectStat ()
 Get status of object stat 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 profileStart ()
 Start profiling timer. More...
 
void profileStop ()
 Stop profiling timer and report results of last session. More...
 
Int_t getNPar () const
 
std::ofstream * logfile ()
 
Double_tmaxFCN ()
 
const RooMinimizerFcnfitterFcn () const
 
RooMinimizerFcnfitterFcn ()
 
- Protected Member Functions inherited from TObject
void MakeZombie ()
 
virtual void DoError (int level, const char *location, const char *fmt, va_list va) const
 Interface to ErrorHandler (protected). More...
 

Private Member Functions

 RooMinimizer (const RooMinimizer &)
 

Private Attributes

Int_t _printLevel
 
Int_t _status
 
Bool_t _optConst
 
Bool_t _profile
 
RooAbsReal_func
 
Bool_t _verbose
 
TStopwatch _timer
 
TStopwatch _cumulTimer
 
Bool_t _profileStart
 
TMatrixDSym_extV
 
RooMinimizerFcn_fcn
 
std::string _minimizerType
 
std::vector< std::pair< std::string, int > > _statusHistory
 

Static Private Attributes

static ROOT::Fit::Fitter_theFitter = 0
 

Friends

class RooAbsPdf
 

#include <RooMinimizer.h>

+ Inheritance diagram for RooMinimizer:
+ Collaboration diagram for RooMinimizer:

Member Enumeration Documentation

Enumerator
None 
Reduced 
Normal 
ExtraForProblem 
Maximum 

Definition at line 45 of file RooMinimizer.h.

Enumerator
Speed 
Balance 
Robustness 

Definition at line 44 of file RooMinimizer.h.

Constructor & Destructor Documentation

RooMinimizer::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.

Definition at line 115 of file RooMinimizer.cxx.

RooMinimizer::~RooMinimizer ( )
virtual

Destructor.

Definition at line 161 of file RooMinimizer.cxx.

RooMinimizer::RooMinimizer ( const RooMinimizer )
private

Member Function Documentation

void RooMinimizer::applyCovarianceMatrix ( TMatrixDSym V)
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 832 of file RooMinimizer.cxx.

Referenced by RooAbsPdf::fitTo().

void RooMinimizer::cleanup ( )
static

Cleanup method called by atexit handler installed by RooSentinel to delete all global heap objects when the program is terminated.

Definition at line 93 of file RooMinimizer.cxx.

RooPlot * RooMinimizer::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 700 of file RooMinimizer.cxx.

Int_t RooMinimizer::evalCounter ( ) const
inline

Definition at line 85 of file RooMinimizer.h.

RooFitResult * RooMinimizer::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

Definition at line 289 of file RooMinimizer.cxx.

Referenced by RooAbsReal::chi2FitDriver(), and RooAbsPdf::fitTo().

ROOT::Fit::Fitter * RooMinimizer::fitter ( )

Return underlying ROOT fitter object.

Definition at line 262 of file RooMinimizer.cxx.

Referenced by fitterFcn().

const ROOT::Fit::Fitter * RooMinimizer::fitter ( ) const

Return underlying ROOT fitter object.

Definition at line 271 of file RooMinimizer.cxx.

const RooMinimizerFcn* RooMinimizer::fitterFcn ( ) const
inlineprotected
RooMinimizerFcn* RooMinimizer::fitterFcn ( )
inlineprotected

Definition at line 104 of file RooMinimizer.h.

Int_t RooMinimizer::getNPar ( ) const
inlineprotected

Definition at line 99 of file RooMinimizer.h.

Referenced by RooAbsPdf::fitTo().

Int_t RooMinimizer::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 375 of file RooMinimizer.cxx.

Referenced by RooAbsReal::chi2FitDriver(), and RooAbsPdf::fitTo().

Int_t RooMinimizer::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 567 of file RooMinimizer.cxx.

RooFitResult * RooMinimizer::lastMinuitFit ( const RooArgList varList = RooArgList())
static

Definition at line 841 of file RooMinimizer.cxx.

std::ofstream* RooMinimizer::logfile ( )
inlineprotected

Definition at line 100 of file RooMinimizer.h.

Double_t& RooMinimizer::maxFCN ( )
inlineprotected

Definition at line 101 of file RooMinimizer.h.

Int_t RooMinimizer::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 346 of file RooMinimizer.cxx.

Int_t RooMinimizer::minimize ( const char *  type,
const char *  alg = 0 
)
Int_t RooMinimizer::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 412 of file RooMinimizer.cxx.

Referenced by RooAbsReal::chi2FitDriver(), and RooAbsPdf::fitTo().

Int_t RooMinimizer::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

Definition at line 450 of file RooMinimizer.cxx.

void RooMinimizer::optimizeConst ( Int_t  flag)
void RooMinimizer::profileStart ( )
protected

Start profiling timer.

Definition at line 800 of file RooMinimizer.cxx.

void RooMinimizer::profileStop ( )
protected

Stop profiling timer and report results of last session.

Definition at line 813 of file RooMinimizer.cxx.

RooFitResult * RooMinimizer::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 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

Definition at line 637 of file RooMinimizer.cxx.

Referenced by RooAbsReal::chi2FitDriver(), RooStats::ProfileLikelihoodCalculator::DoMinimizeNLL(), RooStats::AsymptoticCalculator::EvaluateNLL(), RooAbsPdf::fitTo(), and RooStats::ProfileLikelihoodTestStat::GetMinNLL().

void RooMinimizer::saveStatus ( const char *  label,
Int_t  status 
)
inline

Definition at line 83 of file RooMinimizer.h.

Int_t RooMinimizer::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 509 of file RooMinimizer.cxx.

void RooMinimizer::setEps ( Double_t  eps)
void RooMinimizer::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

Definition at line 219 of file RooMinimizer.cxx.

void RooMinimizer::setEvalErrorWall ( Bool_t  flag)
inline

Definition at line 50 of file RooMinimizer.h.

Referenced by RooAbsPdf::fitTo().

Bool_t RooMinimizer::setLogFile ( const char *  logf = 0)
inline

Definition at line 76 of file RooMinimizer.h.

void RooMinimizer::setMaxFunctionCalls ( Int_t  n)

Change maximum number of likelihood function calss from MINUIT (RooMinimizer default 500 * #parameters)

Definition at line 205 of file RooMinimizer.cxx.

void RooMinimizer::setMaxIterations ( Int_t  n)

Change maximum number of MINUIT iterations (RooMinimizer default 500 * #parameters)

Definition at line 193 of file RooMinimizer.cxx.

void RooMinimizer::setMinimizerType ( const char *  type)

Choose the minimzer algorithm.

Definition at line 251 of file RooMinimizer.cxx.

Referenced by RooAbsReal::chi2FitDriver(), and RooAbsPdf::fitTo().

void RooMinimizer::setOffsetting ( Bool_t  flag)

Enable internal likelihood offsetting for enhanced numeric precision.

Definition at line 240 of file RooMinimizer.cxx.

void RooMinimizer::setPrintEvalErrors ( Int_t  numEvalErrors)
inline

Definition at line 73 of file RooMinimizer.h.

Referenced by RooAbsReal::chi2FitDriver(), and RooAbsPdf::fitTo().

Int_t RooMinimizer::setPrintLevel ( Int_t  newLevel)
void RooMinimizer::setProfile ( Bool_t  flag = kTRUE)
inline

Definition at line 75 of file RooMinimizer.h.

Referenced by RooAbsReal::chi2FitDriver(), and RooAbsPdf::fitTo().

void RooMinimizer::setStrategy ( Int_t  istrat)

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 181 of file RooMinimizer.cxx.

Referenced by RooAbsReal::chi2FitDriver(), RooStats::ProfileLikelihoodCalculator::DoMinimizeNLL(), RooStats::MaxLikelihoodEstimateTestStat::Evaluate(), RooStats::AsymptoticCalculator::EvaluateNLL(), RooAbsPdf::fitTo(), and RooStats::ProfileLikelihoodTestStat::GetMinNLL().

void RooMinimizer::setVerbose ( Bool_t  flag = kTRUE)
inline

Definition at line 74 of file RooMinimizer.h.

Referenced by RooAbsReal::chi2FitDriver(), and RooAbsPdf::fitTo().

Int_t RooMinimizer::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 538 of file RooMinimizer.cxx.

void RooMinimizer::zeroEvalCount ( )
inline

Definition at line 86 of file RooMinimizer.h.

Friends And Related Function Documentation

friend class RooAbsPdf
friend

Definition at line 93 of file RooMinimizer.h.

Member Data Documentation

TStopwatch RooMinimizer::_cumulTimer
private

Definition at line 116 of file RooMinimizer.h.

TMatrixDSym* RooMinimizer::_extV
private

Definition at line 119 of file RooMinimizer.h.

RooMinimizerFcn* RooMinimizer::_fcn
private

Definition at line 121 of file RooMinimizer.h.

Referenced by fitterFcn().

RooAbsReal* RooMinimizer::_func
private

Definition at line 112 of file RooMinimizer.h.

std::string RooMinimizer::_minimizerType
private

Definition at line 122 of file RooMinimizer.h.

Bool_t RooMinimizer::_optConst
private

Definition at line 110 of file RooMinimizer.h.

Int_t RooMinimizer::_printLevel
private

Definition at line 108 of file RooMinimizer.h.

Bool_t RooMinimizer::_profile
private

Definition at line 111 of file RooMinimizer.h.

Referenced by setProfile().

Bool_t RooMinimizer::_profileStart
private

Definition at line 117 of file RooMinimizer.h.

Int_t RooMinimizer::_status
private

Definition at line 109 of file RooMinimizer.h.

std::vector<std::pair<std::string,int> > RooMinimizer::_statusHistory
private

Definition at line 126 of file RooMinimizer.h.

Referenced by saveStatus().

ROOT::Fit::Fitter * RooMinimizer::_theFitter = 0
staticprivate

Definition at line 124 of file RooMinimizer.h.

TStopwatch RooMinimizer::_timer
private

Definition at line 115 of file RooMinimizer.h.

Bool_t RooMinimizer::_verbose
private

Definition at line 114 of file RooMinimizer.h.

Referenced by setVerbose().


The documentation for this class was generated from the following files: