Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:50:51

0001 #ifndef AlignTransform_H
0002 #define AlignTransform_H
0003 #include "CondFormats/Serialization/interface/Serializable.h"
0004 
0005 #include "CLHEP/Vector/EulerAngles.h"
0006 #include "CLHEP/Vector/Rotation.h"
0007 #include "CLHEP/Vector/ThreeVector.h"
0008 #include "CLHEP/Geometry/Transform3D.h"
0009 
0010 #include "CondFormats/Alignment/interface/Definitions.h"
0011 
0012 /// Class holding data for an Alignment transformation
0013 /// It contains the raw detector id, its global position and global orientation.
0014 /// It is optimized for storage.
0015 class AlignTransform {
0016 public:
0017   typedef CLHEP::HepEulerAngles EulerAngles;
0018   typedef CLHEP::Hep3Vector Translation;
0019   typedef CLHEP::HepRotation Rotation;
0020   typedef HepGeom::Transform3D Transform;
0021 
0022   /// Default constructor
0023   AlignTransform() {}
0024 
0025   /// Constructor from Euler angles
0026   AlignTransform(const Translation& itranslation, const EulerAngles& ieulerAngles, align::ID irawId)
0027       : m_translation(itranslation), m_eulerAngles(ieulerAngles), m_rawId(irawId) {}
0028 
0029   /// Constructor from Rotation
0030   AlignTransform(const Translation& itranslation, const Rotation& irotation, align::ID irawId)
0031       : m_translation(itranslation), m_eulerAngles(irotation.eulerAngles()), m_rawId(irawId) {}
0032 
0033   const Translation& translation() const { return m_translation; }
0034   /// Do not expose Euler angles since we may change its type later
0035   //   const EulerAngles & eulerAngles() const { return m_eulerAngles; }
0036   align::ID rawId() const { return m_rawId; }
0037 
0038   Rotation rotation()
0039       const {  //std::cout<<"Inside aligntransform::rotation() with id="<<std::hex<<m_rawId<<std::dec<<std::endl ;
0040     //std::cout<<" for e.a.="<<m_eulerAngles<<std::endl;
0041     return Rotation(m_eulerAngles);
0042   }
0043 
0044   Transform transform() const { return Transform(rotation(), translation()); }
0045 
0046   // Implemented so this can be sorted by rawId
0047   const bool operator<(const AlignTransform& other) const { return (m_rawId < other.rawId()); }
0048 
0049 private:
0050   Translation m_translation;
0051   EulerAngles m_eulerAngles;
0052   align::ID m_rawId;
0053 
0054   COND_SERIALIZABLE;
0055 };
0056 #endif  //AlignTransform_H