#include <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 |
Alignment using only survey info (no tracks) as a proof of principle.
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.
: theSensors(sensors), theLevels(levels) { }
virtual SurveyAlignment::~SurveyAlignment | ( | ) | [inline, virtual] |
Definition at line 28 of file SurveyAlignment.h.
{}
virtual void SurveyAlignment::findAlignPars | ( | bool | bias = false | ) | [protected, pure 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 gather_cfg::cout, AlignmentParameters::covariance(), alignCSCRings::e, findAlignPars(), i, j, dbtoconf::out, AlignmentParameters::parameters(), shiftSensors(), theSensors, and SurveyOutput::write().
Referenced by SurveyAlignmentAlgorithm::initialize().
{ static const double tolerance = 1e-4; // convergence criteria SurveyOutput out(theSensors, fileName); out.write(0); for (unsigned int i = 1; i <= nIteration; ++i) { std::cout << "***** Iteration " << i << " *****\n"; findAlignPars(bias); shiftSensors(); out.write(i); // Check convergence double parChi2 = 0.; unsigned int nSensor = theSensors.size(); for (unsigned int j = 0; j < nSensor; ++j) { AlignmentParameters* alignPar = theSensors[j]->alignmentParameters(); const AlgebraicVector& par = alignPar->parameters(); const AlgebraicSymMatrix& cov = alignPar->covariance(); int dummy; parChi2 += cov.inverse(dummy).similarity(par); } parChi2 /= static_cast<double>(nSensor); std::cout << "chi2 = " << parChi2 << std::endl; if (parChi2 < tolerance) break; // converges, so exit loop } }
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(), align::rectify(), makeMuonMisalignmentScenario::rot, Alignable::rotateInGlobalFrame(), Alignable::surface(), theSensors, AlignableSurface::toGlobal(), and align::toMatrix().
Referenced by iterate().
{ unsigned int nSensor = theSensors.size(); for (unsigned int i = 0; i < nSensor; ++i) { Alignable* ali = theSensors[i]; const AlignableSurface& surf = ali->surface(); const AlgebraicVector& pars = ali->alignmentParameters()->parameters(); EulerAngles angles(3); angles(1) = pars[3]; angles(2) = pars[4]; angles(3) = pars[5]; RotationType rot = surf.toGlobal( toMatrix(angles) ); rectify(rot); // correct for rounding errors ali->move( surf.toGlobal( align::LocalVector(pars[0], pars[1], pars[2]) ) ); ali->rotateInGlobalFrame(rot); } }
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().