CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/DataFormats/GeometryVector/interface/PV3DBase.h

Go to the documentation of this file.
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   typedef typename BasicVectorType::MathVector  MathVector;
00024 
00025 
00030   PV3DBase() : theVector() {}
00031 
00033   PV3DBase(const T & x, const T & y, const T & z) : theVector(x, y, z) {}
00034 
00037   PV3DBase( const Cylindrical& set) : theVector( set) {}
00038 
00040   PV3DBase( const Polar& set) : theVector( set) {}
00041 
00045   PV3DBase( const Geom::Theta<T>& th, 
00046             const Geom::Phi<T>& ph, const T& r) : theVector(th,ph,r) {}
00047 
00050   template <class U>
00051   explicit PV3DBase( const Basic3DVector<U>& v) : theVector(v) {}
00052 
00056   const BasicVectorType& basicVector() const { return theVector;}
00057   MathVector const & mathVector() const { return theVector.v;}
00058   MathVector & mathVector() { return theVector.v;}
00059   
00060 
00061   T x() const { return basicVector().x();}
00062   T y() const { return basicVector().y();}
00063   T z() const { return basicVector().z();}
00064 
00065   T mag2() const { return basicVector().mag2();}
00066   T mag() const  { return basicVector().mag();}
00067   T barePhi() const  { return basicVector().barePhi();}
00068   Geom::Phi<T> phi() const  { return basicVector().phi();}
00069 
00070   T perp2() const { return basicVector().perp2();}
00071   T perp() const  { return basicVector().perp();}
00072   T transverse() const  { return basicVector().transverse();}
00073   T bareTheta() const { return basicVector().bareTheta();}
00074   Geom::Theta<T> theta() const { return basicVector().theta();}
00075   T eta() const   { return basicVector().eta();}
00076 
00077 protected:
00078   BasicVectorType theVector;
00079 };
00080 
00081 template <class T, class PV, class F>
00082 inline std::ostream & operator<<( std::ostream& s, const PV3DBase<T,PV,F>& v) {
00083   return s << v.basicVector();
00084 } 
00085 
00086 #endif // GeometryVector_PV3DBase_h