CMS 3D CMS Logo

Public Types | Public Member Functions | Static Public Member Functions

RigidBodyAlignmentParameters Class Reference

#include <RigidBodyAlignmentParameters.h>

Inheritance diagram for RigidBodyAlignmentParameters:
AlignmentParameters RigidBodyAlignmentParameters4D

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 void apply ()
 apply parameters to alignable
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, bool calcMis)
 RigidBodyAlignmentParameters (Alignable *alignable, const AlgebraicVector &parameters, const AlgebraicSymMatrix &covMatrix)
 Constructor for full set of parameters.
 RigidBodyAlignmentParameters (Alignable *alignable, const AlgebraicVector &parameters, const AlgebraicSymMatrix &covMatrix, const std::vector< bool > &selection)
 Constructor for selection.
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 int type () const
 tell type (AlignmentParametersFactory::ParametersType - but no circular dependency)
virtual ~RigidBodyAlignmentParameters ()
 Destructor.

Static Public Member Functions

static AlgebraicVector displacementFromAlignable (const Alignable *ali)

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:
2008/09/02 15:08:12
Revision:
1.13

(last update by

Author:
flucke

)

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:
2008/12/12 15:58:07
Revision:
1.1

(last update by

Author:
pablom

)

Definition at line 21 of file RigidBodyAlignmentParameters.h.


Member Enumeration Documentation

Give parameters a name.

Enumerator:
dx 
dy 
dz 
dalpha 
dbeta 
dgamma 
N_PARAM 

Definition at line 27 of file RigidBodyAlignmentParameters.h.

        {
          dx = 0, dy, dz,
          dalpha, dbeta, dgamma,
          N_PARAM
        };

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 21 of file RigidBodyAlignmentParameters.cc.

Referenced by clone(), and cloneFromSelected().

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

Constructor for full set of parameters.

Definition at line 28 of file RigidBodyAlignmentParameters.cc.

References Exception, and N_PARAM.

                                                                                                :
  AlignmentParameters( alignable, parameters, covMatrix )
{
 
  if (parameters.num_row() != N_PARAM) {
    throw cms::Exception("BadParameters") << "in RigidBodyAlignmentParameters(): "
                                          << parameters.num_row() << " instead of " << N_PARAM 
                                          << " parameters.";
  }
}
RigidBodyAlignmentParameters::RigidBodyAlignmentParameters ( Alignable alignable,
const AlgebraicVector parameters,
const AlgebraicSymMatrix covMatrix,
const std::vector< bool > &  selection 
)

Constructor for selection.

Definition at line 42 of file RigidBodyAlignmentParameters.cc.

References Exception, and N_PARAM.

                                                                                              :
  AlignmentParameters( alignable, parameters, covMatrix, selection )
{  
  if (parameters.num_row() != N_PARAM) {
    throw cms::Exception("BadParameters") << "in RigidBodyAlignmentParameters(): "
                                          << parameters.num_row() << " instead of " << N_PARAM 
                                          << " parameters.";
  }
}
virtual RigidBodyAlignmentParameters::~RigidBodyAlignmentParameters ( ) [inline, virtual]

Destructor.

Definition at line 49 of file RigidBodyAlignmentParameters.h.

{};

Member Function Documentation

void RigidBodyAlignmentParameters::apply ( ) [virtual]

apply parameters to alignable

Implements AlignmentParameters.

Definition at line 146 of file RigidBodyAlignmentParameters.cc.

References AlignmentParameters::alignable(), Exception, Alignable::move(), align::rectify(), makeMuonMisalignmentScenario::rot, Alignable::rotateInGlobalFrame(), rotation(), edm::shift, Alignable::surface(), AlignableSurface::toGlobal(), align::toMatrix(), and translation().

{
  Alignable *alignable = this->alignable();
  if (!alignable) {
    throw cms::Exception("BadParameters") 
      << "RigidBodyAlignmentParameters::apply: parameters without alignable";
  }
  
  // Translation in local frame
  AlgebraicVector shift = this->translation(); // fixme: should be LocalVector

  // Translation local->global
  align::LocalVector lv(shift[0], shift[1], shift[2]);
  alignable->move( alignable->surface().toGlobal(lv) );

  // Rotation in local frame
  align::EulerAngles angles = this->rotation();
  // original code:
  //  alignable->rotateInLocalFrame( align::toMatrix(angles) );
  // correct for rounding errors:
  align::RotationType rot = alignable->surface().toGlobal( align::toMatrix(angles) );
  align::rectify(rot);
  alignable->rotateInGlobalFrame(rot);
}
RigidBodyAlignmentParameters * RigidBodyAlignmentParameters::clone ( const AlgebraicVector parameters,
const AlgebraicSymMatrix covMatrix 
) const [virtual]
RigidBodyAlignmentParameters * RigidBodyAlignmentParameters::cloneFromSelected ( const AlgebraicVector parameters,
const AlgebraicSymMatrix covMatrix 
) const [virtual]
AlgebraicMatrix RigidBodyAlignmentParameters::derivatives ( const TrajectoryStateOnSurface tsos,
const AlignableDetOrUnitPtr alidet 
) const [virtual]

