Logo ROOT  
Reference Guide
RooMultiVarGaussian.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitModels *
4  * File: $Id$
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_MULTI_VAR_GAUSSIAN
17 #define ROO_MULTI_VAR_GAUSSIAN
18 
19 #include "RooAbsPdf.h"
20 #include "RooListProxy.h"
21 #include "TMatrixDSym.h"
22 #include "TMatrixD.h"
23 #include "TVectorD.h"
24 
25 class RooRealVar;
26 class RooFitResult ;
27 
28 #include <map>
29 #include <vector>
30 
32 public:
33 
35  RooMultiVarGaussian(const char *name, const char *title, const RooArgList& xvec, const RooArgList& mu, const TMatrixDSym& covMatrix) ;
36  RooMultiVarGaussian(const char *name, const char *title, const RooArgList& xvec, const RooFitResult& fr, Bool_t reduceToConditional=kTRUE) ;
37  RooMultiVarGaussian(const char *name, const char *title, const RooArgList& xvec, const TVectorD& mu, const TMatrixDSym& covMatrix) ;
38  RooMultiVarGaussian(const char *name, const char *title, const RooArgList& xvec,const TMatrixDSym& covMatrix) ;
39  void setAnaIntZ(Double_t z) { _z = z ; }
40 
41  RooMultiVarGaussian(const RooMultiVarGaussian& other, const char* name=0) ;
42  virtual TObject* clone(const char* newname) const { return new RooMultiVarGaussian(*this,newname); }
43  inline virtual ~RooMultiVarGaussian() { }
44 
45  Int_t getAnalyticalIntegral(RooArgSet& allVars, RooArgSet& analVars, const char* rangeName=0) const ;
46  Double_t analyticalIntegral(Int_t code, const char* rangeName=0) const ;
47 
48  Int_t getGenerator(const RooArgSet& directVars, RooArgSet &generateVars, Bool_t staticInitOK=kTRUE) const;
49  void initGenerator(Int_t code) ;
50  void generateEvent(Int_t code);
51 
52  const TMatrixDSym& covarianceMatrix() const { return _cov ; }
53 
54  class AnaIntData {
55  public:
58  std::vector<int> pmap ;
60  } ;
61 
62  class GenData {
63  public:
65  std::vector<int> omap ;
66  std::vector<int> pmap ;
70  } ;
71 
72  class BitBlock {
73  public:
74  BitBlock() : b0(0), b1(0), b2(0), b3(0) {} ;
75 
76  void setBit(Int_t ibit) ;
77  Bool_t getBit(Int_t ibit) ;
78  Bool_t operator==(const BitBlock& other) ;
79 
84  } ;
85 
86  static void blockDecompose(const TMatrixD& input, const std::vector<int>& map1, const std::vector<int>& map2, TMatrixDSym& S11, TMatrixD& S12, TMatrixD& S21, TMatrixDSym& S22) ;
87 
88 protected:
89 
90  void decodeCode(Int_t code, std::vector<int>& map1, std::vector<int>& map2) const;
91  AnaIntData& anaIntData(Int_t code) const ;
92  GenData& genData(Int_t code) const ;
93 
94  mutable std::map<int,AnaIntData> _anaIntCache ; //!
95  mutable std::map<int,GenData> _genCache ; //!
96 
97  mutable std::vector<BitBlock> _aicMap ; //!
98 
105 
106  void syncMuVec() const ;
107  mutable TVectorD _muVec ; //! Do not persist
108 
109  Double_t evaluate() const ;
110 
111 private:
112 
113  ClassDef(RooMultiVarGaussian,1) // Multivariate Gaussian PDF with correlations
114 };
115 
116 #endif
RooMultiVarGaussian::GenData::omap
std::vector< int > omap
Definition: RooMultiVarGaussian.h:65
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:100
RooMultiVarGaussian::BitBlock::BitBlock
BitBlock()
Definition: RooMultiVarGaussian.h:74
TVectorD.h
RooMultiVarGaussian::generateEvent
void generateEvent(Int_t code)
Retrieve generator config from cache.
Definition: RooMultiVarGaussian.cxx:432
RooMultiVarGaussian::BitBlock::b1
Int_t b1
Definition: RooMultiVarGaussian.h:81
RooMultiVarGaussian::analyticalIntegral
Double_t analyticalIntegral(Int_t code, const char *rangeName=0) const
Handle full integral here.
Definition: RooMultiVarGaussian.cxx:289
RooMultiVarGaussian
Multivariate Gaussian p.d.f.
Definition: RooMultiVarGaussian.h:31
RooArgList
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgList.h:21
RooMultiVarGaussian::evaluate
Double_t evaluate() const
Do not persist.
Definition: RooMultiVarGaussian.cxx:176
RooMultiVarGaussian::getAnalyticalIntegral
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=0) const
Interface function getAnalyticalIntergral advertises the analytical integrals that are supported.
Definition: RooMultiVarGaussian.cxx:195
RooMultiVarGaussian::BitBlock::setBit
void setBit(Int_t ibit)
Definition: RooMultiVarGaussian.cxx:642
RooMultiVarGaussian::covarianceMatrix
const TMatrixDSym & covarianceMatrix() const
Definition: RooMultiVarGaussian.h:52
TMatrixTSym< Double_t >
RooMultiVarGaussian::decodeCode
void decodeCode(Int_t code, std::vector< int > &map1, std::vector< int > &map2) const
Decode analytical integration/generation code into index map of integrated/generated (map2) and non-i...
Definition: RooMultiVarGaussian.cxx:594
RooMultiVarGaussian::BitBlock::b0
Int_t b0
Definition: RooMultiVarGaussian.h:80
TMatrixT< Double_t >
RooMultiVarGaussian::GenData::UT
TMatrixD UT
Definition: RooMultiVarGaussian.h:64
bool
RooFitResult
RooFitResult is a container class to hold the input and output of a PDF fit to a dataset.
Definition: RooFitResult.h:40
RooMultiVarGaussian::~RooMultiVarGaussian
virtual ~RooMultiVarGaussian()
Definition: RooMultiVarGaussian.h:43
TMatrixDSym.h
RooMultiVarGaussian::clone
virtual TObject * clone(const char *newname) const
Definition: RooMultiVarGaussian.h:42
RooMultiVarGaussian::GenData::pmap
std::vector< int > pmap
Definition: RooMultiVarGaussian.h:66
RooMultiVarGaussian::GenData::mu1
TVectorD mu1
Definition: RooMultiVarGaussian.h:67
RooMultiVarGaussian::_anaIntCache
std::map< int, AnaIntData > _anaIntCache
Definition: RooMultiVarGaussian.h:94
RooMultiVarGaussian::_covI
TMatrixDSym _covI
Definition: RooMultiVarGaussian.h:102
RooMultiVarGaussian::RooMultiVarGaussian
RooMultiVarGaussian()
Definition: RooMultiVarGaussian.h:34
RooMultiVarGaussian::_x
RooListProxy _x
Definition: RooMultiVarGaussian.h:99
RooMultiVarGaussian::anaIntData
AnaIntData & anaIntData(Int_t code) const
Check if cache entry was previously created.
Definition: RooMultiVarGaussian.cxx:318
RooMultiVarGaussian::GenData
Definition: RooMultiVarGaussian.h:62
RooMultiVarGaussian::genData
GenData & genData(Int_t code) const
WVE – CHECK THAT GENDATA IS VALID GIVEN CURRENT VALUES OF _MU.
Definition: RooMultiVarGaussian.cxx:499
RooAbsPdf.h
RooMultiVarGaussian::_muVec
TVectorD _muVec
Definition: RooMultiVarGaussian.h:107
RooMultiVarGaussian::getGenerator
Int_t getGenerator(const RooArgSet &directVars, RooArgSet &generateVars, Bool_t staticInitOK=kTRUE) const
Special case: generate all observables.
Definition: RooMultiVarGaussian.cxx:372
RooMultiVarGaussian::BitBlock
Definition: RooMultiVarGaussian.h:72
RooMultiVarGaussian::BitBlock::getBit
Bool_t getBit(Int_t ibit)
Definition: RooMultiVarGaussian.cxx:650
RooMultiVarGaussian::_det
Double_t _det
Definition: RooMultiVarGaussian.h:103
RooMultiVarGaussian::BitBlock::b2
Int_t b2
Definition: RooMultiVarGaussian.h:82
RooMultiVarGaussian::AnaIntData
Definition: RooMultiVarGaussian.h:54
RooMultiVarGaussian::GenData::S12S22I
TMatrixD S12S22I
Definition: RooMultiVarGaussian.h:69
RooMultiVarGaussian::_aicMap
std::vector< BitBlock > _aicMap
Definition: RooMultiVarGaussian.h:97
RooListProxy
RooListProxy is the concrete proxy for RooArgList objects.
Definition: RooListProxy.h:24
RooMultiVarGaussian::AnaIntData::pmap
std::vector< int > pmap
Definition: RooMultiVarGaussian.h:58
RooMultiVarGaussian::GenData::mu2
TVectorD mu2
Definition: RooMultiVarGaussian.h:68
RooMultiVarGaussian::AnaIntData::S22det
Double_t S22det
Definition: RooMultiVarGaussian.h:57
RooMultiVarGaussian::BitBlock::operator==
Bool_t operator==(const BitBlock &other)
Definition: RooMultiVarGaussian.cxx:659
RooMultiVarGaussian::AnaIntData::S22bar
TMatrixD S22bar
Definition: RooMultiVarGaussian.h:56
TVectorT< Double_t >
RooListProxy.h
Double_t
double Double_t
Definition: RtypesCore.h:59
RooMultiVarGaussian::_mu
RooListProxy _mu
Definition: RooMultiVarGaussian.h:100
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
RooMultiVarGaussian::blockDecompose
static void blockDecompose(const TMatrixD &input, const std::vector< int > &map1, const std::vector< int > &map2, TMatrixDSym &S11, TMatrixD &S12, TMatrixD &S21, TMatrixDSym &S22)
Block decomposition of covI according to given maps of observables.
Definition: RooMultiVarGaussian.cxx:617
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
name
char name[80]
Definition: TGX11.cxx:110
RooMultiVarGaussian::syncMuVec
void syncMuVec() const
Definition: RooMultiVarGaussian.cxx:164
RooMultiVarGaussian::AnaIntData::nint
Int_t nint
Definition: RooMultiVarGaussian.h:59
RooAbsPdf
Definition: RooAbsPdf.h:41
RooMultiVarGaussian::initGenerator
void initGenerator(Int_t code)
Clear the GenData cache as its content is not invariant under changes in the mu vector.
Definition: RooMultiVarGaussian.cxx:420
RooMultiVarGaussian::_genCache
std::map< int, GenData > _genCache
Definition: RooMultiVarGaussian.h:95
TMatrixD.h
RooRealVar
RooRealVar represents a variable that can be changed from the outside.
Definition: RooRealVar.h:39
RooMultiVarGaussian::setAnaIntZ
void setAnaIntZ(Double_t z)
Definition: RooMultiVarGaussian.h:39
RooMultiVarGaussian::_cov
TMatrixDSym _cov
Definition: RooMultiVarGaussian.h:101
RooArgSet
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:33
RooMultiVarGaussian::_z
Double_t _z
Definition: RooMultiVarGaussian.h:104
int
RooMultiVarGaussian::BitBlock::b3
Int_t b3
Definition: RooMultiVarGaussian.h:83