CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Protected Attributes

SurveyAlignment Class Reference

#include <SurveyAlignment.h>

Inheritance diagram for SurveyAlignment:
SurveyAlignmentPoints SurveyAlignmentSensor

List of all members.

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::AlignablestheSensors

Detailed Description

Alignment using only survey info (no tracks) as a proof of principle.

Date:
2007/10/08 16:38:03
Revision:
1.5
Author:
Chung Khim Lae

Definition at line 16 of file SurveyAlignment.h.


Constructor & Destructor Documentation

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.

{}

Member Function Documentation

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(), findAlignPars(), i, j, dbtoconf::out, Gflash::par, 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(), 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);
  }
}

Member Data Documentation

const std::vector<align::StructureType>& SurveyAlignment::theLevels [protected]