RooFitResult.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Project: RooFit                                                           *
00003  * Package: RooFitCore                                                       *
00004  *    File: $Id: RooFitResult.h,v 1.28 2007/05/11 09:11:30 verkerke 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_FIT_RESULT
00017 #define ROO_FIT_RESULT
00018 
00019 #include "Riosfwd.h"
00020 #include "RooAbsArg.h"
00021 #include "RooPrintable.h"
00022 #include "RooDirItem.h"
00023 #include "RooArgList.h"
00024 
00025 #include "RVersion.h"
00026 #include "TMatrixFfwd.h"
00027 #include "TMatrixDSym.h"
00028 #include "TRootIOCtor.h"
00029 
00030 class RooArgSet ;
00031 class RooAbsPdf ;
00032 class RooPlot;
00033 class TObject ;
00034 class TH2 ;
00035 typedef RooArgSet* pRooArgSet ;
00036 
00037 class RooFitResult : public TNamed, public RooPrintable, public RooDirItem {
00038 public:
00039  
00040   // Constructors, assignment etc.
00041   RooFitResult(const char* name=0, const char* title=0) ;
00042   RooFitResult(const RooFitResult& other) ;                          
00043   virtual TObject* Clone(const char* newname = 0) const { 
00044     RooFitResult* r =  new RooFitResult(*this) ; 
00045     if (newname && *newname) r->SetName(newname) ; 
00046     return r ; 
00047   }
00048   virtual TObject* clone() const { return new RooFitResult(*this); }   
00049   virtual ~RooFitResult() ;
00050 
00051   static RooFitResult* lastMinuitFit(const RooArgList& varList=RooArgList()) ;
00052 
00053   // Printing interface (human readable)
00054   virtual void printValue(ostream& os) const ;
00055   virtual void printName(ostream& os) const ;
00056   virtual void printTitle(ostream& os) const ;
00057   virtual void printClassName(ostream& os) const ;
00058   virtual void printArgs(ostream& os) const ;
00059   void printMultiline(ostream& os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const ;
00060 
00061   inline virtual void Print(Option_t *options= 0) const {
00062     // Printing interface
00063     printStream(defaultPrintStream(),defaultPrintContents(options),defaultPrintStyle(options));
00064   }
00065 
00066   virtual Int_t defaultPrintContents(Option_t* opt) const ;
00067   virtual StyleOption defaultPrintStyle(Option_t* opt) const ;
00068 
00069   RooAbsPdf* createHessePdf(const RooArgSet& params) const ;
00070 
00071   // Accessors
00072   inline Int_t status() const {
00073     // Return MINUIT status code
00074     return _status ; 
00075   }
00076   inline Int_t covQual() const { 
00077     // Return MINUIT quality code of covariance matrix
00078     return _covQual ; 
00079   }
00080   inline Int_t numInvalidNLL() const { 
00081     // Return number of NLL evaluations with problems
00082     return _numBadNLL ; 
00083   }
00084   inline Double_t edm() const { 
00085     // Return estimated distance to minimum
00086     return _edm ; 
00087   }
00088   inline Double_t minNll() const { 
00089     // Return minimized -log(L) value
00090     return _minNLL ; 
00091   }
00092   inline const RooArgList& constPars() const { 
00093     // Return list of constant parameters
00094     return *_constPars ; 
00095   }
00096   inline const RooArgList& floatParsInit() const { 
00097     // Return list of floating parameters before fit
00098     return *_initPars ; 
00099   } 
00100   inline const RooArgList& floatParsFinal() const { 
00101     // Return list of floarting parameters after fit
00102     return *_finalPars ; 
00103   } 
00104 
00105   TH2* correlationHist(const char* name = "correlation_matrix") const ;
00106 
00107   Double_t correlation(const RooAbsArg& par1, const RooAbsArg& par2) const {
00108     // Return correlation between par1 and par2
00109     return correlation(par1.GetName(),par2.GetName()) ;
00110   }
00111   const RooArgList* correlation(const RooAbsArg& par) const {
00112     // Return pointer to list of correlations of all parameters with par
00113     return correlation(par.GetName()) ;
00114   }
00115 
00116   Double_t correlation(const char* parname1, const char* parname2) const ;
00117   const RooArgList* correlation(const char* parname) const ;
00118 
00119   
00120   const TMatrixDSym& covarianceMatrix() const ;
00121   TMatrixDSym reducedCovarianceMatrix(const RooArgList& params) const ;
00122   const TMatrixDSym& correlationMatrix() const ;
00123 
00124 
00125   // Global correlation accessors
00126   Double_t globalCorr(const RooAbsArg& par) { return globalCorr(par.GetName()) ; }
00127   Double_t globalCorr(const char* parname) ;
00128   const RooArgList* globalCorr() ;
00129 
00130 
00131   // Add objects to a 2D plot
00132   inline RooPlot *plotOn(RooPlot *frame, const RooAbsArg &par1, const RooAbsArg &par2,
00133                          const char *options= "ME") const {
00134     // Plot error ellipse in par1 and par2 on frame
00135     return plotOn(frame,par1.GetName(),par2.GetName(),options);
00136   }
00137   RooPlot *plotOn(RooPlot *plot, const char *parName1, const char *parName2,
00138                   const char *options= "ME") const;
00139 
00140   // Generate random perturbations of the final parameters using the covariance matrix
00141   const RooArgList& randomizePars() const;
00142 
00143   Bool_t isIdentical(const RooFitResult& other, Double_t tol=5e-5, Double_t tolCorr=1e-4, Bool_t verbose=kTRUE) const ;
00144 
00145   void SetName(const char *name) ;
00146   void SetNameTitle(const char *name, const char* title) ;
00147 
00148 protected:
00149   
00150   friend class RooMinuit ;
00151   friend class RooMinimizer ;
00152   friend class RooNag ;
00153   void setCovarianceMatrix(TMatrixDSym& V) ; 
00154   void setConstParList(const RooArgList& list) ;
00155   void setInitParList(const RooArgList& list) ;
00156   void setFinalParList(const RooArgList& list) ;
00157   inline void setMinNLL(Double_t val) { _minNLL = val ; }
00158   inline void setEDM(Double_t val) { _edm = val ; }
00159   inline void setStatus(Int_t val) { _status = val ; }
00160   inline void setCovQual(Int_t val) { _covQual = val ; }
00161   inline void setNumInvalidNLL(Int_t val) { _numBadNLL=val ; }
00162   void fillCorrMatrix() ;
00163   void fillCorrMatrix(const std::vector<double>& globalCC, const TMatrixDSym& corrs, const TMatrixDSym& covs) ;
00164   void fillLegacyCorrMatrix() const ;
00165 
00166   Double_t correlation(Int_t row, Int_t col) const;
00167   Double_t covariance(Int_t row, Int_t col) const;
00168 
00169   Int_t    _status ;          // MINUIT status code
00170   Int_t    _covQual ;         // MINUIT quality code of covariance matrix
00171   Int_t    _numBadNLL ;       // Number calls with bad (zero,negative) likelihood 
00172   Double_t _minNLL ;          // NLL at minimum
00173   Double_t _edm ;             // Estimated distance to minimum
00174   RooArgList* _constPars ;    // List of constant parameters
00175   RooArgList* _initPars ;     // List of floating parameters with initial values
00176   RooArgList* _finalPars ;    // List of floating parameters with final values
00177 
00178   mutable RooArgList* _globalCorr ;   //! List of global correlation coefficients
00179   mutable TList       _corrMatrix ;   //! Correlation matrix (list of RooArgLists)
00180 
00181   mutable RooArgList *_randomPars; //! List of floating parameters with most recent random perturbation applied
00182   mutable TMatrixF* _Lt;            //! triangular matrix used for generate random perturbations
00183 
00184   TMatrixDSym* _CM ;  // Correlation matrix 
00185   TMatrixDSym* _VM ;  // Covariance matrix 
00186   TVectorD* _GC ;     // Global correlation coefficients 
00187 
00188   ClassDef(RooFitResult,4) // Container class for fit result
00189 };
00190 
00191 #endif

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