CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/DataFormats/GeometryVector/interface/PV2DBase.h

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 #ifndef __REFLEX__
00040   MathVector const & mathVector() const { return theVector.v;}
00041   MathVector & mathVector() { return theVector.v;}
00042 #endif
00043 
00044   
00045   T x() const { return basicVector().x();}
00046   T y() const { return basicVector().y();}
00047   T mag2() const { return basicVector().mag2();}
00048   T r() const    { return basicVector().r();}
00049   T mag() const  { return basicVector().mag();}
00050   T barePhi() const  { return basicVector().barePhi();}
00051   Geom::Phi<T> phi() const { return basicVector().phi();}
00052 
00053 protected:
00054   // required in the implementation of inherited types...
00055   BasicVectorType& basicVector() { return theVector;}
00056 
00057   BasicVectorType theVector;
00058 
00059 };
00060 
00061 template <class T, class PV, class F>
00062 inline std::ostream & operator<<(std::ostream& s, const PV2DBase<T,PV,F>& v) {
00063   return s << " (" << v.x() << ',' << v.y() << ") ";
00064 } 
00065 #endif // GeometryVector_PV2DBase_h