389 double chisquare = 0.;
401 std::vector<std::vector<std::vector<double> > > endFaceZPositions(
402 4,
std::vector<std::vector<double> >(2, std::vector<double>(2, 0.)));
403 endFaceZPositions.at(0).at(0).at(0) = 1322.5;
404 endFaceZPositions.at(0).at(0).at(1) = 2667.5;
405 endFaceZPositions.at(1).at(0).at(0) = -2667;
406 endFaceZPositions.at(1).at(0).at(1) = -1322.5;
407 endFaceZPositions.at(2).at(1).at(0) = -700.;
408 endFaceZPositions.at(2).at(1).at(1) = -300.;
409 endFaceZPositions.at(2).at(0).at(0) = 300.;
410 endFaceZPositions.at(2).at(0).at(1) = 700.;
411 endFaceZPositions.at(3).at(1).at(0) = -1090.;
412 endFaceZPositions.at(3).at(1).at(1) = -300.;
413 endFaceZPositions.at(3).at(0).at(0) = 300.;
414 endFaceZPositions.at(3).at(0).at(1) = 1090.;
417 std::vector<double> disk9EndFaceZPositions(2, 0.);
418 disk9EndFaceZPositions.at(0) = -2667.5;
419 disk9EndFaceZPositions.at(1) = 2667.5;
422 double detReducedZ[2] = {0., 0.};
424 double beamReducedZ[2] = {0., 0.};
432 const int theSide =
pos < 3 ? 0 : 1;
436 const double radialOffset = det == 2 ? 50. : 36.;
441 detReducedZ[0] /= (endFaceZPositions.at(det).at(theSide).at(1) - endFaceZPositions.at(det).at(theSide).at(0));
444 detReducedZ[1] /= (endFaceZPositions.at(det).at(theSide).at(1) - endFaceZPositions.at(det).at(theSide).at(0));
449 beamReducedZ[0] /= (disk9EndFaceZPositions.at(1) - disk9EndFaceZPositions.at(0));
452 beamReducedZ[1] /= (disk9EndFaceZPositions.at(1) - disk9EndFaceZPositions.at(0));
464 double calculatedResidual = 0.;
486 calculatedResidual += detReducedZ[1] * par[indexBase + 0];
489 calculatedResidual += detReducedZ[0] * par[indexBase + 1];
492 calculatedResidual += detReducedZ[1] *
sin(currentPhi) / currentR * par[indexBase + 2];
495 calculatedResidual += detReducedZ[0] *
sin(currentPhi) / currentR * par[indexBase + 3];
498 calculatedResidual += -1. * detReducedZ[1] *
cos(currentPhi) / currentR * par[indexBase + 4];
501 calculatedResidual += -1. * detReducedZ[0] *
cos(currentPhi) / currentR * par[indexBase + 5];
504 indexBase = 36 +
beam * 2;
509 calculatedResidual += beamReducedZ[1] * par[indexBase];
512 calculatedResidual += beamReducedZ[0] * par[indexBase + 1];
515 chisquare +=
pow(measuredResidual - calculatedResidual, 2) /
526 const int theSide = 0;
531 detReducedZ[0] /= (endFaceZPositions.at(det).at(theSide).at(1) - endFaceZPositions.at(det).at(theSide).at(0));
534 detReducedZ[1] /= (endFaceZPositions.at(det).at(theSide).at(1) - endFaceZPositions.at(det).at(theSide).at(0));
538 beamReducedZ[0] /= (disk9EndFaceZPositions.at(1) - disk9EndFaceZPositions.at(0));
540 beamReducedZ[1] /= (disk9EndFaceZPositions.at(1) - disk9EndFaceZPositions.at(0));
552 double calculatedResidual = 0.;
560 calculatedResidual += detReducedZ[1] * (det == 0 ? par[24] : par[30]);
563 calculatedResidual += detReducedZ[0] * (det == 0 ? par[25] : par[31]);
566 calculatedResidual += detReducedZ[1] *
sin(currentPhi) * (det == 0 ? par[26] : par[32]) / currentR;
569 calculatedResidual += detReducedZ[0] *
sin(currentPhi) * (det == 0 ? par[27] : par[33]) / currentR;
572 calculatedResidual += -1. * detReducedZ[1] *
cos(currentPhi) * (det == 0 ? par[28] : par[34]) / currentR;
575 calculatedResidual += -1. * detReducedZ[0] *
cos(currentPhi) * (det == 0 ? par[29] : par[35]) / currentR;
578 const unsigned int indexBase = 36 +
beam * 2;
583 calculatedResidual += beamReducedZ[1] * par[indexBase];
586 calculatedResidual += beamReducedZ[0] * par[indexBase + 1];
590 chisquare +=
pow(measuredResidual - calculatedResidual, 2) /
Sin< T >::type sin(const T &t)
bool TEC2TECLoop(int &, int &, int &) const
double GetPhiError(void) const
LASGlobalData< LASCoordinateSet > * aMeasuredCoordinates
LASGlobalData< LASCoordinateSet > * aNominalCoordinates
Cos< T >::type cos(const T &t)
T & GetTIBTOBEntry(int subdetector, int beam, int tibTobPosition)
bool TIBTOBLoop(int &, int &, int &) const
double GetPhi(void) const
T & GetTEC2TECEntry(int subdetector, int beam, int tecDisk)