CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
AlignableDet Class Reference

#include <AlignableDet.h>

Inheritance diagram for AlignableDet:
AlignableComposite Alignable AlignableCSCChamber AlignableDTChamber AlignableDTSuperLayer AlignableSiStripDet

Public Member Functions

void addAlignmentPositionError (const AlignmentPositionError &ape, bool propagateDown) override
 
void addAlignmentPositionErrorFromRotation (const RotationType &rot, bool propagateDown) override
 
 AlignableDet (const GeomDet *geomDet, bool addComponents=true)
 
AlignmentErrorsExtendedalignmentErrors () const override
 Return vector of alignment errors. More...
 
const AlignmentPositionErroralignmentPositionError () const
 alignment position error - for checking only, otherwise use alignmentErrors() above! More...
 
Alignmentsalignments () const override
 Return vector of alignment data. More...
 
void setAlignmentPositionError (const AlignmentPositionError &ape, bool propagateDown) override
 Set the AlignmentPositionError and, if (propagateDown), to all components. More...
 
void update (const GeomDet *geomDet, bool updateComponents=true)
 
 ~AlignableDet () override
 Destructor. More...
 
- Public Member Functions inherited from AlignableComposite
void addAlignmentPositionErrorFromLocalRotation (const RotationType &rotation, bool propagateDown) override
 
void addComponent (Alignable *component) final
 
void addSurfaceDeformation (const SurfaceDeformation *deformation, bool propagateDown) override
 
 AlignableComposite (align::ID id, StructureType aType, const RotationType &rot=RotationType())
 
StructureType alignableObjectId () const override
 Return the alignable type identifier. More...
 
const Alignablescomponents () const override
 Return vector of direct components. More...
 
void dump () const override
 Recursive printout of alignable structure. More...
 
void move (const GlobalVector &displacement) override
 Move with respect to the global reference frame. More...
 
virtual void moveComponentLocal (const int i, const LocalVector &localDisplacement)
 Move a single component with respect to the local reference frame. More...
 
virtual void moveComponentsLocal (const LocalVector &localDisplacement)
 Move with respect to the local reference frame. More...
 
void recursiveComponents (Alignables &result) const override
 Provide all components, subcomponents etc. (cf. description in base class) More...
 
void rotateInGlobalFrame (const RotationType &rotation) override
 Rotation interpreted in global reference frame. More...
 
void setSurfaceDeformation (const SurfaceDeformation *deformation, bool propagateDown) override
 Set the surface deformation parameters - if (!propagateDown) do not affect daughters. More...
 
int surfaceDeformationIdPairs (std::vector< std::pair< int, SurfaceDeformation * > > &) const override
 Return surface deformations. More...
 
void update (align::ID, StructureType aType, const RotationType &rot=RotationType())
 
 ~AlignableComposite () override
 deleting its components More...
 
- Public Member Functions inherited from Alignable
 Alignable (align::ID, const AlignableSurface &)
 
 Alignable (align::ID, const RotationType &)
 
AlignmentParametersalignmentParameters () const
 Get the AlignmentParameters. More...
 
virtual void cacheTransformation ()
 cache the current position, rotation and other parameters (e.g. surface deformations), also for possible components More...
 
virtual void cacheTransformation (const align::RunNumber &)
 
virtual CompConstraintType compConstraintType () const
 Return the alignable type of contraints wrt. its components. More...
 
const AlignablesdeepComponents () const
 
const GlobalVectordisplacement () const
 Return change of the global position since the creation of the object. More...
 
bool firstCompsWithParams (Alignables &paramComps) const
 
const DetIdgeomDetId () const
 
const PositionTypeglobalPosition () const
 Return the global position of the object. More...
 
const RotationTypeglobalRotation () const
 Return the global orientation of the object. More...
 
align::ID id () const
 Return the ID of Alignable, i.e. DetId of 'first' component GeomDet(Unit). More...
 
bool lastCompsWithParams (Alignables &paramComps) const
 
Alignablemother () const
 Return pointer to container alignable (if any) More...
 
virtual void recenterSurface ()
 Recenter surface object without moving possible components. More...
 
