File indexing completed on 2024-04-06 12:04:16
0001 #ifndef GeometryVector_PV3DBase_h
0002 #define GeometryVector_PV3DBase_h
0003
0004 #include "DataFormats/GeometryVector/interface/Basic3DVector.h"
0005 #include <iosfwd>
0006
0007
0008
0009
0010
0011
0012
0013
0014 template <class T, class PVType, class FrameType>
0015 class PV3DBase {
0016 public:
0017 typedef T ScalarType;
0018 typedef Basic3DVector<T> BasicVectorType;
0019 typedef typename BasicVectorType::Cylindrical Cylindrical;
0020 typedef typename BasicVectorType::Spherical Spherical;
0021 typedef typename BasicVectorType::Polar Polar;
0022 typedef typename BasicVectorType::MathVector MathVector;
0023
0024
0025
0026
0027
0028 PV3DBase() : theVector() {}
0029
0030
0031 PV3DBase(const T& x, const T& y, const T& z) : theVector(x, y, z) {}
0032
0033
0034
0035 PV3DBase(const Cylindrical& set) : theVector(set) {}
0036
0037
0038 PV3DBase(const Polar& set) : theVector(set) {}
0039
0040
0041
0042
0043 PV3DBase(const Geom::Theta<T>& th, const Geom::Phi<T>& ph, const T& r) : theVector(th, ph, r) {}
0044
0045
0046
0047 template <class U>
0048 explicit PV3DBase(const Basic3DVector<U>& v) : theVector(v) {}
0049
0050
0051
0052
0053 const BasicVectorType& basicVector() const { return theVector; }
0054 #ifndef __REFLEX__
0055 MathVector const& mathVector() const { return theVector.v; }
0056 MathVector& mathVector() { return theVector.v; }
0057 #endif
0058
0059 T x() const { return basicVector().x(); }
0060 T y() const { return basicVector().y(); }
0061 T z() const { return basicVector().z(); }
0062
0063 T mag2() const { return basicVector().mag2(); }
0064 T mag() const { return basicVector().mag(); }
0065 T barePhi() const { return basicVector().barePhi(); }
0066 Geom::Phi<T> phi() const { return basicVector().phi(); }
0067
0068 T perp2() const { return basicVector().perp2(); }
0069 T perp() const { return basicVector().perp(); }
0070 T transverse() const { return basicVector().transverse(); }
0071 T bareTheta() const { return basicVector().bareTheta(); }
0072 Geom::Theta<T> theta() const { return basicVector().theta(); }
0073 T eta() const { return basicVector().eta(); }
0074
0075 protected:
0076 BasicVectorType theVector;
0077 };
0078
0079 template <class T, class PV, class F>
0080 inline std::ostream& operator<<(std::ostream& s, const PV3DBase<T, PV, F>& v) {
0081 return s << v.basicVector();
0082 }
0083
0084 #endif