ATLAS Offline Software
GenGauss3Dclone.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 "GenGauss3Dclone.h"
16 #include "RooAbsReal.h"
17 #include "RooAbsCategory.h"
18 #include <math.h>
19 #include "TMath.h"
20 
22 
23  GenGauss3Dclone::GenGauss3Dclone(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 
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 GenGauss3Dclone::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  GenGauss3Dclone* self = const_cast<GenGauss3Dclone*>(this);
113  self->updateCov();
114 
116  }
117 
118 
119 
120  Int_t GenGauss3Dclone::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  GenGauss3Dclone* self = const_cast<GenGauss3Dclone*>(this);
132  self->updateCov();
133 
134  return RooMultiVarGaussian::getAnalyticalIntegral(allVars,analVars,rangeName) ;
135  }
136 
137 
138 
139  Double_t GenGauss3Dclone::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  GenGauss3Dclone* self = const_cast<GenGauss3Dclone*>(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  }
GenGauss3Dclone::vxy
RooRealProxy vxy
Definition: GenGauss3Dclone.h:55
GenGauss3Dclone::updateCov
void updateCov()
Definition: GenGauss3Dclone.cxx:68
GenGauss3Dclone::analyticalIntegral
Double_t analyticalIntegral(Int_t code, const char *rangeName=0) const
Definition: GenGauss3Dclone.cxx:139
GenGauss3Dclone::vyy
RooRealProxy vyy
Definition: GenGauss3Dclone.h:57
GenGauss3Dclone::vxz
RooRealProxy vxz
Definition: GenGauss3Dclone.h:56
GenGauss3Dclone::vxx
RooRealProxy vxx
Definition: GenGauss3Dclone.h:54
fitman.vxy
vxy
Definition: fitman.py:506
GenGauss3Dclone.h
lumiFormat.i
int i
Definition: lumiFormat.py:92
beamspotman.n
n
Definition: beamspotman.py:731
GenGauss3Dclone::generateEvent
void generateEvent(Int_t code)
Definition: GenGauss3Dclone.cxx:160
covarianceTool.title
title
Definition: covarianceTool.py:542
GenGauss3Dclone::GenGauss3Dclone
GenGauss3Dclone()
Definition: GenGauss3Dclone.h:28
GenGauss3Dclone
Definition: GenGauss3Dclone.h:22
GenGauss3Dclone::getAnalyticalIntegral
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=0) const
Definition: GenGauss3Dclone.cxx:120
GenGauss3Dclone::vzz
RooRealProxy vzz
Definition: GenGauss3Dclone.h:59
fitman.vyz
vyz
Definition: fitman.py:508
pmontree.code
code
Definition: pmontree.py:443
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
GenGauss3Dclone::vyz
RooRealProxy vyz
Definition: GenGauss3Dclone.h:58
ClassImp
ClassImp(GenGauss3Dclone) GenGauss3Dclone
Definition: GenGauss3Dclone.cxx:21
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
fitman.vxx
vxx
Definition: fitman.py:504
fitman.vyy
vyy
Definition: fitman.py:505
fitman.dummyMatrix
dummyMatrix
Definition: fitman.py:565
fitman.vxz
vxz
Definition: fitman.py:507
testGeoModel.evaluate
evaluate
Definition: MuonDetDescr/MuonGeoModelTest/python/testGeoModel.py:120
fitman.vzz
vzz
Definition: fitman.py:509
GenGauss3Dclone::evaluate
Double_t evaluate() const
Definition: GenGauss3Dclone.cxx:107