345 double chisquare = 0.;
349 int det, beam,
pos, disk;
357 std::vector<std::vector<std::vector<double> > > endFaceZPositions( 4, std::vector<std::vector<double> >( 2, std::vector<double>( 2, 0. ) ) );
358 endFaceZPositions.at( 0 ).at( 0 ).at( 0 ) = 1322.5;
359 endFaceZPositions.at( 0 ).at( 0 ).at( 1 ) = 2667.5;
360 endFaceZPositions.at( 1 ).at( 0 ).at( 0 ) = -2667;
361 endFaceZPositions.at( 1 ).at( 0 ).at( 1 ) = -1322.5;
362 endFaceZPositions.at( 2 ).at( 1 ).at( 0 ) = -700.;
363 endFaceZPositions.at( 2 ).at( 1 ).at( 1 ) = -300.;
364 endFaceZPositions.at( 2 ).at( 0 ).at( 0 ) = 300.;
365 endFaceZPositions.at( 2 ).at( 0 ).at( 1 ) = 700.;
366 endFaceZPositions.at( 3 ).at( 1 ).at( 0 ) = -1090.;
367 endFaceZPositions.at( 3 ).at( 1 ).at( 1 ) = -300.;
368 endFaceZPositions.at( 3 ).at( 0 ).at( 0 ) = 300.;
369 endFaceZPositions.at( 3 ).at( 0 ).at( 1 ) = 1090.;
372 std::vector<double> disk9EndFaceZPositions( 2, 0. );
373 disk9EndFaceZPositions.at( 0 ) = -2667.5;
374 disk9EndFaceZPositions.at( 1 ) = 2667.5;
377 double detReducedZ[2] = { 0., 0. };
379 double beamReducedZ[2] = { 0., 0. };
382 det = 2; beam = 0; pos = 0;
386 const int theSide = pos<3 ? 0 : 1;
390 const double radialOffset = det==2 ? 50. : 36.;
394 detReducedZ[0] /= ( endFaceZPositions.at( det ).at( theSide ).at( 1 ) - endFaceZPositions.at( det ).at( theSide ).at( 0 ) );
396 detReducedZ[1] /= ( endFaceZPositions.at( det ).at( theSide ).at( 1 ) - endFaceZPositions.at( det ).at( theSide ).at( 0 ) );
400 beamReducedZ[0] /= ( disk9EndFaceZPositions.at( 1 ) - disk9EndFaceZPositions.at( 0 ) );
402 beamReducedZ[1] /= ( disk9EndFaceZPositions.at( 1 ) - disk9EndFaceZPositions.at( 0 ) );
415 double calculatedResidual = 0.;
424 if( theSide == 0 ) indexBase = 0;
425 if( theSide == 1 ) indexBase = 6;
428 if( theSide == 0 ) indexBase = 12;
429 if( theSide == 1 ) indexBase = 18;
433 calculatedResidual += detReducedZ[1] * par[indexBase+0];
436 calculatedResidual += detReducedZ[0] * par[indexBase+1];
439 calculatedResidual += detReducedZ[1] *
sin( currentPhi ) / currentR * par[indexBase+2];
442 calculatedResidual += detReducedZ[0] *
sin( currentPhi ) / currentR * par[indexBase+3];
445 calculatedResidual += -1. * detReducedZ[1] *
cos( currentPhi ) / currentR * par[indexBase+4];
448 calculatedResidual += -1. * detReducedZ[0] *
cos( currentPhi ) / currentR * par[indexBase+5];
452 indexBase = 36 + beam * 2;
457 calculatedResidual += beamReducedZ[1] * par[indexBase];
460 calculatedResidual += beamReducedZ[0] * par[indexBase+1];
466 }
while( moduleLoop.
TIBTOBLoop( det, beam, pos ) );
473 det = 0; beam = 0; disk = 0;
477 const int theSide = 0;
481 detReducedZ[0] /= ( endFaceZPositions.at( det ).at( theSide ).at( 1 ) - endFaceZPositions.at( det ).at( theSide ).at( 0 ) );
483 detReducedZ[1] /= ( endFaceZPositions.at( det ).at( theSide ).at( 1 ) - endFaceZPositions.at( det ).at( theSide ).at( 0 ) );
487 beamReducedZ[0] /= ( disk9EndFaceZPositions.at( 1 ) - disk9EndFaceZPositions.at( 0 ) );
489 beamReducedZ[1] /= ( disk9EndFaceZPositions.at( 1 ) - disk9EndFaceZPositions.at( 0 ) );
501 double calculatedResidual = 0.;
509 calculatedResidual += detReducedZ[1] * (det==0 ? par[24] : par[30]);
512 calculatedResidual += detReducedZ[0] * (det==0 ? par[25] : par[31]);
515 calculatedResidual += detReducedZ[1] *
sin( currentPhi ) * (det==0 ? par[26] : par[32]) / currentR;
518 calculatedResidual += detReducedZ[0] *
sin( currentPhi ) * (det==0 ? par[27] : par[33]) / currentR;
521 calculatedResidual += -1. * detReducedZ[1] *
cos( currentPhi ) * (det==0 ? par[28] : par[34]) / currentR;
524 calculatedResidual += -1. * detReducedZ[0] *
cos( currentPhi ) * (det==0 ? par[29] : par[35]) / currentR;
527 const unsigned int indexBase = 36 + beam * 2;
532 calculatedResidual += beamReducedZ[1] * par[indexBase];
535 calculatedResidual += beamReducedZ[0] * par[indexBase+1];
542 }
while( moduleLoop.
TEC2TECLoop( det, beam, disk ) );
Sin< T >::type sin(const T &t)
LASGlobalData< LASCoordinateSet > * aMeasuredCoordinates
double GetPhi(void) const
LASGlobalData< LASCoordinateSet > * aNominalCoordinates
bool TEC2TECLoop(int &, int &, int &) const
Cos< T >::type cos(const T &t)
T & GetTIBTOBEntry(int subdetector, int beam, int tibTobPosition)
T & GetTEC2TECEntry(int subdetector, int beam, int tecDisk)
bool TIBTOBLoop(int &, int &, int &) const
double GetPhiError(void) const
Power< A, B >::type pow(const A &a, const B &b)