CMS 3D CMS Logo

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

void apply () override
 apply parameters to alignable More...
 
RigidBodyAlignmentParametersclone (const AlgebraicVector &parameters, const AlgebraicSymMatrix &covMatrix) const override
 Clone all parameters (for update of parameters) More...
 
RigidBodyAlignmentParameterscloneFromSelected (const AlgebraicVector &parameters, const AlgebraicSymMatrix &covMatrix) const override
 Clone selected parameters (for update of parameters) More...
 
AlgebraicMatrix derivatives (const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &) const override
 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...
 
AlgebraicMatrix selectedDerivatives (const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &) const override
 Get selected derivatives. More...
 
AlgebraicVector translation (void) const
 Get translation parameters. More...
 
int type () const override
 tell type (AlignmentParametersFactory::ParametersType - but no circular dependency) More...
 
 ~RigidBodyAlignmentParameters () override
 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

◆ AlignmentParameterName

Give parameters a name.

Enumerator
dx 
dy 
dz 
dalpha 
dbeta 
dgamma 
N_PARAM 

Definition at line 24 of file RigidBodyAlignmentParameters.h.

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

Constructor & Destructor Documentation

◆ RigidBodyAlignmentParameters() [1/3]

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.

22  : AlignmentParameters(ali, displacementFromAlignable(calcMis ? ali : nullptr), AlgebraicSymMatrix(N_PARAM, 0)) {}

Referenced by clone(), and cloneFromSelected().

◆ RigidBodyAlignmentParameters() [2/3]

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

Constructor for full set of parameters.

Definition at line 25 of file RigidBodyAlignmentParameters.cc.

29  if (parameters.num_row() != N_PARAM) {
30  throw cms::Exception("BadParameters")
31  << "in RigidBodyAlignmentParameters(): " << parameters.num_row() << " instead of " << N_PARAM << " parameters.";
32  }
33 }

References Exception, and N_PARAM.

◆ RigidBodyAlignmentParameters() [3/3]

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

Constructor for selection.

Definition at line 36 of file RigidBodyAlignmentParameters.cc.

41  if (parameters.num_row() != N_PARAM) {
42  throw cms::Exception("BadParameters")
43  << "in RigidBodyAlignmentParameters(): " << parameters.num_row() << " instead of " << N_PARAM << " parameters.";
44  }
45 }

References Exception, and N_PARAM.

◆ ~RigidBodyAlignmentParameters()

RigidBodyAlignmentParameters::~RigidBodyAlignmentParameters ( )
inlineoverride

Destructor.

Definition at line 43 of file RigidBodyAlignmentParameters.h.

43 {};

Member Function Documentation

◆ apply()

void RigidBodyAlignmentParameters::apply ( )
overridevirtual

apply parameters to alignable

Implements AlignmentParameters.

Definition at line 128 of file RigidBodyAlignmentParameters.cc.

128  {
129  Alignable *alignable = this->alignable();
130  if (!alignable) {
131  throw cms::Exception("BadParameters") << "RigidBodyAlignmentParameters::apply: parameters without alignable";
132  }
133 
134  // Translation in local frame
135  AlgebraicVector shift = this->translation(); // fixme: should be LocalVector
136 
137  // Translation local->global
138  align::LocalVector lv(shift[0], shift[1], shift[2]);
140 
141  // Rotation in local frame
143  // original code:
144  // alignable->rotateInLocalFrame( align::toMatrix(angles) );
145  // correct for rounding errors:
149 }

References AlignmentParameters::alignable(), particleFlowDisplacedVertex_cfi::angles, 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__(), coreTools.RunOnData::__call__(), trackTools.MakeAODTrackCandidates::__call__(), runJetUncertainties.RunJetUncertainties::__call__(), metTools.AddMETCollection::__call__(), heavyIonTools.ProductionDefaults::__call__(), cmsswVersionTools.PickRelValInputFiles::__call__(), coreTools.RemoveMCMatching::__call__(), trackTools.MakePATTrackCandidates::__call__(), trigTools.SwitchOnTrigger::__call__(), runMETCorrectionsAndUncertainties.RunMETCorrectionsAndUncertainties::__call__(), heavyIonTools.SelectionDefaults::__call__(), heavyIonTools.DisbaleMonteCarloDeps::__call__(), trigTools.SwitchOnTriggerStandAlone::__call__(), tauTools.AddTauCollection::__call__(), trackTools.MakeTrackCandidates::__call__(), trigTools.SwitchOnTriggerMatching::__call__(), trigTools.SwitchOnTriggerMatchingStandAlone::__call__(), trigTools.SwitchOnTriggerMatchEmbedding::__call__(), jetTools.AddJetCollection::__call__(), jetTools.SwitchJetCollection::__call__(), jetTools.UpdateJetCollection::__call__(), jetTools.AddJetID::__call__(), and jetTools.SetTagInfos::__call__().

