#include <Alignment/SurveyAnalysis/interface/SurveyAlignment.h>
Public Member Functions | |
void | iterate (unsigned int nIteration, const std::string &fileName, bool bias=false) |
Run the iteration: find residuals, write to output, shift sensors. | |
SurveyAlignment (const align::Alignables &sensors, const std::vector< align::StructureType > &levels) | |
Constructor to set the sensors and residual levels. | |
virtual | ~SurveyAlignment () |
Protected Member Functions | |
virtual void | findAlignPars (bool bias=false)=0 |
Find the alignment parameters for all sensors. | |
virtual void | shiftSensors () |
Apply the alignment parameters to all sensors. | |
Protected Attributes | |
const std::vector < align::StructureType > & | theLevels |
const align::Alignables & | theSensors |
Definition at line 16 of file SurveyAlignment.h.
SurveyAlignment::SurveyAlignment | ( | const align::Alignables & | sensors, | |
const std::vector< align::StructureType > & | levels | |||
) |
Constructor to set the sensors and residual levels.
Definition at line 9 of file SurveyAlignment.cc.
00010 : 00011 theSensors(sensors), 00012 theLevels(levels) 00013 { 00014 }
virtual SurveyAlignment::~SurveyAlignment | ( | ) | [inline, virtual] |
Find the alignment parameters for all sensors.
Implemented in SurveyAlignmentPoints, and SurveyAlignmentSensor.
Referenced by iterate().
void SurveyAlignment::iterate | ( | unsigned int | nIteration, | |
const std::string & | fileName, | |||
bool | bias = false | |||
) |
Run the iteration: find residuals, write to output, shift sensors.
Definition at line 40 of file SurveyAlignment.cc.
References GenMuonPlsPt100GeV_cfg::cout, AlignmentParameters::covariance(), dummy, e, lat::endl(), findAlignPars(), i, j, out, AlignmentParameters::parameters(), shiftSensors(), theSensors, and SurveyOutput::write().
00043 { 00044 static const double tolerance = 1e-4; // convergence criteria 00045 00046 SurveyOutput out(theSensors, fileName); 00047 00048 out.write(0); 00049 00050 for (unsigned int i = 1; i <= nIteration; ++i) 00051 { 00052 std::cout << "***** Iteration " << i << " *****\n"; 00053 findAlignPars(bias); 00054 shiftSensors(); 00055 out.write(i); 00056 00057 // Check convergence 00058 00059 double parChi2 = 0.; 00060 00061 unsigned int nSensor = theSensors.size(); 00062 00063 for (unsigned int j = 0; j < nSensor; ++j) 00064 { 00065 AlignmentParameters* alignPar = theSensors[j]->alignmentParameters(); 00066 00067 const AlgebraicVector& par = alignPar->parameters(); 00068 const AlgebraicSymMatrix& cov = alignPar->covariance(); 00069 00070 int dummy; 00071 00072 parChi2 += cov.inverse(dummy).similarity(par); 00073 } 00074 00075 parChi2 /= static_cast<double>(nSensor); 00076 std::cout << "chi2 = " << parChi2 << std::endl; 00077 if (parChi2 < tolerance) break; // converges, so exit loop 00078 } 00079 }
void SurveyAlignment::shiftSensors | ( | ) | [protected, virtual] |
Apply the alignment parameters to all sensors.
Definition at line 16 of file SurveyAlignment.cc.
References Alignable::alignmentParameters(), i, Alignable::move(), AlignmentParameters::parameters(), pars, align::rectify(), rot, Alignable::rotateInGlobalFrame(), Alignable::surface(), theSensors, AlignableSurface::toGlobal(), and align::toMatrix().
Referenced by iterate().
00017 { 00018 unsigned int nSensor = theSensors.size(); 00019 00020 for (unsigned int i = 0; i < nSensor; ++i) 00021 { 00022 Alignable* ali = theSensors[i]; 00023 00024 const AlignableSurface& surf = ali->surface(); 00025 const AlgebraicVector& pars = ali->alignmentParameters()->parameters(); 00026 00027 EulerAngles angles(3); 00028 00029 angles(1) = pars[3]; angles(2) = pars[4]; angles(3) = pars[5]; 00030 00031 RotationType rot = surf.toGlobal( toMatrix(angles) ); 00032 00033 rectify(rot); // correct for rounding errors 00034 00035 ali->move( surf.toGlobal( align::LocalVector(pars[0], pars[1], pars[2]) ) ); 00036 ali->rotateInGlobalFrame(rot); 00037 } 00038 }
const std::vector<align::StructureType>& SurveyAlignment::theLevels [protected] |
Definition at line 48 of file SurveyAlignment.h.
Referenced by SurveyAlignmentPoints::findAlignPars(), and SurveyAlignmentSensor::findAlignPars().
const align::Alignables& SurveyAlignment::theSensors [protected] |
Definition at line 47 of file SurveyAlignment.h.
Referenced by SurveyAlignmentPoints::findAlignPars(), SurveyAlignmentSensor::findAlignPars(), iterate(), and shiftSensors().