40{
41 const int MAX_STATION = 4;
43
44 int nit;
45 const int nitmx=10;
48
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.;
53 double tm = 0.;
54 double xn = 0.;
55 const double eps = 0.005;
56
57 TrigL2MuonSA::SuperPoint* superPoints[4];
58
59 for (int i_station=0; i_station<MAX_STATION; i_station++) {
60
61 int chamberID = -1;
66 superPoints[i_station] = &(trackPattern.
superPoints[chamberID]);
67
70 if ( i_station != 3 ){
71 phim = superPoints[i_station]->
Phim;
72 }
73 }
74 }
75
77
79 y0 = 4230.;
80
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;
96 }
97
100
102
105 c1 = -
dy*(
y2*y3-y0*y0)+ y3*x2*x2 - y2*x3*x3;
106 c0 = y0*
x2*x3*
dx + y0*
x2*(y3-y0)*(y3-y0) - y0*x3*(
y2-y0)*(y2-y0);
109
110 nit = 1;
111 while((nit++)<=nitmx&&std::abs(x0-xn)>=eps) {
112 xn = x0 -
f(x0,c0,c1,c2,c3)/
fp(x0,c33,c22,c1);
113 x0 = xn;
114 }
116
119
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.;
123 } else {
124 theta = std::atan2(y1,std::abs(x1));
125 signZ = (std::abs(x1) >
ZERO_LIMIT)? x1/std::abs(x1): 1.;
126 }
127
128 trackPattern.
etaMap = (-std::log(std::tan(
theta/2.)))*signZ;
130 one = (std::cos(rpcFitResult.
phi)>0)? 1: -1;
131 } else {
132 one = (std::cos(p_roids->
phi())>0)? 1: -1;
133 }
135
136 if(phim>=
M_PI+0.1) phim = phim - 2*
M_PI;
137
138 if(phim>=0) trackPattern.
phiMap = (
phi>=0.)?
phi - phim : phim -std::abs(
phi);
140
142
150 da = -c2q*
e3 + c3q*
e2;
154
159 if(
a<=0.) trackPattern.
charge = 1;
160
161 }
else if (
count==3) {
162
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.;
165
166 trackPattern.
etaMap = (-std::log(std::tan(
theta/2.)))*signZ;
167
169 one = (std::cos(rpcFitResult.
phi)>0)? 1: -1;
170 } else {
171 one = (std::cos(p_roids->
phi())>0)? 1: -1;
172 }
174 if(phim>=
M_PI+0.1) phim = phim - 2*
M_PI;
175
176 if(phim>=0) trackPattern.
phiMap = (
phi>=0.)?
phi - phim : phim -std::abs(
phi);
178
180
181
183
184 if ( !m_alignmentBarrelLUT ) {
185 ATH_MSG_ERROR("Alignment correction service is not prepared");
186 return StatusCode::FAILURE;
187 }
188
189 double dZ = (*m_alignmentBarrelLUT)->GetDeltaZ(trackPattern.
s_address,
193 superPoints[0]->R);
194 superPoints[1]->Z += 10*dZ;
195 }
196
197 m = ( superPoints[2]->
Z - superPoints[0]->
Z ) / ( superPoints[2]->R - superPoints[0]->R );
198
199 trackPattern.
barrelSagitta = superPoints[1]->
Z - superPoints[1]->
R*
m - superPoints[0]->
Z + superPoints[0]->
R*
m;
200
201 cost = std::cos(std::atan(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;
206
210
211 tm = x3;
212 x3 = ( x3 + y3*
m)*
cost;
213 y3 = (-tm*
m + y3 )*
cost;
214
215 x0 = x3/2.;
217
220
221 }
223 y0 = 4230.;
224
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;
240 }
241
244
246
249 c1 = -
dy*(
y2*y3-y0*y0)+ y3*x2*x2 - y2*x3*x3;
250 c0 = y0*
x2*x3*
dx + y0*
x2*(y3-y0)*(y3-y0) - y0*x3*(
y2-y0)*(y2-y0);
253
254 nit = 1;
255 while((nit++)<=nitmx&&std::abs(x0-xn)>=eps) {
256 xn = x0 -
f(x0,c0,c1,c2,c3)/
fp(x0,c33,c22,c1);
257 x0 = xn;
258 }
260
263
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.;
268 } else {
270 theta = std::atan2(rad,std::abs(x1));
271 signZ = (std::abs(x1) >
ZERO_LIMIT)? x1/std::abs(x1): 1.;
272 }
273
274 trackPattern.
etaMap = (-std::log(std::tan(
theta/2.)))*signZ;
276
277 one = (std::cos(rpcFitResult.
phi)>0)? 1: -1;
278 } else {
279 one = (std::cos(p_roids->
phi())>0)? 1: -1;
280 }
282
283 if(phim>=
M_PI+0.1) phim = phim - 2*
M_PI;
284
285 if(phim>=0) trackPattern.
phiMap = (
phi>=0.)?
phi - phim : phim -std::abs(
phi);
287
289
297 da = -c2q*
e3 + c3q*
e2;
301
307 if(
a<=0.) trackPattern.
charge = 1;
308 }
309
310 ATH_MSG_DEBUG(
"... count/trackPattern.barrelSagitta/barrelRadius/charge/s_address/phi="
313 << trackPattern.
phiMS);
314
315 return StatusCode::SUCCESS;
316}
Scalar phi() const
phi method
Scalar theta() const
theta method
virtual double phi() const override final
Methods to retrieve data members.
float f(float x, float c0, float c1, float c2, float c3) const
float fp(float x, float c33, float c22, float c1) const
TrigL2MuonSA::SuperPoint superPoints[s_NCHAMBER]
int cost(std::vector< std::string > &files, node &n, const std::string &directory="", bool deleteref=false, bool relocate=false)
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string
double e2(const xAOD::CaloCluster &cluster)
return the uncorrected cluster energy in 2nd sampling
@ BarrelInner
Inner station in the barrel spectrometer.
@ BarrelMiddle
Middle station in the barrel spectrometer.
@ BarrelOuter
Outer station in the barrel spectrometer.
@ EndcapInner
Inner station in the endcap spectrometer.
setSAddress setEtaMS setDirPhiMS setDirZMS barrelRadius