17 std::cout <<
" [LASEndcapAlgorithm::CalculateParameters] -- Starting." << std::endl;
25 const double zPositions[9] = {1322.5, 1462.5, 1602.5, 1742.5, 1882.5, 2057.5, 2247.5, 2452.5, 2667.5};
26 std::vector<std::vector<double> > diskZPositions(2, std::vector<double>(9, 0.));
27 for (det = 0; det < 2; ++det) {
28 for (disk = 0; disk < 9; ++disk) {
30 diskZPositions.at(det).at(disk) = (det == 0 ? zPositions[disk] : -1. * zPositions[disk]);
36 const double phiPositions[8] = {0.392699, 1.178097, 1.963495, 2.748894, 3.534292, 4.319690, 5.105088, 5.890486};
37 std::vector<std::vector<double> > beamPhiPositions(2, std::vector<double>(8, 0.));
38 for (det = 0; det < 2; ++det) {
40 beamPhiPositions.at(det).at(
beam) = phiPositions[
beam];
45 std::vector<double>
radius(2, 0.);
50 const double endcapLength = 1345.;
59 std::vector<std::vector<double> > sumOverY(2, std::vector<double>(9, 0.));
60 std::vector<std::vector<double> > sumOverPhi(2, std::vector<double>(9, 0.));
64 std::vector<std::vector<double> > kSumOverPhi(2, std::vector<double>(8, 0.));
68 std::vector<double> doubleSumOverY(2, 0.);
69 std::vector<double> doubleSumOverPhi(2, 0.);
73 std::vector<std::vector<double> > kSumOverPhiZ(2, std::vector<double>(8, 0.));
77 std::vector<double> doubleSumOverYZ(2, 0.);
78 std::vector<double> doubleSumOverPhiZ(2, 0.);
81 std::vector<std::vector<double> > sumOverSinThetaY(2, std::vector<double>(9, 0.));
84 std::vector<std::vector<double> > sumOverCosThetaY(2, std::vector<double>(9, 0.));
87 std::vector<double> doubleSumOverSinThetaY(2, 0.);
88 std::vector<double> doubleSumOverCosThetaY(2, 0.);
91 std::vector<double> doubleSumOverSinThetaYZ(2, 0.);
92 std::vector<double> doubleSumOverCosThetaYZ(2, 0.);
95 std::vector<double> sumOverZ(2, 0.);
96 std::vector<double> sumOverZSquared(2, 0.);
114 sumOverY.at(det).at(disk) += residual;
115 sumOverPhi.at(det).at(disk) += residual /
radius;
116 kSumOverPhi.at(det).at(
beam) += residual /
radius;
118 doubleSumOverY.at(det) += residual;
119 doubleSumOverPhi.at(det) += residual /
radius;
121 kSumOverPhiZ.at(det).at(
beam) += diskZPositions.at(det).at(disk) * residual /
radius;
123 doubleSumOverYZ.at(det) += diskZPositions.at(det).at(disk) * residual;
124 doubleSumOverPhiZ.at(det) += diskZPositions.at(det).at(disk) * residual /
radius;
133 diskZPositions.at(det).at(disk) * residual;
135 diskZPositions.at(det).at(disk) * residual;
140 for (disk = 0; disk < 9; ++disk) {
141 sumOverZ.at(0) += diskZPositions.at(0).at(disk);
142 sumOverZ.at(1) += diskZPositions.at(1).at(disk);
143 sumOverZSquared.at(0) +=
pow(diskZPositions.at(0).at(disk), 2);
144 sumOverZSquared.at(1) +=
pow(diskZPositions.at(1).at(disk), 2);
154 std::vector<double> deltaPhi0(2, 0.);
157 std::vector<double> deltaPhiT(2, 0.);
160 std::vector<std::vector<double> > deltaPhiK(2, std::vector<double>(9, 0.));
163 std::vector<double> deltaX0(2, 0.);
166 std::vector<double> deltaXT(2, 0.);
169 std::vector<std::vector<double> > deltaXK(2, std::vector<double>(9, 0.));
172 std::vector<double> deltaY0(2, 0.);
175 std::vector<double> deltaYT(2, 0.);
178 std::vector<std::vector<double> > deltaYK(2, std::vector<double>(9, 0.));
181 std::vector<std::vector<double> > deltaTA(2, std::vector<double>(8, 0.));
182 std::vector<std::vector<double> > deltaTB(2, std::vector<double>(8, 0.));
186 for (det = 0; det < 2; ++det) {
191 (sumOverZSquared.at(det) * doubleSumOverPhi.at(det) - sumOverZ.at(det) * doubleSumOverPhiZ.at(det)) /
192 (8. * (
pow(sumOverZ.at(det), 2) - 9. * sumOverZSquared.at(det)));
196 deltaPhiT.at(det) = endcapLength * (9. * doubleSumOverPhiZ.at(det) - sumOverZ.at(det) * doubleSumOverPhi.at(det)) /
197 (8. * (
pow(sumOverZ.at(det), 2) - 9. * sumOverZSquared.at(det)));
201 for (disk = 0; disk < 9; ++disk) {
202 deltaPhiK.at(det).at(disk) = (-1. * diskZPositions.at(det).at(disk) * deltaPhiT.at(det) / endcapLength) -
203 (deltaPhi0.at(det)) - sumOverPhi.at(det).at(disk) / 8.;
207 deltaX0.at(det) = 2. *
208 (sumOverZ.at(det) * doubleSumOverSinThetaYZ.at(det) -
209 sumOverZSquared.at(det) * doubleSumOverSinThetaY.at(det)) /
210 (8. * (
pow(sumOverZ.at(det), 2) - 9. * sumOverZSquared.at(det)));
213 deltaXT.at(det) = 2. * endcapLength *
214 (sumOverZ.at(det) * doubleSumOverSinThetaY.at(det) - 9. * doubleSumOverSinThetaYZ.at(det)) /
215 (8. * (
pow(sumOverZ.at(det), 2) - 9. * sumOverZSquared.at(det)));
218 for (disk = 0; disk < 9; ++disk) {
219 deltaXK.at(det).at(disk) = (-1. * diskZPositions.at(det).at(disk) * deltaXT.at(det) / endcapLength) -
220 (deltaX0.at(det)) + 2. * sumOverSinThetaY.at(det).at(disk) / 8.;
224 deltaY0.at(det) = 2. *
225 (sumOverZSquared.at(det) * doubleSumOverCosThetaY.at(det) -
226 sumOverZ.at(det) * doubleSumOverCosThetaYZ.at(det)) /
227 (8. * (
pow(sumOverZ.at(det), 2) - 9. * sumOverZSquared.at(det)));
230 deltaYT.at(det) = 2. * endcapLength *
231 (9. * doubleSumOverCosThetaYZ.at(det) - sumOverZ.at(det) * doubleSumOverCosThetaY.at(det)) /
232 (8. * (
pow(sumOverZ.at(det), 2) - 9. * sumOverZSquared.at(det)));
235 for (disk = 0; disk < 9; ++disk) {
236 deltaYK.at(det).at(disk) = (-1. * diskZPositions.at(det).at(disk) * deltaYT.at(det) / endcapLength) -
237 (deltaY0.at(det)) - 2. * sumOverCosThetaY.at(det).at(disk) / 8.;
242 deltaTA.at(det).at(
beam) =
244 (kSumOverPhi.at(det).at(
beam) * sumOverZSquared.at(det) - kSumOverPhiZ.at(det).at(
beam) * sumOverZ.at(det)) /
245 (
pow(sumOverZ.at(det), 2) - 9. * sumOverZSquared.at(det)) +
246 (
cos(beamPhiPositions.at(det).at(
beam)) * deltaY0.at(det) -
247 sin(beamPhiPositions.at(det).at(
beam)) * deltaX0.at(det)) /
251 deltaTB.at(det).at(
beam) =
252 -1. * deltaPhiT.at(det) - deltaPhi0.at(det) -
253 (kSumOverPhi.at(det).at(
beam) * sumOverZ.at(det) - 9. * kSumOverPhiZ.at(det).at(
beam)) * endcapLength /
254 (
pow(sumOverZ.at(det), 2) - 9. * sumOverZSquared.at(det)) -
255 (kSumOverPhiZ.at(det).at(
beam) * sumOverZ.at(det) - kSumOverPhi.at(det).at(
beam) * sumOverZSquared.at(det)) /
256 (
pow(sumOverZ.at(det), 2) - 9. * sumOverZSquared.at(det)) +
257 ((deltaXT.at(det) + deltaX0.at(det)) *
sin(beamPhiPositions.at(det).at(
beam)) -
258 (deltaYT.at(det) + deltaY0.at(det)) *
cos(beamPhiPositions.at(det).at(
beam))) /
271 for (det = 0; det < 2; ++det) {
272 for (disk = 0; disk < 9; ++disk) {
274 theResult.
GetDiskParameter(det, disk, 0).first = deltaPhiK.at(det).at(disk);
283 for (
int det = 0; det < 2; ++det) {
293 for (
int det = 0; det < 2; ++det) {
296 deltaTA.at(det).at(
beam);
298 deltaTB.at(det).at(
beam);
302 std::cout <<
" [LASEndcapAlgorithm::CalculateParameters] -- Done." << std::endl;
319 const double radius =
ring == 0 ? 564. : 840.;
320 const double endcapLength = 1345.;
324 double phiCorrection = 0.;
368 return phiCorrection;