CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 
13  typedef T ScalarType;
15  typedef typename BasicVectorType::Polar Polar;
17 
23 
25  PV2DBase( const T& x, const T& y) : theVector(x,y) {}
26 
28  PV2DBase( const Polar& set) : theVector( set) {}
29 
32  template <class U>
33  explicit PV2DBase( const Basic2DVector<U>& v) : theVector(v) {}
34 
38  const BasicVectorType& basicVector() const { return theVector;}
39 #ifndef __REFLEX__
40  MathVector const & mathVector() const { return theVector.v;}
42 #endif
43 
44 
45  T x() const { return basicVector().x();}
46  T y() const { return basicVector().y();}
47  T mag2() const { return basicVector().mag2();}
48  T r() const { return basicVector().r();}
49  T mag() const { return basicVector().mag();}
50  T barePhi() const { return basicVector().barePhi();}
51  Geom::Phi<T> phi() const { return basicVector().phi();}
52 
53 protected:
54  // required in the implementation of inherited types...
56 
58 
59 };
60 
61 template <class T, class PV, class F>
62 inline std::ostream & operator<<(std::ostream& s, const PV2DBase<T,PV,F>& v) {
63  return s << " (" << v.x() << ',' << v.y() << ") ";
64 }
65 #endif // GeometryVector_PV2DBase_h
MathVector & mathVector()
Definition: PV2DBase.h:41
T y() const
Definition: PV2DBase.h:46
MathVector const & mathVector() const
Definition: PV2DBase.h:40
T mag() const
Definition: PV2DBase.h:49
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:33
BasicVectorType::Polar Polar
Definition: PV2DBase.h:15
T r() const
Definition: PV2DBase.h:48
T mag2() const
Definition: PV2DBase.h:47
BasicVectorType::MathVector MathVector
Definition: PV2DBase.h:16
T barePhi() const
Definition: PV2DBase.h:50
PV2DBase(const Polar &set)
construct from polar coordinates
Definition: PV2DBase.h:28
Geom::Phi< T > phi() const
Definition: PV2DBase.h:51
BasicVectorType & basicVector()
Definition: PV2DBase.h:55
const BasicVectorType & basicVector() const
Definition: PV2DBase.h:38
T y() const
Cartesian y coordinate.
BasicVectorType theVector
Definition: PV2DBase.h:57
T ScalarType
Definition: PV2DBase.h:13
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
Basic2DVector< T > BasicVectorType
Definition: PV2DBase.h:14
Geom::Phi< T > phi() const
T x() const
Definition: PV2DBase.h:45
long double T
Definition: Phi.h:20
T x() const
Cartesian x coordinate.
PV2DBase(const T &x, const T &y)
construct from cartesian coordinates
Definition: PV2DBase.h:25
PV2DBase()
Definition: PV2DBase.h:22