CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/TrackPropagation/RungeKutta/src/FrameChanger.h

Go to the documentation of this file.
00001 #ifndef FrameChanger_H
00002 #define FrameChanger_H
00003 
00004 #include "FWCore/Utilities/interface/Visibility.h"
00005 #include "DataFormats/GeometrySurface/interface/Plane.h"
00006 #include "DataFormats/GeometrySurface/interface/ReferenceCounted.h"
00007 
00008 class dso_internal FrameChanger {
00009 public:
00013     template <typename T>
00014     static
00015     Plane transformPlane( const Plane& plane, const GloballyPositioned<T>& frame) {
00016         typedef GloballyPositioned<T>                  Frame;
00017         typename Plane::RotationType rot = plane.rotation() * frame.rotation().transposed();
00018         typename Frame::LocalPoint lpos = frame.toLocal(plane.position());
00019         typename Plane::PositionType pos( lpos.basicVector()); // cheat!
00020         return Plane(pos, rot);
00021     }
00022 
00023 
00027     template <typename T, typename U>
00028     static
00029     GloballyPositioned<T> toFrame( const GloballyPositioned<T>& plane, 
00030                                    const GloballyPositioned<U>& frame) {
00031         typedef GloballyPositioned<T>                  Plane;
00032         typedef GloballyPositioned<U>                  Frame;
00033 
00034         typename Plane::RotationType rot = plane.rotation() * frame.rotation().transposed();
00035         typename Frame::LocalPoint lpos = frame.toLocal(plane.position());
00036         typename Plane::PositionType pos( lpos.basicVector()); // cheat!
00037         return Plane( pos, rot);
00038 
00039     }
00040 
00041 };
00042 
00043 #endif