RooMinuit.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Project: RooFit                                                           *
00003  * Package: RooFitCore                                                       *
00004  *    File: $Id: RooMinuit.h,v 1.15 2007/07/12 20:30:28 wouter Exp $
00005  * Authors:                                                                  *
00006  *   WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu       *
00007  *   DK, David Kirkby,    UC Irvine,         dkirkby@uci.edu                 *
00008  *                                                                           *
00009  * Copyright (c) 2000-2005, Regents of the University of California          *
00010  *                          and Stanford University. All rights reserved.    *
00011  *                                                                           *
00012  * Redistribution and use in source and binary forms,                        *
00013  * with or without modification, are permitted according to the terms        *
00014  * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
00015  *****************************************************************************/
00016 #ifndef ROO_MINUIT
00017 #define ROO_MINUIT
00018 
00019 #include "TObject.h"
00020 #include "TStopwatch.h"
00021 #include <fstream>
00022 #include "TMatrixDSymfwd.h"
00023 
00024 class RooAbsReal ;
00025 class RooFitResult ;
00026 class RooArgList ;
00027 class RooRealVar ;
00028 class RooArgSet ;
00029 class TVirtualFitter ;
00030 class TH2F ;
00031 class RooPlot ;
00032 
00033 void RooMinuitGlue(Int_t& /*np*/, Double_t* /*gin*/,  Double_t &f, Double_t *par, Int_t /*flag*/) ;
00034 
00035 class RooMinuit : public TObject {
00036 public:
00037 
00038   RooMinuit(RooAbsReal& function) ;
00039   virtual ~RooMinuit() ;
00040 
00041   enum Strategy { Speed=0, Balance=1, Robustness=2 } ;
00042   enum PrintLevel { None=-1, Reduced=0, Normal=1, ExtraForProblem=2, Maximum=3 } ;
00043   void setStrategy(Int_t strat) ;
00044   void setErrorLevel(Double_t level) ;
00045   void setEps(Double_t eps) ;
00046   void optimizeConst(Bool_t flag) ;
00047   void setEvalErrorWall(Bool_t flag) { _doEvalErrorWall = flag ; }
00048 
00049   RooFitResult* fit(const char* options) ;
00050 
00051   Int_t migrad() ;
00052   Int_t hesse() ;
00053   Int_t minos() ;
00054   Int_t minos(const RooArgSet& minosParamList) ;  // added FMV, 08/18/03
00055   Int_t seek() ;
00056   Int_t simplex() ;
00057   Int_t improve() ;
00058 
00059   RooFitResult* save(const char* name=0, const char* title=0) ;
00060   RooPlot* contour(RooRealVar& var1, RooRealVar& var2, 
00061                    Double_t n1=1, Double_t n2=2, Double_t n3=0,
00062                    Double_t n4=0, Double_t n5=0, Double_t n6=0) ;
00063 
00064   Int_t setPrintLevel(Int_t newLevel) ; 
00065   void setNoWarn() ;
00066   Int_t setWarnLevel(Int_t newLevel) ;
00067   void setPrintEvalErrors(Int_t numEvalErrors) { _printEvalErrors = numEvalErrors ; }
00068   void setVerbose(Bool_t flag=kTRUE) { _verbose = flag ; }
00069   void setProfile(Bool_t flag=kTRUE) { _profile = flag ; }
00070   Bool_t setLogFile(const char* logfile=0) ;  
00071 
00072   static void cleanup() ;
00073   
00074 protected:
00075 
00076   friend class RooAbsPdf ;
00077   void applyCovarianceMatrix(TMatrixDSym& V) ;
00078 
00079   friend void RooMinuitGlue(Int_t &np, Double_t *gin, Double_t &f, Double_t *par, Int_t flag) ;
00080 
00081   void profileStart() ;
00082   void profileStop() ;
00083 
00084   Bool_t synchronize(Bool_t verbose) ;  
00085   void backProp() ;
00086 
00087   inline Int_t getNPar() const { return _nPar ; }
00088   inline ofstream* logfile() const { return _logfile ; }
00089   inline Double_t& maxFCN() { return _maxFCN ; }
00090 
00091   Double_t getPdfParamVal(Int_t index) ;
00092   Double_t getPdfParamErr(Int_t index) ;        
00093   virtual Bool_t setPdfParamVal(Int_t index, Double_t value, Bool_t verbose=kFALSE) ;
00094   void setPdfParamErr(Int_t index, Double_t value) ;
00095   void setPdfParamErr(Int_t index, Double_t loVal, Double_t hiVal) ;
00096   void clearPdfParamAsymErr(Int_t index) ;
00097 
00098 private:
00099 
00100   Int_t       _printLevel ;
00101   Int_t       _warnLevel ;
00102   Int_t       _status ;
00103   Bool_t      _optConst ;
00104   Bool_t      _profile ;
00105   Bool_t      _handleLocalErrors ;
00106   Int_t       _numBadNLL ;
00107   Int_t       _nPar ;
00108   Int_t       _printEvalErrors ;
00109   Bool_t      _doEvalErrorWall ;
00110   RooArgList* _floatParamList ;
00111   RooArgList* _initFloatParamList ;
00112   RooArgList* _constParamList ;
00113   RooArgList* _initConstParamList ;
00114   RooAbsReal* _func ;
00115 
00116   Double_t    _maxFCN ;  
00117   ofstream*   _logfile ;
00118   Bool_t      _verbose ;
00119   TStopwatch  _timer ;
00120   TStopwatch  _cumulTimer ;
00121 
00122   TMatrixDSym* _extV ;
00123 
00124   static TVirtualFitter *_theFitter ; 
00125 
00126   RooMinuit(const RooMinuit&) ;
00127         
00128   ClassDef(RooMinuit,0) // RooFit minimizer based on MINUIT
00129 } ;
00130 
00131 
00132 #endif
00133 

Generated on Tue Jul 5 14:26:14 2011 for ROOT_528-00b_version by  doxygen 1.5.1