CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/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   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   virtual void cacheTransformation();
00200 
00202   virtual void restoreCachedTransformation();
00203 
00205   const SurveyDet* survey() const { return theSurvey; }
00206 
00208   void setSurvey( const SurveyDet* );
00209 
00210 protected:
00211 
00212   void addDisplacement( const GlobalVector& displacement );
00213   void addRotation( const RotationType& rotation );
00214 
00215 protected:
00216 
00217   DetId theDetId; // used to check if Alignable is associated to a GeomDet 
00218                   // ugly way to keep AlignableNavigator happy for now 
00219 
00220   align::ID theId; // real ID as int, above DetId should be removed
00221 
00222   AlignableSurface theSurface; // Global position and orientation of surface
00223 
00224   GlobalVector theDisplacement; // total linear displacement
00225   RotationType theRotation;     // total angular displacement
00226 
00227   AlignableSurface theCachedSurface;
00228   GlobalVector theCachedDisplacement;
00229   RotationType theCachedRotation;
00230 
00231   Alignables theDeepComponents; // list of lowest daughters
00232                                 // contain itself if Alignable is a unit
00233 
00234 private:
00236   Alignable() {};
00237 
00238   AlignmentParameters* theAlignmentParameters;
00239 
00240   Alignable* theMother;       // Pointer to container
00241 
00242   const SurveyDet* theSurvey; // Pointer to survey info; owned by class
00243 
00244 };
00245 
00246 #endif