virtual void restoreCachedTransformation ()
 restore the previously cached transformation, also for possible components More...
 
virtual void restoreCachedTransformation (const align::RunNumber &)
 
virtual void rotateAroundGlobalAxis (const GlobalVector &axis, Scalar radians)
 Rotation around arbitratry global axis. More...
 
virtual void rotateAroundGlobalX (Scalar radians)
 Rotation around global x-axis. More...
 
virtual void rotateAroundGlobalY (Scalar radians)
 Rotation around global y-axis. More...
 
virtual void rotateAroundGlobalZ (Scalar radians)
 Rotation around global z-axis. More...
 
virtual void rotateAroundLocalAxis (const LocalVector &axis, Scalar radians)
 Rotation around arbitratry local axis. More...
 
virtual void rotateAroundLocalX (Scalar radians)
 Rotation around local x-axis. More...
 
virtual void rotateAroundLocalY (Scalar radians)
 Rotation around local y-axis. More...
 
virtual void rotateAroundLocalZ (Scalar radians)
 Rotation around local z-axis. More...
 
virtual void rotateInLocalFrame (const RotationType &rotation)
 Rotation intepreted in the local reference frame. More...
 
const RotationTyperotation () const
 Return change of orientation since the creation of the object. More...
 
void setAlignmentParameters (AlignmentParameters *dap)
 Set the AlignmentParameters. More...
 
void setMother (Alignable *mother)
 Assign mother to alignable. More...
 
void setSurvey (const SurveyDet *)
 Set survey info. More...
 
int size () const
 Return number of direct components. More...
 
const AlignableSurfacesurface () const
 Return the Surface (global position and orientation) of the object. More...
 
AlignmentSurfaceDeformationssurfaceDeformations () const
 Return surface deformations, sorted by DetId. More...
 
const SurveyDetsurvey () const
 Return survey info. More...
 
void update (align::ID, const AlignableSurface &)
 
virtual ~Alignable ()
 Destructor. More...
 

Private Attributes

AlignmentPositionErrortheAlignmentPositionError
 

Additional Inherited Members

- Public Types inherited from Alignable
typedef align::Alignables Alignables
 
enum  CompConstraintType { CompConstraintType::NONE, CompConstraintType::POSITION, CompConstraintType::POSITION_Z }
 
typedef align::GlobalVector GlobalVector
 
typedef align::LocalVector LocalVector
 
typedef align::PositionType PositionType
 
typedef align::RotationType RotationType
 
typedef align::Scalar Scalar
 
typedef align::StructureType StructureType
 
- Protected Types inherited from Alignable
template<class T >
using Cache = std::map< align::RunNumber, T >
 
- Protected Member Functions inherited from AlignableComposite
 AlignableComposite (const GeomDet *geomDet)
 Constructor from GeomDet, only for use in AlignableDet. More...
 
void setSurface (const AlignableSurface &s)
 
void update (const GeomDet *geomDet)
 
template<class T >
void update (T)=delete
 
- Protected Member Functions inherited from Alignable
void addDisplacement (const GlobalVector &displacement)
 
void addRotation (const RotationType &rotation)
 
virtual void updateMother (const GlobalVector &shift)
 
- Protected Attributes inherited from AlignableComposite
StructureType theStructureType
 
- Protected Attributes inherited from Alignable
CompConstraintType compConstraintType_ {CompConstraintType::NONE}
 
Cache< GlobalVectordisplacementsCache_
 
Cache< RotationTyperotationsCache_
 
Cache< AlignableSurfacesurfacesCache_
 
GlobalVector theCachedDisplacement
 
RotationType theCachedRotation
 
AlignableSurface theCachedSurface
 
Alignables theDeepComponents
 
DetId theDetId
 
GlobalVector theDisplacement
 
align::ID theId
 
RotationType theRotation
 
AlignableSurface theSurface
 

Detailed Description

An AlignableComposite corresponding to a composite GeomDet direct components are AlignableDetUnits or AlignableDets.

Definition at line 8 of file AlignableDet.h.

Constructor & Destructor Documentation

◆ AlignableDet()

