ATLAS Offline Software
GenGauss3D.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /*****************************************************************************
6  * Project: RooFit *
7  * *
8  * This code was autogenerated by RooClassFactory *
9  *****************************************************************************/
10 
11 // Your description goes here...
12 
13 #include "Riostream.h"
14 
15 #include "GenGauss3D.h"
16 #include "RooAbsReal.h"
17 #include "RooAbsCategory.h"
18 #include <math.h>
19 #include "TMath.h"
20 
22 
23  GenGauss3D::GenGauss3D(const char *name, const char *title,
24  RooArgList& _xvec,
25  RooArgList& _muvec,
26  RooAbsReal& _vxx,
27  RooAbsReal& _vxy,
28  RooAbsReal& _vxz,
29  RooAbsReal& _vyy,
30  RooAbsReal& _vyz,
31  RooAbsReal& _vzz,
32  TMatrixDSym& dummyMatrix) :
33  RooMultiVarGaussian(name,title,_xvec,_muvec,dummyMatrix),
34  vxx("vxx","vxx",this,_vxx),
35  vxy("vxy","vxy",this,_vxy),
36  vxz("vxz","vxz",this,_vxz),
37  vyy("vyy","vyy",this,_vyy),
38  vyz("vyz","vyz",this,_vyz),
39  vzz("vzz","vzz",this,_vzz)
40  //nUpdates(0),
41  //nChanged(0),
42  //oldVxx(-1),
43  //oldVxy(-1),
44  //oldVyy(-1),
45  //oldVzz(-1)
46  {
47  }
48 
49 
50  GenGauss3D::GenGauss3D(const GenGauss3D& other, const char* name) :
51  RooMultiVarGaussian(other,name),
52  vxx("vxx",this,other.vxx),
53  vxy("vxy",this,other.vxy),
54  vxz("vxz",this,other.vxz),
55  vyy("vyy",this,other.vyy),
56  vyz("vyz",this,other.vyz),
57  vzz("vzz",this,other.vzz)
58  //nUpdates(0),
59  //nChanged(0),
60  //oldVxx(-1),
61  //oldVxy(-1),
62  //oldVyy(-1),
63  //oldVzz(-1)
64  {
65  }
66 
67 
69  //nUpdates++;
70  //if (vxx==oldVxx &&
71  // vyy==oldVyy &&
72  // vxy==oldVxy &&
73  // vzz==oldVzz)
74  // return;
75  //oldVxx = vxx;
76  //oldVyy = vyy;
77  //oldVxy = vxy;
78  //oldVzz = vzz;
79 
80  //nChanged++;
81  //if (nUpdates % 10000 == 0) {
82  // cout << nUpdates << " calls to updateCov" << endl;
83  // cout << nChanged << " calls required recalculation of of covariance matrix" << endl << endl;
84  //}
85 
86  _cov(0,0) = vxx;
87  _cov(0,1) = vxy;
88  _cov(0,2) = vxz;
89  _cov(1,0) = vxy;
90  _cov(1,1) = vyy;
91  _cov(1,2) = vyz;
92  _cov(2,0) = vxz;
93  _cov(2,1) = vyz;
94  _cov(2,2) = vzz;
95  _det = _cov.Determinant();
96 
97  int n = _cov.GetNrows();
98  for (int i=0;i<n;i++) {
99  for (int j=0;j<n;j++) {
100  _covI(i,j)=_cov(i,j);
101  }
102  }
103  _covI.Invert();
104  }
105 
106 
107  Double_t GenGauss3D::evaluate() const
108  {
109  // ENTER EXPRESSION IN TERMS OF VARIABLE ARGUMENTS HERE
110 
111  // Since we need to update _cov here, must get rid of const
112  GenGauss3D* self = const_cast<GenGauss3D*>(this);
113  self->updateCov();
114 
116  }
117 
118 
119 
120  Int_t GenGauss3D::getAnalyticalIntegral(RooArgSet& allVars, RooArgSet& analVars, const char* rangeName) const
121  {
122  // LIST HERE OVER WHICH VARIABLES ANALYTICAL INTEGRATION IS SUPPORTED,
123  // ASSIGN A NUMERIC CODE FOR EACH SUPPORTED (SET OF) PARAMETERS
124  // THE EXAMPLE BELOW ASSIGNS CODE 1 TO INTEGRATION OVER VARIABLE X
125  // YOU CAN ALSO IMPLEMENT MORE THAN ONE ANALYTICAL INTEGRAL BY REPEATING THE matchArgs
126  // EXPRESSION MULTIPLE TIMES
127 
128  // if (matchArgs(allVars,analVars,x)) return 1 ;
129 
130  // Since we need to update _cov here, must get rid of const
131  GenGauss3D* self = const_cast<GenGauss3D*>(this);
132  self->updateCov();
133 
134  return RooMultiVarGaussian::getAnalyticalIntegral(allVars,analVars,rangeName) ;
135  }
136 
137 
138 
139  Double_t GenGauss3D::analyticalIntegral(Int_t code, const char* rangeName) const
140  {
141  // RETURN ANALYTICAL INTEGRAL DEFINED BY RETURN CODE ASSIGNED BY getAnalyticalIntegral
142  // THE MEMBER FUNCTION x.min(rangeName) AND x.max(rangeName) WILL RETURN THE INTEGRATION
143  // BOUNDARIES FOR EACH OBSERVABLE x
144 
145  // assert(code==1) ;
146  // return (x.max(rangeName)-x.min(rangeName)) ;
147 
148  // Since we need to update _cov here, must get rid of const
149  GenGauss3D* self = const_cast<GenGauss3D*>(this);
150  self->updateCov();
151 
152  // Prevent caching of partial integrals - these may depend on the
153  // particular covariance matrix!
154  _anaIntCache.clear();
155 
156  return RooMultiVarGaussian::analyticalIntegral(code,rangeName) ;
157 }
158 
159 
161  _genCache.clear() ;
162  updateCov();
163  _genCache.clear() ;
164  return RooMultiVarGaussian::generateEvent(code);
165  }
ClassImp
ClassImp(GenGauss3D) GenGauss3D
Definition: GenGauss3D.cxx:21
GenGauss3D::evaluate
Double_t evaluate() const
Definition: GenGauss3D.cxx:107
GenGauss3D::vyy
RooRealProxy vyy
Definition: GenGauss3D.h:57
GenGauss3D.h
fitman.vxy
vxy
Definition: fitman.py:506
LArNewCalib_Delay_OFC_Cali.evaluate
evaluate
Definition: LArNewCalib_Delay_OFC_Cali.py:216
GenGauss3D::vxx
RooRealProxy vxx
Definition: GenGauss3D.h:54
histSizes.code
code
Definition: histSizes.py:129
GenGauss3D::vzz
RooRealProxy vzz
Definition: GenGauss3D.h:59
GenGauss3D::getAnalyticalIntegral
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=0) const
Definition: GenGauss3D.cxx:120
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:731
GenGauss3D::vyz
RooRealProxy vyz
Definition: GenGauss3D.h:58
GenGauss3D::generateEvent
void generateEvent(Int_t code)
Definition: GenGauss3D.cxx:160
GenGauss3D::GenGauss3D
GenGauss3D()
Definition: GenGauss3D.h:28
GenGauss3D::vxz
RooRealProxy vxz
Definition: GenGauss3D.h:56
covarianceTool.title
title
Definition: covarianceTool.py:542
fitman.vyz
vyz
Definition: fitman.py:508
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
GenGauss3D::updateCov
void updateCov()
Definition: GenGauss3D.cxx:68
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
fitman.vxx
vxx
Definition: fitman.py:504
fitman.vyy
vyy
Definition: fitman.py:505
GenGauss3D::analyticalIntegral
Double_t analyticalIntegral(Int_t code, const char *rangeName=0) const
Definition: GenGauss3D.cxx:139
fitman.dummyMatrix
dummyMatrix
Definition: fitman.py:565
fitman.vxz
vxz
Definition: fitman.py:507
GenGauss3D::vxy
RooRealProxy vxy
Definition: GenGauss3D.h:55
fitman.vzz
vzz
Definition: fitman.py:509
GenGauss3D
Definition: GenGauss3D.h:22