Get all derivatives.

Implements AlignmentParameters.

Reimplemented in RigidBodyAlignmentParameters4D.

Definition at line 86 of file RigidBodyAlignmentParameters.cc.

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

Referenced by selectedDerivatives().

{
  const Alignable *ali = this->alignable(); // Alignable of these parameters

  if (ali == alidet) { // same alignable => same frame
    return KarimakiAlignmentDerivatives()(tsos);
  } else { // different alignable => transform into correct frame
    const AlgebraicMatrix deriv = KarimakiAlignmentDerivatives()(tsos);
    FrameToFrameDerivative ftfd;
    return ftfd.frameToFrameDerivative(alidet, ali) * deriv;
  }
}
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 212 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().

{
  AlgebraicVector displacement(N_PARAM);

  if (ali) {
    const align::RotationType& dR = ali->rotation();
    
    const align::LocalVector shifts( ali->globalRotation() * 
                                     ( dR.transposed() * ali->displacement().basicVector() ) );

    const align::EulerAngles angles = align::toAngles( ali->surface().toLocal(dR) );

    displacement[0] = shifts.x();
    displacement[1] = shifts.y();
    displacement[2] = shifts.z();
    displacement[3] = angles(1);
    displacement[4] = angles(2);
    displacement[5] = angles(3);
  }

  return displacement;
}
AlgebraicVector RigidBodyAlignmentParameters::globalParameters ( void  ) const

calculate and return parameters in global frame

Definition at line 178 of file RigidBodyAlignmentParameters.cc.

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

{
  AlgebraicVector m_GlobalParameters(N_PARAM, 0);

  const AlgebraicVector shift = translation(); // fixme: should return LocalVector

  const align::LocalVector lv(shift[0], shift[1], shift[2]);
  const align::GlobalVector dg = theAlignable->surface().toGlobal(lv);

  m_GlobalParameters[0] = dg.x();
  m_GlobalParameters[1] = dg.y();
  m_GlobalParameters[2] = dg.z();

  const align::EulerAngles eulerglob = theAlignable->surface().toGlobal( rotation() );

  m_GlobalParameters[3]=eulerglob(1);
  m_GlobalParameters[4]=eulerglob(2);
  m_GlobalParameters[5]=eulerglob(3);

  return m_GlobalParameters;
}
void RigidBodyAlignmentParameters::print ( void  ) const

print parameters to screen

Definition at line 202 of file RigidBodyAlignmentParameters.cc.

References gather_cfg::cout, and AlignmentParameters::theData.

{

  std::cout << "Contents of RigidBodyAlignmentParameters:"
            << "\nParameters: " << theData->parameters()
            << "\nCovariance: " << theData->covariance() << std::endl;
}
AlgebraicVector RigidBodyAlignmentParameters::rotation ( void  ) const

Get rotation parameters.

Definition at line 137 of file RigidBodyAlignmentParameters.cc.

References i, makeMuonMisalignmentScenario::rot, and AlignmentParameters::theData.

Referenced by apply(), KalmanAlignmentAlgorithm::applyAlignmentParameters(), and globalParameters().

{
  AlgebraicVector rot(3);
  for (int i=0;i<3;++i) rot[i] = theData->parameters()[i+3];

  return rot;
}
AlgebraicMatrix RigidBodyAlignmentParameters::selectedDerivatives ( const TrajectoryStateOnSurface tsos,
const AlignableDetOrUnitPtr alignableDet 
) const [virtual]

Get selected derivatives.

Reimplemented from AlignmentParameters.

Definition at line 103 of file RigidBodyAlignmentParameters.cc.

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

{
  const AlgebraicMatrix dev = this->derivatives( tsos, alignableDet );

  int ncols  = dev.num_col();
  int nrows  = dev.num_row();
  int nsel   = numSelected();

  AlgebraicMatrix seldev( nsel, ncols );

  int ir2=0;
  for ( int irow=0; irow<nrows; ++irow ) {
    if (selector()[irow]) {
      for ( int icol=0; icol<ncols; ++icol ) seldev[ir2][icol] = dev[irow][icol];
      ++ir2;
    }
  }

  return seldev;
}
AlgebraicVector RigidBodyAlignmentParameters::translation ( void  ) const

Get translation parameters.

Definition at line 127 of file RigidBodyAlignmentParameters.cc.

References i, edm::shift, and AlignmentParameters::theData.

Referenced by apply(), KalmanAlignmentAlgorithm::applyAlignmentParameters(), and globalParameters().

{ 
  AlgebraicVector shift(3);
  for ( int i=0;i<3;++i ) shift[i]=theData->parameters()[i];

  return shift;
}
int RigidBodyAlignmentParameters::type ( ) const [virtual]