ATLAS Offline Software
SiDetElementLink_xk.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // Implementation file for class SiDetElementLink_xk
8 // (c) ATLAS Detector software
10 //
12 // Version 1.0 21/04/2004 I.Gavrilenko
14 
15 #include <iostream>
16 #include <iomanip>
18 
19 
21 // Set parameters
23 
24 void InDet::SiDetElementLink_xk::set(const double* P, bool isITk)
25 {
26  m_z = float(P[ 1]) ; // Z
27  m_dz = float(std::abs(P[12]-P[11])*.5) ; // dZ
28  m_phi = float(P[ 2]) ; // azimuthal angle
29  m_geo [0] = float(P[ 3]) ; // min. distance
30  m_geo [1] = float(P[ 4]) ; // phi
31  m_geo [2] = float(P[ 5]) ; // sin(phi)
32  m_geo [3] = float(P[ 6]) ; // cos(phi)
33  m_geo [4] = float(P[ 7]) ; // sin(polar)
34  m_geo [5] = float(P[ 8]) ; // cos(polar)
35  m_center[0] = float(P[18]) ; //
36  m_center[1] = float(P[19]) ; //
37  m_bound [0][2] = float(sqrt(P[20]*P[20]+P[21]*P[21])); // -F
38  m_bound [0][0] = float(P[20]/double(m_bound[0][2])) ; //
39  m_bound [0][1] = float(P[21]/double(m_bound[0][2])) ; //
40  m_bound [1][2] = float(sqrt(P[22]*P[22]+P[23]*P[23])); // +ZR
41  m_bound [1][0] = float(P[22]/double(m_bound[1][2])) ; //
42  m_bound [1][1] = float(P[23]/double(m_bound[1][2])) ; //
43  m_bound [2][2] = float(sqrt(P[24]*P[24]+P[25]*P[25])); // +F
44  m_bound [2][0] = float(P[24]/double(m_bound[2][2])) ; //
45  m_bound [2][1] = float(P[25]/double(m_bound[2][2])) ; //
46  m_bound [3][2] = float(sqrt(P[26]*P[26]+P[27]*P[27])); // -ZR
47  m_bound [3][0] = float(P[26]/double(m_bound[3][2])) ; //
48  m_bound [3][1] = float(P[27]/double(m_bound[3][2])) ; //
49  if (isITk) {
50  m_bound [0][2]+=P[40];
51  m_bound [1][2]+=P[40];
52  m_bound [2][2]+=P[40];
53  m_bound [3][2]+=P[40];
54  }
55 }
56 
58 // Detector element intersection using cashed information
59 // Input parameters: r[0] - X a[0] - Ax
60 // r[1] - Y a[1] - Ay
61 // r[2] - Z a[2] - Az
62 // Output parameters: O[0] - close distance in azimuthal direction
63 // O[1] - close distance in r or z direction
64 // O[2] - step to detector element
66 
68 (const float* r ,const float* a,float* O) const
69 {
70  const float* g = &m_geo[0];
71  float s[3] = {g[3]*g[4],g[2]*g[4],g[5]} ;
72  float S = a[0]*s[0]+a[1]*s[1]+a[2]*s[2] ;
73  if(S!=0.) S = (g[0]-(r[0]*s[0]+r[1]*s[1]+r[2]*s[2]))/S ;
74  float rn[3] = {r[0]+S*a[0],r[1]+S*a[1],r[2]+S*a[2]} ;
75  float d0 = rn[1]*g[3]-rn[0]*g[2] -m_center[0];
76  float d1 = g[5]*(rn[0]*g[3]+rn[1]*g[2])-g[4]*rn[2]-m_center[1];
77  O[0] = m_bound[0][0]*d0+m_bound[0][1]*d1-m_bound[0][2] ;
78  float daz = m_bound[2][0]*d0+m_bound[2][1]*d1-m_bound[2][2] ;
79  O[1] = m_bound[1][0]*d0+m_bound[1][1]*d1-m_bound[1][2] ;
80  float drz = m_bound[3][0]*d0+m_bound[3][1]*d1-m_bound[3][2] ;
81  if(O[0] < daz) O[0] = daz;
82  if(O[1] < drz) O[1] = drz;
83  O[2] = S;
84 }
85 
86 
88 // Detector element intersection using cashed information
89 // Input parameters: r[0] - X a[0] - Ax
90 // r[1] - Y a[1] - Ay
91 // r[2] - Z a[2] - Az
92 // Output parameters: Step - step to detector element
95 (const float* r,const float* a,float& Step) const
96 {
97  const float* g = &m_geo[0];
98 
99  float S = a[0]*g[6]+a[1]*g[7]+a[2]*g[5] ;
100  if(S!=0.) S = (g[0]-(r[0]*g[6]+r[1]*g[7]+r[2]*g[5]))/S ;
101  float r0 = r[0]+S*a[0] ;
102  float r1 = r[1]+S*a[1] ;
103  float r2 = r[2]+S*a[2] ;
104  float d0 = r1*g[3]-r0*g[2] -g[8] ;
105  float d1 = g[5]*(r0*g[3]+r1*g[2])-(g[4]*r2+g[9]);
106 
107  if((m_bound[1][0]*d0+m_bound[1][1]*d1) > m_bound[1][2] ||
108  (m_bound[3][0]*d0+m_bound[3][1]*d1) > m_bound[3][2] ||
109  (m_bound[0][0]*d0+m_bound[0][1]*d1) > m_bound[0][2] ||
110  (m_bound[2][0]*d0+m_bound[2][1]*d1) > m_bound[2][2]) return false;
111  Step = S+r[5];
112  return true;
113 }
114 
115 
beamspotman.r
def r
Definition: beamspotman.py:676
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
dq_defect_virtual_defect_validation.d1
d1
Definition: dq_defect_virtual_defect_validation.py:79
JetTiledMap::S
@ S
Definition: TiledEtaPhiMap.h:44
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
TRT::Track::d0
@ d0
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:62
python.BunchSpacingUtils.rn
rn
Definition: BunchSpacingUtils.py:87
python.Dumpers.daz
def daz(f)
Definition: Dumpers.py:149
a
TList * a
Definition: liststreamerinfos.cxx:10
readCCLHist.float
float
Definition: readCCLHist.py:83