00001 #ifndef GeometryVector_PV3DBase_h 00002 #define GeometryVector_PV3DBase_h 00003 00004 #include "DataFormats/GeometryVector/interface/Basic3DVector.h" 00005 #include <iosfwd> 00006 00014 template <class T, class PVType, class FrameType> 00015 class PV3DBase { 00016 public: 00017 00018 typedef T ScalarType; 00019 typedef Basic3DVector<T> BasicVectorType; 00020 typedef typename BasicVectorType::Cylindrical Cylindrical; 00021 typedef typename BasicVectorType::Spherical Spherical; 00022 typedef typename BasicVectorType::Polar Polar; 00023 00028 PV3DBase() : theVector() {} 00029 00031 PV3DBase(const T & x, const T & y, const T & z) : theVector(x, y, z) {} 00032 00035 PV3DBase( const Cylindrical& set) : theVector( set) {} 00036 00038 PV3DBase( const Polar& set) : theVector( set) {} 00039 00043 PV3DBase( const Geom::Theta<T>& th, 00044 const Geom::Phi<T>& ph, const T& r) : theVector(th,ph,r) {} 00045 00048 template <class U> 00049 explicit PV3DBase( const Basic3DVector<U>& v) : theVector(v) {} 00050 00054 const BasicVectorType& basicVector() const { return theVector;} 00055 00056 T x() const { return basicVector().x();} 00057 T y() const { return basicVector().y();} 00058 T z() const { return basicVector().z();} 00059 00060 T mag2() const { return basicVector().mag2();} 00061 T mag() const { return basicVector().mag();} 00062 T barePhi() const { return basicVector().barePhi();} 00063 Geom::Phi<T> phi() const { return basicVector().phi();} 00064 00065 T perp2() const { return basicVector().perp2();} 00066 T perp() const { return basicVector().perp();} 00067 T transverse() const { return basicVector().transverse();} 00068 T bareTheta() const { return basicVector().bareTheta();} 00069 Geom::Theta<T> theta() const { return basicVector().theta();} 00070 T eta() const { return basicVector().eta();} 00071 00072 protected: 00073 BasicVectorType theVector; 00074 }; 00075 00076 template <class T, class PV, class F> 00077 inline std::ostream & operator<<( std::ostream& s, const PV3DBase<T,PV,F>& v) { 00078 return s << " (" << v.x() << ',' << v.y() << ',' << v.z() << ") "; 00079 } 00080 00081 #endif // GeometryVector_PV3DBase_h