◆ clone()

RigidBodyAlignmentParameters * RigidBodyAlignmentParameters::clone ( const AlgebraicVector parameters,
const AlgebraicSymMatrix covMatrix 
) const
overridevirtual

◆ cloneFromSelected()

RigidBodyAlignmentParameters * RigidBodyAlignmentParameters::cloneFromSelected ( const AlgebraicVector parameters,
const AlgebraicSymMatrix covMatrix 
) const
overridevirtual

◆ derivatives()

AlgebraicMatrix RigidBodyAlignmentParameters::derivatives ( const TrajectoryStateOnSurface tsos,
const AlignableDetOrUnitPtr alidet 
) const
overridevirtual

Get all derivatives.

Implements AlignmentParameters.

Reimplemented in RigidBodyAlignmentParameters4D.

Definition at line 73 of file RigidBodyAlignmentParameters.cc.

74  {
75  const Alignable *ali = this->alignable(); // Alignable of these parameters
76 
77  if (ali == alidet) { // same alignable => same frame
78  return KarimakiAlignmentDerivatives()(tsos);
79  } else { // different alignable => transform into correct frame
80  const AlgebraicMatrix deriv = KarimakiAlignmentDerivatives()(tsos);
82  return ftfd.frameToFrameDerivative(alidet, ali).T() * deriv;
83  }
84 }

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

Referenced by selectedDerivatives().

◆ displacementFromAlignable()

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

183  {
184  AlgebraicVector displacement(N_PARAM);
185 
186  if (ali) {
187  const align::RotationType &dR = ali->rotation();
188 
189  const align::LocalVector shifts(ali->globalRotation() * (dR.transposed() * ali->displacement().basicVector()));
190 
192 
193  displacement[0] = shifts.x();
194  displacement[1] = shifts.y();
195  displacement[2] = shifts.z();
196  displacement[3] = angles(1);
197  displacement[4] = angles(2);
198  displacement[5] = angles(3);
199  }
200 
201  return displacement;
202 }

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

◆ globalParameters()

AlgebraicVector RigidBodyAlignmentParameters::globalParameters ( void  ) const

calculate and return parameters in global frame

Definition at line 155 of file RigidBodyAlignmentParameters.cc.

155  {
156  AlgebraicVector m_GlobalParameters(N_PARAM, 0);
157 
158  const AlgebraicVector shift = translation(); // fixme: should return LocalVector
159 
160  const align::LocalVector lv(shift[0], shift[1], shift[2]);
162 
163  m_GlobalParameters[0] = dg.x();
164  m_GlobalParameters[1] = dg.y();
165  m_GlobalParameters[2] = dg.z();
166 
167  const align::EulerAngles eulerglob = theAlignable->surface().toGlobal(rotation());
168 
169  m_GlobalParameters[3] = eulerglob(1);
170  m_GlobalParameters[4] = eulerglob(2);
171  m_GlobalParameters[5] = eulerglob(3);
172 
173  return m_GlobalParameters;
174 }

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

◆ print()

void RigidBodyAlignmentParameters::print ( void  ) const

print parameters to screen

Definition at line 177 of file RigidBodyAlignmentParameters.cc.

177  {
178  std::cout << "Contents of RigidBodyAlignmentParameters:"
179  << "\nParameters: " << theData->parameters() << "\nCovariance: " << theData->covariance() << std::endl;
180 }

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

◆ rotation()

AlgebraicVector RigidBodyAlignmentParameters::rotation ( void  ) const

Get rotation parameters.

Definition at line 119 of file RigidBodyAlignmentParameters.cc.

119  {
120  AlgebraicVector rot(3);
121  for (int i = 0; i < 3; ++i)
122  rot[i] = theData->parameters()[i + 3];
123 
124  return rot;
125 }

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

Referenced by apply(), and globalParameters().

◆ selectedDerivatives()

AlgebraicMatrix RigidBodyAlignmentParameters::selectedDerivatives ( const TrajectoryStateOnSurface tsos,
const AlignableDetOrUnitPtr alignableDet 
) const
overridevirtual

