ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetRecEvent
InDetRIO_OnTrack
src
PixelRIO_OnTrackErrorScaling.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3
*/
4
#include "
InDetRIO_OnTrack/PixelRIO_OnTrackErrorScaling.h
"
5
#include "
InDetIdentifier/PixelID.h
"
6
7
const
char
*
const
PixelRIO_OnTrackErrorScaling::s_names
[
PixelRIO_OnTrackErrorScaling::kNParamTypes
]={
8
"PixPhi Barrel"
,
9
"PixEta Barrel"
,
10
"PixPhi Endcap"
,
11
"PixEta Endcap"
,
12
"PixPhi IBL"
,
13
"PixEta IBL"
14
};
15
16
namespace
{
17
inline
double
square(
double
a
) {
return
a
*
a
; }
18
19
void
scale2by2(
Amg::MatrixX
& cov,
20
const
std::vector<double>& phiTrafo,
21
const
std::vector<double>& etaTrafo)
22
{
23
// careful not to change character of error
24
double
corr = (std::abs(
cov
(0,1)) > 1.0e-20)
25
?
cov
(0,1)/(
cov
(0,0)*
cov
(1,1))
26
: 0.0;
27
cov
(0,0) *= square(phiTrafo[0]);
28
cov
(0,0) += square(phiTrafo[1]);
29
cov
(1,1) *= square(etaTrafo[0]);
30
cov
(1,1) += square(etaTrafo[1]);
31
if
(corr !=0.0) {
32
cov
(0,1) = corr*
cov
(0,0)*
cov
(1,1);
33
cov
(1,0) =
cov
(0,1);
34
}
35
}
36
}
37
38
CLID
PixelRIO_OnTrackErrorScaling::clid
()
const
{
39
return
ClassID_traits<CondCont<PixelRIO_OnTrackErrorScaling>
>::ID();
40
}
41
42
bool
PixelRIO_OnTrackErrorScaling::postProcess
() {
43
if
(
params
().
size
() !=
kPixIBLPhi
&&
params
().
size
() !=
kNParamTypes
) {
44
std::stringstream message;
45
message <<
" PixelRIO_OnTrackErrorScaling: Expecting parameters for"
;
46
{
47
unsigned
int
idx=0;
48
for
(; idx <
kPixIBLPhi
; ++idx) {
49
message <<
" "
<<
s_names
[idx];
50
}
51
message <<
"("
<<
kPixIBLPhi
<<
")"
<<
" and "
;
52
for
(; idx <
kNParamTypes
; ++idx) {
53
message <<
" "
<<
s_names
[idx];
54
}
55
message <<
"("
<<
kNParamTypes
<<
") for run2."
;
56
}
57
message <<
" But got "
<<
params
().size() <<
"."
;
58
throw
std::runtime_error( message.str() );
59
}
60
for
(
unsigned
int
idx=0; idx <
params
().size(); ++idx) {
61
if
(
params
()[idx].
size
()!=2 ) {
62
assert( idx <
kNParamTypes
);
63
std::stringstream message;
64
message <<
" PixelRIO_OnTrackErrorScaling: Expected 2 parameters for "
<<
s_names
[idx] <<
" but got "
<<
params
()[idx].size()
65
<<
"."
;
66
throw
std::runtime_error( message.str() );
67
}
68
}
69
return
true
;
70
}
71
72
Amg::MatrixX
PixelRIO_OnTrackErrorScaling::getScaledCovariance
(
Amg::MatrixX
&& cov_input,
73
const
PixelID
&pixel_id,
74
const
Identifier
&
id
)
const
75
{
76
77
Amg::MatrixX
newCov = std::move(cov_input);
78
79
// from SiDetectorElement::isEndcap
80
bool
is_endcap = !(pixel_id.
is_barrel
(
id
) || pixel_id.
is_dbm
(
id
));
81
unsigned
int
idx=
kNParamTypes
;
82
83
if
(is_endcap) {
84
idx=
kPixEndcapPhi
;
85
}
else
{
86
87
// from PixelDigitizationTool::getReadoutTech
88
int
barrel_ec = pixel_id.
barrel_ec
(
id
);
89
bool
is_ibl = abs(barrel_ec)==4 || pixel_id.
eta_module_max
(
id
)>6;
90
if
(is_ibl) {
91
idx =
kPixIBLPhi
;
92
}
93
else
{
94
idx =
kPixBarrelPhi
;
95
}
96
}
97
98
// checked in postprocess
99
assert(
params
().
size
() > idx + 1);
100
assert(
params
()[idx].
size
() > 1 &&
params
()[idx + 1].
size
() > 1);
101
102
scale2by2(newCov,
params
()[idx]
/* phi */
,
params
()[idx+1]
/* eta */
);
103
return
newCov;
104
}
105
CLID
uint32_t CLID
The Class ID type.
Definition
Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
a
static Double_t a
Definition
LArPhysWaveHECTool.cxx:38
PixelID.h
This is an Identifier helper class for the Pixel subdetector.
PixelRIO_OnTrackErrorScaling.h
size
size_t size() const
Number of registered mappings.
PixelID
This is an Identifier helper class for the Pixel subdetector.
Definition
PixelID.h:69
PixelID::is_dbm
bool is_dbm(const Identifier &id) const
Test for dbm - WARNING: id MUST be pixel id, otherwise answer is not accurate. Use SiliconID for gene...
Definition
PixelID.h:588
PixelID::eta_module_max
int eta_module_max(const Identifier &id) const
Definition
PixelID.cxx:80
PixelID::barrel_ec
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0).
Definition
PixelID.h:595
PixelID::is_barrel
bool is_barrel(const Identifier &id) const
Test for barrel - WARNING: id MUST be pixel id, otherwise answer is not accurate. Use SiliconID for g...
Definition
PixelID.h:581
PixelRIO_OnTrackErrorScaling::postProcess
virtual bool postProcess() override final
Definition
PixelRIO_OnTrackErrorScaling.cxx:42
PixelRIO_OnTrackErrorScaling::s_names
static const char *const s_names[kNParamTypes]
Definition
PixelRIO_OnTrackErrorScaling.h:7
PixelRIO_OnTrackErrorScaling::getScaledCovariance
Amg::MatrixX getScaledCovariance(Amg::MatrixX &&cov_input, const PixelID &pixel_id, const Identifier &id) const
Definition
PixelRIO_OnTrackErrorScaling.cxx:72
PixelRIO_OnTrackErrorScaling::clid
virtual CLID clid() const override final
Definition
PixelRIO_OnTrackErrorScaling.cxx:38
PixelRIO_OnTrackErrorScaling::kNParamTypes
@ kNParamTypes
Definition
PixelRIO_OnTrackErrorScaling.h:29
PixelRIO_OnTrackErrorScaling::kPixEndcapPhi
@ kPixEndcapPhi
Definition
PixelRIO_OnTrackErrorScaling.h:25
PixelRIO_OnTrackErrorScaling::kPixBarrelPhi
@ kPixBarrelPhi
Definition
PixelRIO_OnTrackErrorScaling.h:23
PixelRIO_OnTrackErrorScaling::kPixIBLPhi
@ kPixIBLPhi
Definition
PixelRIO_OnTrackErrorScaling.h:27
RIO_OnTrackErrorScaling::params
std::vector< std::vector< double > > & params()
Definition
RIO_OnTrackErrorScaling.h:29
Amg::MatrixX
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Definition
EventPrimitives.h:27
Identifier
Definition
IdentifierFieldParser.cxx:14
plotBeamSpotVxVal.cov
cov
Definition
plotBeamSpotVxVal.py:200
ClassID_traits
Default, invalid implementation of ClassID_traits.
Definition
Control/AthenaKernel/AthenaKernel/ClassID_traits.h:37
Generated on
for ATLAS Offline Software by
1.17.0