ATLAS Offline Software
Loading...
Searching...
No Matches
InDet::TRT_DetElementsRoadUtils_xk Namespace Reference

Functions

void detElementInformation (const InDetDD::TRT_BaseElement &E, double *P)

Function Documentation

◆ detElementInformation()

void InDet::TRT_DetElementsRoadUtils_xk::detElementInformation ( const InDetDD::TRT_BaseElement & E,
double * P )

Definition at line 48 of file TRT_DetElementsRoadUtils_xk.cxx.

49 {
50 const double pi2=2.*M_PI, pi=M_PI;
51
52 const Trk::RectangleBounds* rb = dynamic_cast<const Trk::RectangleBounds*>(&E.bounds());
53 const Trk::DiscBounds* db = dynamic_cast<const Trk::DiscBounds*> (&E.bounds());
54
55 Amg::Vector3D C = E.center(); double x0=C.x(), y0=C.y(), z0=C.z();
56 Amg::Vector3D AT = E.normal(); double A[3]={AT.x(),AT.y(),AT.z()};
57 const Amg::Transform3D& T = E.surface().transform();
58 double Ax[3] = {T(0,0),T(1,0),T(2,0)};
59 double Ay[3] = {T(0,1),T(1,1),T(2,1)};
60 double x[4],y[4],z[4];
61
62 if(rb) {
63
64 P[ 0] = sqrt(x0*x0+y0*y0);
65 P[ 1] = z0; if(fabs(P[1])<.00004) P[1]=0.;
66 P[ 2] = atan2(y0,x0);
67 P[ 3] = A[0]*x0+A[1]*y0+A[2]*z0;
68 if(P[3]<0.) {P[3]*=-1.; A[0]*=-1.; A[1]*=-1.; A[2]*=-1.;}
69 double B = A[0]*A[0]+A[1]*A[1];
70 if(B>.01) P[4]=atan2(A[1],A[0]); else P[4]=P[2];
71
72 sincos(P[4],&P[5],&P[6]);
73
74 if(fabs(P[5])<.00004) P[5]=0.;
75 if(fabs(P[6])<.00004) P[6]=0.;
76 P[ 7] = sqrt(A[0]*A[0]+A[1]*A[1]); if(fabs(P[7])<.00004) P[7]=0.;
77 P[ 8] = A[2]; if(fabs(P[8])<.00004) P[8]=0.;
78
79 double dx = rb->halflengthX();
80 double dy = rb->halflengthY();
81
82 x[ 0] = x0+dx*Ax[0]+dy*Ay[0];
83 y[ 0] = y0+dx*Ax[1]+dy*Ay[1];
84 z[ 0] = z0+dx*Ax[2]+dy*Ay[2];
85
86 x[ 1] = x0+dx*Ax[0]-dy*Ay[0];
87 y[ 1] = y0+dx*Ax[1]-dy*Ay[1];
88 z[ 1] = z0+dx*Ax[2]-dy*Ay[2];
89
90 x[ 2] = x0-dx*Ax[0]-dy*Ay[0];
91 y[ 2] = y0-dx*Ax[1]-dy*Ay[1];
92 z[ 2] = z0-dx*Ax[2]-dy*Ay[2];
93
94 x[ 3] = x0-dx*Ax[0]+dy*Ay[0];
95 y[ 3] = y0-dx*Ax[1]+dy*Ay[1];
96 z[ 3] = z0-dx*Ax[2]+dy*Ay[2];
97 }
98 else if (db) {
99
100 Ax[0]=T(0,1); Ax[1]=T(1,1); Ax[2]=T(2,1);
101 Ay[0]=T(0,0); Ay[1]=T(1,0); Ay[2]=T(2,0);
102
103 P[ 0] = .5*(db->rMin()+db->rMax());
104 P[ 1] = z0;
105 P[ 2] = atan2(Ay[1],Ay[0]);
106 P[ 3] = A[0]*x0+A[1]*y0+A[2]*z0;
107 if(P[3]<0.) {P[3]*=-1.; A[0]*=-1.; A[1]*=-1.; A[2]*=-1.;}
108 P[ 4] = P[2];
109
110 sincos(P[4],&P[5],&P[6]);
111 P[ 7] = sqrt(A[0]*A[0]+A[1]*A[1]); if(fabs(P[7])<.00004) P[7]=0.;
112 P[ 8] = A[2]; if(fabs(P[8])<.00004) P[8]=0.;
113 x0 = P[0]*P[6];
114 y0 = P[0]*P[5];
115 double df = db->halfPhiSector();
116 double sn1,sn2,cs1,cs2;
117
118 sincos(P[2]+df,&sn1,&cs1);
119 sincos(P[2]-df,&sn2,&cs2);
120
121 x[ 0] = db->rMax()*cs1;
122 y[ 0] = db->rMax()*sn1;
123 z[ 0] = z0;
124
125 x[ 1] = db->rMin()*cs1;
126 y[ 1] = db->rMin()*sn1;
127 z[ 1] = z0;
128
129 x[ 2] = db->rMin()*cs2;
130 y[ 2] = db->rMin()*sn2;
131 z[ 2] = z0;
132
133 x[ 3] = db->rMax()*cs2;
134 y[ 3] = db->rMax()*sn2;
135 z[ 3] = z0;
136 }
137 else return;
138
139 double rmin= 10000., rmax=-10000.;
140 double zmin= 10000., zmax=-10000.;
141 double fmin= 10000., fmax=-10000.;
142 for(int i=0; i!=4; ++i) {
143 double r = sqrt(x[i]*x[i]+y[i]*y[i]);
144 double f = atan2(y[i],x[i])-P[2]; if(f<-pi) f+=pi2; else if(f>pi) f-=pi2;
145 double zf= z[i];
146 if(r <rmin) rmin= r;
147 if(r >rmax) rmax= r;
148 if(zf<zmin) zmin=zf;
149 if(zf>zmax) zmax=zf;
150 if(f <fmin) fmin= f;
151 if(f >fmax) fmax= f;
152 }
153 P[ 9] = rmin;
154 P[10] = rmax;
155 P[11] = zmin;
156 P[12] = zmax;
157 P[13] = P[2]+fmin;
158 P[14] = P[2]+fmax;
159 P[15] = P[4]-P[2]; if(P[15]<-pi) P[15]+=pi2; else if(P[15]>pi) P[15]-=pi2;
160 P[16] = A[0]*x0+A[1]*y0;
161 P[17] = atan2(Ay[1],Ay[0]);
162 P[17] = P[17]-P[2]; if(P[17]<-pi) P[17]+=pi2; else if(P[17]>pi) P[17]-=pi2;
163
164 // Calculation shape parameters
165 //
166 P[18] = y0*P[6]-x0*P[5]; // F center
167 P[19] = P[8]*(x0*P[6]+y0*P[5])-P[7]*z0; // ZR center
168 P[20] = +10000.; // -F
169 P[21] = 0. ; //
170 P[22] = 0. ; // +ZR
171 P[23] = -10000.; //
172 P[24] = -10000.; // +F
173 P[25] = 0. ; //
174 P[26] = 0. ; // -ZR
175 P[27] = +10000.; //
176 //
177 for(int i=0; i!=4; ++i) {
178
179 int k1 = i;
180 int k2 = i+1; if(k2>3) k2=0;
181 double x1 = y[k1]*P[6]-x[k1]*P[5] -P[18];
182 double y1 = P[8]*(x[k1]*P[6]+y[k1]*P[5])-P[7]*z[k1]-P[19];
183 double x2 = y[k2]*P[6]-x[k2]*P[5] -P[18];
184 double y2 = P[8]*(x[k2]*P[6]+y[k2]*P[5])-P[7]*z[k2]-P[19];
185 double d = (x2-x1)*(x2-x1)+(y2-y1)*(y2-y1);
186 double ax =-(y2-y1)*(y1*x2-x1*y2)/d;
187 double ay = (x2-x1)*(y1*x2-x1*y2)/d;
188 if(ax<P[20]) {P[20]=ax; P[21]=ay;}
189 if(ax>P[24]) {P[24]=ax; P[25]=ay;}
190 if(ay<P[27]) {P[26]=ax; P[27]=ay;}
191 if(ay>P[23]) {P[22]=ax; P[23]=ay;}
192 }
193 for(int i=15; i!=28; ++i) {if(fabs(P[i])<.0004 ) P[i]=0.;}
194
195 // Directions Phi and Eta in local system coordinates
196 //
197 P[29] = Ax[1]*P[6]-Ax[0]*P[5];
198 P[30] = P[8]*(Ax[0]*P[6]+Ax[1]*P[5])-P[7]*Ax[2];
199 P[31] = Ay[1]*P[6]-Ay[0]*P[5];
200 P[32] = P[8]*(Ay[0]*P[6]+Ay[1]*P[5])-P[7]*Ay[2];
201 }
#define M_PI
static Double_t P(Double_t *tt, Double_t *par)
#define pi
#define y
#define x
#define z
Class to describe the bounds for a planar DiscSurface.
Definition DiscBounds.h:44
Bounds for a rectangular, planar surface.
int r
Definition globals.cxx:22
struct color C
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
df
Printing table to screen.
unsigned long long T
hold the test vectors and ease the comparison