AlignableDet::AlignableDet ( const GeomDet geomDet,
bool  addComponents = true 
)

Constructor: If addComponents = true, creates components for geomDet's components, assuming they are GeomDetUnits

Definition at line 14 of file AlignableDet.cc.

15  : AlignableComposite(geomDet), theAlignmentPositionError(nullptr) {
16  // ensure that the surface is not constrained to the average position of the
17  // components:
19 
20  if (geomDet->alignmentPositionError()) {
21  // false: do not propagate APE to (anyway not yet existing) daughters
22  this->setAlignmentPositionError(*(geomDet->alignmentPositionError()), false);
23  }
24 
25  if (addComponents) {
26  if (geomDet->components().empty()) { // Is a DetUnit
27  throw cms::Exception("BadHierarchy") << "[AlignableDet] GeomDet with DetId " << geomDet->geographicalId().rawId()
28  << " has no components, use AlignableDetUnit.\n";
29  } else { // Push back all components
30  const std::vector<const GeomDet*>& geomDets = geomDet->components();
31  for (std::vector<const GeomDet*>::const_iterator idet = geomDets.begin(); idet != geomDets.end(); ++idet) {
32  const GeomDetUnit* unit = dynamic_cast<const GeomDetUnit*>(*idet);
33  if (!unit) {
34  throw cms::Exception("BadHierarchy")
35  << "[AlignableDet] component not GeomDetUnit, call with addComponents==false"
36  << " and build hierarchy yourself.\n"; // e.g. AlignableDTChamber
37  }
38  this->addComponent(new AlignableDetUnit(unit));
39  }
40  }
41  // Ensure that the surface is not screwed up by addComponent, it must stay the GeomDet's one:
42  theSurface = AlignableSurface(geomDet->surface());
43  } // end addComponents
44 }

References AlignableComposite::addComponent(), align::AlignableDetUnit, GeomDet::alignmentPositionError(), Alignable::compConstraintType_, GeomDet::components(), Exception, GeomDet::geographicalId(), Alignable::NONE, DetId::rawId(), setAlignmentPositionError(), GeomDet::surface(), Alignable::theSurface, and unit().

◆ ~AlignableDet()

AlignableDet::~AlignableDet ( )
override

Destructor.

Definition at line 47 of file AlignableDet.cc.

47 { delete theAlignmentPositionError; }

References theAlignmentPositionError.

Member Function Documentation

◆ addAlignmentPositionError()

void AlignableDet::addAlignmentPositionError ( const AlignmentPositionError ape,
bool  propagateDown 
)
overridevirtual

Add (or set if it does not exist yet) the AlignmentPositionError, if (propagateDown), add also to all components

Reimplemented from AlignableComposite.

Definition at line 108 of file AlignableDet.cc.

108  {
111  } else {
113  }
114 
115  this->AlignableComposite::addAlignmentPositionError(ape, propagateDown);
116 }

References AlignableComposite::addAlignmentPositionError(), and theAlignmentPositionError.

Referenced by addAlignmentPositionErrorFromRotation().

◆ addAlignmentPositionErrorFromRotation()

void AlignableDet::addAlignmentPositionErrorFromRotation ( const RotationType rot,
bool  propagateDown 
)
overridevirtual

Add (or set if it does not exist yet) the AlignmentPositionError resulting from a rotation in the global reference frame, if (propagateDown), add also to all components

Reimplemented from AlignableComposite.

Definition at line 119 of file AlignableDet.cc.

119  {
120  // average error calculated by movement of a local point at
121  // (xWidth/2,yLength/2,0) caused by the rotation rot
122  GlobalVector localPositionVector =
123  surface().toGlobal(LocalVector(.5 * surface().width(), .5 * surface().length(), 0.));
124 
125  const LocalVector::BasicVectorType& lpvgf = localPositionVector.basicVector();
126  GlobalVector gv(rot.multiplyInverse(lpvgf) - lpvgf);
127 
128  AlignmentPositionError ape(gv.x(), gv.y(), gv.z());
129  this->addAlignmentPositionError(ape, propagateDown);
130 
132 }

