ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetCalibAlgs
InDetBeamSpotFinder
src
InDetCalibAlgs/InDetBeamSpotFinder/src/BeamSpotPdf.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 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 "
BeamSpotPdf.h
"
16
#include <RooAbsCategory.h>
17
#include <RooAbsReal.h>
18
#include <TMath.h>
19
#include <cmath>
20
21
22
23
BeamSpotPdf::BeamSpotPdf
(
const
char
*name,
const
char
*title,
24
RooAbsReal&
x
,
25
RooAbsReal&
y
,
26
RooAbsReal&
z
,
27
RooAbsReal&
vxx
,
28
RooAbsReal&
vyy
,
29
RooAbsReal&
vxy
,
30
RooAbsReal&
mx
,
31
RooAbsReal&
sx
,
32
RooAbsReal&
ax
,
33
RooAbsReal&
my
,
34
RooAbsReal&
sy
,
35
RooAbsReal&
ay
,
36
RooAbsReal&
mz
,
37
RooAbsReal&
sz
,
38
RooAbsReal&
k
,
39
RooAbsReal&
rho
40
) :
41
RooAbsPdf(name,title),
42
m_x
(
"x"
,
"x"
,this,
x
),
43
m_y
(
"y"
,
"y"
,this,
y
),
44
m_z
(
"z"
,
"z"
,this,
z
),
45
m_vxx
(
"vxx"
,
"vxx"
,this,
vxx
),
46
m_vyy
(
"vyy"
,
"vyy"
,this,
vyy
),
47
m_vxy
(
"vxy"
,
"vxy"
,this,
vxy
),
48
m_mx
(
"mx"
,
"mx"
,this,
mx
),
49
m_sx
(
"sx"
,
"sx"
,this,
sx
),
50
m_ax
(
"ax"
,
"ax"
,this,
ax
),
51
m_my
(
"my"
,
"my"
,this,
my
),
52
m_sy
(
"sy"
,
"sy"
,this,
sy
),
53
m_ay
(
"ay"
,
"ay"
,this,
ay
),
54
m_mz
(
"mz"
,
"mz"
,this,
mz
),
55
m_sz
(
"sz"
,
"sz"
,this,
sz
),
56
m_k
(
"k"
,
"k"
,this,
k
),
57
m_rho
(
"rho"
,
"rho"
,this,
rho
)
58
{
59
}
60
61
62
BeamSpotPdf::BeamSpotPdf
(
const
BeamSpotPdf
& other,
const
char
* name) :
63
RooAbsPdf(other,name),
64
m_x
(
"x"
,this,other.
m_x
),
65
m_y
(
"y"
,this,other.
m_y
),
66
m_z
(
"z"
,this,other.
m_z
),
67
m_vxx
(
"vxx"
,this,other.
m_vxx
),
68
m_vyy
(
"vyy"
,this,other.
m_vyy
),
69
m_vxy
(
"vxy"
,this,other.
m_vxy
),
70
m_mx
(
"mx"
,this,other.
m_mx
),
71
m_sx
(
"sx"
,this,other.
m_sx
),
72
m_ax
(
"ax"
,this,other.
m_ax
),
73
m_my
(
"my"
,this,other.
m_my
),
74
m_sy
(
"sy"
,this,other.
m_sy
),
75
m_ay
(
"ay"
,this,other.
m_ay
),
76
m_mz
(
"mz"
,this,other.
m_mz
),
77
m_sz
(
"sz"
,this,other.
m_sz
),
78
m_k
(
"k"
,this,other.
m_k
),
79
m_rho
(
"rho"
,this,other.
m_rho
)
80
{
81
}
82
83
84
85
Double_t
BeamSpotPdf::evaluate
()
const
86
{
87
// ENTER EXPRESSION IN TERMS OF VARIABLE ARGUMENTS HERE
88
double
dx =
m_x
- (
m_mx
+
m_ax
*(
m_z
-
m_mz
));
89
double
dy =
m_y
- (
m_my
+
m_ay
*(
m_z
-
m_mz
));
90
double
dz =
m_z
-
m_mz
;
91
double
k2 =
m_k
*
m_k
;
92
double
wxx =
m_sx
*
m_sx
+ k2*
m_vxx
;
93
double
wyy =
m_sy
*
m_sy
+ k2*
m_vyy
;
94
double
wxy =
m_rho
*
m_sx
*
m_sy
+ k2*
m_vxy
;
95
double
detw = wxx*wyy - wxy*wxy;
96
double
iwxx = wyy/detw;
97
double
iwyy = wxx/detw;
98
double
iwxy = -wxy/detw;
99
double
arg = dx*iwxx*dx + 2*dx*iwxy*dy + dy*iwyy*dy;
100
arg += dz*dz/(
m_sz
*
m_sz
);
101
return
exp(-0.5*arg);
102
}
103
104
Int_t
BeamSpotPdf::getAnalyticalIntegral
(RooArgSet& allVars, RooArgSet& analVars,
const
char
*
/*rangeName*/
)
const
105
{
106
//Previously, we checked to see if the integration range was larger than 5 sigma from the mean, and used
107
//the integral from -inf to +inf to approximate it. Uncomment the next block of code to implement that procedure:
108
109
110
// int mult = 5;
111
//
112
// if (matchArgs(allVars,analVars,m_x,m_y,m_z)){
113
// if ((m_x.min(rangeName) < m_mx - mult*m_sx) && (m_x.max(rangeName) > m_mx + mult*m_sx)){
114
// if ((m_y.min(rangeName) < m_my - mult*m_sy) && (m_y.max(rangeName) > m_my + mult*m_sy)){
115
// if ((m_z.min(rangeName) < m_mz - mult*m_sz) && (m_z.max(rangeName) > m_mz + mult*m_sz)){
116
// return 1 ;
117
// }
118
// }
119
// }
120
//
121
// }
122
// if (matchArgs(allVars,analVars,m_x,m_y)){
123
// if ((m_x.min(rangeName) < m_mx - mult*m_sx ) && (m_x.max(rangeName) > m_mx + mult*m_sx)){
124
// if ((m_y.min(rangeName) < m_my - mult*m_sy) && (m_y.max(rangeName) > m_my + mult*m_sy)){
125
// return 2 ;
126
// }
127
// }
128
// }
129
130
131
//Since we don't care about the range of integration, we aren't using this rangeName variable.
132
//The following line does nothing but silence the compiler warning.
133
//(void) rangeName;
134
135
//Now we can use the Erf approximation over the entire integration range:
136
if
(matchArgs(allVars,analVars,
m_x
,
m_y
,
m_z
))
return
1;
137
if
(matchArgs(allVars,analVars,
m_x
,
m_y
) )
return
2;
138
if
(matchArgs(allVars,analVars,
m_x
,
m_z
) )
return
3;
139
if
(matchArgs(allVars,analVars,
m_y
,
m_z
) )
return
4;
140
141
return
0 ;
142
}
143
144
Double_t
BeamSpotPdf::analyticalIntegral
(Int_t code,
const
char
* rangeName)
const
145
{
146
// RETURN ANALYTICAL INTEGRAL DEFINED BY RETURN CODE ASSIGNED BY getAnalyticalIntegral
147
// THE MEMBER FUNCTION m_x.min(rangeName) AND m_x.max(rangeName) WILL RETURN THE INTEGRATION
148
// BOUNDARIES FOR EACH OBSERVABLE m_x
149
150
double
pi
= TMath::Pi();
151
double
k2 =
m_k
*
m_k
;
152
double
wxx =
m_sx
*
m_sx
+ k2*
m_vxx
;
153
double
wyy =
m_sy
*
m_sy
+ k2*
m_vyy
;
154
double
wxy =
m_rho
*
m_sx
*
m_sy
+ k2*
m_vxy
;
155
double
wzz =
m_sz
*
m_sz
;
156
double
detw = wxx*wyy - wxy*wxy;
157
158
if
(code==1) {
159
//integrating over x,y,z
160
161
// return sqrt((0.5*pi)*(0.5*pi)*(0.5*pi))*sqrt(wxx)*sqrt(wyy)*m_sz*
162
// (TMath::Erf((m_mx-m_x.min(rangeName))/sqrt(2*wxx))-TMath::Erf((m_mx-m_x.max(rangeName))/sqrt(2*wxx)))
163
// *(TMath::Erf((m_my-m_y.min(rangeName))/sqrt(2*wyy))-TMath::Erf((m_my-m_y.max(rangeName))/sqrt(2*wyy)))
164
// *(TMath::Erf((m_mz-m_z.min(rangeName))/sqrt(2*wzz))-TMath::Erf((m_mz-m_z.max(rangeName))/sqrt(2*wzz)));
165
//
166
//The next line is used if we want to approximate the integral with that over -inf to +inf
167
return
2*
pi
*sqrt(detw)*sqrt(2*
pi
)*
m_sz
;
168
}
169
170
171
if
(code==2) {
172
//integrating over x,y only
173
double
dz =
m_z
-
m_mz
;
174
//erf approximation
175
//
176
// return 0.5*pi*sqrt(wxx)*sqrt(wyy)*
177
// (TMath::Erf((m_mx-m_x.min(rangeName))/sqrt(2*wxx))-TMath::Erf((m_mx-m_x.max(rangeName))/sqrt(2*wxx)))
178
// *(TMath::Erf((m_my-m_y.min(rangeName))/sqrt(2*wyy))-TMath::Erf((m_my-m_y.max(rangeName))/sqrt(2*wyy)))
179
// *exp(-0.5*dz*dz/(m_sz*m_sz));
180
//
181
182
//inf approximation
183
return
2*
pi
*sqrt(detw)*exp(-0.5*dz*dz/(
m_sz
*
m_sz
));
184
}
185
if
(code==3){
186
//integrating over x,z
187
double
dy =
m_y
-
m_my
;
188
return
0.5*
pi
*sqrt(wxx)*sqrt(wzz)*
189
(TMath::Erf((
m_mx
-
m_x
.min(rangeName))/sqrt(2*wxx))-TMath::Erf((
m_mx
-
m_x
.max(rangeName))/sqrt(2*wxx)))
190
*(TMath::Erf((
m_mz
-
m_z
.min(rangeName))/sqrt(2*wzz))-TMath::Erf((
m_mz
-
m_z
.max(rangeName))/sqrt(2*wzz)))
191
*exp(-0.5*dy*dy/(wyy));
192
}
193
if
(code==4){
194
//integrating over y,z
195
double
dx =
m_x
-
m_mx
;
196
return
0.5*
pi
*sqrt(wyy)*sqrt(wzz)*
197
(TMath::Erf((
m_my
-
m_y
.min(rangeName))/sqrt(2*wyy))-TMath::Erf((
m_my
-
m_y
.max(rangeName))/sqrt(2*wyy)))
198
*(TMath::Erf((
m_mz
-
m_z
.min(rangeName))/sqrt(2*wzz))-TMath::Erf((
m_mz
-
m_z
.max(rangeName))/sqrt(2*wzz)))
199
*exp(-0.5*dx*dx/(wxx));
200
}
201
202
return
0 ;
203
}
BeamSpotPdf.h
pi
#define pi
Definition
TileMuonFitter.cxx:65
BeamSpotPdf::m_sy
RooRealProxy m_sy
Definition
InDetCalibAlgs/InDetBeamSpotFinder/src/BeamSpotPdf.h:62
BeamSpotPdf::z
RooRealProxy z
Definition
InDetExample/InDetBeamSpotExample/roofit/BeamSpotPdf.h:51
BeamSpotPdf::k
RooRealProxy k
Definition
InDetExample/InDetBeamSpotExample/roofit/BeamSpotPdf.h:63
BeamSpotPdf::m_k
RooRealProxy m_k
Definition
InDetCalibAlgs/InDetBeamSpotFinder/src/BeamSpotPdf.h:66
BeamSpotPdf::vyy
RooRealProxy vyy
Definition
InDetExample/InDetBeamSpotExample/roofit/BeamSpotPdf.h:53
BeamSpotPdf::ax
RooRealProxy ax
Definition
InDetExample/InDetBeamSpotExample/roofit/BeamSpotPdf.h:57
BeamSpotPdf::m_vyy
RooRealProxy m_vyy
Definition
InDetCalibAlgs/InDetBeamSpotFinder/src/BeamSpotPdf.h:56
BeamSpotPdf::m_vxy
RooRealProxy m_vxy
Definition
InDetCalibAlgs/InDetBeamSpotFinder/src/BeamSpotPdf.h:57
BeamSpotPdf::m_z
RooRealProxy m_z
Definition
InDetCalibAlgs/InDetBeamSpotFinder/src/BeamSpotPdf.h:54
BeamSpotPdf::m_mx
RooRealProxy m_mx
Definition
InDetCalibAlgs/InDetBeamSpotFinder/src/BeamSpotPdf.h:58
BeamSpotPdf::m_mz
RooRealProxy m_mz
Definition
InDetCalibAlgs/InDetBeamSpotFinder/src/BeamSpotPdf.h:64
BeamSpotPdf::mz
RooRealProxy mz
Definition
InDetExample/InDetBeamSpotExample/roofit/BeamSpotPdf.h:61
BeamSpotPdf::m_my
RooRealProxy m_my
Definition
InDetCalibAlgs/InDetBeamSpotFinder/src/BeamSpotPdf.h:61
BeamSpotPdf::sx
RooRealProxy sx
Definition
InDetExample/InDetBeamSpotExample/roofit/BeamSpotPdf.h:56
BeamSpotPdf::vxy
RooRealProxy vxy
Definition
InDetExample/InDetBeamSpotExample/roofit/BeamSpotPdf.h:54
BeamSpotPdf::ay
RooRealProxy ay
Definition
InDetExample/InDetBeamSpotExample/roofit/BeamSpotPdf.h:60
BeamSpotPdf::sz
RooRealProxy sz
Definition
InDetExample/InDetBeamSpotExample/roofit/BeamSpotPdf.h:62
BeamSpotPdf::m_ay
RooRealProxy m_ay
Definition
InDetCalibAlgs/InDetBeamSpotFinder/src/BeamSpotPdf.h:63
BeamSpotPdf::m_y
RooRealProxy m_y
Definition
InDetCalibAlgs/InDetBeamSpotFinder/src/BeamSpotPdf.h:53
BeamSpotPdf::BeamSpotPdf
BeamSpotPdf()
Definition
InDetCalibAlgs/InDetBeamSpotFinder/src/BeamSpotPdf.h:24
BeamSpotPdf::y
RooRealProxy y
Definition
InDetExample/InDetBeamSpotExample/roofit/BeamSpotPdf.h:50
BeamSpotPdf::mx
RooRealProxy mx
Definition
InDetExample/InDetBeamSpotExample/roofit/BeamSpotPdf.h:55
BeamSpotPdf::m_rho
RooRealProxy m_rho
Definition
InDetCalibAlgs/InDetBeamSpotFinder/src/BeamSpotPdf.h:67
BeamSpotPdf::getAnalyticalIntegral
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *) const
Definition
InDetCalibAlgs/InDetBeamSpotFinder/src/BeamSpotPdf.cxx:104
BeamSpotPdf::my
RooRealProxy my
Definition
InDetExample/InDetBeamSpotExample/roofit/BeamSpotPdf.h:58
BeamSpotPdf::m_sz
RooRealProxy m_sz
Definition
InDetCalibAlgs/InDetBeamSpotFinder/src/BeamSpotPdf.h:65
BeamSpotPdf::m_ax
RooRealProxy m_ax
Definition
InDetCalibAlgs/InDetBeamSpotFinder/src/BeamSpotPdf.h:60
BeamSpotPdf::m_vxx
RooRealProxy m_vxx
Definition
InDetCalibAlgs/InDetBeamSpotFinder/src/BeamSpotPdf.h:55
BeamSpotPdf::vxx
RooRealProxy vxx
Definition
InDetExample/InDetBeamSpotExample/roofit/BeamSpotPdf.h:52
BeamSpotPdf::rho
RooRealProxy rho
Definition
InDetExample/InDetBeamSpotExample/roofit/BeamSpotPdf.h:64
BeamSpotPdf::m_x
RooRealProxy m_x
Definition
InDetCalibAlgs/InDetBeamSpotFinder/src/BeamSpotPdf.h:52
BeamSpotPdf::sy
RooRealProxy sy
Definition
InDetExample/InDetBeamSpotExample/roofit/BeamSpotPdf.h:59
BeamSpotPdf::m_sx
RooRealProxy m_sx
Definition
InDetCalibAlgs/InDetBeamSpotFinder/src/BeamSpotPdf.h:59
BeamSpotPdf::x
RooRealProxy x
Definition
InDetExample/InDetBeamSpotExample/roofit/BeamSpotPdf.h:49
BeamSpotPdf::analyticalIntegral
Double_t analyticalIntegral(Int_t code, const char *rangeName=0) const
Definition
InDetCalibAlgs/InDetBeamSpotFinder/src/BeamSpotPdf.cxx:144
BeamSpotPdf::evaluate
Double_t evaluate() const
Definition
InDetCalibAlgs/InDetBeamSpotFinder/src/BeamSpotPdf.cxx:85
Generated on
for ATLAS Offline Software by
1.17.0