CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions
RigidBodyAlignmentParameters Class Reference

#include <RigidBodyAlignmentParameters.h>

Inheritance diagram for RigidBodyAlignmentParameters:
AlignmentParameters RigidBodyAlignmentParameters4D

Public Types

enum  AlignmentParameterName {
  dx = 0, dy, dz, dalpha,
  dbeta, dgamma, N_PARAM
}
 Give parameters a name. More...
 
- Public Types inherited from AlignmentParameters
typedef
AlignmentParametersData::DataContainer 
DataContainer
 

Public Member Functions

virtual void apply ()
 apply parameters to alignable More...
 
virtual
RigidBodyAlignmentParameters
clone (const AlgebraicVector &parameters, const AlgebraicSymMatrix &covMatrix) const
 Clone all parameters (for update of parameters) More...
 
virtual
RigidBodyAlignmentParameters
cloneFromSelected (const AlgebraicVector &parameters, const AlgebraicSymMatrix &covMatrix) const
 Clone selected parameters (for update of parameters) More...
 
virtual AlgebraicMatrix derivatives (const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &) const
 Get all derivatives. More...
 
AlgebraicVector globalParameters (void) const
 calculate and return parameters in global frame More...
 
void print (void) const
 print parameters to screen More...
 
 RigidBodyAlignmentParameters (Alignable *alignable, bool calcMis)
 
 RigidBodyAlignmentParameters (Alignable *alignable, const AlgebraicVector &parameters, const AlgebraicSymMatrix &covMatrix)
 Constructor for full set of parameters. More...
 
 RigidBodyAlignmentParameters (Alignable *alignable, const AlgebraicVector &parameters, const AlgebraicSymMatrix &covMatrix, const std::vector< bool > &selection)
 Constructor for selection. More...
 
AlgebraicVector rotation (void) const
 Get rotation parameters. More...
 
virtual AlgebraicMatrix selectedDerivatives (const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &) const
 Get selected derivatives. More...
 
AlgebraicVector translation (void) const
 Get translation parameters. More...
 
virtual int type () const
 tell type (AlignmentParametersFactory::ParametersType - but no circular dependency) More...
 
virtual ~RigidBodyAlignmentParameters ()
 Destructor. More...
 
- Public Member Functions inherited from AlignmentParameters
Alignablealignable (void) const
 Get pointer to corresponding alignable. More...
 
 AlignmentParameters ()
 Default constructor. More...
 
 AlignmentParameters (Alignable *object, const AlgebraicVector &par, const AlgebraicSymMatrix &cov)
 Constructor from given input. More...
 
 AlignmentParameters (Alignable *object, const AlgebraicVector &par, const AlgebraicSymMatrix &cov, const std::vector< bool > &sel)
 Constructor including selection of active parameters. More...
 
 AlignmentParameters (Alignable *object, const DataContainer &data)
 Constructor. More...
 
const AlgebraicSymMatrixcovariance (void) const
 Get parameter covariance matrix. More...
 
virtual unsigned int hierarchyLevel () const
 
bool isValid (void) const
 Get validity flag. More...
 
int numSelected (void) const
 Get number of selected parameters. More...
 
const AlgebraicVectorparameters (void) const
 Get alignment parameters. More...
 
AlgebraicSymMatrix selectedCovariance (void) const
 Get covariance matrix of selected parameters. More...
 
AlgebraicVector selectedParameters (void) const
 Get selected parameters. More...
 
const std::vector< bool > & selector (void) const
 Get alignment parameter selector vector. More...
 
void setUserVariables (AlignmentUserVariables *auv)
 Set pointer to user variables. More...
 
void setValid (bool v)
 Set validity flag. More...
 
int size (void) const
 Get number of parameters. More...
 
AlignmentUserVariablesuserVariables (void) const
 Get pointer to user variables. More...
 
virtual ~AlignmentParameters ()
 Destructor. More...
 

Static Public Member Functions

static AlgebraicVector displacementFromAlignable (const Alignable *ali)
 

Additional Inherited Members

- Protected Member Functions inherited from AlignmentParameters
AlgebraicSymMatrix collapseSymMatrix (const AlgebraicSymMatrix &m, const std::vector< bool > &sel) const
 
AlgebraicVector collapseVector (const AlgebraicVector &m, const std::vector< bool > &sel) const
 
AlgebraicSymMatrix expandSymMatrix (const AlgebraicSymMatrix &m, const std::vector< bool > &sel) const
 
AlgebraicVector expandVector (const AlgebraicVector &m, const std::vector< bool > &sel) const
 
