CMS 3D CMS Logo

Alignable.h
Go to the documentation of this file.
1 #ifndef Alignment_CommonAlignment_Alignable_H
2 #define Alignment_CommonAlignment_Alignable_H
3 
8 
12 class Alignments;
14 class SurfaceDeformation;
15 
25 class SurveyDet;
26 
27 class Alignable
28 {
29 
30 public:
31 
39 
41 
45 
48  Alignable( align::ID, const RotationType& );
49 
51  virtual ~Alignable();
52 
55  void update(align::ID, const AlignableSurface&);
56 
59 
62 
65  virtual void addComponent( Alignable* ) = 0;
66 
68  virtual const Alignables& components() const = 0;
69 
71  int size() const { return components().size(); }
72 
75  const Alignables& deepComponents() const { return theDeepComponents; }
76 
81  virtual void recursiveComponents(Alignables &result) const = 0;
82 
86  bool firstCompsWithParams(Alignables &paramComps) const;
87 
91  bool lastCompsWithParams(Alignables& paramComps) const;
92 
94  Alignable* mother() const { return theMother; }
95 
98 
100  virtual void move( const GlobalVector& displacement) = 0;
101 
105  virtual void rotateInGlobalFrame( const RotationType& rotation) = 0;
106 
108  virtual void rotateInLocalFrame( const RotationType& rotation);
109 
111  virtual void rotateAroundGlobalAxis( const GlobalVector& axis, Scalar radians );
112 
114  virtual void rotateAroundLocalAxis( const LocalVector& axis, Scalar radians );
115 
117  virtual void rotateAroundGlobalX( Scalar radians );
118 
120  virtual void rotateAroundLocalX( Scalar radians );
121 
123  virtual void rotateAroundGlobalY( Scalar radians );
124 
126  virtual void rotateAroundLocalY( Scalar radians );
127 
129  virtual void rotateAroundGlobalZ( Scalar radians );
130 
132  virtual void rotateAroundLocalZ( Scalar radians);
133 
135  const AlignableSurface& surface() const { return theSurface; }
136 
138  const PositionType& globalPosition() const { return surface().position(); }
139 
141  const RotationType& globalRotation() const { return surface().rotation(); }
142 
144  const GlobalVector& displacement() const { return theDisplacement; }
145 
147  const RotationType& rotation() const { return theRotation; }
148 
150  virtual void
151  setAlignmentPositionError( const AlignmentPositionError& ape, bool propagateDown) = 0;
152 
155  virtual void
156  addAlignmentPositionError( const AlignmentPositionError& ape, bool propagateDown ) = 0;
157 
162  virtual void
163  addAlignmentPositionErrorFromRotation( const RotationType& rotation, bool propagateDown ) = 0;
164 
169  virtual void
170  addAlignmentPositionErrorFromLocalRotation( const RotationType& rotation, bool propagateDown ) = 0;
171 
173  virtual void
174  setSurfaceDeformation(const SurfaceDeformation *deformation, bool propagateDown) = 0;
175 
178  virtual void
179  addSurfaceDeformation(const SurfaceDeformation *deformation, bool propagateDown) = 0;
180 
182  virtual StructureType alignableObjectId() const = 0;
183 
186  const DetId& geomDetId() const { return theDetId; }
187 
189  align::ID id() const { return theId; }
190 
193 
195  virtual void dump() const = 0;
196 
198  virtual Alignments* alignments() const = 0;
199 
201  virtual AlignmentErrorsExtended* alignmentErrors() const = 0;
202 
205 
208  virtual int surfaceDeformationIdPairs(std::vector<std::pair<int,SurfaceDeformation*> > &) const = 0;
209 
211  virtual void cacheTransformation();
212 
215  virtual void cacheTransformation(const align::RunNumber&);
216 
218  virtual void restoreCachedTransformation();
219 
222  virtual void restoreCachedTransformation(const align::RunNumber&);
223 
225  const SurveyDet* survey() const { return theSurvey; }
226 
228  void setSurvey( const SurveyDet* );
229 
231  virtual void recenterSurface();
232 
233 protected:
234  template<class T>
235  using Cache = std::map<align::RunNumber, T>;
236 
237  void addDisplacement( const GlobalVector& displacement );
238  void addRotation( const RotationType& rotation );
239  virtual void updateMother(const GlobalVector& shift);
240 
241  DetId theDetId; // used to check if Alignable is associated to a GeomDet
242  // ugly way to keep AlignableNavigator happy for now
243 
244  align::ID theId; // real ID as int, above DetId should be removed
245 
246  AlignableSurface theSurface; // Global position and orientation of surface
247 
248  GlobalVector theDisplacement; // total linear displacement
249  RotationType theRotation; // total angular displacement
250 
252  GlobalVector theCachedDisplacement;
253  RotationType theCachedRotation;
254 
256 
257  Alignables theDeepComponents; // list of lowest daughters
258  // contain itself if Alignable is a unit
259 
263 
264 private:
265 
267  Alignable() {};
268 
270 
271  Alignable* theMother; // Pointer to container
272 
273  const SurveyDet* theSurvey; // Pointer to survey info; owned by class
274 
275 };
276 
277 #endif
RotationType theCachedRotation
Definition: Alignable.h:253
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:189
void update(align::ID, const AlignableSurface &)
Definition: Alignable.cc:50
virtual void rotateInLocalFrame(const RotationType &rotation)
Rotation intepreted in the local reference frame.
Definition: Alignable.cc:138
DetId theDetId
Definition: Alignable.h:241
virtual int surfaceDeformationIdPairs(std::vector< std::pair< int, SurfaceDeformation * > > &) const =0
RotationType theRotation
Definition: Alignable.h:249
virtual void rotateAroundLocalZ(Scalar radians)
Rotation around local z-axis.
Definition: Alignable.cc:234
double Scalar
Definition: Definitions.h:27
virtual void rotateAroundLocalAxis(const LocalVector &axis, Scalar radians)
Rotation around arbitratry local axis.
Definition: Alignable.cc:160
virtual void addAlignmentPositionErrorFromRotation(const RotationType &rotation, bool propagateDown)=0
Alignable()
private default ctr. to enforce usage of the specialised ones
Definition: Alignable.h:267
uint32_t ID
Definition: Definitions.h:26
const SurveyDet * survey() const
Return survey info.
Definition: Alignable.h:225
Alignable * theMother
Definition: Alignable.h:271
const GlobalVector & displacement() const
Return change of the global position since the creation of the object.
Definition: Alignable.h:144
const RotationType & globalRotation() const
Return the global orientation of the object.
Definition: Alignable.h:141
Cache< GlobalVector > displacementsCache_
Definition: Alignable.h:261
virtual void move(const GlobalVector &displacement)=0
Movement with respect to the global reference frame.
Cache< AlignableSurface > surfacesCache_
Definition: Alignable.h:260
virtual void setSurfaceDeformation(const SurfaceDeformation *deformation, bool propagateDown)=0
Set the surface deformation parameters - if (!propagateDown) do not affect daughters.
virtual const Alignables & components() const =0
Return vector of all direct components.
Cache< RotationType > rotationsCache_
Definition: Alignable.h:262
virtual void addAlignmentPositionError(const AlignmentPositionError &ape, bool propagateDown)=0
virtual void rotateAroundGlobalAxis(const GlobalVector &axis, Scalar radians)
Rotation around arbitratry global axis.
Definition: Alignable.cc:151
align::LocalVector LocalVector
Definition: Alignable.h:36
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:61
GlobalVector theDisplacement
Definition: Alignable.h:248
virtual void rotateAroundGlobalZ(Scalar radians)
Rotation around global z-axis.
Definition: Alignable.cc:221
virtual void addAlignmentPositionErrorFromLocalRotation(const RotationType &rotation, bool propagateDown)=0
virtual void recursiveComponents(Alignables &result) const =0
virtual void recenterSurface()
Recenter surface object without moving possible components.
Definition: Alignable.cc:375
const RotationType & rotation() const
Return change of orientation since the creation of the object.
Definition: Alignable.h:147
AlignmentParameters * theAlignmentParameters
Definition: Alignable.h:267
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
void setAlignmentParameters(AlignmentParameters *dap)
Set the AlignmentParameters.
Definition: Alignable.cc:128
virtual void addSurfaceDeformation(const SurfaceDeformation *deformation, bool propagateDown)=0
bool firstCompsWithParams(Alignables &paramComps) const
Definition: Alignable.cc:69
virtual void addComponent(Alignable *)=0
AlignmentSurfaceDeformations * surfaceDeformations() const
Return surface deformations, sorted by DetId.
Definition: Alignable.cc:263
virtual void restoreCachedTransformation()
restore the previously cached transformation, also for possible components
Definition: Alignable.cc:313
CompConstraintType
Definition: Alignable.h:40
virtual void updateMother(const GlobalVector &shift)
Definition: Alignable.cc:352
virtual void setAlignmentPositionError(const AlignmentPositionError &ape, bool propagateDown)=0
Set the alignment position error - if (!propagateDown) do not affect daughters.
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:135
void setMother(Alignable *mother)
Assign mother to alignable.
Definition: Alignable.h:97
AlignableSurface theCachedSurface
Definition: Alignable.h:251
Definition: DetId.h:18
virtual void dump() const =0
Recursive printout of alignable information.
const Alignables & deepComponents() const
Definition: Alignable.h:75
virtual void rotateAroundGlobalX(Scalar radians)
Rotation around global x-axis.
Definition: Alignable.cc:169
virtual void rotateInGlobalFrame(const RotationType &rotation)=0
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:343
void addRotation(const RotationType &rotation)
Definition: Alignable.cc:255
align::RotationType RotationType
Definition: Alignable.h:34
GlobalVector theCachedDisplacement
Definition: Alignable.h:252
virtual void rotateAroundLocalY(Scalar radians)
Rotation around local y-axis.
Definition: Alignable.cc:208
virtual void rotateAroundGlobalY(Scalar radians)
Rotation around global y-axis.
Definition: Alignable.cc:195
void addDisplacement(const GlobalVector &displacement)
Definition: Alignable.cc:247
virtual CompConstraintType compConstraintType() const
Return the alignable type of contraints wrt. its components.
Definition: Alignable.h:192
align::PositionType PositionType
Definition: Alignable.h:33
std::vector< Alignable * > Alignables
Definition: Utilities.h:32
virtual Alignments * alignments() const =0
Return vector of alignment data.
virtual void cacheTransformation()
cache the current position, rotation and other parameters (e.g. surface deformations), also for possible components
Definition: Alignable.cc:291
virtual void rotateAroundLocalX(Scalar radians)
Rotation around local x-axis.
Definition: Alignable.cc:182
static unsigned int const shift
align::Scalar Scalar
Definition: Alignable.h:32
const RotationType & rotation() const
CompConstraintType compConstraintType_
Definition: Alignable.h:255
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:138
std::map< align::RunNumber, T > Cache
Definition: Alignable.h:235
align::GlobalVector GlobalVector
Definition: Alignable.h:35
align::ID theId
Definition: Alignable.h:244
const PositionType & position() const
virtual ~Alignable()
Destructor.
Definition: Alignable.cc:43
virtual AlignmentErrorsExtended * alignmentErrors() const =0
Return vector of alignment errors.
const SurveyDet * theSurvey
Definition: Alignable.h:273
Alignable * mother() const
Return pointer to container alignable (if any)
Definition: Alignable.h:94
const DetId & geomDetId() const
Definition: Alignable.h:186
align::Alignables Alignables
Definition: Alignable.h:37
AlignableSurface theSurface
Definition: Alignable.h:246
int size() const
Return number of direct components.
Definition: Alignable.h:71
Alignables theDeepComponents
Definition: Alignable.h:257
bool lastCompsWithParams(Alignables &paramComps) const
Definition: Alignable.cc:99
cond::RealTimeType< cond::runnumber >::type RunNumber
Definition: Utilities.h:38
align::StructureType StructureType
Definition: Alignable.h:38