References addAlignmentPositionError(), AlignableComposite::addAlignmentPositionErrorFromRotation(), PV3DBase< T, PVType, FrameType >::basicVector(), makeMuonMisalignmentScenario::rot, Alignable::surface(), AlignableSurface::toGlobal(), and ApeEstimator_cff::width.

◆ alignmentErrors()

AlignmentErrorsExtended * AlignableDet::alignmentErrors ( void  ) const
overridevirtual

Return vector of alignment errors.

Reimplemented from AlignableComposite.

Definition at line 159 of file AlignableDet.cc.

159  {
160  AlignmentErrorsExtended* m_alignmentErrors = new AlignmentErrorsExtended();
161 
162  // Add associated alignment position error
163  uint32_t detId = this->geomDetId().rawId();
164  CLHEP::HepSymMatrix clhepSymMatrix(6, 0);
165  if (theAlignmentPositionError) // Might not be set
167  AlignTransformErrorExtended transformError(clhepSymMatrix, detId);
168  m_alignmentErrors->m_alignError.push_back(transformError);
169 
170  // Add those from components
172  std::copy(compAlignmentErrs->m_alignError.begin(),
173  compAlignmentErrs->m_alignError.end(),
174  std::back_inserter(m_alignmentErrors->m_alignError));
175  delete compAlignmentErrs;
176 
177  return m_alignmentErrors;
178 }

References AlignableComposite::alignmentErrors(), asHepMatrix(), filterCSVwithJSON::copy, Alignable::geomDetId(), AlignmentPositionError::globalError(), AlignmentErrorsExtended::m_alignError, GlobalErrorBaseExtended< T, ErrorWeightType >::matrix(), DetId::rawId(), and theAlignmentPositionError.

◆ alignmentPositionError()

const AlignmentPositionError* AlignableDet::alignmentPositionError ( ) const
inline

alignment position error - for checking only, otherwise use alignmentErrors() above!

Definition at line 44 of file AlignableDet.h.

44 { return theAlignmentPositionError; }

References theAlignmentPositionError.

Referenced by AlignableDetOrUnitPtr::alignmentPositionError().

◆ alignments()

Alignments * AlignableDet::alignments ( void  ) const
overridevirtual

Return vector of alignment data.

Reimplemented from AlignableComposite.

Reimplemented in AlignableSiStripDet.

Definition at line 135 of file AlignableDet.cc.

135  {
136  Alignments* m_alignments = new Alignments();
138 
139  // Get position, rotation, detId
140  CLHEP::Hep3Vector clhepVector(globalPosition().x(), globalPosition().y(), globalPosition().z());
141  CLHEP::HepRotation clhepRotation(
142  CLHEP::HepRep3x3(rot.xx(), rot.xy(), rot.xz(), rot.yx(), rot.yy(), rot.yz(), rot.zx(), rot.zy(), rot.zz()));
143  uint32_t detId = this->geomDetId().rawId();
144 
145  AlignTransform transform(clhepVector, clhepRotation, detId);
146 
147  // Add to alignments container
148  m_alignments->m_align.push_back(transform);
149 
150  // Add those from components
151  Alignments* compAlignments = this->AlignableComposite::alignments();
152  std::copy(compAlignments->m_align.begin(), compAlignments->m_align.end(), std::back_inserter(m_alignments->m_align));
153  delete compAlignments;
154 
155  return m_alignments;
156 }

References AlignableComposite::alignments(), filterCSVwithJSON::copy, Alignable::geomDetId(), Alignable::globalPosition(), Alignable::globalRotation(), Alignments::m_align, DetId::rawId(), makeMuonMisalignmentScenario::rot, HcalDetIdTransform::transform(), x, y, and z.

Referenced by AlignableSiStripDet::alignments().

◆ setAlignmentPositionError()

void AlignableDet::setAlignmentPositionError ( const AlignmentPositionError ape,
bool  propagateDown 
)
overridevirtual

Set the AlignmentPositionError and, if (propagateDown), to all components.

Reimplemented from AlignableComposite.

Definition at line 98 of file AlignableDet.cc.