- Protected Attributes inherited from AlignmentParameters
bool bValid
 True if parameters are valid. More...
 
AlignabletheAlignable
 
DataContainer theData
 
AlignmentUserVariablestheUserVariables
 

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

)

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

)

Definition at line 21 of file RigidBodyAlignmentParameters.h.

Member Enumeration Documentation

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().

21  :
22  AlignmentParameters(ali, displacementFromAlignable(calcMis ? ali : 0),
24 {
25 }
static AlgebraicVector displacementFromAlignable(const Alignable *ali)
CLHEP::HepSymMatrix AlgebraicSymMatrix
AlignmentParameters()
Default constructor.
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.

30  :
31  AlignmentParameters( alignable, parameters, covMatrix )
32 {
33 
34  if (parameters.num_row() != N_PARAM) {
35  throw cms::Exception("BadParameters") << "in RigidBodyAlignmentParameters(): "
36  << parameters.num_row() << " instead of " << N_PARAM
37  << " parameters.";
38  }
39 }
const AlgebraicVector & parameters(void) const
Get alignment parameters.
AlignmentParameters()
Default constructor.
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.

45  :
46  AlignmentParameters( alignable, parameters, covMatrix, selection )
47 {
48  if (parameters.num_row() != N_PARAM) {
49  throw cms::Exception("BadParameters") << "in RigidBodyAlignmentParameters(): "
50  << parameters.num_row() << " instead of " << N_PARAM
51  << " parameters.";
52  }
53 }
selection
main part
Definition: corrVsCorr.py:98
const AlgebraicVector & parameters(void) const
Get alignment parameters.
AlignmentParameters()
Default constructor.
virtual RigidBodyAlignmentParameters::~RigidBodyAlignmentParameters ( )
inlinevirtual

Destructor.

Definition at line 49 of file RigidBodyAlignmentParameters.h.

49 {};

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().

Referenced by heavyIonTools.ConfigureHeavyIons::__call__(), editorTools.UserCodeTool::__call__(), HiCoreTools.RestrictInputToAOD::__call__(), coreTools.RunOnData::__call__(), trackTools.MakeAODTrackCandidates::__call__(), runJetUncertainties.RunJetUncertainties::__call__(), metTools.AddMETCollection::__call__(), heavyIonTools.ProductionDefaults::__call__(), editorTools.ChangeSource::__call__(), HiCoreTools.RemoveMCMatching::__call__(), cmsswVersionTools.PickRelValInputFiles::__call__(), coreTools.RemoveMCMatching::__call__(), trackTools.MakePATTrackCandidates::__call__(), trigTools.SwitchOnTrigger::__call__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties::__call__(), heavyIonTools.SelectionDefaults::__call__(), HiCoreTools.RemoveAllPATObjectsBut::__call__(), heavyIonTools.DisbaleMonteCarloDeps::__call__(), HiCoreTools.RemoveSpecificPATObjects::__call__(), trigTools.SwitchOnTriggerStandAlone::__call__(), trackTools.MakeTrackCandidates::__call__(), tauTools.AddTauCollection::__call__(), trigTools.SwitchOnTriggerMatching::__call__(), HiCoreTools.RemoveCleaning::__call__(), HiCoreTools.AddCleaning::__call__(), trigTools.SwitchOnTriggerMatchingStandAlone::__call__(), jetTools.AddJetCollection::__call__(), trigTools.SwitchOnTriggerMatchEmbedding::__call__(), jetTools.SwitchJetCollection::__call__(), jetTools.UpdateJetCollection::__call__(), jetTools.AddJetID::__call__(), and jetTools.SetTagInfos::__call__().

147 {
148  Alignable *alignable = this->alignable();
149  if (!alignable) {
150  throw cms::Exception("BadParameters")
151  << "RigidBodyAlignmentParameters::apply: parameters without alignable";
152  }
153 
154  // Translation in local frame
155  AlgebraicVector shift = this->translation(); // fixme: should be LocalVector
156 
157  // Translation local->global
158  align::LocalVector lv(shift[0], shift[1], shift[2]);
159  alignable->move( alignable->surface().toGlobal(lv) );
160 
161  // Rotation in local frame
162  align::EulerAngles angles = this->rotation();
163  // original code:
164  // alignable->rotateInLocalFrame( align::toMatrix(angles) );
165  // correct for rounding errors:
166  align::RotationType rot = alignable->surface().toGlobal( align::toMatrix(angles) );
167  align::rectify(rot);
168  alignable->rotateInGlobalFrame(rot);
169 }
virtual void move(const GlobalVector &displacement)=0
Movement with respect to the global reference frame.
void rectify(RotationType &)
Correct a rotation matrix for rounding errors.
Definition: Utilities.cc:196
Alignable * alignable(void) const
Get pointer to corresponding alignable.
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:131
CLHEP::HepVector AlgebraicVector
AlgebraicVector EulerAngles
Definition: Definitions.h:36
virtual void rotateInGlobalFrame(const RotationType &rotation)=0
AlgebraicVector translation(void) const
Get translation parameters.
align::GlobalPoints toGlobal(const align::LocalPoints &) const
Return in global coord given a set of local points.
RotationType toMatrix(const EulerAngles &)
Convert rotation angles about x-, y-, z-axes to matrix.
Definition: Utilities.cc:40
static unsigned int const shift
AlgebraicVector rotation(void) const
Get rotation parameters.
RigidBodyAlignmentParameters * RigidBodyAlignmentParameters::clone ( const AlgebraicVector parameters,
const AlgebraicSymMatrix covMatrix 
) const
virtual

Clone all parameters (for update of parameters)

Implements AlignmentParameters.

Reimplemented in RigidBodyAlignmentParameters4D.

Definition at line 57 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().

59 {
62 
64  rbap->setValid(isValid());
65 
66  return rbap;
67 }
virtual RigidBodyAlignmentParameters * clone(const AlgebraicVector &parameters, const AlgebraicSymMatrix &covMatrix) const
Clone all parameters (for update of parameters)
const std::vector< bool > & selector(void) const
Get alignment parameter selector vector.
const AlgebraicVector & parameters(void) const
Get alignment parameters.
AlignmentUserVariables * userVariables(void) const
Get pointer to user variables.
void setValid(bool v)
Set validity flag.
Alignable * alignable(void) const
Get pointer to corresponding alignable.
void setUserVariables(AlignmentUserVariables *auv)
Set pointer to user variables.
bool isValid(void) const
Get validity flag.
RigidBodyAlignmentParameters(Alignable *alignable, bool calcMis)
RigidBodyAlignmentParameters * RigidBodyAlignmentParameters::cloneFromSelected ( const AlgebraicVector parameters,
const AlgebraicSymMatrix covMatrix 
) const
virtual

Clone selected parameters (for update of parameters)

Implements AlignmentParameters.

Reimplemented in RigidBodyAlignmentParameters4D.

Definition at line 71 of file RigidBodyAlignmentParameters.cc.

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

73 {
76  expandSymMatrix(covMatrix, selector()), selector());
77 
79  rbap->setValid(isValid());
80 
81  return rbap;
82 }
virtual RigidBodyAlignmentParameters * clone(const AlgebraicVector &parameters, const AlgebraicSymMatrix &covMatrix) const
Clone all parameters (for update of parameters)
AlgebraicSymMatrix expandSymMatrix(const AlgebraicSymMatrix &m, const std::vector< bool > &sel) const
const std::vector< bool > & selector(void) const
Get alignment parameter selector vector.
const AlgebraicVector & parameters(void) const
Get alignment parameters.
AlignmentUserVariables * userVariables(void) const
Get pointer to user variables.
void setValid(bool v)
Set validity flag.
Alignable * alignable(void) const
Get pointer to corresponding alignable.
AlgebraicVector expandVector(const AlgebraicVector &m, const std::vector< bool > &sel) const
void setUserVariables(AlignmentUserVariables *auv)
Set pointer to user variables.
bool isValid(void) const
Get validity flag.
RigidBodyAlignmentParameters(Alignable *alignable, bool calcMis)
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().

