RooMultiVarGaussian.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Project: RooFit                                                           *
00003  * Package: RooFitModels                                                     *
00004  *    File: $Id: RooMultiVarGaussian.h 30333 2009-09-21 15:39:17Z wouter $
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_MULTI_VAR_GAUSSIAN
00017 #define ROO_MULTI_VAR_GAUSSIAN
00018 
00019 #include "RooAbsPdf.h"
00020 #include "RooListProxy.h"
00021 #include "TMatrixDSym.h"
00022 #include "TMatrixD.h"
00023 #include "TVectorD.h"
00024 
00025 class RooRealVar;
00026 class RooFitResult ;
00027 
00028 class RooMultiVarGaussian : public RooAbsPdf {
00029 public:
00030 
00031   RooMultiVarGaussian() {} ;
00032   RooMultiVarGaussian(const char *name, const char *title, const RooArgList& xvec, const RooFitResult& fr) ;
00033   RooMultiVarGaussian(const char *name, const char *title, const RooArgList& xvec, const RooArgList& mu, const TMatrixDSym& covMatrix) ;
00034   RooMultiVarGaussian(const char *name, const char *title, const RooArgList& xvec, const TVectorD& mu, const TMatrixDSym& covMatrix) ;
00035   RooMultiVarGaussian(const char *name, const char *title, const RooArgList& xvec,const TMatrixDSym& covMatrix) ;
00036   void setAnaIntZ(Double_t z) { _z = z ; }
00037 
00038   RooMultiVarGaussian(const RooMultiVarGaussian& other, const char* name=0) ;
00039   virtual TObject* clone(const char* newname) const { return new RooMultiVarGaussian(*this,newname); }
00040   inline virtual ~RooMultiVarGaussian() { }
00041 
00042   Int_t getAnalyticalIntegral(RooArgSet& allVars, RooArgSet& analVars, const char* rangeName=0) const ; 
00043   Double_t analyticalIntegral(Int_t code, const char* rangeName=0) const ; 
00044 
00045   Int_t getGenerator(const RooArgSet& directVars, RooArgSet &generateVars, Bool_t staticInitOK=kTRUE) const; 
00046   void initGenerator(Int_t code) ;
00047   void generateEvent(Int_t code); 
00048 
00049   const TMatrixDSym& covarianceMatrix() const { return _cov ; }
00050   
00051   class AnaIntData {
00052   public:
00053     TMatrixD    S22bar ;
00054     Double_t    S22det ;
00055     vector<int> pmap ;
00056     Int_t       nint ;
00057   } ;
00058 
00059   class GenData {
00060   public:
00061     TMatrixD    UT ;
00062     vector<int> omap ;
00063     vector<int> pmap ;
00064     TVectorD    mu1 ;
00065     TVectorD    mu2 ;
00066     TMatrixD    S12S22I ;
00067   } ;
00068 
00069   static void blockDecompose(const TMatrixD& input, const vector<int>& map1, const vector<int>& map2, TMatrixDSym& S11, TMatrixD& S12, TMatrixD& S21, TMatrixDSym& S22) ;
00070 
00071 protected:
00072 
00073   void decodeCode(Int_t code, vector<int>& map1, vector<int>& map2) const;
00074   AnaIntData& anaIntData(Int_t code) const ;
00075   GenData& genData(Int_t code) const ;
00076 
00077   mutable map<int,AnaIntData> _anaIntCache ; //!
00078   mutable map<int,GenData> _genCache ; //!
00079 
00080   RooListProxy _x ;
00081   RooListProxy _mu ;
00082   TMatrixDSym _cov ;
00083   TMatrixDSym _covI ;
00084   Double_t    _det ; 
00085   Double_t    _z ; 
00086 
00087   void syncMuVec() const ;
00088   mutable TVectorD _muVec ; //! Do not persist
00089 
00090   Double_t evaluate() const ;
00091 
00092 private:
00093 
00094   ClassDef(RooMultiVarGaussian,1) // Multivariate Gaussian PDF with correlations
00095 };
00096 
00097 #endif

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