ATLAS Offline Software
Loading...
Searching...
No Matches
ITkSiSpacePointForSeed.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#include <cmath>
6
7
8
10
14#include "TrkSurfaces/Surface.h"
15#include "CxxUtils/restrict.h"
16namespace ITk
17{
18
20 (const Trk::SpacePoint* sp,std::span<float const, 15> r)
21 {
22 set(sp,r); m_param = 0.;
23 }
24
26 (const Trk::SpacePoint* sp,std::span<float const, 15> r,std::span<float const, 15> sc)
27 {
28 set(sp,r,sc); m_param = 0.;
29 }
30
32 // Set
34
36 (const Trk::SpacePoint* sp,std::span<float const, 15> r)
37 {
38 spacepoint = sp ;
39 m_x = r[0];
40 m_y = r[1];
41 m_z = r[2];
42 m_r =std::sqrt(m_x*m_x+m_y*m_y);
43 m_q = 100000.;
44
45 const InDet::SiCluster* c = static_cast<const InDet::SiCluster*>(sp->clusterList().first);
46 const InDetDD::SiDetectorElement* de = c ->detectorElement();
47
48 if( de->isPixel() ) {
49
50 const Amg::MatrixX& v = c->localCovariance();
51 float f22 = float(v(1,1) );
52 float wid = float(c->width().z());
53 float cov = wid*wid*.08333f; if(cov < f22) cov = f22;
54 m_sn = nullptr;
55 cov*=6.;
56 m_covz = cov*(r[3]*r[3]+r[4]*r[4]);
57 m_covr = cov*(r[5]*r[5]);
58 }
59 else {
60
61 const Amg::MatrixX& v = sp->localCovariance();
62 float f22 = float(v(1,1));
63 if(de->isBarrel()) {m_covz = 8.f*f22; m_covr = .1f;}
64 else {m_covr = 8.f*f22; m_covz = .1f;}
65 m_sn = &sp->clusterList().second->detectorElement()->surface();
66
67 for(int i=0; i!=3; ++i) {
68 m_b0[i]=r[3 +i]; m_b1[i]=r[6 +i]; m_dr[i]=r[9 +i]; m_r0[i]=r[12+i];
69 }
70 }
71 m_su = &sp->clusterList().first->detectorElement()->surface();
72 }
73
74
76 // Set with error correction
77 // sc[0] - barrel pixels error correction
78 // sc[1] - endcap pixels
79 // sc[2] - barrel sct
80 // sc[3] - endcap sct
82
84 (const Trk::SpacePoint* sp,std::span<float const, 15> r, std::span<float const, 15> sc)
85 {
86 m_sn = nullptr;
87 spacepoint = sp ;
88 m_x = r[0];
89 m_y = r[1];
90 m_z = r[2];
91 m_r =std::sqrt(m_x*m_x+m_y*m_y);
92 m_q = 100000.;
93
94 const InDet::SiCluster* c = static_cast<const InDet::SiCluster*>(sp->clusterList().first);
95 const InDetDD::SiDetectorElement* de = c ->detectorElement();
96
97 if( de->isPixel() ) {
98 const Amg::MatrixX& v = c->localCovariance();
99 float f22 = float(v(1,1));
100 float wid = float(c->width().z());
101 float cov = wid*wid*.08333f; if(cov < f22) cov = f22;
102 cov*=6.;
103 m_covz = cov*(r[3]*r[3]+r[4]*r[4]);
104 m_covr = cov*(r[5]*r[5]);
105 } else {
106 const Amg::MatrixX& v = sp->localCovariance();
107 float f22 = float(v(1,1));
108 if(de->isBarrel()) {m_covz = 8.f*f22*sc[2]; m_covr = .1f;}
109 else {m_covr = 8.f*f22*sc[3]; m_covz = .1f;}
110 for(int i=0; i!=3; ++i) {m_b0[i]=r[3 +i]; m_b1[i]=r[6 +i]; m_dr[i]=r[9 +i]; m_r0[i]=r[12+i];}
111 }
112 m_su = &sp->clusterList().first->detectorElement()->surface();
113 }
114
116 {
117 if(q <= m_q) m_q = q;
118 }
119
121 // Coordinate of cross points two SCT strip calculation for given direction
122 // d - input direction
123 // r - output coordinates
124 // true if cross point is inside detector elements
126
128 {
129 float d1[3] = {m_b0[1]*d[2]-m_b0[2]*d[1],m_b0[2]*d[0]-m_b0[0]*d[2],m_b0[0]*d[1]-m_b0[1]*d[0]};
130 float bd = m_b1[0]*d1[0]+m_b1[1]*d1[1]+m_b1[2]*d1[2];
131
132 if(std::abs(m_dr[0]*d1[0]+m_dr[1]*d1[1]+m_dr[2]*d1[2]) > std::abs(bd)*1.1) return false;
133
134 float s0 = m_dr[0]*(m_b1[1]*d[2]-m_b1[2]*d[1])+
135 m_dr[1]*(m_b1[2]*d[0]-m_b1[0]*d[2])+
136 m_dr[2]*(m_b1[0]*d[1]-m_b1[1]*d[0]);
137 if(std::abs(s0) > std::abs(bd)*1.1) return false;
138
139 s0/=bd;
140 r[0] = m_r0[0]+m_b0[0]*s0;
141 r[1] = m_r0[1]+m_b0[1]*s0;
142 r[2] = m_r0[2]+m_b0[2]*s0;
143 return true;
144 }
145
146} // end of name space ITk
static Double_t sp
static Double_t s0
static Double_t sc
const Trk::SpacePoint * spacepoint
void set(const Trk::SpacePoint *, std::span< float const, 15 >)
bool coordinates(const float *, float *)
Class to hold geometrical description of a silicon detector element.
int r
Definition globals.cxx:22
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Macro wrapping the nonstandard restrict keyword.
#define ATH_RESTRICT
Definition restrict.h:31