CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/Alignment/CommonAlignment/interface/Alignable.h

Go to the documentation of this file.
00001 #ifndef Alignment_CommonAlignment_Alignable_H
00002 #define Alignment_CommonAlignment_Alignable_H
00003 
00004 #include "Alignment/CommonAlignment/interface/AlignableSurface.h"
00005 #include "Alignment/CommonAlignment/interface/StructureType.h"
00006 #include "DataFormats/DetId/interface/DetId.h"
00007 
00008 class AlignmentErrors;
00009 class AlignmentParameters;
00010 class AlignmentPositionError;
00011 class Alignments;
00012 class AlignmentSurfaceDeformations;
00013 class SurfaceDeformation;
00014 
00026 class AlignmentParameters;
00027 class SurveyDet;
00028 
00029 class Alignable
00030 {
00031   
00032 public:
00033 
00034   typedef align::Scalar       Scalar;
00035   typedef align::PositionType PositionType;
00036   typedef align::RotationType RotationType;
00037   typedef align::GlobalVector GlobalVector;
00038   typedef align::LocalVector  LocalVector;
00039   typedef align::Alignables   Alignables;
00040   typedef align::StructureType StructureType;
00041 
00044   Alignable( align::ID, const AlignableSurface& );
00045 
00048   Alignable( align::ID, const RotationType& );
00049 
00051   virtual ~Alignable();
00052 
00054   void setAlignmentParameters( AlignmentParameters* dap );
00055 
00057   AlignmentParameters* alignmentParameters() const { return theAlignmentParameters; }
00058 
00061   virtual void addComponent( Alignable* ) = 0;
00062 
00064   virtual Alignables components() const = 0;
00065 
00067   const int size() const { return components().size(); }
00068 
00071   const Alignables& deepComponents() const { return theDeepComponents; }
00072 
00077   virtual void recursiveComponents(Alignables &result) const = 0;
00078 
00082   bool firstCompsWithParams(Alignables &paramComps) const;
00083 
00085   Alignable* mother() const { return theMother; }
00086 
00088   void setMother( Alignable* mother ) { theMother = mother; }
00089 
00091   virtual void move( const GlobalVector& displacement) = 0;
00092 
00096   virtual void rotateInGlobalFrame( const RotationType& rotation) = 0;
00097   
00099   virtual void rotateInLocalFrame( const RotationType& rotation);
00100   
00102   virtual void rotateAroundGlobalAxis( const GlobalVector& axis, Scalar radians );
00103 
00105   virtual void rotateAroundLocalAxis( const LocalVector& axis, Scalar radians );
00106 
00108   virtual void rotateAroundGlobalX( Scalar radians );
00109 
00111   virtual void rotateAroundLocalX( Scalar radians );
00112 
00114   virtual void rotateAroundGlobalY( Scalar radians );
00115 
00117   virtual void rotateAroundLocalY( Scalar radians ); 
00118 
00120   virtual void rotateAroundGlobalZ( Scalar radians );
00121 
00123   virtual void rotateAroundLocalZ( Scalar radians);
00124 
00126   const AlignableSurface& surface() const { return theSurface; }
00127 
00129   const PositionType& globalPosition() const { return surface().position(); }
00130   
00132   const RotationType& globalRotation() const { return surface().rotation(); }
00133 
00135   const GlobalVector& displacement() const { return theDisplacement; }
00136 
00138   const RotationType& rotation() const { return theRotation; }
00139 
00141   virtual void 
00142   setAlignmentPositionError( const AlignmentPositionError& ape, bool propagateDown) = 0;
00143 
00146   virtual void 
00147   addAlignmentPositionError( const AlignmentPositionError& ape, bool propagateDown ) = 0;
00148 
00153   virtual void 
00154   addAlignmentPositionErrorFromRotation( const RotationType& rotation, bool propagateDown ) = 0;
00155 
00160   virtual void 
00161   addAlignmentPositionErrorFromLocalRotation( const RotationType& rotation, bool propagateDown ) = 0;
00162 
00164   virtual void
00165   setSurfaceDeformation(const SurfaceDeformation *deformation, bool propagateDown) = 0;
00166 
00169   virtual void
00170   addSurfaceDeformation(const SurfaceDeformation *deformation, bool propagateDown) = 0;
00171   
00173   virtual StructureType alignableObjectId() const = 0;
00174 
00177   const DetId& geomDetId() const { return theDetId; }
00178 
00180   align::ID id() const { return theId; } 
00181 
00183   virtual void dump() const = 0;
00184 
00186   virtual Alignments* alignments() const = 0;
00187   
00189   virtual AlignmentErrors* alignmentErrors() const = 0;
00190 
00192   AlignmentSurfaceDeformations* surfaceDeformations() const;
00193 
00196   virtual int surfaceDeformationIdPairs(std::vector<std::pair<int,SurfaceDeformation*> > &) const = 0;
00197 
00199   const SurveyDet* survey() const { return theSurvey; }
00200 
00202   void setSurvey( const SurveyDet* );
00203 
00204 protected:
00205 
00206   void addDisplacement( const GlobalVector& displacement );
00207   void addRotation( const RotationType& rotation );
00208 
00209 protected:
00210 
00211   DetId theDetId; // used to check if Alignable is associated to a GeomDet 
00212                   // ugly way to keep AlignableNavigator happy for now 
00213 
00214   align::ID theId; // real ID as int, above DetId should be removed
00215 
00216   AlignableSurface theSurface; // Global position and orientation of surface
00217 
00218   GlobalVector theDisplacement; // total linear displacement
00219   RotationType theRotation;     // total angular displacement
00220 
00221   Alignables theDeepComponents; // list of lowest daughters
00222                                 // contain itself if Alignable is a unit
00223 
00224 private:
00226   Alignable() {};
00227 
00228   AlignmentParameters* theAlignmentParameters;
00229 
00230   Alignable* theMother;       // Pointer to container
00231 
00232   const SurveyDet* theSurvey; // Pointer to survey info; owned by class
00233 
00234 };
00235 
00236 #endif