Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooMultiVarGaussian.cxx
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitModels *
4 * @(#)root/roofit:$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
17/**
18\file RooMultiVarGaussian.cxx
19\class RooMultiVarGaussian
20\ingroup Roofitcore
21
22Multivariate Gaussian p.d.f. with correlations
23**/
24
25#include "RooMultiVarGaussian.h"
26#include "RooAbsReal.h"
27#include "RooRealVar.h"
28#include "RooRandom.h"
29#include "RooGlobalFunc.h"
30#include "RooConstVar.h"
31#include "TDecompChol.h"
32#include "RooFitResult.h"
33
34#include <cmath>
35#include <list>
36#include <map>
37#include <vector>
38#include <ostream>
39
40using std::string, std::list, std::map, std::vector;
41
42
43////////////////////////////////////////////////////////////////////////////////
44
45RooMultiVarGaussian::RooMultiVarGaussian(const char *name, const char *title,
46 const RooArgList& xvec, const RooArgList& mu, const TMatrixDBase& cov) :
47 RooAbsPdf(name,title),
48 _x("x","Observables",this,true,false),
49 _mu("mu","Offset vector",this,true,false),
50 _cov{cov.GetNrows()},
51 _covI{cov.GetNrows()},
52 _z(4)
53{
54 if(!cov.IsSymmetric()) {
55 std::stringstream errorMsg;
56 errorMsg << "RooMultiVarGaussian::RooMultiVarGaussian(" << GetName()
57 << ") input covariance matrix is not symmetric!";
58 coutE(InputArguments) << errorMsg.str() << std::endl;
59 throw std::invalid_argument(errorMsg.str().c_str());
60 }
61
62 _cov.SetSub(0, cov);
63 _covI.SetSub(0, cov);
64
65 _x.add(xvec) ;
66
67 _mu.add(mu) ;
68
70
71 // Invert covariance matrix
72 _covI.Invert() ;
73}
74
75
76////////////////////////////////////////////////////////////////////////////////
77
78RooMultiVarGaussian::RooMultiVarGaussian(const char *name, const char *title, const RooArgList &xvec,
79 const RooFitResult &fr, bool reduceToConditional)
80 : RooAbsPdf(name, title),
81 _x("x", "Observables", this, true, false),
82 _mu("mu", "Offset vector", this, true, false),
83 _cov(reduceToConditional ? fr.conditionalCovarianceMatrix(xvec) : fr.reducedCovarianceMatrix(xvec)),
84 _covI(_cov),
85 _det(_cov.Determinant()),
86 _z(4)
87{
88
89 // Fill mu vector with constant RooRealVars
91 const RooArgList& fpf = fr.floatParsFinal() ;
92 for (std::size_t i=0 ; i<fpf.size() ; i++) {
93 if (xvec.find(fpf.at(i)->GetName())) {
94 std::unique_ptr<RooRealVar> parclone{static_cast<RooRealVar*>(fpf.at(i)->Clone(Form("%s_centralvalue",fpf.at(i)->GetName())))};
95 parclone->setConstant(true) ;
96 _mu.addOwned(std::move(parclone));
97 munames.push_back(fpf.at(i)->GetName()) ;
98 }
99 }
100
101 // Fill X vector in same order as mu vector
102 for (list<string>::iterator iter=munames.begin() ; iter!=munames.end() ; ++iter) {
103 RooRealVar* xvar = static_cast<RooRealVar*>(xvec.find(iter->c_str())) ;
104 _x.add(*xvar) ;
105 }
106
107 // Invert covariance matrix
108 _covI.Invert() ;
109
110}
111
112namespace {
113
115{
116 RooArgList out;
117 for (int i = 0; i < mu.GetNrows(); i++) {
118 out.add(RooFit::RooConst(mu(i)));
119 }
120 return out;
121}
122
123RooArgList muConstants(std::size_t n)
124{
125 RooArgList out;
126 for (std::size_t i = 0; i < n; i++) {
127 out.add(RooFit::RooConst(0));
128 }
129 return out;
130}
131
132} // namespace
133
134
135////////////////////////////////////////////////////////////////////////////////
136
137RooMultiVarGaussian::RooMultiVarGaussian(const char *name, const char *title, const RooArgList &xvec,
138 const TVectorD &mu, const TMatrixDBase &cov)
139 : RooMultiVarGaussian{name, title, xvec, muFromVector(mu), cov}
140{
141}
142
143////////////////////////////////////////////////////////////////////////////////
144
145RooMultiVarGaussian::RooMultiVarGaussian(const char *name, const char *title, const RooArgList &xvec,
146 const TMatrixDBase &cov)
147 : RooMultiVarGaussian{name, title, xvec, muConstants(xvec.size()), cov}
148{
149}
150
151
152////////////////////////////////////////////////////////////////////////////////
153
155 RooAbsPdf(other,name), _aicMap(other._aicMap), _x("x",this,other._x), _mu("mu",this,other._mu),
156 _cov(other._cov), _covI(other._covI), _det(other._det), _z(other._z)
157{
158}
159
160
161
162////////////////////////////////////////////////////////////////////////////////
163
165{
167 for (std::size_t i=0 ; i<_mu.size() ; i++) {
168 _muVec[i] = static_cast<RooAbsReal*>(_mu.at(i))->getVal() ;
169 }
170}
171
172
173////////////////////////////////////////////////////////////////////////////////
174/// Represent observables as vector
175
177{
178 TVectorD x(_x.size()) ;
179 for (std::size_t i=0 ; i<_x.size() ; i++) {
180 x[i] = static_cast<RooAbsReal*>(_x.at(i))->getVal() ;
181 }
182
183 // Calculate return value
184 syncMuVec() ;
186
187 double alpha = x_min_mu * (_covI * x_min_mu) ;
188 return exp(-0.5*alpha) ;
189}
190
191////////////////////////////////////////////////////////////////////////////////
192
194{
195 RooArgSet allVars(allVarsIn) ;
196
197 // If allVars contains x_i it cannot contain mu_i
198 for (std::size_t i=0 ; i<_x.size() ; i++) {
199 if (allVars.contains(*_x.at(i))) {
200 allVars.remove(*_mu.at(i),true,true) ;
201 }
202 }
203
204
205 // Analytical integral known over all observables
206 if (allVars.size()==_x.size() && !rangeName) {
207 analVars.add(allVars) ;
208 return -1 ;
209 }
210
211 Int_t code(0) ;
212
213 Int_t nx = _x.size() ;
214 if (nx>127) {
215 // Warn that analytical integration is only provided for the first 127 observables
216 coutW(Integration) << "RooMultiVarGaussian::getAnalyticalIntegral(" << GetName() << ") WARNING: p.d.f. has " << _x.size()
217 << " observables, analytical integration is only implemented for the first 127 observables" << std::endl ;
218 nx=127 ;
219 }
220
221 // Advertise partial analytical integral over all observables for which is wide enough to
222 // use asymptotic integral calculation
223 BitBlock bits ;
224 bool anyBits(false) ;
225 syncMuVec() ;
226 for (std::size_t i=0 ; i<_x.size() ; i++) {
227
228 // Check if integration over observable #i is requested
229 if (allVars.find(_x.at(i)->GetName())) {
230 // Check if range is wider than Z sigma
231 RooRealVar* xi = static_cast<RooRealVar*>(_x.at(i)) ;
232 if (xi->getMin(rangeName)<_muVec(i)-_z*sqrt(_cov(i,i)) && xi->getMax(rangeName) > _muVec(i)+_z*sqrt(_cov(i,i))) {
233 cxcoutD(Integration) << "RooMultiVarGaussian::getAnalyticalIntegral(" << GetName()
234 << ") Advertising analytical integral over " << xi->GetName() << " as range is >" << _z << " sigma" << std::endl ;
235 bits.setBit(i) ;
236 anyBits = true ;
237 analVars.add(*allVars.find(_x.at(i)->GetName())) ;
238 } else {
239 cxcoutD(Integration) << "RooMultiVarGaussian::getAnalyticalIntegral(" << GetName() << ") Range of " << xi->GetName() << " is <"
240 << _z << " sigma, relying on numeric integral" << std::endl ;
241 }
242 }
243
244 // Check if integration over parameter #i is requested
245 if (allVars.find(_mu.at(i)->GetName())) {
246 // Check if range is wider than Z sigma
247 RooRealVar* pi = static_cast<RooRealVar*>(_mu.at(i)) ;
248 if (pi->getMin(rangeName)<_muVec(i)-_z*sqrt(_cov(i,i)) && pi->getMax(rangeName) > _muVec(i)+_z*sqrt(_cov(i,i))) {
249 cxcoutD(Integration) << "RooMultiVarGaussian::getAnalyticalIntegral(" << GetName()
250 << ") Advertising analytical integral over " << pi->GetName() << " as range is >" << _z << " sigma" << std::endl ;
251 bits.setBit(i) ;
252 anyBits = true ;
253 analVars.add(*allVars.find(_mu.at(i)->GetName())) ;
254 } else {
255 cxcoutD(Integration) << "RooMultiVarGaussian::getAnalyticalIntegral(" << GetName() << ") Range of " << pi->GetName() << " is <"
256 << _z << " sigma, relying on numeric integral" << std::endl ;
257 }
258 }
259
260
261 }
262
263 // Full numeric integration over requested observables maps always to code zero
264 if (!anyBits) {
265 return 0 ;
266 }
267
268 // Map BitBlock into return code
269 for (UInt_t i=0 ; i<_aicMap.size() ; i++) {
270 if (_aicMap[i]==bits) {
271 code = i+1 ;
272 }
273 }
274 if (code==0) {
275 _aicMap.push_back(bits) ;
276 code = _aicMap.size() ;
277 }
278
279 return code ;
280}
281
282
283
284////////////////////////////////////////////////////////////////////////////////
285/// Handle full integral here
286
287double RooMultiVarGaussian::analyticalIntegral(Int_t code, const char* /*rangeName*/) const
288{
289 if (code==-1) {
290 return pow(2*3.14159268,_x.size()/2.)*sqrt(std::abs(_det)) ;
291 }
292
293 // Handle partial integrals here
294
295 // Retrieve |S22|, S22bar from cache
296 AnaIntData& aid = anaIntData(code) ;
297
298 // Fill position vector for non-integrated observables
299 syncMuVec() ;
300 TVectorD u(aid.pmap.size()) ;
301 for (UInt_t i=0 ; i<aid.pmap.size() ; i++) {
302 u(i) = (static_cast<RooAbsReal*>(_x.at(aid.pmap[i])))->getVal() - _muVec(aid.pmap[i]) ;
303 }
304
305 // Calculate partial integral
306 double ret = pow(2*3.14159268,aid.nint/2.)/sqrt(std::abs(aid.S22det))*exp(-0.5*u*(aid.S22bar*u)) ;
307
308 return ret ;
309}
310
311
312////////////////////////////////////////////////////////////////////////////////
313/// Check if cache entry was previously created
314
316{
317 map<int,AnaIntData>::iterator iter = _anaIntCache.find(code) ;
318 if (iter != _anaIntCache.end()) {
319 return iter->second ;
320 }
321
322 // Calculate cache contents
323
324 // Decode integration code
327 decodeCode(code,map1,map2) ;
328
329 // Rearrange observables so that all non-integrated observables
330 // go first (preserving relative order) and all integrated observables
331 // go last (preserving relative order)
337
338 // Begin calculation of partial integrals
339 // ___
340 // sqrt(2pi)^(#intObs) (-0.5 * u1T S22 u1 )
341 // I = ------------------- * e
342 // sqrt(|det(S22)|)
343 // ___
344 // Where S22 is the sub-matrix of covI for the integrated observables and S22
345 // is the Schur complement of S22
346 // ___ -1
347 // S22 = S11 - S12 * S22 * S21
348 //
349 // and u1 is the vector of non-integrated observables
350
351 // Calculate Schur complement S22bar
353 S22inv.Invert() ;
354 TMatrixD S22bar = S11 - S12*S22inv*S21 ;
355
356 // Create new cache entry
358 cacheData.S22bar.ResizeTo(S22bar) ;
359 cacheData.S22bar=S22bar ;
360 cacheData.S22det= S22.Determinant() ;
361 cacheData.pmap = map1 ;
362 cacheData.nint = map2.size() ;
363
364 return cacheData ;
365}
366
367
368
369////////////////////////////////////////////////////////////////////////////////
370/// Special case: generate all observables
371
373{
374 if (directVars.size()==_x.size()) {
376 return -1 ;
377 }
378
379 Int_t nx = _x.size() ;
380 if (nx>127) {
381 // Warn that analytical integration is only provided for the first 127 observables
382 coutW(Integration) << "RooMultiVarGaussian::getGenerator(" << GetName() << ") WARNING: p.d.f. has " << _x.size()
383 << " observables, partial internal generation is only implemented for the first 127 observables" << std::endl ;
384 nx=127 ;
385 }
386
387 // Advertise partial generation over all permutations of observables
388 Int_t code(0) ;
389 BitBlock bits ;
390 for (std::size_t i=0 ; i<_x.size() ; i++) {
391 RooAbsArg* arg = directVars.find(_x.at(i)->GetName()) ;
392 if (arg) {
393 bits.setBit(i) ;
394// code |= (1<<i) ;
395 generateVars.add(*arg) ;
396 }
397 }
398
399 // Map BitBlock into return code
400 for (UInt_t i=0 ; i<_aicMap.size() ; i++) {
401 if (_aicMap[i]==bits) {
402 code = i+1 ;
403 }
404 }
405 if (code==0) {
406 _aicMap.push_back(bits) ;
407 code = _aicMap.size() ;
408 }
409
410
411 return code ;
412}
413
414
415
416////////////////////////////////////////////////////////////////////////////////
417/// Clear the GenData cache as its content is not invariant under changes in
418/// the mu vector.
419
421{
422 _genCache.clear() ;
423
424}
425
426
427
428
429////////////////////////////////////////////////////////////////////////////////
430/// Retrieve generator config from cache
431
433{
434 GenData& gd = genData(code) ;
435 TMatrixD& TU = gd.UT ;
436 Int_t nobs = TU.GetNcols() ;
437 vector<int>& omap = gd.omap ;
438
439 while(true) {
440
441 // Create unit Gaussian vector
443 for(Int_t k= 0; k <nobs; k++) {
445 }
446
447 // Apply transformation matrix
448 xgen *= TU ;
449
450 // Apply shift
451 if (code == -1) {
452
453 // Simple shift if we generate all observables
454 xgen += gd.mu1 ;
455
456 } else {
457
458 // Non-generated observable dependent shift for partial generations
459
460 // mubar = mu1 + S12 S22Inv ( x2 - mu2)
461 TVectorD mubar(gd.mu1) ;
462 TVectorD x2(gd.pmap.size()) ;
463 for (UInt_t i=0 ; i<gd.pmap.size() ; i++) {
464 x2(i) = (static_cast<RooAbsReal*>(_x.at(gd.pmap[i])))->getVal() ;
465 }
466 mubar += gd.S12S22I * (x2 - gd.mu2) ;
467
468 xgen += mubar ;
469
470 }
471
472 // Transfer values and check if values are in range
473 bool ok(true) ;
474 for (int i=0 ; i<nobs ; i++) {
475 RooRealVar* xi = static_cast<RooRealVar*>(_x.at(omap[i])) ;
476 if (xgen(i)<xi->getMin() || xgen(i)>xi->getMax()) {
477 ok = false ;
478 break ;
479 } else {
480 xi->setVal(xgen(i)) ;
481 }
482 }
483
484 // If all values are in range, accept event and return
485 // otherwise retry
486 if (ok) {
487 break ;
488 }
489 }
490
491 return;
492}
493
494
495
496////////////////////////////////////////////////////////////////////////////////
497/// WVE -- CHECK THAT GENDATA IS VALID GIVEN CURRENT VALUES OF _MU
498
500{
501 // Check if cache entry was previously created
502 map<int,GenData>::iterator iter = _genCache.find(code) ;
503 if (iter != _genCache.end()) {
504 return iter->second ;
505 }
506
507 // Create new entry
508 GenData& cacheData = _genCache[code] ;
509
510 if (code==-1) {
511
512 // Do eigen value decomposition
514 tdc.Decompose() ;
515 TMatrixD U = tdc.GetU() ;
517
518 // Fill cache data
519 cacheData.UT.ResizeTo(TU) ;
520 cacheData.UT = TU ;
521 cacheData.omap.resize(_x.size()) ;
522 for (std::size_t i=0 ; i<_x.size() ; i++) {
523 cacheData.omap[i] = i ;
524 }
525 syncMuVec() ;
526 cacheData.mu1.ResizeTo(_muVec) ;
527 cacheData.mu1 = _muVec ;
528
529 } else {
530
531 // Construct observables: map1 = generated, map2 = given
534 decodeCode(code,map2,map1) ;
535
536 // Do block decomposition of covariance matrix
542
543 // Constructed conditional matrix form
544 // -1
545 // F(X1|X2) --> CovI --> S22bar = S11 - S12 S22 S21
546 // -1
547 // --> mu --> mubar = mu1 + S12 S22 ( x2 - mu2)
548
549 // Do eigenvalue decomposition
551 TMatrixD S22bar = S11 - S12 * (S22Inv * S21) ;
552
553 // Do eigen value decomposition of S22bar
554 TDecompChol tdc(S22bar) ;
555 tdc.Decompose() ;
556 TMatrixD U = tdc.GetU() ;
558
559 // Split mu vector into mu1 and mu2
560 TVectorD mu1(map1.size());
561 TVectorD mu2(map2.size());
562 syncMuVec() ;
563 for (UInt_t i=0 ; i<map1.size() ; i++) {
564 mu1(i) = _muVec(map1[i]) ;
565 }
566 for (UInt_t i=0 ; i<map2.size() ; i++) {
567 mu2(i) = _muVec(map2[i]) ;
568 }
569
570 // Calculate rotation matrix for mu vector
572
573 // Fill cache data
574 cacheData.UT.ResizeTo(TU) ;
575 cacheData.UT = TU ;
576 cacheData.omap = map1 ;
577 cacheData.pmap = map2 ;
578 cacheData.mu1.ResizeTo(mu1) ;
579 cacheData.mu2.ResizeTo(mu2) ;
580 cacheData.mu1 = mu1 ;
581 cacheData.mu2 = mu2 ;
582 cacheData.S12S22I.ResizeTo(S12S22Inv) ;
583 cacheData.S12S22I = S12S22Inv ;
584
585 }
586
587
588 return cacheData ;
589}
590
591
592
593
594////////////////////////////////////////////////////////////////////////////////
595/// Decode analytical integration/generation code into index map of integrated/generated (map2)
596/// and non-integrated/generated observables (map1)
597
599{
600 if (code<0 || code> (Int_t)_aicMap.size()) {
601 std::cout << "RooMultiVarGaussian::decodeCode(" << GetName() << ") ERROR don't have bit pattern for code " << code << std::endl ;
602 throw string("RooMultiVarGaussian::decodeCode() ERROR don't have bit pattern for code") ;
603 }
604
605 BitBlock b = _aicMap[code-1] ;
606 map1.clear() ;
607 map2.clear() ;
608 for (std::size_t i=0 ; i<_x.size() ; i++) {
609 if (b.getBit(i)) {
610 map2.push_back(i) ;
611 } else {
612 map1.push_back(i) ;
613 }
614 }
615}
616
617
618////////////////////////////////////////////////////////////////////////////////
619/// Block decomposition of covI according to given maps of observables
620
622{
623 // Allocate and fill reordered covI matrix in 2x2 block structure
624
625 S11.ResizeTo(map1.size(),map1.size()) ;
626 S12.ResizeTo(map1.size(),map2.size()) ;
627 S21.ResizeTo(map2.size(),map1.size()) ;
628 S22.ResizeTo(map2.size(),map2.size()) ;
629
630 for (UInt_t i=0 ; i<map1.size() ; i++) {
631 for (UInt_t j=0 ; j<map1.size() ; j++)
632 S11(i,j) = input(map1[i],map1[j]) ;
633 for (UInt_t j=0 ; j<map2.size() ; j++)
634 S12(i,j) = input(map1[i],map2[j]) ;
635 }
636 for (UInt_t i=0 ; i<map2.size() ; i++) {
637 for (UInt_t j=0 ; j<map1.size() ; j++)
638 S21(i,j) = input(map2[i],map1[j]) ;
639 for (UInt_t j=0 ; j<map2.size() ; j++)
640 S22(i,j) = input(map2[i],map2[j]) ;
641 }
642
643}
644
645
647{
648 if (ibit<32) { b0 |= (1<<ibit) ; return ; }
649 if (ibit<64) { b1 |= (1<<(ibit-32)) ; return ; }
650 if (ibit<96) { b2 |= (1<<(ibit-64)) ; return ; }
651 if (ibit<128) { b3 |= (1<<(ibit-96)) ; return ; }
652}
653
655{
656 if (ibit<32) return (b0 & (1<<ibit)) ;
657 if (ibit<64) return (b1 & (1<<(ibit-32))) ;
658 if (ibit<96) return (b2 & (1<<(ibit-64))) ;
659 if (ibit<128) return (b3 & (1<<(ibit-96))) ;
660 return false ;
661}
662
664{
665 if (lhs.b0 != rhs.b0)
666 return false;
667 if (lhs.b1 != rhs.b1)
668 return false;
669 if (lhs.b2 != rhs.b2)
670 return false;
671 if (lhs.b3 != rhs.b3)
672 return false;
673 return true;
674}
#define b(i)
Definition RSha256.hxx:100
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
#define cxcoutD(a)
#define coutW(a)
#define coutE(a)
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 name[80]
Definition TGX11.cxx:142
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Definition TString.cxx:2571
const_iterator begin() const
const_iterator end() const
Common abstract base class for objects that represent a value and a "shape" in RooFit.
Definition RooAbsArg.h:76
bool contains(const char *name) const
Check if collection contains an argument with a specific name.
virtual bool remove(const RooAbsArg &var, bool silent=false, bool matchByNameOnly=false)
Remove the specified argument from our list.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
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.
Definition RooAbsPdf.h:32
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...
Definition RooAbsReal.h:63
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
Definition RooAbsReal.h:107
bool operator==(double value) const
Equality operator comparing to a double.
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition RooArgList.h:22
RooAbsArg * at(Int_t idx) const
Return object at given index, or nullptr if index is out of range.
Definition RooArgList.h:110
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:24
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.
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 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
Represent observables as vector.
std::map< int, GenData > _genCache
!
TVectorD _muVec
! Do not persist
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.
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.
Definition RooRealVar.h:37
void setVal(double value) override
Set value of variable to 'value'.
Cholesky Decomposition class.
Definition TDecompChol.h:25
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 char * GetName() const override
Returns name of object.
Definition TNamed.h:49
TVectorT< Element > & ResizeTo(Int_t lwb, Int_t upb)
Resize the vector to [lwb:upb] .
Definition TVectorT.cxx:294
Int_t GetNrows() const
Definition TVectorT.h:75
RooConstVar & RooConst(double val)
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16