00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef __ROOFIT_NOROOMINIMIZER
00017
00018 #ifndef ROO_MINIMIZER
00019 #define ROO_MINIMIZER
00020
00021 #include "TObject.h"
00022 #include "TStopwatch.h"
00023 #include <fstream>
00024 #include "TMatrixDSymfwd.h"
00025
00026
00027 #include "Fit/Fitter.h"
00028 #include "RooMinimizerFcn.h"
00029
00030 class RooAbsReal ;
00031 class RooFitResult ;
00032 class RooArgList ;
00033 class RooRealVar ;
00034 class RooArgSet ;
00035 class TH2F ;
00036 class RooPlot ;
00037
00038 class RooMinimizer : public TObject {
00039 public:
00040
00041 RooMinimizer(RooAbsReal& function) ;
00042 virtual ~RooMinimizer() ;
00043
00044 enum Strategy { Speed=0, Balance=1, Robustness=2 } ;
00045 enum PrintLevel { None=-1, Reduced=0, Normal=1, ExtraForProblem=2, Maximum=3 } ;
00046 void setStrategy(Int_t strat) ;
00047 void setErrorLevel(Double_t level) ;
00048 void setEps(Double_t eps) ;
00049 void optimizeConst(Bool_t flag) ;
00050 void setEvalErrorWall(Bool_t flag) { _fcn->SetEvalErrorWall(flag); }
00051
00052 RooFitResult* fit(const char* options) ;
00053
00054 Int_t migrad() ;
00055 Int_t hesse() ;
00056 Int_t minos() ;
00057 Int_t minos(const RooArgSet& minosParamList) ;
00058 Int_t seek() ;
00059 Int_t simplex() ;
00060 Int_t improve() ;
00061
00062 Int_t minimize(const char* type, const char* alg=0) ;
00063
00064 RooFitResult* save(const char* name=0, const char* title=0) ;
00065 RooPlot* contour(RooRealVar& var1, RooRealVar& var2,
00066 Double_t n1=1, Double_t n2=2, Double_t n3=0,
00067 Double_t n4=0, Double_t n5=0, Double_t n6=0) ;
00068
00069 Int_t setPrintLevel(Int_t newLevel) ;
00070 void setPrintEvalErrors(Int_t numEvalErrors) { _fcn->SetPrintEvalErrors(numEvalErrors); }
00071 void setVerbose(Bool_t flag=kTRUE) { _verbose = flag ; _fcn->SetVerbose(flag); }
00072 void setProfile(Bool_t flag=kTRUE) { _profile = flag ; }
00073 Bool_t setLogFile(const char* logf=0) { return _fcn->SetLogFile(logf); }
00074
00075 void setMinimizerType(const char* type) ;
00076
00077 static void cleanup() ;
00078 static RooFitResult* lastMinuitFit(const RooArgList& varList=RooArgList()) ;
00079
00080 protected:
00081
00082 friend class RooAbsPdf ;
00083 void applyCovarianceMatrix(TMatrixDSym& V) ;
00084
00085 void profileStart() ;
00086 void profileStop() ;
00087
00088 inline Int_t getNPar() const { return _fcn->NDim() ; }
00089 inline ofstream* logfile() const { return _fcn->GetLogFile(); }
00090 inline Double_t& maxFCN() { return _fcn->GetMaxFCN() ; }
00091
00092 private:
00093
00094 Int_t _printLevel ;
00095 Int_t _status ;
00096 Bool_t _optConst ;
00097 Bool_t _profile ;
00098 RooAbsReal* _func ;
00099
00100 Bool_t _verbose ;
00101 TStopwatch _timer ;
00102 TStopwatch _cumulTimer ;
00103
00104 TMatrixDSym* _extV ;
00105
00106 RooMinimizerFcn *_fcn;
00107 std::string _minimizerType;
00108
00109 static ROOT::Fit::Fitter *_theFitter ;
00110
00111 RooMinimizer(const RooMinimizer&) ;
00112
00113 ClassDef(RooMinimizer,0)
00114 } ;
00115
00116
00117 #endif
00118
00119 #endif