CMS 3D CMS Logo

RigidBodyAlignmentParameters Class Reference

Concrete class for alignment parameters and associated quantities [derived from AlignmentParameters]. More...

#include <Alignment/CommonAlignmentParametrization/interface/RigidBodyAlignmentParameters.h>

Inheritance diagram for RigidBodyAlignmentParameters:

AlignmentParameters

List of all members.

Public Types

enum  AlignmentParameterName {
  dx = 0, dy, dz, dalpha,
  dbeta, dgamma, N_PARAM
}
 Give parameters a name. More...

Public Member Functions

virtual
RigidBodyAlignmentParameters
clone (const AlgebraicVector &parameters, const AlgebraicSymMatrix &covMatrix) const
 Clone all parameters (for update of parameters).
virtual
RigidBodyAlignmentParameters
cloneFromSelected (const AlgebraicVector &parameters, const AlgebraicSymMatrix &covMatrix) const
 Clone selected parameters (for update of parameters).
virtual AlgebraicMatrix derivatives (const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &) const
 Get all derivatives.
AlgebraicVector globalParameters (void) const
 calculate and return parameters in global frame
void print (void) const
 print parameters to screen
 RigidBodyAlignmentParameters (Alignable *alignable, const AlgebraicVector &parameters, const AlgebraicSymMatrix &covMatrix, const std::vector< bool > &selection)
 Constructor for selection.
 RigidBodyAlignmentParameters (Alignable *alignable, const AlgebraicVector &parameters, const AlgebraicSymMatrix &covMatrix)
 Constructor for full set of parameters.
 RigidBodyAlignmentParameters (Alignable *alignable, bool calcMis)
 Constructor with empty parameters/covariance (if calcMis = false) or with parameters (no covariance) created from current (mis-)placement of alignable (if calcMis = true).
AlgebraicVector rotation (void) const
 Get rotation parameters.
virtual AlgebraicMatrix selectedDerivatives (const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &) const
 Get selected derivatives.
AlgebraicVector translation (void) const
 Get translation parameters.
virtual ~RigidBodyAlignmentParameters ()
 Destructor.

Static Public Member Functions

static AlgebraicVector displacementFromAlignable (const Alignable *ali)
 Calculate parameter vector of misplacements (shift+rotation) from alignable.


Detailed Description

Concrete class for alignment parameters and associated quantities [derived from AlignmentParameters].

The number of parameters N_PARAM is fixed to 6 (3 translations + 3 rotations)

Date
2007/10/08 15:56:00
Revision
1.12
(last update by
Author
cklae
)

Definition at line 16 of file RigidBodyAlignmentParameters.h.


Member Enumeration Documentation

enum RigidBodyAlignmentParameters::AlignmentParameterName

Give parameters a name.

Enumerator:
dx 
dy 
dz 
dalpha 
dbeta 
dgamma 
N_PARAM 

Definition at line 22 of file RigidBodyAlignmentParameters.h.

00023         {
00024           dx = 0, dy, dz,
00025           dalpha, dbeta, dgamma,
00026           N_PARAM
00027         };


Constructor & Destructor Documentation

RigidBodyAlignmentParameters::RigidBodyAlignmentParameters ( Alignable alignable,
bool  calcMis 
)

Constructor with empty parameters/covariance (if calcMis = false) or with parameters (no covariance) created from current (mis-)placement of alignable (if calcMis = true).

Definition at line 20 of file RigidBodyAlignmentParameters.cc.

Referenced by clone(), and cloneFromSelected().

00020                                                                                        :
00021   AlignmentParameters(ali, displacementFromAlignable(calcMis ? ali : 0),
00022                       AlgebraicSymMatrix(N_PARAM, 0))
00023 {
00024 }

RigidBodyAlignmentParameters::RigidBodyAlignmentParameters ( Alignable alignable,
const AlgebraicVector parameters,
const AlgebraicSymMatrix covMatrix 
)

Constructor for full set of parameters.

Definition at line 27 of file RigidBodyAlignmentParameters.cc.

References Exception, and N_PARAM.

00029                                                                                                 :
00030   AlignmentParameters( alignable, parameters, covMatrix )
00031 {
00032  
00033   if (parameters.num_row() != N_PARAM) {
00034     throw cms::Exception("BadParameters") << "in RigidBodyAlignmentParameters(): "
00035                                           << parameters.num_row() << " instead of " << N_PARAM 
00036                                           << " parameters.";
00037   }
00038 }

RigidBodyAlignmentParameters::RigidBodyAlignmentParameters ( Alignable alignable,
const AlgebraicVector parameters,
const AlgebraicSymMatrix covMatrix,
const std::vector< bool > &  selection 
)

