14 std::cout <<
" [LASAlignmentTubeAlgorithm::CalculateParameters] -- Starting." << std::endl;
26 const double phiPositions[8] = {0.392699, 1.289799, 1.851794, 2.748894, 3.645995, 4.319690, 5.216791, 5.778784};
27 std::vector<double> beamPhiPositions(8, 0.);
29 beamPhiPositions.at(
beam) = phiPositions[
beam];
35 const double radii[6] = {564., 564., 514., 514., 600., 600.};
36 std::vector<double> beamRadii(6, 0.);
37 for (
int aHalfbarrel = 0; aHalfbarrel < 6; ++aHalfbarrel)
38 beamRadii.at(aHalfbarrel) =
radii[aHalfbarrel];
42 std::vector<std::vector<std::vector<double> > > endFaceZPositions(
43 4,
std::vector<std::vector<double> >(2, std::vector<double>(2, 0.)));
44 endFaceZPositions.at(0).at(0).at(0) = 1322.5;
45 endFaceZPositions.at(0).at(0).at(1) = 2667.5;
46 endFaceZPositions.at(1).at(0).at(0) = -2667.5;
47 endFaceZPositions.at(1).at(0).at(1) = -1322.5;
48 endFaceZPositions.at(2).at(1).at(0) = -700.;
49 endFaceZPositions.at(2).at(1).at(1) = -300.;
50 endFaceZPositions.at(2).at(0).at(0) = 300.;
51 endFaceZPositions.at(2).at(0).at(1) = 700.;
52 endFaceZPositions.at(3).at(1).at(0) = -1090.;
53 endFaceZPositions.at(3).at(1).at(1) = -300.;
54 endFaceZPositions.at(3).at(0).at(0) = 300.;
55 endFaceZPositions.at(3).at(0).at(1) = 1090.;
58 double detReducedZ[2] = {0., 0.};
60 double beamReducedZ[2] = {0., 0.};
63 std::vector<double> disk9EndFaceZPositions(2, 0.);
64 disk9EndFaceZPositions.at(0) = -2667.5;
65 disk9EndFaceZPositions.at(1) = 2667.5;
70 std::vector<double> sumOverPhiZPrime(6, 0.);
71 std::vector<double> sumOverPhiZPrimePrime(6, 0.);
72 std::vector<double> sumOverPhiZPrimeSinTheta(6, 0.);
73 std::vector<double> sumOverPhiZPrimePrimeSinTheta(6, 0.);
74 std::vector<double> sumOverPhiZPrimeCosTheta(6, 0.);
75 std::vector<double> sumOverPhiZPrimePrimeCosTheta(6, 0.);
78 std::vector<double> sumOverPhiZTPrime(8, 0.);
79 std::vector<double> sumOverPhiZTPrimePrime(8, 0.);
84 std::vector<double> sumOverZPrimeSquared(6, 0.);
85 std::vector<double> sumOverZPrimePrimeSquared(6, 0.);
86 std::vector<double> sumOverZPrimeZPrimePrime(6, 0.);
87 std::vector<double> sumOverZPrimeZTPrime(6, 0.);
88 std::vector<double> sumOverZPrimeZTPrimePrime(6, 0.);
89 std::vector<double> sumOverZPrimePrimeZTPrime(6, 0.);
90 std::vector<double> sumOverZPrimePrimeZTPrimePrime(6, 0.);
93 double sumOverZTPrimeSquared = 0.;
94 double sumOverZTPrimePrimeSquared = 0.;
95 double sumOverZTPrimeZTPrimePrime = 0.;
103 const int theSide =
pos < 3 ? 0 : 1;
106 const int halfbarrel = det == 2 ? det + theSide : det + 1 + theSide;
110 const double radialOffset = det == 2 ? 50. : 36.;
114 endFaceZPositions.at(det).at(theSide).at(0);
115 detReducedZ[0] /= (endFaceZPositions.at(det).at(theSide).at(1) - endFaceZPositions.at(det).at(theSide).at(0));
116 detReducedZ[1] = endFaceZPositions.at(det).at(theSide).at(1) -
118 detReducedZ[1] /= (endFaceZPositions.at(det).at(theSide).at(1) - endFaceZPositions.at(det).at(theSide).at(0));
122 disk9EndFaceZPositions.at(0);
123 beamReducedZ[0] /= (disk9EndFaceZPositions.at(1) - disk9EndFaceZPositions.at(0));
124 beamReducedZ[1] = disk9EndFaceZPositions.at(1) -
126 beamReducedZ[1] /= (disk9EndFaceZPositions.at(1) - disk9EndFaceZPositions.at(0));
133 sumOverPhiZPrime.at(halfbarrel) += phiResidual * detReducedZ[0];
134 sumOverPhiZPrimePrime.at(halfbarrel) += phiResidual * detReducedZ[1];
135 sumOverPhiZPrimeSinTheta.at(halfbarrel) += phiResidual * detReducedZ[0] *
sin(beamPhiPositions.at(
beam));
136 sumOverPhiZPrimePrimeSinTheta.at(halfbarrel) += phiResidual * detReducedZ[1] *
sin(beamPhiPositions.at(
beam));
137 sumOverPhiZPrimeCosTheta.at(halfbarrel) += phiResidual * detReducedZ[0] *
cos(beamPhiPositions.at(
beam));
138 sumOverPhiZPrimePrimeCosTheta.at(halfbarrel) += phiResidual * detReducedZ[1] *
cos(beamPhiPositions.at(
beam));
140 sumOverPhiZTPrime.at(
beam) += phiResidual * beamReducedZ[0];
141 sumOverPhiZTPrimePrime.at(
beam) += phiResidual * beamReducedZ[1];
144 sumOverZPrimeSquared.at(halfbarrel) +=
pow(detReducedZ[0], 2) / 8.;
145 sumOverZPrimePrimeSquared.at(halfbarrel) +=
pow(detReducedZ[1], 2) / 8.;
146 sumOverZPrimeZPrimePrime.at(halfbarrel) += detReducedZ[0] * detReducedZ[1] / 8.;
147 sumOverZPrimeZTPrime.at(halfbarrel) += detReducedZ[0] * beamReducedZ[0] / 8.;
148 sumOverZPrimeZTPrimePrime.at(halfbarrel) += detReducedZ[0] * beamReducedZ[1] / 8.;
149 sumOverZPrimePrimeZTPrime.at(halfbarrel) += detReducedZ[1] * beamReducedZ[0] / 8.;
150 sumOverZPrimePrimeZTPrimePrime.at(halfbarrel) += detReducedZ[1] * beamReducedZ[1] / 8.;
152 sumOverZTPrimeSquared +=
pow(beamReducedZ[0], 2) / 8.;
153 sumOverZTPrimePrimeSquared +=
pow(beamReducedZ[1], 2) / 8.;
154 sumOverZTPrimeZTPrimePrime += beamReducedZ[0] * beamReducedZ[1] / 8.;
164 const int halfbarrel = det;
167 const int theSide = 0;
170 const double radialOffset = 0.;
174 endFaceZPositions.at(det).at(theSide).at(0);
175 detReducedZ[0] /= (endFaceZPositions.at(det).at(theSide).at(1) - endFaceZPositions.at(det).at(theSide).at(0));
176 detReducedZ[1] = endFaceZPositions.at(det).at(theSide).at(1) -
178 detReducedZ[1] /= (endFaceZPositions.at(det).at(theSide).at(1) - endFaceZPositions.at(det).at(theSide).at(0));
182 disk9EndFaceZPositions.at(0);
183 beamReducedZ[0] /= (disk9EndFaceZPositions.at(1) - disk9EndFaceZPositions.at(0));
184 beamReducedZ[1] = disk9EndFaceZPositions.at(1) -
186 beamReducedZ[1] /= (disk9EndFaceZPositions.at(1) - disk9EndFaceZPositions.at(0));
193 sumOverPhiZPrime.at(halfbarrel) += phiResidual * detReducedZ[0];
194 sumOverPhiZPrimePrime.at(halfbarrel) += phiResidual * detReducedZ[1];
195 sumOverPhiZPrimeSinTheta.at(halfbarrel) += phiResidual * detReducedZ[0] *
sin(beamPhiPositions.at(
beam));
196 sumOverPhiZPrimePrimeSinTheta.at(halfbarrel) += phiResidual * detReducedZ[1] *
sin(beamPhiPositions.at(
beam));
197 sumOverPhiZPrimeCosTheta.at(halfbarrel) += phiResidual * detReducedZ[0] *
cos(beamPhiPositions.at(
beam));
198 sumOverPhiZPrimePrimeCosTheta.at(halfbarrel) += phiResidual * detReducedZ[1] *
cos(beamPhiPositions.at(
beam));
200 sumOverPhiZTPrime.at(
beam) += phiResidual * beamReducedZ[0];
201 sumOverPhiZTPrimePrime.at(
beam) += phiResidual * beamReducedZ[1];
204 sumOverZPrimeSquared.at(halfbarrel) +=
pow(detReducedZ[0], 2) / 8.;
205 sumOverZPrimePrimeSquared.at(halfbarrel) +=
pow(detReducedZ[1], 2) / 8.;
206 sumOverZPrimeZPrimePrime.at(halfbarrel) += detReducedZ[0] * detReducedZ[1] / 8.;
207 sumOverZPrimeZTPrime.at(halfbarrel) += detReducedZ[0] * beamReducedZ[0] / 8.;
208 sumOverZPrimeZTPrimePrime.at(halfbarrel) += detReducedZ[0] * beamReducedZ[1] / 8.;
209 sumOverZPrimePrimeZTPrime.at(halfbarrel) += detReducedZ[1] * beamReducedZ[0] / 8.;
210 sumOverZPrimePrimeZTPrimePrime.at(halfbarrel) += detReducedZ[1] * beamReducedZ[1] / 8.;
212 sumOverZTPrimeSquared +=
pow(beamReducedZ[0], 2) / 8.;
213 sumOverZTPrimePrimeSquared +=
pow(beamReducedZ[1], 2) / 8.;
214 sumOverZTPrimeZTPrimePrime += beamReducedZ[0] * beamReducedZ[1] / 8.;
220 double sumOverSinTheta = 0.;
221 double sumOverCosTheta = 0.;
222 double sumOverSinThetaSquared = 0.;
223 double sumOverCosThetaSquared = 0.;
224 double sumOverCosThetaSinTheta = 0.;
225 double mixedTrigonometricTerm = 0.;
228 sumOverSinTheta +=
sin(beamPhiPositions.at(
beam));
229 sumOverCosTheta +=
cos(beamPhiPositions.at(
beam));
230 sumOverSinThetaSquared +=
pow(
sin(beamPhiPositions.at(
beam)), 2);
231 sumOverCosThetaSquared +=
pow(
cos(beamPhiPositions.at(
beam)), 2);
232 sumOverCosThetaSinTheta +=
cos(beamPhiPositions.at(
beam)) *
sin(beamPhiPositions.at(
beam));
235 mixedTrigonometricTerm = 8. * (sumOverCosThetaSquared * sumOverSinThetaSquared -
pow(sumOverCosThetaSinTheta, 2)) -
236 pow(sumOverCosTheta, 2) * sumOverSinThetaSquared -
237 pow(sumOverSinTheta, 2) * sumOverCosThetaSquared +
238 2. * sumOverCosTheta * sumOverSinTheta * sumOverCosThetaSinTheta;
241 double beamDenominator =
242 (
pow(sumOverZTPrimeZTPrimePrime, 2) - sumOverZTPrimeSquared * sumOverZTPrimePrimeSquared) * beamRadii.at(0);
243 std::vector<double> alignmentDenominator(6, 0.);
244 std::vector<double> termA(6, 0.), termB(6, 0.), termC(6, 0.), termD(6, 0.);
245 for (
unsigned int aHalfbarrel = 0; aHalfbarrel < 6; ++aHalfbarrel) {
246 alignmentDenominator.at(aHalfbarrel) =
247 (
pow(sumOverZPrimeZPrimePrime.at(aHalfbarrel), 2) -
248 sumOverZPrimeSquared.at(aHalfbarrel) * sumOverZPrimePrimeSquared.at(aHalfbarrel)) *
249 mixedTrigonometricTerm;
250 termA.at(aHalfbarrel) = sumOverZPrimeZTPrime.at(aHalfbarrel) * sumOverZTPrimeZTPrimePrime -
251 sumOverZPrimeZTPrimePrime.at(aHalfbarrel) * sumOverZTPrimeSquared;
252 termB.at(aHalfbarrel) = sumOverZPrimePrimeZTPrime.at(aHalfbarrel) * sumOverZTPrimeZTPrimePrime -
253 sumOverZPrimePrimeZTPrimePrime.at(aHalfbarrel) * sumOverZTPrimeSquared;
254 termC.at(aHalfbarrel) = sumOverZPrimeZTPrimePrime.at(aHalfbarrel) * sumOverZTPrimeZTPrimePrime -
255 sumOverZPrimeZTPrime.at(aHalfbarrel) * sumOverZTPrimePrimeSquared;
256 termD.at(aHalfbarrel) = sumOverZPrimePrimeZTPrimePrime.at(aHalfbarrel) * sumOverZTPrimeZTPrimePrime -
257 sumOverZPrimePrimeZTPrime.at(aHalfbarrel) * sumOverZTPrimePrimeSquared;
261 const int numberOfBeams = 8;
268 for (
int aHalfbarrel = 0; aHalfbarrel < 6; ++aHalfbarrel) {
273 (sumOverPhiZPrime.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) * sumOverCosThetaSquared *
274 sumOverSinThetaSquared -
275 sumOverPhiZPrimePrime.at(aHalfbarrel) * sumOverZPrimeSquared.at(aHalfbarrel) * sumOverCosThetaSquared *
276 sumOverSinThetaSquared -
277 sumOverPhiZPrimeCosTheta.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) * sumOverCosTheta *
278 sumOverSinThetaSquared +
279 sumOverPhiZPrimePrimeCosTheta.at(aHalfbarrel) * sumOverZPrimeSquared.at(aHalfbarrel) * sumOverCosTheta *
280 sumOverSinThetaSquared +
281 sumOverPhiZPrimeCosTheta.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) * sumOverCosThetaSinTheta *
283 sumOverPhiZPrimePrimeCosTheta.at(aHalfbarrel) * sumOverZPrimeSquared.at(aHalfbarrel) *
284 sumOverCosThetaSinTheta * sumOverSinTheta -
285 sumOverPhiZPrimeSinTheta.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) * sumOverCosThetaSquared *
287 sumOverPhiZPrimePrimeSinTheta.at(aHalfbarrel) * sumOverZPrimeSquared.at(aHalfbarrel) * sumOverCosThetaSquared *
289 sumOverPhiZPrime.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) *
pow(sumOverCosThetaSinTheta, 2) +
290 sumOverPhiZPrimePrime.at(aHalfbarrel) * sumOverZPrimeSquared.at(aHalfbarrel) *
291 pow(sumOverCosThetaSinTheta, 2) +
292 sumOverPhiZPrimeSinTheta.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) * sumOverCosTheta *
293 sumOverCosThetaSinTheta -
294 sumOverPhiZPrimePrimeSinTheta.at(aHalfbarrel) * sumOverZPrimeSquared.at(aHalfbarrel) * sumOverCosTheta *
295 sumOverCosThetaSinTheta) /
296 alignmentDenominator.at(aHalfbarrel);
300 (sumOverPhiZPrimePrime.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) * sumOverCosThetaSquared *
301 sumOverSinThetaSquared -
302 sumOverPhiZPrime.at(aHalfbarrel) * sumOverZPrimePrimeSquared.at(aHalfbarrel) * sumOverCosThetaSquared *
303 sumOverSinThetaSquared -
304 sumOverPhiZPrimePrimeCosTheta.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) * sumOverCosTheta *
305 sumOverSinThetaSquared +
306 sumOverPhiZPrimeCosTheta.at(aHalfbarrel) * sumOverZPrimePrimeSquared.at(aHalfbarrel) * sumOverCosTheta *
307 sumOverSinThetaSquared +
308 sumOverPhiZPrimePrimeCosTheta.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) *
309 sumOverCosThetaSinTheta * sumOverSinTheta -
310 sumOverPhiZPrimeCosTheta.at(aHalfbarrel) * sumOverZPrimePrimeSquared.at(aHalfbarrel) *
311 sumOverCosThetaSinTheta * sumOverSinTheta -
312 sumOverPhiZPrimePrimeSinTheta.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) *
313 sumOverCosThetaSquared * sumOverSinTheta +
314 sumOverPhiZPrimeSinTheta.at(aHalfbarrel) * sumOverZPrimePrimeSquared.at(aHalfbarrel) * sumOverCosThetaSquared *
316 sumOverPhiZPrimePrime.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) * sumOverCosThetaSinTheta *
317 sumOverCosThetaSinTheta +
318 sumOverPhiZPrime.at(aHalfbarrel) * sumOverZPrimePrimeSquared.at(aHalfbarrel) * sumOverCosThetaSinTheta *
319 sumOverCosThetaSinTheta +
320 sumOverPhiZPrimePrimeSinTheta.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) * sumOverCosTheta *
321 sumOverCosThetaSinTheta -
322 sumOverPhiZPrimeSinTheta.at(aHalfbarrel) * sumOverZPrimePrimeSquared.at(aHalfbarrel) * sumOverCosTheta *
323 sumOverCosThetaSinTheta) /
324 alignmentDenominator.at(aHalfbarrel);
329 (sumOverPhiZPrime.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) * sumOverCosThetaSquared *
331 sumOverPhiZPrimePrime.at(aHalfbarrel) * sumOverZPrimeSquared.at(aHalfbarrel) * sumOverCosThetaSquared *
333 sumOverPhiZPrimeCosTheta.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) * sumOverCosTheta *
335 sumOverPhiZPrimePrimeCosTheta.at(aHalfbarrel) * sumOverZPrimeSquared.at(aHalfbarrel) * sumOverCosTheta *
337 sumOverPhiZPrime.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) * sumOverCosTheta *
338 sumOverCosThetaSinTheta +
339 sumOverPhiZPrimePrime.at(aHalfbarrel) * sumOverZPrimeSquared.at(aHalfbarrel) * sumOverCosTheta *
340 sumOverCosThetaSinTheta +
341 sumOverPhiZPrimeCosTheta.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) * numberOfBeams *
342 sumOverCosThetaSinTheta -
343 sumOverPhiZPrimePrimeCosTheta.at(aHalfbarrel) * sumOverZPrimeSquared.at(aHalfbarrel) * numberOfBeams *
344 sumOverCosThetaSinTheta -
345 sumOverPhiZPrimeSinTheta.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) * numberOfBeams *
346 sumOverCosThetaSquared +
347 sumOverPhiZPrimePrimeSinTheta.at(aHalfbarrel) * sumOverZPrimeSquared.at(aHalfbarrel) * numberOfBeams *
348 sumOverCosThetaSquared +
349 sumOverPhiZPrimeSinTheta.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) * sumOverCosTheta *
351 sumOverPhiZPrimePrimeSinTheta.at(aHalfbarrel) * sumOverZPrimeSquared.at(aHalfbarrel) * sumOverCosTheta *
353 alignmentDenominator.at(aHalfbarrel) * beamRadii.at(aHalfbarrel);
358 (sumOverPhiZPrimePrime.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) * sumOverCosThetaSquared *
360 sumOverPhiZPrime.at(aHalfbarrel) * sumOverZPrimePrimeSquared.at(aHalfbarrel) * sumOverCosThetaSquared *
362 sumOverPhiZPrimePrimeCosTheta.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) * sumOverCosTheta *
364 sumOverPhiZPrimeCosTheta.at(aHalfbarrel) * sumOverZPrimePrimeSquared.at(aHalfbarrel) * sumOverCosTheta *
366 sumOverPhiZPrimePrime.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) * sumOverCosTheta *
367 sumOverCosThetaSinTheta +
368 sumOverPhiZPrime.at(aHalfbarrel) * sumOverZPrimePrimeSquared.at(aHalfbarrel) * sumOverCosTheta *
369 sumOverCosThetaSinTheta +
370 sumOverPhiZPrimePrimeCosTheta.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) * numberOfBeams *
371 sumOverCosThetaSinTheta -
372 sumOverPhiZPrimeCosTheta.at(aHalfbarrel) * sumOverZPrimePrimeSquared.at(aHalfbarrel) * numberOfBeams *
373 sumOverCosThetaSinTheta -
374 sumOverPhiZPrimePrimeSinTheta.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) * numberOfBeams *
375 sumOverCosThetaSquared +
376 sumOverPhiZPrimeSinTheta.at(aHalfbarrel) * sumOverZPrimePrimeSquared.at(aHalfbarrel) * numberOfBeams *
377 sumOverCosThetaSquared +
378 sumOverPhiZPrimePrimeSinTheta.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) * sumOverCosTheta *
380 sumOverPhiZPrimeSinTheta.at(aHalfbarrel) * sumOverZPrimePrimeSquared.at(aHalfbarrel) * sumOverCosTheta *
382 alignmentDenominator.at(aHalfbarrel) * beamRadii.at(aHalfbarrel);
386 (sumOverPhiZPrime.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) * sumOverCosTheta *
387 sumOverSinThetaSquared -
388 sumOverPhiZPrimePrime.at(aHalfbarrel) * sumOverZPrimeSquared.at(aHalfbarrel) * sumOverCosTheta *
389 sumOverSinThetaSquared -
390 sumOverPhiZPrimeCosTheta.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) * numberOfBeams *
391 sumOverSinThetaSquared +
392 sumOverPhiZPrimePrimeCosTheta.at(aHalfbarrel) * sumOverZPrimeSquared.at(aHalfbarrel) * numberOfBeams *
393 sumOverSinThetaSquared +
394 sumOverPhiZPrimeCosTheta.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) * sumOverSinTheta *
396 sumOverPhiZPrimePrimeCosTheta.at(aHalfbarrel) * sumOverZPrimeSquared.at(aHalfbarrel) * sumOverSinTheta *
398 sumOverPhiZPrime.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) * sumOverCosThetaSinTheta *
400 sumOverPhiZPrimePrime.at(aHalfbarrel) * sumOverZPrimeSquared.at(aHalfbarrel) * sumOverCosThetaSinTheta *
402 sumOverPhiZPrimeSinTheta.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) * sumOverCosTheta *
404 sumOverPhiZPrimePrimeSinTheta.at(aHalfbarrel) * sumOverZPrimeSquared.at(aHalfbarrel) * sumOverCosTheta *
406 sumOverPhiZPrimeSinTheta.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) * numberOfBeams *
407 sumOverCosThetaSinTheta -
408 sumOverPhiZPrimePrimeSinTheta.at(aHalfbarrel) * sumOverZPrimeSquared.at(aHalfbarrel) * numberOfBeams *
409 sumOverCosThetaSinTheta) /
410 alignmentDenominator.at(aHalfbarrel) * beamRadii.at(aHalfbarrel);
414 (sumOverPhiZPrimePrime.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) * sumOverCosTheta *
415 sumOverSinThetaSquared -
416 sumOverPhiZPrime.at(aHalfbarrel) * sumOverZPrimePrimeSquared.at(aHalfbarrel) * sumOverCosTheta *
417 sumOverSinThetaSquared -
418 sumOverPhiZPrimePrimeCosTheta.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) * numberOfBeams *
419 sumOverSinThetaSquared +
420 sumOverPhiZPrimeCosTheta.at(aHalfbarrel) * sumOverZPrimePrimeSquared.at(aHalfbarrel) * numberOfBeams *
421 sumOverSinThetaSquared +
422 sumOverPhiZPrimePrimeCosTheta.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) * sumOverSinTheta *
424 sumOverPhiZPrimeCosTheta.at(aHalfbarrel) * sumOverZPrimePrimeSquared.at(aHalfbarrel) * sumOverSinTheta *
426 sumOverPhiZPrimePrime.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) * sumOverCosThetaSinTheta *
428 sumOverPhiZPrime.at(aHalfbarrel) * sumOverZPrimePrimeSquared.at(aHalfbarrel) * sumOverCosThetaSinTheta *
430 sumOverPhiZPrimePrimeSinTheta.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) * sumOverCosTheta *
432 sumOverPhiZPrimeSinTheta.at(aHalfbarrel) * sumOverZPrimePrimeSquared.at(aHalfbarrel) * sumOverCosTheta *
434 sumOverPhiZPrimePrimeSinTheta.at(aHalfbarrel) * sumOverZPrimeZPrimePrime.at(aHalfbarrel) * numberOfBeams *
435 sumOverCosThetaSinTheta -
436 sumOverPhiZPrimeSinTheta.at(aHalfbarrel) * sumOverZPrimePrimeSquared.at(aHalfbarrel) * numberOfBeams *
437 sumOverCosThetaSinTheta) /
438 alignmentDenominator.at(aHalfbarrel) * beamRadii.at(aHalfbarrel);
442 double vsumA = 0., vsumB = 0., vsumC = 0., vsumD = 0., vsumE = 0., vsumF = 0.;
443 for (
unsigned int aHalfbarrel = 0; aHalfbarrel < 6; ++aHalfbarrel) {
444 vsumA += theResult.
GetParameter(aHalfbarrel, 1, 2).first * termA.at(aHalfbarrel) +
445 theResult.
GetParameter(aHalfbarrel, 0, 2).first * termB.at(aHalfbarrel);
446 vsumB += theResult.
GetParameter(aHalfbarrel, 1, 1).first * termA.at(aHalfbarrel) +
447 theResult.
GetParameter(aHalfbarrel, 0, 1).first * termB.at(aHalfbarrel);
448 vsumC += beamRadii.at(aHalfbarrel) * (theResult.
GetParameter(aHalfbarrel, 1, 0).first * termA.at(aHalfbarrel) +
449 theResult.
GetParameter(aHalfbarrel, 0, 0).first * termB.at(aHalfbarrel));
450 vsumD += theResult.
GetParameter(aHalfbarrel, 1, 2).first * termC.at(aHalfbarrel) +
451 theResult.
GetParameter(aHalfbarrel, 0, 2).first * termD.at(aHalfbarrel);
452 vsumE += theResult.
GetParameter(aHalfbarrel, 1, 1).first * termC.at(aHalfbarrel) +
453 theResult.
GetParameter(aHalfbarrel, 0, 1).first * termD.at(aHalfbarrel);
454 vsumF += beamRadii.at(aHalfbarrel) * (theResult.
GetParameter(aHalfbarrel, 1, 0).first * termC.at(aHalfbarrel) +
455 theResult.
GetParameter(aHalfbarrel, 0, 0).first * termD.at(aHalfbarrel));
462 (
cos(beamPhiPositions.at(
beam)) * vsumA -
sin(beamPhiPositions.at(
beam)) * vsumB - vsumC +
463 sumOverPhiZTPrime.at(
beam) * sumOverZTPrimeZTPrimePrime -
464 sumOverPhiZTPrimePrime.at(
beam) * sumOverZTPrimeSquared) /
469 << -1. *
sin(beamPhiPositions.at(
beam)) * vsumB <<
" " << -1. * vsumC <<
" " 470 << sumOverPhiZTPrime.at(
beam) * sumOverZTPrimeZTPrimePrime -
471 sumOverPhiZTPrimePrime.at(
beam) * sumOverZTPrimeSquared
472 <<
" " << beamDenominator << std::endl;
477 (
cos(beamPhiPositions.at(
beam)) * vsumD -
sin(beamPhiPositions.at(
beam)) * vsumE - vsumF +
478 sumOverPhiZTPrimePrime.at(
beam) * sumOverZTPrimeZTPrimePrime -
479 sumOverPhiZTPrime.at(
beam) * sumOverZTPrimePrimeSquared) /
502 std::vector<std::vector<std::vector<double> > > endFaceZPositions(
503 4,
std::vector<std::vector<double> >(2, std::vector<double>(2, 0.)));
504 endFaceZPositions.at(0).at(0).at(0) = 1322.5;
505 endFaceZPositions.at(0).at(0).at(1) = 2667.5;
506 endFaceZPositions.at(1).at(0).at(0) = -2667.5;
507 endFaceZPositions.at(1).at(0).at(1) = -1322.5;
508 endFaceZPositions.at(2).at(1).at(0) = -700.;
509 endFaceZPositions.at(2).at(1).at(1) = -300.;
510 endFaceZPositions.at(2).at(0).at(0) = 300.;
511 endFaceZPositions.at(2).at(0).at(1) = 700.;
512 endFaceZPositions.at(3).at(1).at(0) = -1090.;
513 endFaceZPositions.at(3).at(1).at(1) = -300.;
514 endFaceZPositions.at(3).at(0).at(0) = 300.;
515 endFaceZPositions.at(3).at(0).at(1) = 1090.;
518 std::vector<double> disk9EndFaceZPositions(2, 0.);
519 disk9EndFaceZPositions.at(0) = -2667.5;
520 disk9EndFaceZPositions.at(1) = 2667.5;
523 const int theSide =
pos < 3 ? 0 : 1;
526 const int halfbarrel = det == 2 ? det + theSide : det + 1 + theSide;
530 const double radialOffset = det == 2 ? 50. : 36.;
533 const double phiPositions[8] = {0.392699, 1.289799, 1.851794, 2.748894, 3.645995, 4.319690, 5.216791, 5.778784};
534 std::vector<double> beamPhiPositions(8, 0.);
535 for (
unsigned int aBeam = 0; aBeam < 8; ++aBeam)
536 beamPhiPositions.at(aBeam) = phiPositions[aBeam];
542 const double radii[6] = {564., 564., 514., 514., 600., 600.};
543 std::vector<double> beamRadii(6, 0.);
544 for (
int aHalfbarrel = 0; aHalfbarrel < 6; ++aHalfbarrel)
545 beamRadii.at(aHalfbarrel) =
radii[aHalfbarrel];
548 double detReducedZ[2] = {0., 0.};
550 double beamReducedZ[2] = {0., 0.};
554 endFaceZPositions.at(det).at(theSide).at(0);
555 detReducedZ[0] /= (endFaceZPositions.at(det).at(theSide).at(1) - endFaceZPositions.at(det).at(theSide).at(0));
556 detReducedZ[1] = endFaceZPositions.at(det).at(theSide).at(1) -
558 detReducedZ[1] /= (endFaceZPositions.at(det).at(theSide).at(1) - endFaceZPositions.at(det).at(theSide).at(0));
562 disk9EndFaceZPositions.at(0);
563 beamReducedZ[0] /= (disk9EndFaceZPositions.at(1) - disk9EndFaceZPositions.at(0));
564 beamReducedZ[1] = disk9EndFaceZPositions.at(1) -
566 beamReducedZ[1] /= (disk9EndFaceZPositions.at(1) - disk9EndFaceZPositions.at(0));
570 double phiCorrection = 0.;
573 phiCorrection += detReducedZ[1] * alignmentParameters.
GetParameter(halfbarrel, 0, 0).first;
576 phiCorrection += detReducedZ[0] * alignmentParameters.
GetParameter(halfbarrel, 1, 0).first;
579 phiCorrection += detReducedZ[1] *
sin(beamPhiPositions.at(
beam)) *
580 alignmentParameters.
GetParameter(halfbarrel, 0, 1).first / beamRadii.at(halfbarrel);
583 phiCorrection += detReducedZ[0] *
sin(beamPhiPositions.at(
beam)) *
584 alignmentParameters.
GetParameter(halfbarrel, 1, 1).first / beamRadii.at(halfbarrel);
587 phiCorrection -= detReducedZ[1] *
cos(beamPhiPositions.at(
beam)) *
588 alignmentParameters.
GetParameter(halfbarrel, 0, 2).first / beamRadii.at(halfbarrel);
591 phiCorrection -= detReducedZ[0] *
cos(beamPhiPositions.at(
beam)) *
592 alignmentParameters.
GetParameter(halfbarrel, 1, 2).first / beamRadii.at(halfbarrel);
597 phiCorrection += beamReducedZ[1] * alignmentParameters.
GetBeamParameter(
beam, 0).first * beamRadii.at(0) /
598 beamRadii.at(halfbarrel);
599 phiCorrection += beamReducedZ[0] * alignmentParameters.
GetBeamParameter(
beam, 1).first * beamRadii.at(0) /
600 beamRadii.at(halfbarrel);
602 return phiCorrection;
621 std::vector<std::vector<std::vector<double> > > endFaceZPositions(
622 4,
std::vector<std::vector<double> >(2, std::vector<double>(2, 0.)));
623 endFaceZPositions.at(0).at(0).at(0) = 1322.5;
624 endFaceZPositions.at(0).at(0).at(1) = 2667.5;
625 endFaceZPositions.at(1).at(0).at(0) = -2667.5;
626 endFaceZPositions.at(1).at(0).at(1) = -1322.5;
627 endFaceZPositions.at(2).at(1).at(0) = -700.;
628 endFaceZPositions.at(2).at(1).at(1) = -300.;
629 endFaceZPositions.at(2).at(0).at(0) = 300.;
630 endFaceZPositions.at(2).at(0).at(1) = 700.;
631 endFaceZPositions.at(3).at(1).at(0) = -1090.;
632 endFaceZPositions.at(3).at(1).at(1) = -300.;
633 endFaceZPositions.at(3).at(0).at(0) = 300.;
634 endFaceZPositions.at(3).at(0).at(1) = 1090.;
637 std::vector<double> disk9EndFaceZPositions(2, 0.);
638 disk9EndFaceZPositions.at(0) = -2667.5;
639 disk9EndFaceZPositions.at(1) = 2667.5;
642 const int halfbarrel = det;
645 const int theSide = 0;
648 const double radialOffset = 0.;
651 const double phiPositions[8] = {0.392699, 1.289799, 1.851794, 2.748894, 3.645995, 4.319690, 5.216791, 5.778784};
652 std::vector<double> beamPhiPositions(8, 0.);
653 for (
unsigned int aBeam = 0; aBeam < 8; ++aBeam)
654 beamPhiPositions.at(aBeam) = phiPositions[aBeam];
660 const double radii[6] = {564., 564., 514., 514., 600., 600.};
661 std::vector<double> beamRadii(6, 0.);
662 for (
int aHalfbarrel = 0; aHalfbarrel < 6; ++aHalfbarrel)
663 beamRadii.at(aHalfbarrel) =
radii[aHalfbarrel];
666 double detReducedZ[2] = {0., 0.};
668 double beamReducedZ[2] = {0., 0.};
672 endFaceZPositions.at(det).at(theSide).at(0);
673 detReducedZ[0] /= (endFaceZPositions.at(det).at(theSide).at(1) - endFaceZPositions.at(det).at(theSide).at(0));
674 detReducedZ[1] = endFaceZPositions.at(det).at(theSide).at(1) -
676 detReducedZ[1] /= (endFaceZPositions.at(det).at(theSide).at(1) - endFaceZPositions.at(det).at(theSide).at(0));
680 disk9EndFaceZPositions.at(0);
681 beamReducedZ[0] /= (disk9EndFaceZPositions.at(1) - disk9EndFaceZPositions.at(0));
682 beamReducedZ[1] = disk9EndFaceZPositions.at(1) -
684 beamReducedZ[1] /= (disk9EndFaceZPositions.at(1) - disk9EndFaceZPositions.at(0));
688 double phiCorrection = 0.;
691 phiCorrection += detReducedZ[1] * alignmentParameters.
GetParameter(halfbarrel, 0, 0).first;
694 phiCorrection += detReducedZ[0] * alignmentParameters.
GetParameter(halfbarrel, 1, 0).first;
697 phiCorrection += detReducedZ[1] *
sin(beamPhiPositions.at(
beam)) *
698 alignmentParameters.
GetParameter(halfbarrel, 0, 1).first / beamRadii.at(halfbarrel);
701 phiCorrection += detReducedZ[0] *
sin(beamPhiPositions.at(
beam)) *
702 alignmentParameters.
GetParameter(halfbarrel, 1, 1).first / beamRadii.at(halfbarrel);
705 phiCorrection -= detReducedZ[1] *
cos(beamPhiPositions.at(
beam)) *
706 alignmentParameters.
GetParameter(halfbarrel, 0, 2).first / beamRadii.at(halfbarrel);
709 phiCorrection -= detReducedZ[0] *
cos(beamPhiPositions.at(
beam)) *
710 alignmentParameters.
GetParameter(halfbarrel, 1, 2).first / beamRadii.at(halfbarrel);
715 phiCorrection += beamReducedZ[1] * alignmentParameters.
GetBeamParameter(
beam, 0).first * beamRadii.at(0) /
716 beamRadii.at(halfbarrel);
717 phiCorrection += beamReducedZ[0] * alignmentParameters.
GetBeamParameter(
beam, 1).first * beamRadii.at(0) /
718 beamRadii.at(halfbarrel);
720 return phiCorrection;
737 std::cerr <<
" [LASAlignmentTubeAlgorithm::ReadMisalignmentFromFile] ** ERROR: cannot open file \"" <<
filename 738 <<
"\"." << std::endl;
742 std::cerr <<
" @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" 745 std::cerr <<
" @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" 748 std::cerr <<
" [LASAlignmentTubeAlgorithm::ReadMisalignmentFromFile] ** WARNING: you are reading a fake measurement " 751 std::cerr <<
" @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" 754 std::cerr <<
" @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" 760 measuredCoordinates = nominalCoordinates;
794 while (!
file.eof()) {
std::pair< double, double > & GetParameter(int aSubdetector, int aDisk, int aParameter)
void SetPhiError(double aPhiError)
Sin< T >::type sin(const T &t)
bool TEC2TECLoop(int &, int &, int &) const
bool TECLoop(int &, int &, int &, int &) const
LASAlignmentTubeAlgorithm()
Cos< T >::type cos(const T &t)
std::pair< double, double > & GetBeamParameter(int aBeam, int aParameter)
T & GetTIBTOBEntry(int subdetector, int beam, int tibTobPosition)
double GetTEC2TECAlignmentParameterCorrection(int, int, int, LASGlobalData< LASCoordinateSet > &, LASBarrelAlignmentParameterSet &)
bool TIBTOBLoop(int &, int &, int &) const
void ReadMisalignmentFromFile(const char *, LASGlobalData< LASCoordinateSet > &, LASGlobalData< LASCoordinateSet > &)
double GetPhi(void) const
T & GetTEC2TECEntry(int subdetector, int beam, int tecDisk)
LASBarrelAlignmentParameterSet CalculateParameters(LASGlobalData< LASCoordinateSet > &, LASGlobalData< LASCoordinateSet > &)
T & GetTECEntry(int subdetector, int tecRing, int beam, int tecDisk)
double GetTIBTOBAlignmentParameterCorrection(int, int, int, LASGlobalData< LASCoordinateSet > &, LASBarrelAlignmentParameterSet &)
Power< A, B >::type pow(const A &a, const B &b)