CMS 3D CMS Logo

Vector3DBase.h
Go to the documentation of this file.
1 #ifndef GeometryVector_Vector3DBase_h
2 #define GeometryVector_Vector3DBase_h
3 
6 
7 template <class T, class FrameTag>
8 class Vector3DBase : public PV3DBase<T, VectorTag, FrameTag> {
9 public:
13  typedef typename BaseClass::Spherical Spherical;
14  typedef typename BaseClass::Polar Polar;
16 
22 
26  template <class U>
28 
30  Vector3DBase(const T& x, const T& y, const T& z) : BaseClass(x, y, z) {}
31 
34  explicit Vector3DBase(const Cylindrical& set) : BaseClass(set) {}
35 
37  explicit Vector3DBase(const Polar& set) : BaseClass(set) {}
38 
42  Vector3DBase(const Geom::Theta<T>& th, const Geom::Phi<T>& ph, const T& r) : BaseClass(th, ph, r) {}
43 
48  template <class U>
49  explicit Vector3DBase(const Basic3DVector<U>& v) : BaseClass(v) {}
50 
54  Vector3DBase unit() const { return Vector3DBase(this->basicVector().unit()); }
55 
56  // equality
57  bool operator==(const Vector3DBase& rh) const { return this->basicVector() == rh.basicVector(); }
58 
62  template <class U>
64  this->theVector += v.basicVector();
65  return *this;
66  }
67 
71  template <class U>
73  this->theVector -= v.basicVector();
74  return *this;
75  }
76 
78  Vector3DBase operator-() const { return Vector3DBase(-this->basicVector()); }
79 
82  this->theVector *= t;
83  return *this;
84  }
85 
88  this->theVector /= t;
89  return *this;
90  }
91 
98  template <class U>
100  return this->theVector.dot(v.basicVector());
101  }
102 
109  template <class U>
112  return RT(this->theVector.cross(v.basicVector()));
113  }
114 };
115 
117 template <class T, class U, class FrameTag>
119  const Vector3DBase<U, FrameTag>& v2) {
121  return RT(v1.basicVector() + v2.basicVector());
122 }
123 
124 template <class T, class U, class FrameTag>
126  const Vector3DBase<U, FrameTag>& v2) {
128  return RT(v1.basicVector() - v2.basicVector());
129 }
130 
132 template <class T, class U, class FrameTag>
134  const Vector3DBase<U, FrameTag>& v2) {
135  return v1.basicVector() * v2.basicVector();
136 }
137 
141 template <class T, class FrameTag, class Scalar>
143  return Vector3DBase<T, FrameTag>(v.basicVector() * s);
144 }
145 
147 template <class T, class FrameTag, class Scalar>
149  return Vector3DBase<T, FrameTag>(v.basicVector() * s);
150 }
151 
155 template <class T, class FrameTag, class Scalar>
157  return Vector3DBase<T, FrameTag>(v.basicVector() / s);
158 }
159 
160 #endif // GeometryVector_Vector3DBase_h
Vector3DBase
Definition: Vector3DBase.h:8
Vector3DBase::Vector3DBase
Vector3DBase(const T &x, const T &y, const T &z)
construct from cartesian coordinates
Definition: Vector3DBase.h:30
Vector3DBase::Vector3DBase
Vector3DBase()
Definition: Vector3DBase.h:21
PV3DBase.h
Vector3DBase::Cylindrical
BaseClass::Cylindrical Cylindrical
Definition: Vector3DBase.h:12
Vector3DBase::Vector3DBase
Vector3DBase(const Vector3DBase< U, FrameTag > &v)
Definition: Vector3DBase.h:27
PV3DBase< T, VectorTag, FrameTag >::x
T x() const
Definition: PV3DBase.h:59
VectorTag.h
Vector3DBase::Vector3DBase
Vector3DBase(const Basic3DVector< U > &v)
Definition: Vector3DBase.h:49
Geom::Theta
Definition: Theta.h:12
Geom::Spherical2Cartesian
Definition: CoordinateSets.h:58
PV3DBase< T, VectorTag, FrameTag >::theVector
BasicVectorType theVector
Definition: PV3DBase.h:76
PV3DBase
Definition: PV3DBase.h:15
findQualityFiles.v
v
Definition: findQualityFiles.py:179
Vector3DBase::operator-=
Vector3DBase & operator-=(const Vector3DBase< U, FrameTag > &v)
Definition: Vector3DBase.h:72
align::Scalar
double Scalar
Definition: Definitions.h:25
Vector3DBase::Vector3DBase
Vector3DBase(const Geom::Theta< T > &th, const Geom::Phi< T > &ph, const T &r)
Definition: Vector3DBase.h:42
PV3DBase< T, VectorTag, FrameTag >::z
T z() const
Definition: PV3DBase.h:61
alignCSCRings.s
s
Definition: alignCSCRings.py:92
Vector3DBase::unit
Vector3DBase unit() const
Definition: Vector3DBase.h:54
operator-
Vector3DBase< typename PreciseFloatType< T, U >::Type, FrameTag > operator-(const Vector3DBase< T, FrameTag > &v1, const Vector3DBase< U, FrameTag > &v2)
Definition: Vector3DBase.h:125
Vector3DBase::Polar
BaseClass::Polar Polar
Definition: Vector3DBase.h:14
Basic3DVector::cross
Basic3DVector cross(const Basic3DVector &lh) const
Vector product, or "cross" product, with a vector of same type.
Definition: extBasic3DVector.h:203
Geom::Cylindrical2Cartesian
Definition: CoordinateSets.h:34
Basic3DVector::dot
T dot(const Basic3DVector &rh) const
Scalar product, or "dot" product, with a vector of same type.
Definition: extBasic3DVector.h:189
Vector3DBase::operator-
Vector3DBase operator-() const
Unary minus, returns a vector with components (-x(),-y(),-z())
Definition: Vector3DBase.h:78
PV3DBase< T, VectorTag, FrameTag >::y
T y() const
Definition: PV3DBase.h:60
operator/
Vector3DBase< T, FrameTag > operator/(const Vector3DBase< T, FrameTag > &v, const Scalar &s)
Definition: Vector3DBase.h:156
Vector3DBase::operator==
bool operator==(const Vector3DBase &rh) const
Definition: Vector3DBase.h:57
Vector3DBase::cross
Vector3DBase< typename PreciseFloatType< T, U >::Type, FrameTag > cross(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:110
Geom::Phi
Definition: Phi.h:52
PreciseFloatType::Type
double Type
Definition: PreciseFloatType.h:24
Vector3DBase::operator*=
Vector3DBase & operator*=(const T &t)
Scaling by a scalar value (multiplication)
Definition: Vector3DBase.h:81
Vector3DBase::dot
PreciseFloatType< T, U >::Type dot(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:99
Vector3DBase::Vector3DBase
Vector3DBase(const Cylindrical &set)
Definition: Vector3DBase.h:34
PV3DBase< T, VectorTag, FrameTag >::basicVector
const BasicVectorType & basicVector() const
Definition: PV3DBase.h:53
operator+
Vector3DBase< typename PreciseFloatType< T, U >::Type, FrameTag > operator+(const Vector3DBase< T, FrameTag > &v1, const Vector3DBase< U, FrameTag > &v2)
vector sum and subtraction of vectors of possibly different precision
Definition: Vector3DBase.h:118
alignCSCRings.r
r
Definition: alignCSCRings.py:93
Vector3DBase::BasicVectorType
BaseClass::BasicVectorType BasicVectorType
Definition: Vector3DBase.h:15
operator*
PreciseFloatType< T, U >::Type operator*(const Vector3DBase< T, FrameTag > &v1, const Vector3DBase< U, FrameTag > &v2)
scalar product of vectors of possibly different precision
Definition: Vector3DBase.h:133
Vector3DBase::BaseClass
PV3DBase< T, VectorTag, FrameTag > BaseClass
Definition: Vector3DBase.h:10
T
long double T
Definition: Basic3DVectorLD.h:48
Vector3DBase::Spherical
BaseClass::Spherical Spherical
Definition: Vector3DBase.h:13
Vector3DBase::Vector3DBase
Vector3DBase(const Polar &set)
construct from polar coordinates
Definition: Vector3DBase.h:37
Vector3DBase::operator/=
Vector3DBase & operator/=(const T &t)
Scaling by a scalar value (division)
Definition: Vector3DBase.h:87
Vector3DBase::VectorType
Vector3DBase< T, FrameTag > VectorType
Definition: Vector3DBase.h:11
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
Basic3DVector< Scalar >
Vector3DBase::operator+=
Vector3DBase & operator+=(const Vector3DBase< U, FrameTag > &v)
Definition: Vector3DBase.h:63