Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
25class RooRealVar;
26class RooFitResult ;
27
28#include <map>
29#include <vector>
30
32public:
33
35 RooMultiVarGaussian(const char *name, const char *title, const RooArgList& xvec, const RooArgList& mu, const TMatrixDBase& covMatrix) ;
36 RooMultiVarGaussian(const char *name, const char *title, const RooArgList& xvec, const RooFitResult& fr, bool reduceToConditional=true) ;
37 RooMultiVarGaussian(const char *name, const char *title, const RooArgList& xvec, const TVectorD& mu, const TMatrixDBase& covMatrix) ;
38 RooMultiVarGaussian(const char *name, const char *title, const RooArgList& xvec,const TMatrixDBase& covMatrix) ;
39 void setAnaIntZ(double z) { _z = z ; }
40
41 RooMultiVarGaussian(const RooMultiVarGaussian& other, const char* name=nullptr) ;
42 TObject* clone(const char* newname) const override { return new RooMultiVarGaussian(*this,newname); }
43
44 Int_t getAnalyticalIntegral(RooArgSet& allVars, RooArgSet& analVars, const char* rangeName=nullptr) const override ;
45 double analyticalIntegral(Int_t code, const char* rangeName=nullptr) const override ;
46
47 Int_t getGenerator(const RooArgSet& directVars, RooArgSet &generateVars, bool staticInitOK=true) const override;
48 void initGenerator(Int_t code) override ;
49 void generateEvent(Int_t code) override;
50
51 const TMatrixDSym& covarianceMatrix() const { return _cov ; }
52 const RooArgList& xVec() const { return _x;}
53 const RooArgList& muVec() const { return _mu; }
54
55 class AnaIntData {
56 public:
58 double S22det ;
59 std::vector<int> pmap ;
61 } ;
62
63 class GenData {
64 public:
66 std::vector<int> omap ;
67 std::vector<int> pmap ;
71 } ;
72
73 class BitBlock {
74 public:
75 void setBit(Int_t ibit) ;
76 bool getBit(Int_t ibit) ;
77 friend bool operator==(BitBlock const& lhs, BitBlock const& rhs);
78
79 Int_t b0 = 0;
80 Int_t b1 = 0;
81 Int_t b2 = 0;
82 Int_t b3 = 0;
83 } ;
84
85 static void blockDecompose(const TMatrixD& input, const std::vector<int>& map1, const std::vector<int>& map2, TMatrixDSym& S11, TMatrixD& S12, TMatrixD& S21, TMatrixDSym& S22) ;
86
87 void translate(RooFit::Detail::CodeSquashContext &ctx) const override;
88 std::string
89 buildCallToAnalyticIntegral(Int_t code, const char *rangeName, RooFit::Detail::CodeSquashContext &ctx) const override;
90
91protected:
92
93 void decodeCode(Int_t code, std::vector<int>& map1, std::vector<int>& map2) const;
94 AnaIntData& anaIntData(Int_t code) const ;
95 GenData& genData(Int_t code) const ;
96
97 mutable std::map<int,AnaIntData> _anaIntCache ; ///<!
98 mutable std::map<int,GenData> _genCache ; ///<!
99
100 mutable std::vector<BitBlock> _aicMap ; ///<!
101
106 double _det ;
107 double _z ;
108
109 void syncMuVec() const ;
110 mutable TVectorD _muVec ; //! Do not persist
111
112 double evaluate() const override ;
113
114private:
115
116 ClassDefOverride(RooMultiVarGaussian,1) // Multivariate Gaussian PDF with correlations
117};
118
119#endif
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
char name[80]
Definition TGX11.cxx:110
Abstract interface for all probability density functions.
Definition RooAbsPdf.h:40
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition RooArgList.h:22
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:24
RooFitResult is a container class to hold the input and output of a PDF fit to a dataset.
A class to maintain the context for squashing of RooFit models into code.
friend bool operator==(BitBlock const &lhs, BitBlock const &rhs)
Multivariate Gaussian p.d.f.
double analyticalIntegral(Int_t code, const char *rangeName=nullptr) const override
Handle full integral here.
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=nullptr) const override
Interface function getAnalyticalIntergral advertises the analytical integrals that are supported.
const TMatrixDSym & covarianceMatrix() const
void translate(RooFit::Detail::CodeSquashContext &ctx) const override
This function defines a translation for each RooAbsReal based object that can be used to express the ...
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...
std::vector< BitBlock > _aicMap
!
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.
AnaIntData & anaIntData(Int_t code) const
Check if cache entry was previously created.
double evaluate() const override
Do not persist.
std::map< int, GenData > _genCache
!
const RooArgList & xVec() const
TObject * clone(const char *newname) const override
Int_t getGenerator(const RooArgSet &directVars, RooArgSet &generateVars, bool staticInitOK=true) const override
Special case: generate all observables.
void initGenerator(Int_t code) override
Clear the GenData cache as its content is not invariant under changes in the mu vector.
std::string buildCallToAnalyticIntegral(Int_t code, const char *rangeName, RooFit::Detail::CodeSquashContext &ctx) const override
This function defines the analytical integral translation for the class.
GenData & genData(Int_t code) const
WVE – CHECK THAT GENDATA IS VALID GIVEN CURRENT VALUES OF _MU.
std::map< int, AnaIntData > _anaIntCache
!
void generateEvent(Int_t code) override
Retrieve generator config from cache.
const RooArgList & muVec() const
Variable that can be changed from the outside.
Definition RooRealVar.h:37
Mother of all ROOT objects.
Definition TObject.h:41