ATLAS Offline Software
Loading...
Searching...
No Matches
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*/
6
8 "PixPhi Barrel",
9 "PixEta Barrel",
10 "PixPhi Endcap",
11 "PixEta Endcap",
12 "PixPhi IBL",
13 "PixEta IBL"
14 };
15
16namespace {
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
41
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
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
std::vector< Identifier > ID
uint32_t CLID
The Class ID type.
static Double_t a
This is an Identifier helper class for the Pixel subdetector.
This is an Identifier helper class for the Pixel subdetector.
Definition PixelID.h:67
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:593
int eta_module_max(const Identifier &id) const
Definition PixelID.cxx:79
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition PixelID.h:600
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:586
virtual bool postProcess() override final
static const char *const s_names[kNParamTypes]
Amg::MatrixX getScaledCovariance(Amg::MatrixX &&cov_input, const PixelID &pixel_id, const Identifier &id) const
virtual CLID clid() const override final
std::vector< std::vector< double > > & params()
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Default, invalid implementation of ClassID_traits.