Constructor for selection.

Definition at line 41 of file RigidBodyAlignmentParameters.cc.

References Exception, and N_PARAM.

00044                                                                                               :
00045   AlignmentParameters( alignable, parameters, covMatrix, selection )
00046 {  
00047   if (parameters.num_row() != N_PARAM) {
00048     throw cms::Exception("BadParameters") << "in RigidBodyAlignmentParameters(): "
00049                                           << parameters.num_row() << " instead of " << N_PARAM 
00050                                           << " parameters.";
00051   }
00052 }

virtual RigidBodyAlignmentParameters::~RigidBodyAlignmentParameters (  )  [inline, virtual]

Destructor.

Definition at line 44 of file RigidBodyAlignmentParameters.h.

00044 {};


Member Function Documentation

RigidBodyAlignmentParameters * RigidBodyAlignmentParameters::clone ( const AlgebraicVector parameters,
const AlgebraicSymMatrix covMatrix 
) const [virtual]

Clone all parameters (for update of parameters).

Implements AlignmentParameters.

Definition at line 56 of file RigidBodyAlignmentParameters.cc.

References AlignmentParameters::alignable(), AlignmentParameters::isValid(), RigidBodyAlignmentParameters(), AlignmentParameters::selector(), AlignmentParameters::setUserVariables(), AlignmentParameters::setValid(), and AlignmentParameters::userVariables().

Referenced by AlignmentParameterStore::acquireRelativeParameters(), and cloneFromSelected().

00058 {
00059   RigidBodyAlignmentParameters* rbap = 
00060     new RigidBodyAlignmentParameters( alignable(), parameters, covMatrix, selector());
00061 
00062   if (userVariables()) rbap->setUserVariables(userVariables()->clone());
00063   rbap->setValid(isValid());
00064 
00065   return rbap;
00066 }

RigidBodyAlignmentParameters * RigidBodyAlignmentParameters::cloneFromSelected ( const AlgebraicVector parameters,
const AlgebraicSymMatrix covMatrix 
) const [virtual]

Clone selected parameters (for update of parameters).

Implements AlignmentParameters.

Definition at line 70 of file RigidBodyAlignmentParameters.cc.

References AlignmentParameters::alignable(), clone(), AlignmentParameters::expandSymMatrix(), AlignmentParameters::expandVector(), AlignmentParameters::isValid(), RigidBodyAlignmentParameters(), AlignmentParameters::selector(), AlignmentParameters::setUserVariables(), AlignmentParameters::setValid(), and AlignmentParameters::userVariables().

00072 {
00073   RigidBodyAlignmentParameters* rbap = 
00074     new RigidBodyAlignmentParameters(alignable(), expandVector( parameters, selector()),
00075                                      expandSymMatrix(covMatrix, selector()), selector());
00076 
00077   if ( userVariables() ) rbap->setUserVariables(userVariables()->clone());
00078   rbap->setValid(isValid());
00079 
00080   return rbap;
00081 }

AlgebraicMatrix RigidBodyAlignmentParameters::derivatives ( const TrajectoryStateOnSurface tsos,
const AlignableDetOrUnitPtr alidet 
) const [virtual]

Get all derivatives.

Implements AlignmentParameters.

Definition at line 85 of file RigidBodyAlignmentParameters.cc.

References AlignmentParameters::alignable(), and FrameToFrameDerivative::frameToFrameDerivative().

Referenced by selectedDerivatives().

00087 {
00088   const Alignable *ali = this->alignable(); // Alignable of these parameters
00089 
00090   if (ali == alidet) { // same alignable => same frame
00091     return KarimakiAlignmentDerivatives()(tsos);
00092   } else { // different alignable => transform into correct frame
00093     const AlgebraicMatrix deriv = KarimakiAlignmentDerivatives()(tsos);
00094     FrameToFrameDerivative ftfd;
00095     return ftfd.frameToFrameDerivative(alidet, ali) * deriv;
00096   }
00097 }

AlgebraicVector RigidBodyAlignmentParameters::displacementFromAlignable ( const Alignable ali  )  [static]

Calculate parameter vector of misplacements (shift+rotation) from alignable.

(If ali=0, return empty AlgebraicVector of proper length.)

Definition at line 180 of file RigidBodyAlignmentParameters.cc.

