18 const std::string&
name,
30 m_use_mcLUT = use_mcLUT;
31 if ( alignmentBarrelLUTSvc ) m_alignmentBarrelLUT = alignmentBarrelLUTSvc->
alignmentBarrelLUT();
41 const int MAX_STATION = 4;
47 double theta,
rad,phi,
one,phim=0,signZ;
49 double c0,
c1,
c2,
c3,c22,c33,
e2,
e3,c2q,c3q,
d,da,
db,
a,
b,
dx,
dy;
52 double x0 = 0., y0 = 0.,
x1 = 0.,
y1 = 0.,
x2 = 0.,
y2 = 0., x3 = 0., y3 = 0.;
55 const double eps = 0.005;
59 for (
int i_station=0; i_station<MAX_STATION; i_station++) {
66 superPoints[i_station] = &(trackPattern.
superPoints[chamberID]);
70 if ( i_station != 3 ){
71 phim = superPoints[i_station]->
Phim;
82 x2 = superPoints[1]->
Z;
83 y2 = superPoints[1]->
R;
84 x3 = superPoints[2]->
Z;
85 y3 = superPoints[2]->
R;
87 x2 = superPoints[0]->
Z;
88 y2 = superPoints[0]->
R;
89 x3 = superPoints[2]->
Z;
90 y3 = superPoints[2]->
R;
92 x2 = superPoints[0]->
Z;
93 y2 = superPoints[0]->
R;
94 x3 = superPoints[1]->
Z;
95 y3 = superPoints[1]->
R;
106 c0 = y0*
x2*x3*
dx + y0*
x2*(y3-y0)*(y3-y0) - y0*x3*(
y2-y0)*(
y2-y0);
111 while((nit++)<=nitmx&&std::abs(x0-xn)>=eps) {
121 theta = std::atan2(superPoints[0]->R,std::abs(superPoints[0]->Z));
122 signZ = (std::abs(superPoints[0]->Z) >
ZERO_LIMIT)? superPoints[0]->Z/std::abs(superPoints[0]->Z): 1.;
124 theta = std::atan2(
y1,std::abs(
x1));
136 if(phim>=
M_PI+0.1) phim = phim - 2*
M_PI;
138 if(phim>=0) trackPattern.
phiMap = (phi>=0.)? phi - phim : phim -std::abs(phi);
139 else trackPattern.
phiMap = phi - phim;
141 trackPattern.
phiMS = phi;
150 da = -c2q*
e3 + c3q*
e2;
159 if(
a<=0.) trackPattern.
charge = 1;
161 }
else if (
count==3) {
163 theta = std::atan2(superPoints[0]->R,std::abs(superPoints[0]->Z));
164 signZ = (std::abs(superPoints[0]->Z) >
ZERO_LIMIT)? superPoints[0]->Z/std::abs(superPoints[0]->Z): 1.;
174 if(phim>=
M_PI+0.1) phim = phim - 2*
M_PI;
176 if(phim>=0) trackPattern.
phiMap = (phi>=0.)? phi - phim : phim -std::abs(phi);
177 else trackPattern.
phiMap = phi - phim;
179 trackPattern.
phiMS = phi;
184 if ( !m_alignmentBarrelLUT ) {
185 ATH_MSG_ERROR(
"Alignment correction service is not prepared");
186 return StatusCode::FAILURE;
189 double dZ = (*m_alignmentBarrelLUT)->GetDeltaZ(trackPattern.
s_address,
194 superPoints[1]->
Z += 10*dZ;
197 m = ( superPoints[2]->
Z - superPoints[0]->
Z ) / ( superPoints[2]->R - superPoints[0]->R );
199 trackPattern.
barrelSagitta = superPoints[1]->
Z - superPoints[1]->
R*
m - superPoints[0]->
Z + superPoints[0]->
R*
m;
202 x2 = superPoints[1]->
R - superPoints[0]->
R;
203 y2 = superPoints[1]->
Z - superPoints[0]->
Z;
204 x3 = superPoints[2]->
R - superPoints[0]->
R;
205 y3 = superPoints[2]->
Z - superPoints[0]->
Z;
212 x3 = ( x3 + y3*
m)*
cost;
213 y3 = (-tm*
m + y3 )*
cost;
222 else if ( m_use_endcapInner ==
true &&
count == 1 && superPoints[3]->R >
ZERO_LIMIT ) {
226 x2 = superPoints[0]->
Z;
227 y2 = superPoints[0]->
R;
228 x3 = superPoints[3]->
Z;
229 y3 = superPoints[3]->
R;
231 x2 = superPoints[3]->
Z;
232 y2 = superPoints[3]->
R;
233 x3 = superPoints[1]->
Z;
234 y3 = superPoints[1]->
R;
236 x2 = superPoints[3]->
Z;
237 y2 = superPoints[3]->
R;
238 x3 = superPoints[2]->
Z;
239 y3 = superPoints[2]->
R;
250 c0 = y0*
x2*x3*
dx + y0*
x2*(y3-y0)*(y3-y0) - y0*x3*(
y2-y0)*(
y2-y0);
255 while((nit++)<=nitmx&&std::abs(x0-xn)>=eps) {
265 rad = superPoints[0]->
R;
266 theta = std::atan2(
rad,std::abs(superPoints[0]->Z));
267 signZ = (std::abs(superPoints[0]->Z) >
ZERO_LIMIT)? superPoints[0]->Z/std::abs(superPoints[0]->Z): 1.;
270 theta = std::atan2(
rad,std::abs(
x1));
283 if(phim>=
M_PI+0.1) phim = phim - 2*
M_PI;
285 if(phim>=0) trackPattern.
phiMap = (phi>=0.)? phi - phim : phim -std::abs(phi);
286 else trackPattern.
phiMap = phi - phim;
288 trackPattern.
phiMS = phi;
297 da = -c2q*
e3 + c3q*
e2;
307 if(
a<=0.) trackPattern.
charge = 1;
310 ATH_MSG_DEBUG(
"... count/trackPattern.barrelSagitta/barrelRadius/charge/s_address/phi="
313 << trackPattern.
phiMS);
315 return StatusCode::SUCCESS;