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
00021 PV2DBase() : theVector() {}
00022
00024 PV2DBase( const T& x, const T& y) : theVector(x,y) {}
00025
00027 PV2DBase( const Polar& set) : theVector( set) {}
00028
00031 template <class U>
00032 explicit PV2DBase( const Basic2DVector<U>& v) : theVector(v) {}
00033
00037 const BasicVectorType& basicVector() const { return theVector;}
00038
00039 T x() const { return basicVector().x();}
00040 T y() const { return basicVector().y();}
00041 T mag2() const { return basicVector().mag2();}
00042 T r() const { return basicVector().r();}
00043 T mag() const { return basicVector().mag();}
00044 T barePhi() const { return basicVector().barePhi();}
00045 Geom::Phi<T> phi() const { return basicVector().phi();}
00046
00047 protected:
00048
00049 BasicVectorType& basicVector() { return theVector;}
00050
00051 BasicVectorType theVector;
00052
00053 };
00054
00055 template <class T, class PV, class F>
00056 inline std::ostream & operator<<(std::ostream& s, const PV2DBase<T,PV,F>& v) {
00057 return s << " (" << v.x() << ',' << v.y() << ") ";
00058 }
00059 #endif // GeometryVector_PV2DBase_h