References PV3DBase< T, PVType, FrameType >::basicVector(), Alignable::displacement(), Alignable::globalRotation(), N_PARAM, Alignable::rotation(), Alignable::surface(), align::toAngles(), AlignableSurface::toLocal(), TkRotation< T >::transposed(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

00181 {
00182   AlgebraicVector displacement(N_PARAM);
00183 
00184   if (ali) {
00185     const align::RotationType& dR = ali->rotation();
00186     
00187     const align::LocalVector shifts( ali->globalRotation() * 
00188                                      ( dR.transposed() * ali->displacement().basicVector() ) );
00189 
00190     const align::EulerAngles angles = align::toAngles( ali->surface().toLocal(dR) );
00191 
00192     displacement[0] = shifts.x();
00193     displacement[1] = shifts.y();
00194     displacement[2] = shifts.z();
00195     displacement[3] = angles(1);
00196     displacement[4] = angles(2);
00197     displacement[5] = angles(3);
00198   }
00199 
00200   return displacement;
00201 }

AlgebraicVector RigidBodyAlignmentParameters::globalParameters ( void   )  const

calculate and return parameters in global frame

Definition at line 146 of file RigidBodyAlignmentParameters.cc.

References lv, N_PARAM, rotation(), Alignable::surface(), AlignmentParameters::theAlignable, AlignableSurface::toGlobal(), translation(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

00147 {
00148   AlgebraicVector m_GlobalParameters(N_PARAM, 0);
00149 
00150   const AlgebraicVector shift = translation(); // fixme: should return LocalVector
00151 
00152   const align::LocalVector lv(shift[0], shift[1], shift[2]);
00153   const align::GlobalVector dg = theAlignable->surface().toGlobal(lv);
00154 
00155   m_GlobalParameters[0] = dg.x();
00156   m_GlobalParameters[1] = dg.y();
00157   m_GlobalParameters[2] = dg.z();
00158 
00159   const align::EulerAngles eulerglob = theAlignable->surface().toGlobal( rotation() );
00160 
00161   m_GlobalParameters[3]=eulerglob(1);
00162   m_GlobalParameters[4]=eulerglob(2);
00163   m_GlobalParameters[5]=eulerglob(3);
00164 
00165   return m_GlobalParameters;
00166 }

void RigidBodyAlignmentParameters::print ( void   )  const

print parameters to screen

Definition at line 170 of file RigidBodyAlignmentParameters.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), and AlignmentParameters::theData.

00171 {
00172 
00173   std::cout << "Contents of RigidBodyAlignmentParameters:"
00174             << "\nParameters: " << theData->parameters()
00175             << "\nCovariance: " << theData->covariance() << std::endl;
00176 }

AlgebraicVector RigidBodyAlignmentParameters::rotation ( void   )  const

Get rotation parameters.

Definition at line 136 of file RigidBodyAlignmentParameters.cc.

References i, rot, and AlignmentParameters::theData.

Referenced by AlignmentParameterStore::applyParameters(), globalParameters(), and KalmanAlignmentAlgorithm::initializeAlignmentParameters().

00137 {
00138   AlgebraicVector rot(3);
00139   for (int i=0;i<3;++i) rot[i] = theData->parameters()[i+3];
00140 
00141   return rot;
00142 }

AlgebraicMatrix RigidBodyAlignmentParameters::selectedDerivatives ( const TrajectoryStateOnSurface tsos,
const AlignableDetOrUnitPtr alignableDet 
) const [virtual]

Get selected derivatives.

Implements AlignmentParameters.

Definition at line 102 of file RigidBodyAlignmentParameters.cc.

References derivatives(), icol, AlignmentParameters::numSelected(), and AlignmentParameters::selector().

00104 {
00105   const AlgebraicMatrix dev = this->derivatives( tsos, alignableDet );
00106 
00107   int ncols  = dev.num_col();
00108   int nrows  = dev.num_row();
00109   int nsel   = numSelected();
00110 
00111   AlgebraicMatrix seldev( nsel, ncols );
00112 
00113   int ir2=0;
00114   for ( int irow=0; irow<nrows; ++irow ) {
00115     if (selector()[irow]) {
00116       for ( int icol=0; icol<ncols; ++icol ) seldev[ir2][icol] = dev[irow][icol];
00117       ++ir2;
00118     }
00119   }
00120 
00121   return seldev;
00122 }

AlgebraicVector RigidBodyAlignmentParameters::translation ( void   )  const

Get translation parameters.

Definition at line 126 of file RigidBodyAlignmentParameters.cc.

References i, and AlignmentParameters::theData.

Referenced by AlignmentParameterStore::applyParameters(), globalParameters(), and KalmanAlignmentAlgorithm::initializeAlignmentParameters().

00127 { 
00128   AlgebraicVector shift(3);
00129   for ( int i=0;i<3;++i ) shift[i]=theData->parameters()[i];
00130 
00131   return shift;
00132 }


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:30:45 2009 for CMSSW by  doxygen 1.5.4