Logo ROOT  
Reference Guide
RooMinuit.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * File: $Id: RooMinuit.h,v 1.15 2007/07/12 20:30:28 wouter Exp $
5 * Authors: *
6 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8 * *
9 * Copyright (c) 2000-2005, Regents of the University of California *
10 * and Stanford University. All rights reserved. *
11 * *
12 * Redistribution and use in source and binary forms, *
13 * with or without modification, are permitted according to the terms *
14 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15 *****************************************************************************/
16#ifndef ROO_MINUIT
17#define ROO_MINUIT
18
19#include "TObject.h"
20#include "TStopwatch.h"
21#include <fstream>
22#include "TMatrixDSymfwd.h"
23#include <vector>
24#include <string>
25#include <utility>
26
27#include <ROOT/RConfig.hxx>
28
29class RooAbsReal ;
30class RooFitResult ;
31class RooArgList ;
32class RooRealVar ;
33class RooArgSet ;
34class RooAbsArg ;
35class TVirtualFitter ;
36class TH2F ;
37class RooPlot ;
38
39void RooMinuitGlue(Int_t& /*np*/, double* /*gin*/, double &f, double *par, Int_t /*flag*/) ;
40
41class RooMinuit : public TObject {
42public:
43
45 ~RooMinuit() override ;
46
47 enum Strategy { Speed=0, Balance=1, Robustness=2 } ;
49 void setStrategy(Int_t strat) ;
50 void setErrorLevel(double level) ;
51 void setEps(double eps) ;
52 void optimizeConst(Int_t flag) ;
53 void setEvalErrorWall(bool flag) { _doEvalErrorWall = flag ; }
54 void setOffsetting(bool flag) ;
55
56 RooFitResult* fit(const char* options) ;
57
58 Int_t migrad() ;
59 Int_t hesse() ;
60 Int_t minos() ;
61 Int_t minos(const RooArgSet& minosParamList) ; // added FMV, 08/18/03
62 Int_t seek() ;
63 Int_t simplex() ;
64 Int_t improve() ;
65
66 RooFitResult* save(const char* name=0, const char* title=0) ;
68 double n1=1, double n2=2, double n3=0,
69 double n4=0, double n5=0, double n6=0) ;
70
71 Int_t setPrintLevel(Int_t newLevel) ;
72 void setNoWarn() ;
73 Int_t setWarnLevel(Int_t newLevel) ;
74 void setPrintEvalErrors(Int_t numEvalErrors) { _printEvalErrors = numEvalErrors ; }
75 void setVerbose(bool flag=true) { _verbose = flag ; }
76 void setProfile(bool flag=true) { _profile = flag ; }
78 bool setLogFile(const char* logfile=0) ;
79
80 static void cleanup() ;
81
82 Int_t evalCounter() const { return _evalCounter ; }
83 void zeroEvalCount() { _evalCounter = 0 ; }
84
85protected:
86
87 friend class RooAbsPdf ;
89
90 friend void RooMinuitGlue(Int_t &np, double *gin, double &f, double *par, Int_t flag) ;
91
92 void profileStart() ;
93 void profileStop() ;
94
95 bool synchronize(bool verbose) ;
96 void backProp() ;
97
98 inline Int_t getNPar() const { return _nPar ; }
99 inline std::ofstream* logfile() const { return _logfile ; }
100 inline double& maxFCN() { return _maxFCN ; }
101
102 double getPdfParamVal(Int_t index) ;
103 double getPdfParamErr(Int_t index) ;
104 virtual bool setPdfParamVal(Int_t index, double value, bool verbose=false) ;
105 void setPdfParamErr(Int_t index, double value) ;
106 void setPdfParamErr(Int_t index, double loVal, double hiVal) ;
108
109 void saveStatus(const char* label, Int_t status) { _statusHistory.push_back(std::pair<std::string,int>(label,status)) ; }
110
111 void updateFloatVec() ;
112
113private:
114
120 bool _profile ;
128 std::vector<RooAbsArg*> _floatParamVec ;
133
134 double _maxFCN ;
135 std::ofstream* _logfile ;
136 bool _verbose ;
139
141
143
144 std::vector<std::pair<std::string,int> > _statusHistory ;
145
147
148 ClassDefOverride(RooMinuit,0) // RooFit minimizer based on MINUIT
149} R__SUGGEST_ALTERNATIVE("Please use RooMinimizer instead of RooMinuit");
150
151
152#endif
153
#define R__SUGGEST_ALTERNATIVE(ALTERNATIVE)
Definition: RConfig.hxx:521
#define f(i)
Definition: RSha256.hxx:104
void RooMinuitGlue(Int_t &, double *, double &f, double *par, Int_t)
Definition: RooMinuit.cxx:1191
int Int_t
Definition: RtypesCore.h:45
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t np
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
char name[80]
Definition: TGX11.cxx:110
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Definition: RooAbsArg.h:72
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:64
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgList.h:22
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:57
RooFitResult is a container class to hold the input and output of a PDF fit to a dataset.
Definition: RooFitResult.h:40
RooMinuit is a wrapper class around TFitter/TMinuit that provides a seamless interface between the MI...
Definition: RooMinuit.h:41
Int_t _numBadNLL
Definition: RooMinuit.h:122
Int_t hesse()
Execute HESSE.
Definition: RooMinuit.cxx:335
Int_t _nPar
Definition: RooMinuit.h:123
void setEps(double eps)
Change MINUIT epsilon.
Definition: RooMinuit.cxx:237
RooMinuit(RooAbsReal &function)
Construct MINUIT interface to given function.
Definition: RooMinuit.cxx:104
void setProfile(bool flag=true)
Definition: RooMinuit.h:76
Int_t _optConst
Definition: RooMinuit.h:119
RooArgList * _floatParamList
Definition: RooMinuit.h:127
Int_t _printEvalErrors
Definition: RooMinuit.h:124
void setOffsetting(bool flag)
Enable internal likelihood offsetting for enhanced numeric precision.
Definition: RooMinuit.cxx:247
Int_t evalCounter() const
Definition: RooMinuit.h:82
~RooMinuit() override
Destructor.
Definition: RooMinuit.cxx:194
void optimizeConst(Int_t flag)
If flag is true, perform constant term optimization on function being minimized.
Definition: RooMinuit.cxx:834
RooFitResult * save(const char *name=0, const char *title=0)
Save and return a RooFitResult snaphot of current minimizer status.
Definition: RooMinuit.cxx:866
bool synchronize(bool verbose)
Internal function to synchronize TMinuit with current information in RooAbsReal function parameters.
Definition: RooMinuit.cxx:610
bool _verbose
Definition: RooMinuit.h:136
virtual bool setPdfParamVal(Int_t index, double value, bool verbose=false)
Modify PDF parameter value by ordinal index (needed by MINUIT)
Definition: RooMinuit.cxx:1047
Int_t getNPar() const
Definition: RooMinuit.h:98
void setErrorLevel(double level)
Set the level for MINUIT error analysis to the given value.
Definition: RooMinuit.cxx:227
@ Robustness
Definition: RooMinuit.h:47
static void cleanup()
Cleanup method called by atexit handler installed by RooSentinel to delete all global heap objects wh...
Definition: RooMinuit.cxx:82
Int_t seek()
Execute SEEK.
Definition: RooMinuit.cxx:461
bool _doEvalErrorWall
Definition: RooMinuit.h:125
std::ofstream * _logfile
Definition: RooMinuit.h:135
Int_t simplex()
Execute SIMPLEX.
Definition: RooMinuit.cxx:494
TStopwatch _cumulTimer
Definition: RooMinuit.h:138
bool _handleLocalErrors
Definition: RooMinuit.h:121
void zeroEvalCount()
Definition: RooMinuit.h:83
void saveStatus(const char *label, Int_t status)
Definition: RooMinuit.h:109
void setStrategy(Int_t strat)
Change MINUIT strategy to istrat.
Definition: RooMinuit.cxx:213
Int_t setPrintLevel(Int_t newLevel)
Change the MINUIT internal printing level.
Definition: RooMinuit.cxx:558
std::vector< std::pair< std::string, int > > _statusHistory
Definition: RooMinuit.h:144
Int_t _warnLevel
Definition: RooMinuit.h:117
std::vector< RooAbsArg * > _floatParamVec
Definition: RooMinuit.h:128
double _maxFCN
Definition: RooMinuit.h:134
Int_t migrad()
Execute MIGRAD.
Definition: RooMinuit.cxx:301
Int_t _printLevel
Definition: RooMinuit.h:116
std::ofstream * logfile() const
Definition: RooMinuit.h:99
double getPdfParamVal(Int_t index)
Access PDF parameter value by ordinal index (needed by MINUIT)
Definition: RooMinuit.cxx:1027
Int_t setWarnLevel(Int_t newLevel)
Set MINUIT warning level to given level.
Definition: RooMinuit.cxx:584
void applyCovarianceMatrix(TMatrixDSym &V)
Apply results of given external covariance matrix.
Definition: RooMinuit.cxx:1171
Int_t _status
Definition: RooMinuit.h:118
void backProp()
Transfer MINUIT fit results back into RooFit objects.
Definition: RooMinuit.cxx:1126
bool setLogFile(const char *logfile=0)
Change the file name for logging of a RooMinuit of all MINUIT steppings through the parameter space.
Definition: RooMinuit.cxx:1004
double getPdfParamErr(Int_t index)
Access PDF parameter error by ordinal index (needed by MINUIT)
Definition: RooMinuit.cxx:1037
RooArgList * _initConstParamList
Definition: RooMinuit.h:131
double & maxFCN()
Definition: RooMinuit.h:100
void setEvalErrorWall(bool flag)
Definition: RooMinuit.h:53
@ ExtraForProblem
Definition: RooMinuit.h:48
void updateFloatVec()
Definition: RooMinuit.cxx:1152
bool _profile
Definition: RooMinuit.h:120
friend void RooMinuitGlue(Int_t &np, double *gin, double &f, double *par, Int_t flag)
Definition: RooMinuit.cxx:1191
RooArgList * _initFloatParamList
Definition: RooMinuit.h:129
void setPdfParamErr(Int_t index, double value)
Modify PDF parameter error by ordinal index (needed by MINUIT)
Definition: RooMinuit.cxx:1066
void setPrintEvalErrors(Int_t numEvalErrors)
Definition: RooMinuit.h:74
void setMaxEvalMultiplier(Int_t n)
Definition: RooMinuit.h:77
void profileStop()
Stop profiling timer and report results of last session.
Definition: RooMinuit.cxx:1109
TMatrixDSym * _extV
Definition: RooMinuit.h:140
TStopwatch _timer
Definition: RooMinuit.h:137
Int_t minos()
Execute MINOS.
Definition: RooMinuit.cxx:368
RooMinuit(const RooMinuit &)
void clearPdfParamAsymErr(Int_t index)
Modify PDF parameter error by ordinal index (needed by MINUIT)
Definition: RooMinuit.cxx:1076
Int_t improve()
Execute IMPROVE.
Definition: RooMinuit.cxx:528
void profileStart()
Start profiling timer.
Definition: RooMinuit.cxx:1095
void setNoWarn()
Instruct MINUIT to suppress warnings.
Definition: RooMinuit.cxx:572
RooArgList * _constParamList
Definition: RooMinuit.h:130
void setVerbose(bool flag=true)
Definition: RooMinuit.h:75
Int_t _evalCounter
Definition: RooMinuit.h:115
RooFitResult * fit(const char *options)
Parse traditional RooAbsPdf::fitTo driver options.
Definition: RooMinuit.cxx:265
RooAbsReal * _func
Definition: RooMinuit.h:132
RooPlot * contour(RooRealVar &var1, RooRealVar &var2, double n1=1, double n2=2, double n3=0, double n4=0, double n5=0, double n6=0)
Create and draw a TH2 with the error contours in parameters var1 and v2 at up to 6 'sigma' settings w...
Definition: RooMinuit.cxx:932
Int_t _maxEvalMult
Definition: RooMinuit.h:126
static TVirtualFitter * _theFitter
Definition: RooMinuit.h:142
A RooPlot is a plot frame and a container for graphics objects within that frame.
Definition: RooPlot.h:43
RooRealVar represents a variable that can be changed from the outside.
Definition: RooRealVar.h:40
2-D histogram with a float per channel (see TH1 documentation)}
Definition: TH2.h:257
Mother of all ROOT objects.
Definition: TObject.h:37
Stopwatch class.
Definition: TStopwatch.h:28
Abstract Base Class for Fitting.
const Int_t n
Definition: legend1.C:16
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
Definition: RExports.h:167