98  {
101  else
103 
104  this->AlignableComposite::setAlignmentPositionError(ape, propagateDown);
105 }

References AlignableComposite::setAlignmentPositionError(), and theAlignmentPositionError.

Referenced by AlignableDet(), and update().

◆ update()

void AlignableDet::update ( const GeomDet geomDet,
bool  updateComponents = true 
)

Updater from GeomDet The given GeomDet id has to match the current id.

Definition at line 50 of file AlignableDet.cc.

50  {
52 
53  if (geomDet->alignmentPositionError()) {
54  // false: do not propagate APE to daughters (done by their update functions)
55  this->setAlignmentPositionError(*(geomDet->alignmentPositionError()), false);
56  }
57 
58  if (updateComponents) {
59  if (geomDet->components().empty()) { // Is a DetUnit
60  throw cms::Exception("BadHierarchy") << "[AlignableDet] GeomDet with DetId " << geomDet->geographicalId().rawId()
61  << " has no components, use AlignableDetUnit.\n";
62  } else { // Push back all components
63  const auto& geomDets = geomDet->components();
64  for (const auto& idet : geomDets) {
65  auto unit = dynamic_cast<const GeomDetUnit*>(idet);
66  if (!unit) {
67  throw cms::Exception("BadHierarchy") << "[AlignableDet] component not GeomDetUnit, call with "
68  << "updateComponents==false and build hierarchy yourself.\n";
69  // -> e.g. AlignableDTChamber
70  }
71 
72  const auto components = this->components();
73  auto comp = std::find_if(components.begin(), components.end(), [&unit](const auto& c) {
74  return c->id() == unit->geographicalId().rawId();
75  });
76 
77  if (comp != components.end()) {
78  auto aliDetUnit = dynamic_cast<AlignableDetUnit*>(*comp);
79  if (aliDetUnit) {
80  aliDetUnit->update(unit);
81  } else {
82  throw cms::Exception("LogicError") << "[AlignableDet::update] cast to 'AlignableDetUnit*' failed "
83  << "while it should not\n";
84  }
85  } else {
86  throw cms::Exception("GeometryMismatch")
87  << "[AlignableDet::update] GeomDet with DetId " << unit->geographicalId().rawId()
88  << " not found in current geometry.\n";
89  }
90  }
91  }
92  // Ensure that the surface is not screwed up by update of components, it must stay the GeomDet's one:
93  theSurface = AlignableSurface(geomDet->surface());
94  } // end updateComponents
95 }

References GeomDet::alignmentPositionError(), HltBtagPostValidation_cff::c, AlCaHLTBitMon_QueryRunRegistry::comp, AlignableComposite::components(), GeomDet::components(), Exception, GeomDet::geographicalId(), DetId::rawId(), setAlignmentPositionError(), GeomDet::surface(), Alignable::theSurface, unit(), and AlignableComposite::update().

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), dqm-mbProfile.Profile::finish(), progressbar.ProgressBar::finish(), MatrixUtil.Steps::overwrite(), and AlignableCSCChamber::update().

Member Data Documentation

◆ theAlignmentPositionError

