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