38using std::string, std::list, std::map, std::vector, std::cout, std::endl;
50 _covI{
cov.GetNrows()},
53 if(!
cov.IsSymmetric()) {
56 <<
") input covariance matrix is not symmetric!";
58 throw std::invalid_argument(
errorMsg.str().c_str());
82 _cov(
reduceToConditional ? fr.conditionalCovarianceMatrix(xvec) : fr.reducedCovarianceMatrix(xvec)),
84 _det(_cov.Determinant()),
91 for (std::size_t i=0 ; i<
fpf.size() ; i++) {
92 if (xvec.
find(
fpf.at(i)->GetName())) {
116 for (
int i = 0; i < mu.
GetNrows(); i++) {
125 for (std::size_t i = 0; i <
n; i++) {
166 for (std::size_t i=0 ; i<
_mu.
size() ; i++) {
178 for (std::size_t i=0 ; i<
_x.
size() ; i++) {
187 return exp(-0.5*alpha) ;
203 for (std::size_t i=0 ; i<
_x.
size() ; i++) {
211 if (allVars.
size()==
_x.
size() && !rangeName) {
221 coutW(Integration) <<
"RooMultiVarGaussian::getAnalyticalIntegral(" <<
GetName() <<
") WARNING: p.d.f. has " <<
_x.
size()
222 <<
" observables, analytical integration is only implemented for the first 127 observables" << endl ;
231 for (std::size_t i=0 ; i<
_x.
size() ; i++) {
238 cxcoutD(Integration) <<
"RooMultiVarGaussian::getAnalyticalIntegral(" <<
GetName()
239 <<
") Advertising analytical integral over " << xi->
GetName() <<
" as range is >" <<
_z <<
" sigma" << endl ;
244 cxcoutD(Integration) <<
"RooMultiVarGaussian::getAnalyticalIntegral(" <<
GetName() <<
") Range of " << xi->
GetName() <<
" is <"
245 <<
_z <<
" sigma, relying on numeric integral" << endl ;
254 cxcoutD(Integration) <<
"RooMultiVarGaussian::getAnalyticalIntegral(" <<
GetName()
255 <<
") Advertising analytical integral over " << pi->
GetName() <<
" as range is >" <<
_z <<
" sigma" << endl ;
260 cxcoutD(Integration) <<
"RooMultiVarGaussian::getAnalyticalIntegral(" <<
GetName() <<
") Range of " << pi->
GetName() <<
" is <"
261 <<
_z <<
" sigma, relying on numeric integral" << endl ;
295 return pow(2*3.14159268,
_x.
size()/2.)*sqrt(std::abs(
_det)) ;
306 for (
UInt_t i=0 ; i<
aid.pmap.size() ; i++) {
311 double ret = pow(2*3.14159268,
aid.nint/2.)/sqrt(std::abs(
aid.S22det))*exp(-0.5*
u*(
aid.S22bar*
u)) ;
322 errorMsg <<
"Partial integrals over RooMultiVarGaussian are not supported.";
324 throw std::runtime_error(
errorMsg.str().c_str());
336 map<int,AnaIntData>::iterator iter =
_anaIntCache.find(code) ;
338 return iter->second ;
401 coutW(Integration) <<
"RooMultiVarGaussian::getGenerator(" <<
GetName() <<
") WARNING: p.d.f. has " <<
_x.
size()
402 <<
" observables, partial internal generation is only implemented for the first 127 observables" << endl ;
409 for (std::size_t i=0 ; i<
_x.
size() ; i++) {
482 for (
UInt_t i=0 ; i<
gd.pmap.size() ; i++) {
493 for (
int i=0 ; i<
nobs ; i++) {
521 map<int,GenData>::iterator iter =
_genCache.find(code) ;
523 return iter->second ;
541 for (std::size_t i=0 ; i<
_x.
size() ; i++) {
620 cout <<
"RooMultiVarGaussian::decodeCode(" <<
GetName() <<
") ERROR don't have bit pattern for code " << code << endl ;
621 throw string(
"RooMultiVarGaussian::decodeCode() ERROR don't have bit pattern for code") ;
627 for (std::size_t i=0 ; i<
_x.
size() ; i++) {
675 if (
ibit<32)
return (b0 & (1<<
ibit)) ;
676 if (
ibit<64)
return (b1 & (1<<(
ibit-32))) ;
677 if (
ibit<96)
return (b2 & (1<<(
ibit-64))) ;
678 if (
ibit<128)
return (b3 & (1<<(
ibit-96))) ;
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
Option_t Option_t TPoint TPoint const char x2
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
const_iterator begin() const
const_iterator end() const
Common abstract base class for objects that represent a value and a "shape" in RooFit.
virtual bool remove(const RooAbsArg &var, bool silent=false, bool matchByNameOnly=false)
Remove the specified argument from our list.
bool contains(const RooAbsArg &var) const
Check if collection contains an argument with the same name as var.
Storage_t::size_type size() const
RooAbsArg * find(const char *name) const
Find object with given name in list.
Abstract interface for all probability density functions.
virtual double getMax(const char *name=nullptr) const
Get maximum of currently defined range.
virtual double getMin(const char *name=nullptr) const
Get minimum of currently defined range.
Abstract base class for objects that represent a real value and implements functionality common to al...
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
bool operator==(double value) const
Equality operator comparing to a double.
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooAbsArg * at(Int_t idx) const
Return object at given index, or nullptr if index is out of range.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
bool addOwned(RooAbsArg &var, bool silent=false) override
Overloaded RooCollection_t::addOwned() method insert object into owning set and registers object as s...
bool add(const RooAbsArg &var, bool valueServer, bool shapeServer, bool silent)
Overloaded RooCollection_t::add() method insert object into set and registers object as server to own...
RooFitResult is a container class to hold the input and output of a PDF fit to a dataset.
const RooArgList & floatParsFinal() const
Return list of floating parameters after fit.
A class to maintain the context for squashing of RooFit models into code.
std::string buildCall(std::string const &funcname, Args_t const &...args)
Build the code to call the function with name funcname, passing some arguments.
void addResult(RooAbsArg const *key, std::string const &value)
A function to save an expression that includes/depends on the result of the input node.
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.
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
!
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.
static double gaussian(TRandom *generator=randomGenerator())
Return a Gaussian random variable with mean 0 and variance 1.
Variable that can be changed from the outside.
void setVal(double value) override
Set value of variable to 'value'.
Cholesky Decomposition class.
Int_t GetNoElements() const
TMatrixTSym< Element > & SetSub(Int_t row_lwb, const TMatrixTBase< Element > &source)
Insert matrix source starting at [row_lwb][row_lwb], thereby overwriting the part [row_lwb....
Double_t Determinant() const override
TMatrixTSym< Element > & Invert(Double_t *det=nullptr)
Invert the matrix and calculate its determinant Notice that the LU decomposition is used instead of B...
const Element * GetMatrixArray() const override
const char * GetName() const override
Returns name of object.
TVectorT< Element > & ResizeTo(Int_t lwb, Int_t upb)
Resize the vector to [lwb:upb] .
RooConstVar & RooConst(double val)