kalmanalignment is hosted by Hepforge, IPPP Durham
Kalman Alignment

/home/mweber/Dokumente/CMS/Alignment/kalmanalignment/trunk/simulation/ReferenceFrame.h

Go to the documentation of this file.
00001 #ifndef _ReferenceFrame_h
00002 #define _ReferenceFrame_h
00003 
00004 #include <CLHEP/Matrix/Vector.h>
00005 #include <CLHEP/Matrix/Matrix.h>
00006 
00025 class ReferenceFrame {
00026   CLHEP::HepVector fPosition;
00027   CLHEP::HepMatrix fRotation;
00028 
00029  public:
00030   // constructor & destructor
00031   ReferenceFrame();
00032   ReferenceFrame(CLHEP::HepVector position, CLHEP::HepMatrix rotation);
00033 
00034   // methods for access to member variables
00035   CLHEP::HepVector GetPosition() const { return fPosition; };
00036   CLHEP::HepMatrix GetRotation() const { return fRotation; };
00037   void SetPosition(CLHEP::HepVector position) { fPosition = position; };
00038   void SetRotation(CLHEP::HepMatrix rotation) { fRotation = rotation; };
00039   CLHEP::HepVector & GetPosRef() { return fPosition; };
00040   CLHEP::HepMatrix & GetRotRef() { return fRotation; };
00041 
00042   // coordinate transformation from global to reference frame
00043   CLHEP::HepVector ToLocal(CLHEP::HepVector global) const { return fRotation * (global - fPosition); };
00044   // coordinate transformation from reference to global frame
00045   CLHEP::HepVector ToGlobal(CLHEP::HepVector local) const { return fRotation.T() * local + fPosition; };
00046 
00047   // static member to combine two reference frames. Note that the order is
00048   // important. Note that also it does *NOT* correspond to two consecutive
00049   // transformations from global to first frame, and then to the delta
00050   // frame. Instead, the two Rotations are multiplied and the two positions
00051   // added.  This is done how Veikko Karimaki defined the "misalignment". It
00052   // has the advantage that once you are satisfied with the combined values,
00053   // you can make them to the nominal ones...
00054   static ReferenceFrame combine_karimaki(const ReferenceFrame & first, const ReferenceFrame & delta);
00055 };
00056 
00057 #endif