CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PV2DBase.h
Go to the documentation of this file.
1 #ifndef GeometryVector_PV2DBase_h
2 #define GeometryVector_PV2DBase_h
3 
5 
6 #include <iosfwd>
7 #include <ostream>
8 
9 template <class T, class PVType, class FrameType>
10 class PV2DBase {
11 public:
12  typedef T ScalarType;
14  typedef typename BasicVectorType::Polar Polar;
16 
22 
24  PV2DBase(const T& x, const T& y) : theVector(x, y) {}
25 
27  PV2DBase(const Polar& set) : theVector(set) {}
28 
31  template <class U>
32  explicit PV2DBase(const Basic2DVector<U>& v) : theVector(v) {}
33 
37  const BasicVectorType& basicVector() const { return theVector; }
38 #ifndef __REFLEX__
39  MathVector const& mathVector() const { return theVector.v; }
41 #endif
42 
43  T x() const { return basicVector().x(); }
44  T y() const { return basicVector().y(); }
45  T mag2() const { return basicVector().mag2(); }
46  T r() const { return basicVector().r(); }
47  T mag() const { return basicVector().mag(); }
48  T barePhi() const { return basicVector().barePhi(); }
49  Geom::Phi<T> phi() const { return basicVector().phi(); }
50 
51 protected:
52  // required in the implementation of inherited types...
54 
56 };
57 
58 template <class T, class PV, class F>
59 inline std::ostream& operator<<(std::ostream& s, const PV2DBase<T, PV, F>& v) {
60  return s << " (" << v.x() << ',' << v.y() << ") ";
61 }
62 #endif // GeometryVector_PV2DBase_h
MathVector & mathVector()
Definition: PV2DBase.h:40
T y() const
Definition: PV2DBase.h:44
MathVector const & mathVector() const
Definition: PV2DBase.h:39
T mag() const
Definition: PV2DBase.h:47
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
T r() const
Radius, same as mag()
T barePhi() const
PV2DBase(const Basic2DVector< U > &v)
Definition: PV2DBase.h:32
BasicVectorType::Polar Polar
Definition: PV2DBase.h:14
T r() const
Definition: PV2DBase.h:46
T mag2() const
Definition: PV2DBase.h:45
BasicVectorType::MathVector MathVector
Definition: PV2DBase.h:15
T barePhi() const
Definition: PV2DBase.h:48
PV2DBase(const Polar &set)
construct from polar coordinates
Definition: PV2DBase.h:27
Geom::Phi< T > phi() const
Definition: PV2DBase.h:49
BasicVectorType & basicVector()
Definition: PV2DBase.h:53
const BasicVectorType & basicVector() const
Definition: PV2DBase.h:37
T y() const
Cartesian y coordinate.
BasicVectorType theVector
Definition: PV2DBase.h:55
T ScalarType
Definition: PV2DBase.h:12
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
Basic2DVector< T > BasicVectorType
Definition: PV2DBase.h:13
Geom::Phi< T > phi() const
T x() const
Definition: PV2DBase.h:43
long double T
Definition: Phi.h:52
T x() const
Cartesian x coordinate.
PV2DBase(const T &x, const T &y)
construct from cartesian coordinates
Definition: PV2DBase.h:24
PV2DBase()
Definition: PV2DBase.h:21