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 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 
230 protected:
231  template<class T>
232  using Cache = std::map<align::RunNumber, T>;
233 
234  void addDisplacement( const GlobalVector& displacement );
235  void addRotation( const RotationType& rotation );
236  virtual void updateMother(const GlobalVector& shift);
237 
238  DetId theDetId; // used to check if Alignable is associated to a GeomDet
239  // ugly way to keep AlignableNavigator happy for now
240 
241  align::ID theId; // real ID as int, above DetId should be removed
242 
243  AlignableSurface theSurface; // Global position and orientation of surface
244 
245  GlobalVector theDisplacement; // total linear displacement
246  RotationType theRotation; // total angular displacement
247 
249  GlobalVector theCachedDisplacement;
250  RotationType theCachedRotation;
251 
253 
254  Alignables theDeepComponents; // list of lowest daughters
255  // contain itself if Alignable is a unit
256 
260 
261 private:
262 
264  Alignable() {};
265 
267 
268  Alignable* theMother; // Pointer to container
269 
270  const SurveyDet* theSurvey; // Pointer to survey info; owned by class
271 
272 };
273 
274 typedef std::vector<Alignable*> Alignables;
275 
276 #endif
RotationType theCachedRotation
Definition: Alignable.h:250
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:139
DetId theDetId
Definition: Alignable.h:238
virtual int surfaceDeformationIdPairs(std::vector< std::pair< int, SurfaceDeformation * > > &) const =0
RotationType theRotation
Definition: Alignable.h:246
virtual void rotateAroundLocalZ(Scalar radians)
Rotation around local z-axis.
Definition: Alignable.cc:235
double Scalar
Definition: Definitions.h:27
virtual void rotateAroundLocalAxis(const LocalVector &axis, Scalar radians)
Rotation around arbitratry local axis.
Definition: Alignable.cc:161
virtual void addAlignmentPositionErrorFromRotation(const RotationType &rotation, bool propagateDown)=0
Alignable()
private default ctr. to enforce usage of the specialised ones
Definition: Alignable.h:264
uint32_t ID
Definition: Definitions.h:26
const SurveyDet * survey() const
Return survey info.
Definition: Alignable.h:225
Alignable * theMother
Definition: Alignable.h:268
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:258
virtual void move(const GlobalVector &displacement)=0
Movement with respect to the global reference frame.
Cache< AlignableSurface > surfacesCache_
Definition: Alignable.h:257
virtual void setSurfaceDeformation(const SurfaceDeformation *deformation, bool propagateDown)=0
Set the surface deformation parameters - if (!propagateDown) do not affect daughters.
Cache< RotationType > rotationsCache_
Definition: Alignable.h:259
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:152
align::LocalVector LocalVector
Definition: Alignable.h:36
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:61
GlobalVector theDisplacement
Definition: Alignable.h:245
virtual void rotateAroundGlobalZ(Scalar radians)
Rotation around global z-axis.
Definition: Alignable.cc:222
virtual void addAlignmentPositionErrorFromLocalRotation(const RotationType &rotation, bool propagateDown)=0
virtual void recursiveComponents(Alignables &result) const =0
const RotationType & rotation() const
Return change of orientation since the creation of the object.
Definition: Alignable.h:147
AlignmentParameters * theAlignmentParameters
Definition: Alignable.h:264
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
void setAlignmentParameters(AlignmentParameters *dap)
Set the AlignmentParameters.
Definition: Alignable.cc:129
virtual void addSurfaceDeformation(const SurfaceDeformation *deformation, bool propagateDown)=0
virtual Alignables components() const =0
Return vector of all direct components.
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:264
virtual void restoreCachedTransformation()
restore the previously cached transformation, also for possible components
Definition: Alignable.cc:320
CompConstraintType
Definition: Alignable.h:40
virtual void updateMother(const GlobalVector &shift)
Definition: Alignable.cc:365
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:248
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:170
virtual void rotateInGlobalFrame(const RotationType &rotation)=0
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:356
void addRotation(const RotationType &rotation)
Definition: Alignable.cc:256
align::RotationType RotationType
Definition: Alignable.h:34
GlobalVector theCachedDisplacement
Definition: Alignable.h:249
virtual void rotateAroundLocalY(Scalar radians)
Rotation around local y-axis.
Definition: Alignable.cc:209
virtual void rotateAroundGlobalY(Scalar radians)
Rotation around global y-axis.
Definition: Alignable.cc:196
void addDisplacement(const GlobalVector &displacement)
Definition: Alignable.cc:248
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:31
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:292
virtual void rotateAroundLocalX(Scalar radians)
Rotation around local x-axis.
Definition: Alignable.cc:183
static unsigned int const shift
align::Scalar Scalar
Definition: Alignable.h:32
const RotationType & rotation() const
CompConstraintType compConstraintType_
Definition: Alignable.h:252
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:138
std::map< align::RunNumber, T > Cache
Definition: Alignable.h:232
align::GlobalVector GlobalVector
Definition: Alignable.h:35
align::ID theId
Definition: Alignable.h:241
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:270
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:243
int size() const
Return number of direct components.
Definition: Alignable.h:71
Alignables theDeepComponents
Definition: Alignable.h:254
bool lastCompsWithParams(Alignables &paramComps) const
Definition: Alignable.cc:100
cond::RealTimeType< cond::runnumber >::type RunNumber
Definition: Utilities.h:37
align::StructureType StructureType
Definition: Alignable.h:38