88 {
89  const Alignable *ali = this->alignable(); // Alignable of these parameters
90 
91  if (ali == alidet) { // same alignable => same frame
92  return KarimakiAlignmentDerivatives()(tsos);
93  } else { // different alignable => transform into correct frame
94  const AlgebraicMatrix deriv = KarimakiAlignmentDerivatives()(tsos);
96  return ftfd.frameToFrameDerivative(alidet, ali).T() * deriv;
97  }
98 }
CLHEP::HepMatrix AlgebraicMatrix
Alignable * alignable(void) const
Get pointer to corresponding alignable.
AlgebraicMatrix frameToFrameDerivative(const Alignable *object, const Alignable *composedObject) const
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(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, 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().

213 {
214  AlgebraicVector displacement(N_PARAM);
215 
216  if (ali) {
217  const align::RotationType& dR = ali->rotation();
218 
219  const align::LocalVector shifts( ali->globalRotation() *
220  ( dR.transposed() * ali->displacement().basicVector() ) );
221 
222  const align::EulerAngles angles = align::toAngles( ali->surface().toLocal(dR) );
223 
224  displacement[0] = shifts.x();
225  displacement[1] = shifts.y();
226  displacement[2] = shifts.z();
227  displacement[3] = angles(1);
228  displacement[4] = angles(2);
229  displacement[5] = angles(3);
230  }
231 
232  return displacement;
233 }
const GlobalVector & displacement() const
Return change of the global position since the creation of the object.
Definition: Alignable.h:140
const RotationType & globalRotation() const
Return the global orientation of the object.
Definition: Alignable.h:137
const RotationType & rotation() const
Return change of orientation since the creation of the object.
Definition: Alignable.h:143
align::RotationType toLocal(const align::RotationType &) const
Return in local frame a rotation given in global frame.
EulerAngles toAngles(const RotationType &)
Convert rotation matrix to angles about x-, y-, z-axes (frame rotation).
Definition: Utilities.cc:7
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:131
CLHEP::HepVector AlgebraicVector
AlgebraicVector EulerAngles
Definition: Definitions.h:36
TkRotation transposed() const
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:56
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().

179 {
180  AlgebraicVector m_GlobalParameters(N_PARAM, 0);
181 
182  const AlgebraicVector shift = translation(); // fixme: should return LocalVector
183 
184  const align::LocalVector lv(shift[0], shift[1], shift[2]);
186 
187  m_GlobalParameters[0] = dg.x();
188  m_GlobalParameters[1] = dg.y();
189  m_GlobalParameters[2] = dg.z();
190 
191  const align::EulerAngles eulerglob = theAlignable->surface().toGlobal( rotation() );
192 
193  m_GlobalParameters[3]=eulerglob(1);
194  m_GlobalParameters[4]=eulerglob(2);
195  m_GlobalParameters[5]=eulerglob(3);
196 
197  return m_GlobalParameters;
198 }
T y() const
Definition: PV3DBase.h:63
T z() const
Definition: PV3DBase.h:64
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:131
CLHEP::HepVector AlgebraicVector
AlgebraicVector EulerAngles
Definition: Definitions.h:36
AlgebraicVector translation(void) const
Get translation parameters.
align::GlobalPoints toGlobal(const align::LocalPoints &) const
Return in global coord given a set of local points.
static unsigned int const shift
AlgebraicVector rotation(void) const
Get rotation parameters.
T x() const
Definition: PV3DBase.h:62
void RigidBodyAlignmentParameters::print ( void  ) const

print parameters to screen

Definition at line 202 of file RigidBodyAlignmentParameters.cc.

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

203 {
204 
205  std::cout << "Contents of RigidBodyAlignmentParameters:"
206  << "\nParameters: " << theData->parameters()
207  << "\nCovariance: " << theData->covariance() << std::endl;
208 }
tuple cout
Definition: gather_cfg.py:145
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(), and globalParameters().

138 {
139  AlgebraicVector rot(3);
140  for (int i=0;i<3;++i) rot[i] = theData->parameters()[i+3];
141 
142  return rot;
143 }
int i
Definition: DBlmapReader.cc:9
CLHEP::HepVector AlgebraicVector
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().

105 {
106  const AlgebraicMatrix dev = this->derivatives( tsos, alignableDet );
107 
108  int ncols = dev.num_col();
109  int nrows = dev.num_row();
110  int nsel = numSelected();
111 
112  AlgebraicMatrix seldev( nsel, ncols );
113 
114  int ir2=0;
115  for ( int irow=0; irow<nrows; ++irow ) {
116  if (selector()[irow]) {
117  for ( int icol=0; icol<ncols; ++icol ) seldev[ir2][icol] = dev[irow][icol];
118  ++ir2;
119  }
120  }
121 
122  return seldev;
123 }
const std::vector< bool > & selector(void) const
Get alignment parameter selector vector.
virtual AlgebraicMatrix derivatives(const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &) const
Get all derivatives.
CLHEP::HepMatrix AlgebraicMatrix
int numSelected(void) const
Get number of selected parameters.
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(), and globalParameters().

128 {
130  for ( int i=0;i<3;++i ) shift[i]=theData->parameters()[i];
131 
132  return shift;
133 }
int i
Definition: DBlmapReader.cc:9
CLHEP::HepVector AlgebraicVector
static unsigned int const shift
int RigidBodyAlignmentParameters::type ( ) const
virtual