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 public:
36 
38 
42 
46 
48  virtual ~Alignable();
49 
52  void update(align::ID, const AlignableSurface&);
53 
56 
59 
62  virtual void addComponent(Alignable*) = 0;
63 
65  virtual const Alignables& components() const = 0;
66 
68  int size() const { return components().size(); }
69 
72  const Alignables& deepComponents() const { return theDeepComponents; }
73 
78  virtual void recursiveComponents(Alignables& result) const = 0;
79 
83  bool firstCompsWithParams(Alignables& paramComps) const;
84 
88  bool lastCompsWithParams(Alignables& paramComps) const;
89 
91  Alignable* mother() const { return theMother; }
92 
95 
97  virtual void move(const GlobalVector& displacement) = 0;
98 
102  virtual void rotateInGlobalFrame(const RotationType& rotation) = 0;
103 
105  virtual void rotateInLocalFrame(const RotationType& rotation);
106 
108  virtual void rotateAroundGlobalAxis(const GlobalVector& axis, Scalar radians);
109 
111  virtual void rotateAroundLocalAxis(const LocalVector& axis, Scalar radians);
112 
114  virtual void rotateAroundGlobalX(Scalar radians);
115 
117  virtual void rotateAroundLocalX(Scalar radians);
118 
120  virtual void rotateAroundGlobalY(Scalar radians);
121 
123  virtual void rotateAroundLocalY(Scalar radians);
124 
126  virtual void rotateAroundGlobalZ(Scalar radians);
127 
129  virtual void rotateAroundLocalZ(Scalar radians);
130 
132  const AlignableSurface& surface() const { return theSurface; }
133 
135  const PositionType& globalPosition() const { return surface().position(); }
136 
138  const RotationType& globalRotation() const { return surface().rotation(); }
139 
141  const GlobalVector& displacement() const { return theDisplacement; }
142 
144  const RotationType& rotation() const { return theRotation; }
145 
147  virtual void setAlignmentPositionError(const AlignmentPositionError& ape, bool propagateDown) = 0;
148 
151  virtual void addAlignmentPositionError(const AlignmentPositionError& ape, bool propagateDown) = 0;
152 
157  virtual void addAlignmentPositionErrorFromRotation(const RotationType& rotation, bool propagateDown) = 0;
158 
163  virtual void addAlignmentPositionErrorFromLocalRotation(const RotationType& rotation, bool propagateDown) = 0;
164 
166  virtual void setSurfaceDeformation(const SurfaceDeformation* deformation, bool propagateDown) = 0;
167 
170  virtual void addSurfaceDeformation(const SurfaceDeformation* deformation, bool propagateDown) = 0;
171 
173  virtual StructureType alignableObjectId() const = 0;
174 
177  const DetId& geomDetId() const { return theDetId; }
178 
180  align::ID id() const { return theId; }
181 
184 
186  virtual void dump() const = 0;
187 
189  virtual Alignments* alignments() const = 0;
190 
192  virtual AlignmentErrorsExtended* alignmentErrors() const = 0;
193 
196 
199  virtual int surfaceDeformationIdPairs(std::vector<std::pair<int, SurfaceDeformation*> >&) const = 0;
200 
202  virtual void cacheTransformation();
203 
206  virtual void cacheTransformation(const align::RunNumber&);
207 
209  virtual void restoreCachedTransformation();
210 
213  virtual void restoreCachedTransformation(const align::RunNumber&);
214 
216  const SurveyDet* survey() const { return theSurvey; }
217 
219  void setSurvey(const SurveyDet*);
220 
222  virtual void recenterSurface();
223 
224 protected:
225  template <class T>
226  using Cache = std::map<align::RunNumber, T>;
227 
229  void addRotation(const RotationType& rotation);
230  virtual void updateMother(const GlobalVector& shift);
231 
232  DetId theDetId; // used to check if Alignable is associated to a GeomDet
233  // ugly way to keep AlignableNavigator happy for now
234 
235  align::ID theId; // real ID as int, above DetId should be removed
236 
237  AlignableSurface theSurface; // Global position and orientation of surface
238 
239  GlobalVector theDisplacement; // total linear displacement
240  RotationType theRotation; // total angular displacement
241 
245 
247 
248  Alignables theDeepComponents; // list of lowest daughters
249  // contain itself if Alignable is a unit
250 
254 
255 private:
258 
260 
261  Alignable* theMother; // Pointer to container
262 
263  const SurveyDet* theSurvey; // Pointer to survey info; owned by class
264 };
265 
266 #endif
RotationType theCachedRotation
Definition: Alignable.h:244
AlignmentSurfaceDeformations * surfaceDeformations() const
Return surface deformations, sorted by DetId.
Definition: Alignable.cc:196
void update(align::ID, const AlignableSurface &)
Definition: Alignable.cc:45
AlignmentParameters * alignmentParameters() const
Get the AlignmentParameters.
Definition: Alignable.h:58
virtual void rotateInLocalFrame(const RotationType &rotation)
Rotation intepreted in the local reference frame.
Definition: Alignable.cc:129
Alignable * mother() const
Return pointer to container alignable (if any)
Definition: Alignable.h:91
DetId theDetId
Definition: Alignable.h:232
virtual AlignmentErrorsExtended * alignmentErrors() const =0
Return vector of alignment errors.
RotationType theRotation
Definition: Alignable.h:240
const AlignableSurface & surface() const
Return the Surface (global position and orientation) of the object.
Definition: Alignable.h:132
virtual void rotateAroundLocalZ(Scalar radians)
Rotation around local z-axis.
Definition: Alignable.cc:183
double Scalar
Definition: Definitions.h:25
virtual void rotateAroundLocalAxis(const LocalVector &axis, Scalar radians)
Rotation around arbitratry local axis.
Definition: Alignable.cc:143
virtual void addAlignmentPositionErrorFromRotation(const RotationType &rotation, bool propagateDown)=0
Alignable()
private default ctr. to enforce usage of the specialised ones
Definition: Alignable.h:257
uint32_t ID
Definition: Definitions.h:24
Alignable * theMother
Definition: Alignable.h:261
Cache< GlobalVector > displacementsCache_
Definition: Alignable.h:252
virtual void move(const GlobalVector &displacement)=0
Movement with respect to the global reference frame.
Cache< AlignableSurface > surfacesCache_
Definition: Alignable.h:251
virtual void setSurfaceDeformation(const SurfaceDeformation *deformation, bool propagateDown)=0
Set the surface deformation parameters - if (!propagateDown) do not affect daughters.
const Alignables & deepComponents() const
Definition: Alignable.h:72
Cache< RotationType > rotationsCache_
Definition: Alignable.h:253
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:138
align::LocalVector LocalVector
Definition: Alignable.h:33
GlobalVector theDisplacement
Definition: Alignable.h:239
virtual void rotateAroundGlobalZ(Scalar radians)
Rotation around global z-axis.
Definition: Alignable.cc:176
virtual void addAlignmentPositionErrorFromLocalRotation(const RotationType &rotation, bool propagateDown)=0
virtual void dump() const =0
Recursive printout of alignable information.
bool firstCompsWithParams(Alignables &paramComps) const
Definition: Alignable.cc:62
virtual void recenterSurface()
Recenter surface object without moving possible components.
Definition: Alignable.cc:295
virtual void recursiveComponents(Alignables &result) const =0
const PositionType & globalPosition() const
Return the global position of the object.
Definition: Alignable.h:135
AlignmentParameters * theAlignmentParameters
Definition: Alignable.h:257
void setAlignmentParameters(AlignmentParameters *dap)
Set the AlignmentParameters.
Definition: Alignable.cc:123
const SurveyDet * survey() const
Return survey info.
Definition: Alignable.h:216
virtual void addSurfaceDeformation(const SurfaceDeformation *deformation, bool propagateDown)=0
virtual StructureType alignableObjectId() const =0
Return the alignable type identifier.
virtual void addComponent(Alignable *)=0
virtual void restoreCachedTransformation()
restore the previously cached transformation, also for possible components
Definition: Alignable.cc:237
CompConstraintType
Definition: Alignable.h:37
virtual const Alignables & components() const =0
Return vector of all direct components.
virtual void updateMother(const GlobalVector &shift)
Definition: Alignable.cc:272
virtual void setAlignmentPositionError(const AlignmentPositionError &ape, bool propagateDown)=0
Set the alignment position error - if (!propagateDown) do not affect daughters.
void setMother(Alignable *mother)
Assign mother to alignable.
Definition: Alignable.h:94
AlignableSurface theCachedSurface
Definition: Alignable.h:242
virtual CompConstraintType compConstraintType() const
Return the alignable type of contraints wrt. its components.
Definition: Alignable.h:183
Definition: DetId.h:17
align::ID id() const
Return the ID of Alignable, i.e. DetId of &#39;first&#39; component GeomDet(Unit).
Definition: Alignable.h:180
const PositionType & position() const
virtual void rotateAroundGlobalX(Scalar radians)
Rotation around global x-axis.
Definition: Alignable.cc:148
virtual void rotateInGlobalFrame(const RotationType &rotation)=0
const DetId & geomDetId() const
Definition: Alignable.h:177
void setSurvey(const SurveyDet *)
Set survey info.
Definition: Alignable.cc:266
void addRotation(const RotationType &rotation)
Definition: Alignable.cc:193
align::RotationType RotationType
Definition: Alignable.h:31
bool lastCompsWithParams(Alignables &paramComps) const
Definition: Alignable.cc:93
const GlobalVector & displacement() const
Return change of the global position since the creation of the object.
Definition: Alignable.h:141
GlobalVector theCachedDisplacement
Definition: Alignable.h:243
virtual void rotateAroundLocalY(Scalar radians)
Rotation around local y-axis.
Definition: Alignable.cc:169
virtual void rotateAroundGlobalY(Scalar radians)
Rotation around global y-axis.
Definition: Alignable.cc:162
void addDisplacement(const GlobalVector &displacement)
Definition: Alignable.cc:190
int size() const
Return number of direct components.
Definition: Alignable.h:68
align::PositionType PositionType
Definition: Alignable.h:30
std::vector< Alignable * > Alignables
Definition: Utilities.h:31
virtual void cacheTransformation()
cache the current position, rotation and other parameters (e.g. surface deformations), also for possible components
Definition: Alignable.cc:215
virtual void rotateAroundLocalX(Scalar radians)
Rotation around local x-axis.
Definition: Alignable.cc:155
static unsigned int const shift
align::Scalar Scalar
Definition: Alignable.h:29
virtual int surfaceDeformationIdPairs(std::vector< std::pair< int, SurfaceDeformation *> > &) const =0
CompConstraintType compConstraintType_
Definition: Alignable.h:246
const RotationType & globalRotation() const
Return the global orientation of the object.
Definition: Alignable.h:138
const RotationType & rotation() const
std::map< align::RunNumber, T > Cache
Definition: Alignable.h:226
align::GlobalVector GlobalVector
Definition: Alignable.h:32
align::ID theId
Definition: Alignable.h:235
virtual ~Alignable()
Destructor.
Definition: Alignable.cc:39
const SurveyDet * theSurvey
Definition: Alignable.h:263
align::Alignables Alignables
Definition: Alignable.h:34
virtual Alignments * alignments() const =0
Return vector of alignment data.
AlignableSurface theSurface
Definition: Alignable.h:237
Alignables theDeepComponents
Definition: Alignable.h:248
cond::RealTimeType< cond::runnumber >::type RunNumber
Definition: Utilities.h:37
const RotationType & rotation() const
Return change of orientation since the creation of the object.
Definition: Alignable.h:144
align::StructureType StructureType
Definition: Alignable.h:35