File indexing completed on 2024-04-06 12:04:16
0001 #ifndef GeometryVector_Point2DBase_h
0002 #define GeometryVector_Point2DBase_h
0003
0004 #include "DataFormats/GeometryVector/interface/PointTag.h"
0005 #include "DataFormats/GeometryVector/interface/PV2DBase.h"
0006 #include "DataFormats/GeometryVector/interface/Vector2DBase.h"
0007
0008 template <class T, class FrameTag>
0009 class Point2DBase : public PV2DBase<T, PointTag, FrameTag> {
0010 public:
0011 typedef PV2DBase<T, PointTag, FrameTag> BaseClass;
0012 typedef Vector2DBase<T, FrameTag> VectorType;
0013 typedef Basic2DVector<T> BasicVectorType;
0014 typedef typename BaseClass::Polar Polar;
0015
0016
0017
0018
0019
0020 Point2DBase() {}
0021
0022
0023
0024
0025 template <class U>
0026 Point2DBase(const Point2DBase<U, FrameTag>& p) : BaseClass(p.basicVector()) {}
0027
0028
0029 Point2DBase(const T& x, const T& y) : BaseClass(x, y) {}
0030
0031
0032 explicit Point2DBase(const Polar& set) : BaseClass(set) {}
0033
0034
0035
0036
0037
0038 template <class U>
0039 explicit Point2DBase(const Basic2DVector<U>& v) : BaseClass(v) {}
0040
0041
0042
0043
0044 template <class U>
0045 Point2DBase& operator+=(const Vector2DBase<U, FrameTag>& v) {
0046 this->basicVector() += v.basicVector();
0047 return *this;
0048 }
0049
0050 template <class U>
0051 Point2DBase& operator-=(const Vector2DBase<U, FrameTag>& v) {
0052 this->basicVector() -= v.basicVector();
0053 return *this;
0054 }
0055 };
0056
0057
0058
0059
0060
0061 template <typename T, typename U, class Frame>
0062 inline Point2DBase<typename PreciseFloatType<T, U>::Type, Frame> operator+(const Point2DBase<T, Frame>& p,
0063 const Vector2DBase<U, Frame>& v) {
0064 typedef Point2DBase<typename PreciseFloatType<T, U>::Type, Frame> RT;
0065 return RT(p.basicVector() + v.basicVector());
0066 }
0067
0068
0069
0070 template <typename T, typename U, class Frame>
0071 inline Point2DBase<typename PreciseFloatType<T, U>::Type, Frame> operator+(const Vector2DBase<T, Frame>& p,
0072 const Point2DBase<U, Frame>& v) {
0073 typedef Point2DBase<typename PreciseFloatType<T, U>::Type, Frame> RT;
0074 return RT(p.basicVector() + v.basicVector());
0075 }
0076
0077
0078
0079
0080
0081 template <typename T, typename U, class Frame>
0082 inline Vector2DBase<typename PreciseFloatType<T, U>::Type, Frame> operator-(const Point2DBase<T, Frame>& p1,
0083 const Point2DBase<U, Frame>& p2) {
0084 typedef Vector2DBase<typename PreciseFloatType<T, U>::Type, Frame> RT;
0085 return RT(p1.basicVector() - p2.basicVector());
0086 }
0087
0088 #endif