Get selected derivatives.

Reimplemented from AlignmentParameters.

Definition at line 87 of file RigidBodyAlignmentParameters.cc.

88  {
89  const AlgebraicMatrix dev = this->derivatives(tsos, alignableDet);
90 
91  int ncols = dev.num_col();
92  int nrows = dev.num_row();
93  int nsel = numSelected();
94 
95  AlgebraicMatrix seldev(nsel, ncols);
96 
97  int ir2 = 0;
98  for (int irow = 0; irow < nrows; ++irow) {
99  if (selector()[irow]) {
100  for (int icol = 0; icol < ncols; ++icol)
101  seldev[ir2][icol] = dev[irow][icol];
102  ++ir2;
103  }
104  }
105 
106  return seldev;
107 }

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

◆ translation()

AlgebraicVector RigidBodyAlignmentParameters::translation ( void  ) const

Get translation parameters.

Definition at line 110 of file RigidBodyAlignmentParameters.cc.

110  {
112  for (int i = 0; i < 3; ++i)
113  shift[i] = theData->parameters()[i];
114 
115  return shift;
116 }

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

Referenced by apply(), and globalParameters().

◆ type()

int RigidBodyAlignmentParameters::type ( ) const
overridevirtual

tell type (AlignmentParametersFactory::ParametersType - but no circular dependency)

Implements AlignmentParameters.

Reimplemented in RigidBodyAlignmentParameters4D.

Definition at line 152 of file RigidBodyAlignmentParameters.cc.

References AlignmentParametersFactory::kRigidBody.