AlignmentPositionError* AlignableDet::theAlignmentPositionError
private
Vector3DBase
Definition: Vector3DBase.h:8
DDAxes::y
ApeEstimator_cff.width
width
Definition: ApeEstimator_cff.py:24
AlignableComposite::alignments
Alignments * alignments() const override
Return alignment data.
Definition: AlignableComposite.cc:254
GeomDet
Definition: GeomDet.h:27
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
AlignableComposite::components
const Alignables & components() const override
Return vector of direct components.
Definition: AlignableComposite.h:45
AlignableDet::theAlignmentPositionError
AlignmentPositionError * theAlignmentPositionError
Definition: AlignableDet.h:47
AlignableDet::setAlignmentPositionError
void setAlignmentPositionError(const AlignmentPositionError &ape, bool propagateDown) override
Set the AlignmentPositionError and, if (propagateDown), to all components.
Definition: AlignableDet.cc:98
GeomDet::components
virtual std::vector< const GeomDet * > components() const
Returns direct components, if any.
Definition: GeomDet.h:73
DDAxes::x
AlignableComposite::addAlignmentPositionErrorFromRotation
void addAlignmentPositionErrorFromRotation(const RotationType &rotation, bool propagateDown) override
Definition: AlignableComposite.cc:175
AlCaHLTBitMon_QueryRunRegistry.comp
comp
Definition: AlCaHLTBitMon_QueryRunRegistry.py:249
GeomDet::surface
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
AlignmentPositionError::globalError
const GlobalErrorExtended & globalError() const
Definition: AlignmentPositionError.h:24
Alignable::compConstraintType_
CompConstraintType compConstraintType_
Definition: Alignable.h:246
DDAxes::z
AlignableComposite::addComponent
void addComponent(Alignable *component) final
Definition: AlignableComposite.cc:53
AlignableComposite::update
void update(align::ID, StructureType aType, const RotationType &rot=RotationType())
Definition: AlignableComposite.cc:43
HcalDetIdTransform::transform
unsigned transform(const HcalDetId &id, unsigned transformCode)
Definition: HcalDetIdTransform.cc:7
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
AlignTransform
Definition: AlignTransform.h:15
GeomDet::geographicalId
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
align::AlignableDetUnit
Definition: StructureType.h:19
GeomDet::alignmentPositionError
AlignmentPositionError const * alignmentPositionError() const
Return pointer to alignment errors.
Definition: GeomDet.h:80
AlignableComposite::AlignableComposite
AlignableComposite()
default constructor hidden
Definition: AlignableComposite.h:118
Alignable::RotationType
align::RotationType RotationType
Definition: Alignable.h:31
Alignable::CompConstraintType::NONE
Alignable::geomDetId
const DetId & geomDetId() const
Definition: Alignable.h:177
Alignable::theSurface
AlignableSurface theSurface
Definition: Alignable.h:237
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
AlignmentErrorsExtended
Definition: AlignmentErrorsExtended.h:10
PV3DBase::basicVector
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:53
unit
Basic3DVector unit() const
Definition: Basic3DVectorLD.h:162
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
AlignableSurface
Definition: AlignableSurface.h:20
Exception
Definition: hltDiff.cc:246
makeMuonMisalignmentScenario.rot
rot
Definition: makeMuonMisalignmentScenario.py:322
AlignableComposite::addAlignmentPositionError
void addAlignmentPositionError(const AlignmentPositionError &ape, bool propagateDown) override
Definition: AlignableComposite.cc:160
AlignTransformErrorExtended
Definition: AlignTransformErrorExtended.h:13
GlobalErrorBaseExtended::matrix
const AlgebraicSymMatrix66 & matrix() const
Definition: GlobalErrorBaseExtended.h:153
Alignments::m_align
std::vector< AlignTransform > m_align
Definition: Alignments.h:19
AlignmentErrorsExtended::m_alignError
std::vector< AlignTransformErrorExtended > m_alignError
Definition: AlignmentErrorsExtended.h:19
Alignable::globalPosition
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:135
AlignmentPositionError
Definition: AlignmentPositionError.h:10
AlignableComposite::setAlignmentPositionError
void setAlignmentPositionError(const AlignmentPositionError &ape, bool propagateDown) override
Definition: AlignableComposite.cc:148
asHepMatrix
CLHEP::HepMatrix asHepMatrix(const ROOT::Math::SMatrix< double, N1, N2, typename ROOT::Math::MatRepStd< double, N1, N2 > > &rm)
Definition: Migration.h:59
Alignments
Definition: Alignments.h:10
Alignable::LocalVector
align::LocalVector LocalVector
Definition: Alignable.h:33
AlignableDet::addAlignmentPositionError
void addAlignmentPositionError(const AlignmentPositionError &ape, bool propagateDown) override
Definition: AlignableDet.cc:108
AlignableComposite::alignmentErrors
AlignmentErrorsExtended * alignmentErrors() const override
Return vector of alignment errors.
Definition: AlignableComposite.cc:269
Basic3DVector< float >
Alignable::globalRotation
const RotationType & globalRotation() const
Return the global orientation of the object.
Definition: Alignable.h:138