39#ifndef __ROOFIT_NOROOMINIMIZER
73#if (__GNUC__==3&&__GNUC_MINOR__==2&&__GNUC_PATCHLEVEL__==3)
288 TString opts(options) ;
301 if (opts.Contains(
"h")||!opts.Contains(
"m"))
hesse() ;
302 if (!opts.Contains(
"m"))
minos() ;
304 return (opts.Contains(
"r")) ?
save() : 0 ;
454 else if (minosParamList.
getSize()>0) {
465 std::vector<unsigned int> paramInd;
470 paramInd.push_back(index);
475 if (paramInd.size()) {
656 saveFloatFinalList.
remove(*par) ;
657 saveConstList.
add(*par) ;
660 saveConstList.
sort() ;
672 std::vector<double> globalCC;
710 <<
") ERROR: " << var1.
GetName()
711 <<
" is not a floating parameter of "
719 <<
") ERROR: " << var2.
GetName()
720 <<
" is not a floating parameter of PDF "
735 coutW(
Minimization) <<
"RooMinimizer::contour: Error, run Migrad before contours!"
745 n[0] = n1 ;
n[1] = n2 ;
n[2] = n3 ;
n[3] = n4 ;
n[4] = n5 ;
n[5] = n6 ;
746 unsigned int npoints(50);
748 for (
Int_t ic = 0 ; ic<6 ; ic++) {
762 <<
") ERROR: MINUIT did not return a contour graph for n="
765 xcoor[npoints] = xcoor[0];
766 ycoor[npoints] = ycoor[0];
770 graph->SetLineStyle(ic+1) ;
771 graph->SetLineWidth(2) ;
786 *params = *paramSave ;
852 <<
"RooMinimizer::lastMinuitFit: ERROR: supplied variable list must be either empty " << endl
853 <<
" or match the number of variables of the last fit ("
865 << arg->
GetName() <<
"' is not of type RooRealVar" << endl ;
892 if ((xlo<xhi) && !isConst) {
893 var =
new RooRealVar(varName,varName,xval,xlo,xhi) ;
907 if (varName.CompareTo(var->
GetName())) {
908 oocoutI((
TObject*)0,
Eval) <<
"RooMinimizer::lastMinuitFit: fit parameter '" << varName
909 <<
"' stored in variable '" << var->
GetName() <<
"'" << endl ;
929 std::vector<double> globalCC;
char * Form(const char *fmt,...)
TString operator+(const TString &s1, const TString &s2)
Use the special concatenation constructor.
void SetMinosErrors(bool on=true)
set Minos erros computation to be performed after fitting
void SetMinimizer(const char *type, const char *algo=0)
set minimizer type
const std::vector< ROOT::Fit::ParameterSettings > & ParamsSettings() const
get the vector of parameter settings (const method)
const ParameterSettings & ParSettings(unsigned int i) const
get the parameter settings for the i-th parameter (const method)
ROOT::Math::MinimizerOptions & MinimizerOptions()
access to the minimizer control parameter (non const method)
bool IsParameterFixed(unsigned int ipar) const
query if a parameter is fixed
double Error(unsigned int i) const
parameter error by index
double CovMatrix(unsigned int i, unsigned int j) const
retrieve covariance matrix element
double Value(unsigned int i) const
parameter value by index
const std::vector< double > & Parameters() const
parameter values (return std::vector)
std::string GetParameterName(unsigned int ipar) const
get name of parameter (deprecated)
double MinFcnValue() const
Return value of the objective function (chi2 or likelihood) used in the fit.
double Edm() const
Expected distance from minimum.
double Correlation(unsigned int i, unsigned int j) const
retrieve correlation elements
unsigned int NTotalParameters() const
get total number of parameters
int Status() const
minimizer status code
double GlobalCC(unsigned int i) const
parameter global correlation coefficient
Fitter class, entry point for performing all type of fits.
bool FitFCN(unsigned int npar, Function &fcn, const double *params=0, unsigned int dataSize=0, bool chi2fit=false)
Fit using the a generic FCN function as a C++ callable object implementing double () (const double *)...
ROOT::Math::Minimizer * GetMinimizer() const
return pointer to last used minimizer (is NULL in case fit is not yet done) This pointer is guranteed...
const FitResult & Result() const
get fit result
const FitConfig & Config() const
access to the fit configuration (const method)
bool CalculateMinosErrors()
perform an error analysis on the result using MINOS To be called only after fitting and when a minimi...
bool CalculateHessErrors()
perform an error analysis on the result using the Hessian Errors are obtaied from the inverse of the ...
double LowerLimit() const
return lower limit value
double UpperLimit() const
return upper limit value
void SetMaxFunctionCalls(unsigned int maxfcn)
set maximum of function calls
void SetStrategy(int stra)
set the strategy
void SetMaxIterations(unsigned int maxiter)
set maximum iterations (one iteration can have many function calls)
void SetErrorDef(double err)
set error def
void SetPrintLevel(int level)
set print level
void SetTolerance(double tol)
set the tolerance
void SetErrorDef(double up)
set scale for calculating the errors
virtual int CovMatrixStatus() const
return status of covariance matrix using Minuit convention {0 not calculated 1 approximated 2 made po...
double ErrorDef() const
return the statistical scale used for calculate the error is typically 1 for Chi2 and 0....
virtual bool Contour(unsigned int ivar, unsigned int jvar, unsigned int &npoints, double *xi, double *xj)
find the contour points (xi, xj) of the function for parameter ivar and jvar around the minimum The c...
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
virtual TObject * Clone(const char *newname=0) const
Make a clone of an object using the Streamer facility.
virtual void constOptimizeTestStatistic(ConstOpCode opcode, Bool_t doAlsoTrackingOpt=kTRUE)
Interface function signaling a request to perform constant term optimization.
Bool_t isConstant() const
RooAbsCollection * snapshot(Bool_t deepCopy=kTRUE) const
Take a snap shot of current collection contents: An owning collection is returned containing clones o...
virtual Bool_t addOwned(RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
virtual Bool_t remove(const RooAbsArg &var, Bool_t silent=kFALSE, Bool_t matchByNameOnly=kFALSE)
Remove the specified argument from our list.
TIterator * createIterator(Bool_t dir=kIterForward) const
RooAbsArg * find(const char *name) const
Find object with given name in list.
void setConstant(Bool_t value=kTRUE)
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
virtual Double_t defaultErrorLevel() const
virtual void enableOffsetting(Bool_t)
Double_t getVal(const RooArgSet *set=0) const
Evaluate object. Returns either cached value or triggers a recalculation.
static void setEvalErrorLoggingMode(ErrorLoggingMode m)
Set evaluation error logging mode.
static void clearEvalErrorLog()
Clear the stack of evaluation error messages.
RooAbsArg * at(Int_t idx) const
Int_t index(const RooAbsArg *arg) const
void sort(Bool_t reverse=kFALSE)
RooArgSet is a container object that can hold multiple RooAbsArg objects.
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.
RooArgList * GetInitFloatParamList()
void ApplyCovarianceMatrix(TMatrixDSym &V)
virtual unsigned int NDim() const
Retrieve the dimension of the function.
Bool_t Synchronize(std::vector< ROOT::Fit::ParameterSettings > ¶meters, Bool_t optConst, Bool_t verbose)
void BackProp(const ROOT::Fit::FitResult &results)
RooArgList * GetFloatParamList()
RooArgList * GetConstParamList()
RooMinimizer is a wrapper class around ROOT::Fit:Fitter that provides a seamless interface between th...
std::vector< std::pair< std::string, int > > _statusHistory
RooMinimizer(RooAbsReal &function)
Construct MINUIT interface to given function.
Int_t hesse()
Execute HESSE.
void setMaxIterations(Int_t n)
Change maximum number of MINUIT iterations (RooMinimizer default 500 * #parameters)
RooFitResult * save(const char *name=0, const char *title=0)
Save and return a RooFitResult snaphot of current minimizer status.
void setMinimizerType(const char *type)
Choose the minimzer algorithm.
void saveStatus(const char *label, Int_t status)
Int_t improve()
Execute IMPROVE.
void profileStart()
Start profiling timer.
Int_t migrad()
Execute MIGRAD.
Int_t minimize(const char *type, const char *alg=0)
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...
void profileStop()
Stop profiling timer and report results of last session.
static RooFitResult * lastMinuitFit(const RooArgList &varList=RooArgList())
RooFitResult * fit(const char *options)
Parse traditional RooAbsPdf::fitTo driver options.
void setOffsetting(Bool_t flag)
Enable internal likelihood offsetting for enhanced numeric precision.
Int_t seek()
Execute SEEK.
Bool_t setLogFile(const char *logf=0)
void setProfile(Bool_t flag=kTRUE)
void setEps(Double_t eps)
Change MINUIT epsilon.
void setErrorLevel(Double_t level)
Set the level for MINUIT error analysis to the given value.
static ROOT::Fit::Fitter * _theFitter
static void cleanup()
Cleanup method called by atexit handler installed by RooSentinel to delete all global heap objects wh...
Int_t setPrintLevel(Int_t newLevel)
Change the MINUIT internal printing level.
void setMaxFunctionCalls(Int_t n)
Change maximum number of likelihood function calss from MINUIT (RooMinimizer default 500 * #parameter...
Int_t minos()
Execute MINOS.
void applyCovarianceMatrix(TMatrixDSym &V)
Apply results of given external covariance matrix.
void optimizeConst(Int_t flag)
If flag is true, perform constant term optimization on function being minimized.
Int_t simplex()
Execute SIMPLEX.
ROOT::Fit::Fitter * fitter()
Return underlying ROOT fitter object.
void setStrategy(Int_t strat)
Change MINUIT strategy to istrat.
std::string _minimizerType
void setVerbose(Bool_t flag=kTRUE)
virtual ~RooMinimizer()
Destructor.
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.
void setError(Double_t value)
void setRange(const char *name, Double_t min, Double_t max)
Set range named 'name to [min,max].
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 const char * GetTitle() const
Returns title of object.
virtual const char * GetName() const
Returns name of object.
Mother of all ROOT objects.
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.
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 function(const Char_t *name_, T fun, const Char_t *docstring=0)
RooCmdArg Parameters(const RooArgSet ¶ms)