CMS 3D CMS Logo

Vector2DBase.h
Go to the documentation of this file.
1 #ifndef GeometryVector_Vector2DBase_h
2 #define GeometryVector_Vector2DBase_h
3 
6 
7 template <class T, class FrameTag>
8 class Vector2DBase : public PV2DBase<T, VectorTag, FrameTag> {
9 public:
12  typedef typename BaseClass::Polar Polar;
13 
19 
23  template <class U>
25 
27  Vector2DBase(const T& x, const T& y) : BaseClass(x, y) {}
28 
30  explicit Vector2DBase(const Polar& set) : BaseClass(set) {}
31 
36  template <class U>
37  explicit Vector2DBase(const Basic2DVector<U>& v) : BaseClass(v) {}
38 
42  Vector2DBase unit() const { return Vector2DBase(this->basicVector().unit()); }
43 
47  template <class U>
49  this->basicVector() += v.basicVector();
50  return *this;
51  }
52 
56  template <class U>
58  this->basicVector() -= v.basicVector();
59  return *this;
60  }
61 
63  Vector2DBase operator-() const { return Vector2DBase(-this->basicVector()); }
64 
67  this->basicVector() *= t;
68  return *this;
69  }
70 
73  this->basicVector() /= t;
74  return *this;
75  }
76 
83  template <class U>
85  return this->basicVector().dot(v.basicVector());
86  }
87 };
88 
90 template <class T, class U, class FrameTag>
92  const Vector2DBase<U, FrameTag>& v2) {
94  return RT(v1.basicVector() + v2.basicVector());
95 }
96 
97 template <class T, class U, class FrameTag>
99  const Vector2DBase<U, FrameTag>& v2) {
101  return RT(v1.basicVector() - v2.basicVector());
102 }
103 
105 template <class T, class U, class FrameTag>
107  const Vector2DBase<U, FrameTag>& v2) {
108  return v1.basicVector() * v2.basicVector();
109 }
110 
114 template <class T, class FrameTag, class Scalar>
116  return Vector2DBase<T, FrameTag>(v.basicVector() * s);
117 }
118 
120 template <class T, class FrameTag, class Scalar>
122  return Vector2DBase<T, FrameTag>(v.basicVector() * s);
123 }
124 
128 template <class T, class FrameTag, class Scalar>
130  return Vector2DBase<T, FrameTag>(v.basicVector() / s);
131 }
132 
133 #endif // GeometryVector_Vector2DBase_h
PV2DBase.h
Vector2DBase::operator/=
Vector2DBase & operator/=(const T &t)
Scaling by a scalar value (division)
Definition: Vector2DBase.h:72
VectorTag.h
Vector2DBase::operator+=
Vector2DBase & operator+=(const Vector2DBase< U, FrameTag > &v)
Definition: Vector2DBase.h:48
Vector2DBase::operator-
Vector2DBase operator-() const
Unary minus, returns a vector with components (-x(),-y())
Definition: Vector2DBase.h:63
Vector2DBase::Vector2DBase
Vector2DBase(const T &x, const T &y)
construct from cartesian coordinates
Definition: Vector2DBase.h:27
Vector2DBase::unit
Vector2DBase unit() const
Definition: Vector2DBase.h:42
operator+
Vector2DBase< typename PreciseFloatType< T, U >::Type, FrameTag > operator+(const Vector2DBase< T, FrameTag > &v1, const Vector2DBase< U, FrameTag > &v2)
vector sum and subtraction of vectors of possibly different precision
Definition: Vector2DBase.h:91
PV2DBase< T, VectorTag, FrameTag >::basicVector
const BasicVectorType & basicVector() const
Definition: PV2DBase.h:37
operator/
Vector2DBase< T, FrameTag > operator/(const Vector2DBase< T, FrameTag > &v, const Scalar &s)
Definition: Vector2DBase.h:129
Vector2DBase::dot
PreciseFloatType< T, U >::Type dot(const Vector2DBase< U, FrameTag > &v) const
Definition: Vector2DBase.h:84
Vector2DBase::operator*=
Vector2DBase & operator*=(const T &t)
Scaling by a scalar value (multiplication)
Definition: Vector2DBase.h:66
Vector2DBase::Vector2DBase
Vector2DBase(const Polar &set)
construct from polar coordinates
Definition: Vector2DBase.h:30
findQualityFiles.v
v
Definition: findQualityFiles.py:179
align::Scalar
double Scalar
Definition: Definitions.h:25
Vector2DBase::Vector2DBase
Vector2DBase(const Vector2DBase< U, FrameTag > &p)
Definition: Vector2DBase.h:24
alignCSCRings.s
s
Definition: alignCSCRings.py:92
Vector2DBase::BasicVectorType
Basic2DVector< T > BasicVectorType
Definition: Vector2DBase.h:11
Geom::Polar2Cartesian
Definition: CoordinateSets.h:14
Vector2DBase::Vector2DBase
Vector2DBase(const Basic2DVector< U > &v)
Definition: Vector2DBase.h:37
Basic2DVector::dot
T dot(const Basic2DVector &lh) const
Scalar product, or "dot" product, with a vector of same type.
Definition: extBasic2DVector.h:126
Vector2DBase
Definition: Vector2DBase.h:8
Vector2DBase::operator-=
Vector2DBase & operator-=(const Vector2DBase< U, FrameTag > &v)
Definition: Vector2DBase.h:57
Vector2DBase::Vector2DBase
Vector2DBase()
Definition: Vector2DBase.h:18
Basic2DVector
Definition: extBasic2DVector.h:15
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
PV2DBase< T, VectorTag, FrameTag >::y
T y() const
Definition: PV2DBase.h:44
Vector2DBase::BaseClass
PV2DBase< T, VectorTag, FrameTag > BaseClass
Definition: Vector2DBase.h:10
PV2DBase< T, VectorTag, FrameTag >::x
T x() const
Definition: PV2DBase.h:43
operator*
PreciseFloatType< T, U >::Type operator*(const Vector2DBase< T, FrameTag > &v1, const Vector2DBase< U, FrameTag > &v2)
scalar product of vectors of possibly different precision
Definition: Vector2DBase.h:106
Vector2DBase::Polar
BaseClass::Polar Polar
Definition: Vector2DBase.h:12
PreciseFloatType::Type
double Type
Definition: PreciseFloatType.h:24
T
long double T
Definition: Basic3DVectorLD.h:48
PV2DBase
Definition: PV2DBase.h:10
operator-
Vector2DBase< typename PreciseFloatType< T, U >::Type, FrameTag > operator-(const Vector2DBase< T, FrameTag > &v1, const Vector2DBase< U, FrameTag > &v2)
Definition: Vector2DBase.h:98
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644