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
00063
00064 bool operator==(const Point3DBase & rh) const {
00065 return this->basicVector()==rh.basicVector();
00066 }
00067
00071 template <class U>
00072 Point3DBase& operator+=( const Vector3DBase< U, FrameTag>& v) {
00073 this->theVector += v.basicVector();
00074 return *this;
00075 }
00076
00077 template <class U>
00078 Point3DBase& operator-=( const Vector3DBase< U, FrameTag>& v) {
00079 this->theVector -= v.basicVector();
00080 return *this;
00081 }
00082
00083 };
00084
00089 template< typename T, typename U, class Frame>
00090 inline Point3DBase< typename PreciseFloatType<T,U>::Type, Frame>
00091 operator+( const Point3DBase<T,Frame>& p, const Vector3DBase<U,Frame>& v) {
00092 typedef Point3DBase< typename PreciseFloatType<T,U>::Type, Frame> RT;
00093 return RT( p.basicVector() + v.basicVector());
00094 }
00095
00098 template< typename T, typename U, class Frame>
00099 inline Point3DBase< typename PreciseFloatType<T,U>::Type, Frame>
00100 operator+( const Vector3DBase<T,Frame>& p, const Point3DBase<U,Frame>& v) {
00101 typedef Point3DBase< typename PreciseFloatType<T,U>::Type, Frame> RT;
00102 return RT( p.basicVector() + v.basicVector());
00103 }
00104
00109 template< typename T, typename U, class Frame>
00110 inline Vector3DBase< typename PreciseFloatType<T,U>::Type, Frame>
00111 operator-( const Point3DBase<T,Frame>& p1, const Point3DBase<U,Frame>& p2) {
00112 typedef Vector3DBase< typename PreciseFloatType<T,U>::Type, Frame> RT;
00113 return RT( p1.basicVector() - p2.basicVector());
00114 }
00115
00120 template< typename T, typename U, class Frame>
00121 inline Point3DBase< typename PreciseFloatType<T,U>::Type, Frame>
00122 operator-( const Point3DBase<T,Frame>& p, const Vector3DBase<U,Frame>& v) {
00123 typedef Point3DBase< typename PreciseFloatType<T,U>::Type, Frame> RT;
00124 return RT( p.basicVector() - v.basicVector());
00125 }
00126 #endif // GeometryVector_Point3DBase_h