CMS 3D CMS Logo

Point3DBase.h

Go to the documentation of this file.
00001 #ifndef GeometryVector_Point3DBase_h
00002 #define GeometryVector_Point3DBase_h
00003 
00004 
00005 #include "DataFormats/GeometryVector/interface/PointTag.h"
00006 #include "DataFormats/GeometryVector/interface/PV3DBase.h"
00007 #include "DataFormats/GeometryVector/interface/Point2DBase.h"
00008 #include "DataFormats/GeometryVector/interface/Vector3DBase.h"
00009 
00010 template <class T, class FrameTag>
00011 class Point3DBase : public PV3DBase< T, PointTag, FrameTag> {
00012 public:
00013 
00014   typedef PV3DBase< T, PointTag, FrameTag>    BaseClass;
00015   typedef Vector3DBase< T, FrameTag>          VectorType;
00016   typedef typename BaseClass::Cylindrical     Cylindrical;
00017   typedef typename BaseClass::Spherical       Spherical;
00018   typedef typename BaseClass::Polar           Polar;
00019   typedef typename BaseClass::BasicVectorType BasicVectorType;
00020 
00025   Point3DBase() {}
00026 
00030   template <class U> 
00031   Point3DBase( const Point3DBase<U,FrameTag>& p) : BaseClass( p.basicVector()) {}
00032 
00034   Point3DBase(const T& x, const T& y, const T& z) : BaseClass(x, y, z) {}
00035 
00038   explicit Point3DBase( const Cylindrical& set) : BaseClass( set) {}
00039 
00041   explicit Point3DBase( const Polar& set) : BaseClass( set) {}
00042 
00046   Point3DBase(const Geom::Theta<T>& th, 
00047               const Geom::Phi<T>& ph, const T& r) : BaseClass(th,ph,r) {}
00048 
00052   Point3DBase( const T& x, const T& y) : BaseClass( x, y, 0) {}
00053   explicit Point3DBase( Point2DBase<T,FrameTag> p) : 
00054     BaseClass( p.x(), p.y(), 0) {}
00055 
00060   template <class U>
00061   explicit Point3DBase( const Basic3DVector<U>& v) : BaseClass(v) {}
00062 
00066   template <class U> 
00067   Point3DBase& operator+=( const Vector3DBase< U, FrameTag>& v) {
00068     this->theVector += v.basicVector();
00069     return *this;
00070   } 
00071 
00072   template <class U> 
00073   Point3DBase& operator-=( const Vector3DBase< U, FrameTag>& v) {
00074     this->theVector -= v.basicVector();
00075     return *this;
00076   } 
00077 
00078 };
00079 
00084 template< typename T, typename U, class Frame>
00085 inline Point3DBase< typename PreciseFloatType<T,U>::Type, Frame> 
00086 operator+( const Point3DBase<T,Frame>& p, const Vector3DBase<U,Frame>& v) {
00087   typedef Point3DBase< typename PreciseFloatType<T,U>::Type, Frame> RT;
00088   return RT( p.basicVector() + v.basicVector());
00089 }
00090 
00093 template< typename T, typename U, class Frame>
00094 inline Point3DBase< typename PreciseFloatType<T,U>::Type, Frame> 
00095 operator+( const Vector3DBase<T,Frame>& p, const Point3DBase<U,Frame>& v) {
00096   typedef Point3DBase< typename PreciseFloatType<T,U>::Type, Frame> RT;
00097   return RT( p.basicVector() + v.basicVector());
00098 }
00099 
00104 template< typename T, typename U, class Frame>
00105 inline Vector3DBase< typename PreciseFloatType<T,U>::Type, Frame>
00106 operator-( const Point3DBase<T,Frame>& p1, const Point3DBase<U,Frame>& p2) {
00107   typedef Vector3DBase< typename PreciseFloatType<T,U>::Type, Frame> RT;
00108   return RT( p1.basicVector() - p2.basicVector());
00109 }
00110 
00115 template< typename T, typename U, class Frame>
00116 inline Point3DBase< typename PreciseFloatType<T,U>::Type, Frame> 
00117 operator-( const Point3DBase<T,Frame>& p, const Vector3DBase<U,Frame>& v) {
00118   typedef Point3DBase< typename PreciseFloatType<T,U>::Type, Frame> RT;
00119   return RT( p.basicVector() - v.basicVector());
00120 }
00121 #endif // GeometryVector_Point3DBase_h

Generated on Tue Jun 9 17:30:52 2009 for CMSSW by  doxygen 1.5.4