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  MathVector const & mathVector() const { return theVector.v;}
41 
42 
43 
44  T x() const { return basicVector().x();}
45  T y() const { return basicVector().y();}
46  T mag2() const { return basicVector().mag2();}
47  T r() const { return basicVector().r();}
48  T mag() const { return basicVector().mag();}
49  T barePhi() const { return basicVector().barePhi();}
50  Geom::Phi<T> phi() const { return basicVector().phi();}
51 
52 protected:
53  // required in the implementation of inherited types...
55 
57 
58 };
59 
60 template <class T, class PV, class F>
61 inline std::ostream & operator<<(std::ostream& s, const PV2DBase<T,PV,F>& v) {
62  return s << " (" << v.x() << ',' << v.y() << ") ";
63 }
64 #endif // GeometryVector_PV2DBase_h
MathVector & mathVector()
Definition: PV2DBase.h:40
T y() const
Definition: PV2DBase.h:45
MathVector const & mathVector() const
Definition: PV2DBase.h:39
T mag() const
Definition: PV2DBase.h:48
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:47
T mag2() const
Definition: PV2DBase.h:46
BasicVectorType::MathVector MathVector
Definition: PV2DBase.h:16
T barePhi() const
Definition: PV2DBase.h:49
PV2DBase(const Polar &set)
construct from polar coordinates
Definition: PV2DBase.h:28
Geom::Phi< T > phi() const
Definition: PV2DBase.h:50
BasicVectorType & basicVector()
Definition: PV2DBase.h:54
const BasicVectorType & basicVector() const
Definition: PV2DBase.h:38
T y() const
Cartesian y coordinate.
BasicVectorType theVector
Definition: PV2DBase.h:56
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:44
long double T
Definition: Phi.h:20
mathSSE::Vec4< T > v
mathSSE::Vec2< T > v
T x() const
Cartesian x coordinate.
PV2DBase(const T &x, const T &y)
construct from cartesian coordinates
Definition: PV2DBase.h:25
void set(const std::string &name, int value)
set the flag, with a run-time name
PV2DBase()
Definition: PV2DBase.h:22