ATLAS Offline Software
SiDetElementsRoadUtils_xk.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include <cmath>
7 
9 // Output parameters: P[ 0] - radius centre of wafer
10 // P[ 1] - z centre of wafer
11 // P[ 2] - azimuthal angle centra of wifer
12 // P[ 3] - min. distance to surface
13 // P[ 4] - azimythal angle normal to surface
14 // P[ 5] - sin(P[4])
15 // P[ 6] - cos(P[4])
16 // P[ 7] - sin(Polar angle)
17 // P[ 8] - cos(Polar abgle)
18 // P[ 9] - min. radius
19 // P[10] - max. radius
20 // P[11] - min. z
21 // P[12] - max z
22 // P[13] - min. azimythal angle
23 // P[14] - max. azimuthal angle
24 // P[15] - tilt angle
25 // P[16] - min. dist to surface in XY-plane
26 // P[17] - Tilt angle
27 // P[18] - first local coordinate of wafer
28 // P[19] - second local coordinate of wafer
29 // P[20],P[21] - vector to -F boundary
30 // P[22],P[23] - vector to +ZR boundary
31 // P[24],P[25] - vector to +F boundary
32 // P[26],P[27] - vector to -ZR boundary
33 // P[28] - thikness of the detector element
34 // P[29] - Ax of Phi exis
35 // P[30] - Ay of Phi exis
36 // P[31] - Ax of Eta exis
37 // P[32] - Ay of Eta exis
39 
40 namespace InDet {
43  {
44  const double pi2=2.*M_PI, pi= M_PI;
45 
46  double Sl = .5*Si.design().length ();
47  double Swmax = .5*Si.design().maxWidth();
48  double Swmin = .5*Si.design().minWidth();
49 
50  // Thickness of the waver
51  //
52  P[28] = Si.design().thickness();
53  Amg::Vector3D C = Si.center(); double x0=C.x(), y0=C.y(), z0=C.z();
54  Amg::Vector3D AT = Si.normal ();
55  Amg::Vector3D AF = Si.phiAxis();
56  Amg::Vector3D AE = Si.etaAxis();
57 
58  double A[3]={AT.x(),AT.y(),AT.z()};
59 
60  P[ 0] = sqrt(x0*x0+y0*y0);
61  P[ 1] = z0;
62  P[ 2] = atan2(y0,x0);
63  P[ 3] = A[0]*x0+A[1]*y0+A[2]*z0;
64  if(P[3]<0.) {P[3]*=-1.; A[0]*=-1.; A[1]*=-1.; A[2]*=-1.;}
65  P[ 7] = sqrt(A[0]*A[0]+A[1]*A[1]);
66 
67  if(P[7] >.000001) P[4]=atan2(A[1],A[0]); else P[4]=P[2];
68  sincos(P[4],&P[5],&P[6]);
69  P[ 8] = A[2];
70 
71  if( fabs(P[7]) <= .000001) {
72 
73  P[3] = fabs(P[1]);
74  if(P[8] > 0.) P[8] = 1.; else P[8] = -1.;
75  P[7] = 0.;
76  }
77 
78  double x[4],y[4],z[4];
79 
80  x[0] = x0+AF.x()*Swmax+AE.x()*Sl;
81  y[0] = y0+AF.y()*Swmax+AE.y()*Sl;
82  z[0] = z0+AF.z()*Swmax+AE.z()*Sl;
83 
84  x[1] = x0+AF.x()*Swmin-AE.x()*Sl;
85  y[1] = y0+AF.y()*Swmin-AE.y()*Sl;
86  z[1] = z0+AF.z()*Swmin-AE.z()*Sl;
87 
88  x[2] = x0-AF.x()*Swmin-AE.x()*Sl;
89  y[2] = y0-AF.y()*Swmin-AE.y()*Sl;
90  z[2] = z0-AF.z()*Swmin-AE.z()*Sl;
91 
92  x[3] = x0-AF.x()*Swmax+AE.x()*Sl;
93  y[3] = y0-AF.y()*Swmax+AE.y()*Sl;
94  z[3] = z0-AF.z()*Swmax+AE.z()*Sl;
95 
96  double rmin= 10000., rmax=-10000.;
97  double zmin= 10000., zmax=-10000.;
98  double fmin= 10000., fmax=-10000.;
99  for(int i=0; i!=4; ++i) {
100  double r = sqrt(x[i]*x[i]+y[i]*y[i]);
101  double f = atan2(y[i],x[i])-P[2]; if(f<-pi) f+=pi2; else if(f>pi) f-=pi2;
102  double zf= z[i];
103  if(r <rmin) rmin= r;
104  if(r >rmax) rmax= r;
105  if(zf<zmin) zmin=zf;
106  if(zf>zmax) zmax=zf;
107  if(f <fmin) fmin= f;
108  if(f >fmax) fmax= f;
109  }
110  P[ 9] = rmin;
111  P[10] = rmax;
112  P[11] = zmin;
113  P[12] = zmax;
114  P[13] = P[2]+fmin;
115  P[14] = P[2]+fmax;
116  P[15] = P[4]-P[2]; if(P[15]<-pi) P[15]+=pi2; else if(P[15]>pi) P[15]-=pi2;
117  P[16] = A[0]*x0+A[1]*y0;
118  P[17] = atan2(AE.y(),AE.x());
119  P[17] = P[17]-P[2]; if(P[17]<-pi) P[17]+=pi2; else if(P[17]>pi) P[17]-=pi2;
120 
121  // Calculation shape parameters
122  //
123  P[18] = y0*P[6]-x0*P[5]; // F center
124  P[19] = P[8]*(x0*P[6]+y0*P[5])-P[7]*z0; // ZR center
125  P[20] = +10000.; // -F
126  P[21] = 0. ; //
127  P[22] = 0. ; // +ZR
128  P[23] = -10000.; //
129  P[24] = -10000.; // +F
130  P[25] = 0. ; //
131  P[26] = 0. ; // -ZR
132  P[27] = +10000.; //
133  //
134  for(int i=0; i!=4; ++i) {
135 
136  int k1 = i;
137  int k2 = i+1; if(k2>3) k2=0;
138  double x1 = y[k1]*P[6]-x[k1]*P[5] -P[18];
139  double y1 = P[8]*(x[k1]*P[6]+y[k1]*P[5])-P[7]*z[k1]-P[19];
140  double x2 = y[k2]*P[6]-x[k2]*P[5] -P[18];
141  double y2 = P[8]*(x[k2]*P[6]+y[k2]*P[5])-P[7]*z[k2]-P[19];
142  double d = (x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
143  double ax =-(y2-y1)*(y1*x2-x1*y2)/d;
144  double ay = (x2-x1)*(y1*x2-x1*y2)/d;
145  if(ax<P[20]) {P[20]=ax; P[21]=ay;}
146  if(ax>P[24]) {P[24]=ax; P[25]=ay;}
147  if(ay<P[27]) {P[26]=ax; P[27]=ay;}
148  if(ay>P[23]) {P[22]=ax; P[23]=ay;}
149  }
150 
151  // Directions Phi and Eta in local system coordinates
152  //
153  P[29] = AF.y()*P[6]-AF.x()*P[5];
154  P[30] = P[8]*(AF.x()*P[6]+AF.y()*P[5])-P[7]*AF.z();
155  P[31] = AE.y()*P[6]-AE.x()*P[5];
156  P[32] = P[8]*(AE.x()*P[6]+AE.y()*P[5])-P[7]*AE.z();
157  }
158 
159  }
160 }
beamspotman.r
def r
Definition: beamspotman.py:676
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
SiDetElementsRoadUtils_xk.h
SiDetElementsRoadUtils_xk
InDetDD::DetectorDesign::thickness
double thickness() const
Method which returns thickness of the silicon wafer.
Definition: DetectorDesign.h:271
fitman.ax
ax
Definition: fitman.py:522
PixelAthClusterMonAlgCfg.zmin
zmin
Definition: PixelAthClusterMonAlgCfg.py:169
hist_file_dump.d
d
Definition: hist_file_dump.py:137
DMTest::P
P_v1 P
Definition: P.h:23
InDet
Primary Vertex Finder.
Definition: VP1ErrorUtils.h:36
InDetDD::SolidStateDetectorElementBase::center
virtual const Amg::Vector3D & center() const override final
Center in global coordinates.
plotBeamSpotCompare.x2
x2
Definition: plotBeamSpotCompare.py:218
python.HLT.MinBias.MinBiasMenuSequences.zf
zf
Definition: MinBiasMenuSequences.py:224
InDetDD::SolidStateDetectorElementBase::etaAxis
const Amg::Vector3D & etaAxis() const
Definition: SolidStateDetectorElementBase.cxx:88
python.PhysicalConstants.pi2
float pi2
Definition: PhysicalConstants.py:52
InDetDD::DetectorDesign::length
virtual double length() const =0
Method to calculate length of a module.
M_PI
#define M_PI
Definition: ActiveFraction.h:11
TRT_PAI_gasdata::AF
const float AF
Definition: TRT_PAI_gasdata.h:27
x
#define x
makeTRTBarrelCans.y1
tuple y1
Definition: makeTRTBarrelCans.py:15
pi
#define pi
Definition: TileMuonFitter.cxx:65
A
lumiFormat.i
int i
Definition: lumiFormat.py:85
z
#define z
makeTRTBarrelCans.y2
tuple y2
Definition: makeTRTBarrelCans.py:18
PixelAthClusterMonAlgCfg.zmax
zmax
Definition: PixelAthClusterMonAlgCfg.py:169
hist_file_dump.f
f
Definition: hist_file_dump.py:135
InDetDD::DetectorDesign::maxWidth
virtual double maxWidth() const =0
Method to calculate maximum width of a module.
TRT::Track::z0
@ z0
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:63
InDet::SiDetElementsRoadUtils_xk::detElementInformation
void detElementInformation(const InDetDD::SiDetectorElement &Si, double *P)
Definition: SiDetElementsRoadUtils_xk.cxx:42
InDetDD::SolidStateDetectorElementBase::normal
virtual const Amg::Vector3D & normal() const override final
Get reconstruction local normal axes in global frame.
InDetDD::SiDetectorElement
Definition: SiDetectorElement.h:109
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
y
#define y
InDetDD::DetectorDesign::minWidth
virtual double minWidth() const =0
Method to calculate minimum width of a module.
InDetDD::SolidStateDetectorElementBase::phiAxis
const Amg::Vector3D & phiAxis() const
Definition: SolidStateDetectorElementBase.cxx:74
InDetDD::SiDetectorElement::design
virtual const SiDetectorDesign & design() const override final
access to the local description (inline):
FlavorTagDiscriminants::AE
SG::AuxElement AE
Definition: BTagMuonAugmenter.h:36
fitman.ay
ay
Definition: fitman.py:525