Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-30 02:32:39

0001 #ifndef Alignment_CommonAlignment_AlignableComposite_H
0002 #define Alignment_CommonAlignment_AlignableComposite_H
0003 
0004 #include "Alignment/CommonAlignment/interface/Alignable.h"
0005 
0006 /// Abstract base class for composites of Alignable objects.
0007 /// The AlignableComposite is itself Alignable.
0008 /// Apart from providing an interface to access components,
0009 /// the AlignableComposite provides a convenient way of (mis)aligning
0010 /// a group of detectors as one rigid body.
0011 /// The components of a Composite can themselves be composite,
0012 /// providing a hierarchical view of the detector for alignment.
0013 ///
0014 /// This is similar to the GeomDetUnit - GeomDet hierarchy, but the two
0015 /// hierarchies are deliberately not coupled: the hierarchy for
0016 /// alignment is defined by the mechanical mounting of detectors
0017 /// in various structures, while the GeomDet hierarchy is
0018 /// optimised for pattern recognition.
0019 ///
0020 /// Note that AlignableComposite owns (and deletes in its destructor)
0021 /// all its component which are added by addComponent.
0022 
0023 class GeomDet;
0024 
0025 class AlignableComposite : public Alignable {
0026 public:
0027   /// Constructor for a composite with given rotation.
0028   /// Position can be found from average of daughters' positions later,
0029   /// using addComponent(Alignable*).
0030   AlignableComposite(align::ID id, StructureType aType, const RotationType& rot = RotationType());
0031 
0032   /// deleting its components
0033   ~AlignableComposite() override;
0034 
0035   /// Updater for a composite with given rotation.
0036   /// The given id and structure type have to match the current ones.
0037   void update(align::ID, StructureType aType, const RotationType& rot = RotationType());
0038 
0039   /// Add a component and set its mother to this alignable.
0040   /// (Note: The component will be adopted, e.g. later deleted.)
0041   /// Also find average position of this composite from its modules' positions.
0042   void addComponent(Alignable* component) final;
0043 
0044   /// Return vector of direct components
0045   const Alignables& components() const override { return theComponents; }
0046 
0047   /// Provide all components, subcomponents etc. (cf. description in base class)
0048   void recursiveComponents(Alignables& result) const override;
0049 
0050   /// Move with respect to the global reference frame
0051   void move(const GlobalVector& displacement) override;
0052 
0053   /// Move with respect to the local reference frame
0054   virtual void moveComponentsLocal(const LocalVector& localDisplacement);
0055 
0056   /// Move a single component with respect to the local reference frame
0057   virtual void moveComponentLocal(const int i, const LocalVector& localDisplacement);
0058 
0059   /// Rotation interpreted in global reference frame
0060   void rotateInGlobalFrame(const RotationType& rotation) override;
0061 
0062   /// Set the AlignmentPositionError (if this Alignable is a Det) and,
0063   /// if (propagateDown), to all the components of the composite
0064   void setAlignmentPositionError(const AlignmentPositionError& ape, bool propagateDown) override;
0065 
0066   /// Add the AlignmentPositionError (if this Alignable is a Det) and,
0067   /// if (propagateDown), add to all the components of the composite
0068   void addAlignmentPositionError(const AlignmentPositionError& ape, bool propagateDown) override;
0069 
0070   /// Add the AlignmentPositionError resulting from global rotation (if this Alignable is a Det) and,
0071   /// if (propagateDown), add to all the components of the composite
0072   void addAlignmentPositionErrorFromRotation(const RotationType& rotation, bool propagateDown) override;
0073 
0074   /// Add the AlignmentPositionError resulting from local rotation (if this Alignable is a Det) and,
0075   /// if (propagateDown), add to all the components of the composite
0076   void addAlignmentPositionErrorFromLocalRotation(const RotationType& rotation, bool propagateDown) override;
0077 
0078   /// Set the surface deformation parameters - if (!propagateDown) do not affect daughters
0079   void setSurfaceDeformation(const SurfaceDeformation* deformation, bool propagateDown) override;
0080 
0081   /// Add the surface deformation parameters to the existing ones,
0082   /// if (!propagateDown) do not affect daughters.
0083   void addSurfaceDeformation(const SurfaceDeformation* deformation, bool propagateDown) override;
0084 
0085   /// Return the alignable type identifier
0086   StructureType alignableObjectId() const override { return theStructureType; }
0087 
0088   /// Recursive printout of alignable structure
0089   void dump() const override;
0090 
0091   /// Return alignment data
0092   Alignments* alignments() const override;
0093 
0094   /// Return vector of alignment errors
0095   AlignmentErrorsExtended* alignmentErrors() const override;
0096 
0097   /// Return surface deformations
0098   int surfaceDeformationIdPairs(std::vector<std::pair<int, SurfaceDeformation*> >&) const override;
0099 
0100   // avoid implicit cast of not explicitely defined version to the defined ones
0101   template <class T>
0102   void update(T) = delete;
0103 
0104 protected:
0105   /// Constructor from GeomDet, only for use in AlignableDet
0106   explicit AlignableComposite(const GeomDet* geomDet);
0107 
0108   /// Updater from GeomDet, only for use in AlignableDet
0109   /// The given GeomDetUnit id has to match the current id.
0110   void update(const GeomDet* geomDet);
0111 
0112   void setSurface(const AlignableSurface& s) { theSurface = s; }
0113 
0114   StructureType theStructureType;
0115 
0116 private:
0117   /// default constructor hidden
0118   AlignableComposite() : Alignable(0, RotationType()){};
0119 
0120   Alignables theComponents;  // direct daughters
0121 };
0122 
0123 #endif