Vector3DBase
Definition: Vector3DBase.h:8
AlignmentParameters::theAlignable
Alignable * theAlignable
Definition: AlignmentParameters.h:121
align::toAngles
EulerAngles toAngles(const RotationType &)
Convert rotation matrix to angles about x-, y-, z-axes (frame rotation).
Definition: Utilities.cc:8
AlignmentParameters::expandVector
AlgebraicVector expandVector(const AlgebraicVector &m, const std::vector< bool > &sel) const
Definition: AlignmentParameters.cc:215
RigidBodyAlignmentParameters::displacementFromAlignable
static AlgebraicVector displacementFromAlignable(const Alignable *ali)
Definition: RigidBodyAlignmentParameters.cc:183
TkRotation< Scalar >
hgcalPlots.ncols
ncols
Definition: hgcalPlots.py:105
mps_fire.i
i
Definition: mps_fire.py:355
AlignmentParameters::theData
DataContainer theData
Definition: AlignmentParameters.h:123
RigidBodyAlignmentParameters::rotation
AlgebraicVector rotation(void) const
Get rotation parameters.
Definition: RigidBodyAlignmentParameters.cc:119
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
Alignable::rotateInGlobalFrame
virtual void rotateInGlobalFrame(const RotationType &rotation)=0
RigidBodyAlignmentParameters::derivatives
AlgebraicMatrix derivatives(const TrajectoryStateOnSurface &tsos, const AlignableDetOrUnitPtr &) const override
Get all derivatives.
Definition: RigidBodyAlignmentParameters.cc:73
Alignable
Definition: Alignable.h:27
gather_cfg.cout
cout
Definition: gather_cfg.py:144
RigidBodyAlignmentParameters::dbeta
Definition: RigidBodyAlignmentParameters.h:24
AlignmentParameters::userVariables
AlignmentUserVariables * userVariables(void) const
Get pointer to user variables.
Definition: AlignmentParameters.cc:101
RigidBodyAlignmentParameters::clone
RigidBodyAlignmentParameters * clone(const AlgebraicVector &parameters, const AlgebraicSymMatrix &covMatrix) const override
Clone all parameters (for update of parameters)
Definition: RigidBodyAlignmentParameters.cc:48
RigidBodyAlignmentParameters::dx
Definition: RigidBodyAlignmentParameters.h:24
AlignableSurface::toLocal
align::RotationType toLocal(const align::RotationType &) const
Return in local frame a rotation given in global frame.
Definition: AlignableSurface.cc:35
AlignmentParameters::isValid
bool isValid(void) const
Get validity flag.
Definition: AlignmentParameters.cc:134
parameters
parameters
Definition: BeamSpot_PayloadInspector.cc:14
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
RigidBodyAlignmentParameters::N_PARAM
Definition: RigidBodyAlignmentParameters.h:24
FrameToFrameDerivative::frameToFrameDerivative
AlgebraicMatrix frameToFrameDerivative(const Alignable *object, const Alignable *composedObject) const
Definition: FrameToFrameDerivative.cc:16
AlgebraicVector
CLHEP::HepVector AlgebraicVector
Definition: AlgebraicObjects.h:13
AlignmentParametersFactory::kRigidBody
Definition: AlignmentParametersFactory.h:22
corrVsCorr.selection
selection
main part
Definition: corrVsCorr.py:100
KarimakiAlignmentDerivatives
Definition: KarimakiAlignmentDerivatives.h:16
align::rectify
void rectify(RotationType &)
Correct a rotation matrix for rounding errors.
Definition: Utilities.cc:185
AlignableSurface::toGlobal
align::GlobalPoints toGlobal(const align::LocalPoints &) const
Return in global coord given a set of local points.
Definition: AlignableSurface.cc:15
Alignable::surface
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:132
Alignable::displacement
const GlobalVector & displacement() const
Return change of the global position since the creation of the object.
Definition: Alignable.h:141
Alignable::rotation
const RotationType & rotation() const
Return change of orientation since the creation of the object.
Definition: Alignable.h:144
AlignmentParameters::AlignmentParameters
AlignmentParameters()
Default constructor.
Definition: AlignmentParameters.cc:9
RigidBodyAlignmentParameters::translation
AlgebraicVector translation(void) const
Get translation parameters.
Definition: RigidBodyAlignmentParameters.cc:110
RigidBodyAlignmentParameters
Definition: RigidBodyAlignmentParameters.h:21
RigidBodyAlignmentParameters::dgamma
Definition: RigidBodyAlignmentParameters.h:24
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
RigidBodyAlignmentParameters::dy
Definition: RigidBodyAlignmentParameters.h:24
FrameToFrameDerivative
Definition: FrameToFrameDerivative.h:20
AlgebraicSymMatrix
CLHEP::HepSymMatrix AlgebraicSymMatrix
Definition: AlgebraicObjects.h:15
AlignmentParameters::expandSymMatrix
AlgebraicSymMatrix expandSymMatrix(const AlgebraicSymMatrix &m, const std::vector< bool > &sel) const
Definition: AlignmentParameters.cc:190
RigidBodyAlignmentParameters::RigidBodyAlignmentParameters
RigidBodyAlignmentParameters(Alignable *alignable, bool calcMis)
Definition: RigidBodyAlignmentParameters.cc:21
align::EulerAngles
AlgebraicVector EulerAngles
Definition: Definitions.h:34
Alignable::move
virtual void move(const GlobalVector &displacement)=0
Movement with respect to the global reference frame.
PV3DBase::basicVector
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:53
AlgebraicMatrix
CLHEP::HepMatrix AlgebraicMatrix
Definition: AlgebraicObjects.h:14
particleFlowDisplacedVertex_cfi.angles
angles
Definition: particleFlowDisplacedVertex_cfi.py:84
AlignmentParameters::setValid
void setValid(bool v)
Set validity flag.
Definition: AlignmentParameters.cc:137
edm::shift
static unsigned const int shift
Definition: LuminosityBlockID.cc:7
Exception
Definition: hltDiff.cc:246
AlignmentParameters::numSelected
int numSelected(void) const
Get number of selected parameters.
Definition: AlignmentParameters.cc:51
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
RigidBodyAlignmentParameters::dz
Definition: RigidBodyAlignmentParameters.h:24
align::toMatrix
RotationType toMatrix(const EulerAngles &)
Convert rotation angles about x-, y-, z-axes to matrix.
Definition: Utilities.cc:34
AlignmentParameters::alignable
Alignable * alignable(void) const
Get pointer to corresponding alignable.
Definition: AlignmentParameters.cc:104
AlignmentParameters::selector
const std::vector< bool > & selector(void) const
Get alignment parameter selector vector.
Definition: AlignmentParameters.cc:48
RigidBodyAlignmentParameters::dalpha
Definition: RigidBodyAlignmentParameters.h:24
HGC3DClusterGenMatchSelector_cfi.dR
dR
Definition: HGC3DClusterGenMatchSelector_cfi.py:7
Alignable::globalRotation
const RotationType & globalRotation() const
Return the global orientation of the object.
Definition: Alignable.h:138
AlignmentParameters::setUserVariables
void setUserVariables(AlignmentUserVariables *auv)
Set pointer to user variables.
Definition: AlignmentParameters.cc:94