Go to the documentation of this file.00001 #ifndef GeometryVector_PV2DBase_h
00002 #define GeometryVector_PV2DBase_h
00003
00004 #include "DataFormats/GeometryVector/interface/Basic2DVector.h"
00005
00006 #include <iosfwd>
00007 #include <ostream>
00008
00009 template <class T, class PVType, class FrameType>
00010 class PV2DBase {
00011 public:
00012
00013 typedef T ScalarType;
00014 typedef Basic2DVector<T> BasicVectorType;
00015 typedef typename BasicVectorType::Polar Polar;
00016 typedef typename BasicVectorType::MathVector MathVector;
00017
00022 PV2DBase() : theVector() {}
00023
00025 PV2DBase( const T& x, const T& y) : theVector(x,y) {}
00026
00028 PV2DBase( const Polar& set) : theVector( set) {}
00029
00032 template <class U>
00033 explicit PV2DBase( const Basic2DVector<U>& v) : theVector(v) {}
00034
00038 const BasicVectorType& basicVector() const { return theVector;}
00039 MathVector const & mathVector() const { return theVector.v;}
00040 MathVector & mathVector() { return theVector.v;}
00041
00042
00043
00044 T x() const { return basicVector().x();}
00045 T y() const { return basicVector().y();}
00046 T mag2() const { return basicVector().mag2();}
00047 T r() const { return basicVector().r();}
00048 T mag() const { return basicVector().mag();}
00049 T barePhi() const { return basicVector().barePhi();}
00050 Geom::Phi<T> phi() const { return basicVector().phi();}
00051
00052 protected:
00053
00054 BasicVectorType& basicVector() { return theVector;}
00055
00056 BasicVectorType theVector;
00057
00058 };
00059
00060 template <class T, class PV, class F>
00061 inline std::ostream & operator<<(std::ostream& s, const PV2DBase<T,PV,F>& v) {
00062 return s << " (" << v.x() << ',' << v.y() << ") ";
00063 }
00064 #endif // GeometryVector_PV2DBase_h