00001
00002
00004 #ifndef HEPMC_SIMPLEVECTOR_H
00005 #define HEPMC_SIMPLEVECTOR_H
00006
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00024
00025
00026 #include "HepMC/enable_if.h"
00027 #include "HepMC/is_arithmetic.h"
00028
00029
00030 namespace HepMC {
00031
00033
00042 class FourVector {
00043
00044 public:
00045
00047 FourVector( double xin, double yin, double zin, double tin=0)
00048 : m_x(xin), m_y(yin), m_z(zin), m_t(tin) {}
00049
00051 FourVector(double tin)
00052 : m_x(0), m_y(0), m_z(0), m_t(tin) {}
00053
00054 FourVector()
00055 : m_x(0), m_y(0), m_z(0), m_t(0) {}
00056
00059 template <class T >
00060 FourVector( const T& v,
00061 typename detail::disable_if< detail::is_arithmetic<T>::value, void >::type * = 0 )
00062 : m_x(v.x()), m_y(v.y()), m_z(v.z()), m_t(v.t()) {}
00063
00065 FourVector(const FourVector & v)
00066 : m_x(v.x()), m_y(v.y()), m_z(v.z()), m_t(v.t()) {}
00067
00068 void swap( FourVector & other );
00069
00070 double px() const { return m_x; }
00071 double py() const { return m_y; }
00072 double pz() const { return m_z; }
00073 double e() const { return m_t; }
00074
00075 double x() const { return m_x; }
00076 double y() const { return m_y; }
00077 double z() const { return m_z; }
00078 double t() const { return m_t; }
00079
00080 double m2() const;
00081 double m() const;
00082
00083 double perp2() const;
00084 double perp() const;
00085
00086
00087 double theta() const;
00088 double phi() const;
00089 double rho() const;
00090
00091 FourVector & operator = (const FourVector &);
00092
00093 bool operator == (const FourVector &) const;
00094 bool operator != (const FourVector &) const;
00095
00096 double pseudoRapidity() const;
00097 double eta() const;
00098
00100 void set (double x, double y, double z, double t);
00101
00102 void setX(double xin) { m_x=xin; }
00103 void setY(double yin) { m_y=yin; }
00104 void setZ(double zin) { m_z=zin; }
00105 void setT(double tin) { m_t=tin; }
00106
00107 void setPx(double xin) { m_x=xin; }
00108 void setPy(double yin) { m_y=yin; }
00109 void setPz(double zin) { m_z=zin; }
00110 void setE(double tin) { m_t=tin; }
00111
00112 private:
00113
00114 double m_x;
00115 double m_y;
00116 double m_z;
00117 double m_t;
00118
00119 };
00120
00122
00131 class ThreeVector {
00132
00133 public:
00134
00136 ThreeVector( double xin, double yin =0, double zin =0 )
00137 : m_x(xin), m_y(yin), m_z(zin) {}
00138
00139 ThreeVector( )
00140 : m_x(0), m_y(0), m_z(0) {}
00141
00144 template <class T >
00145 ThreeVector( const T& v,
00146 typename detail::disable_if< detail::is_arithmetic<T>::value, void >::type * = 0 )
00147 : m_x(v.x()), m_y(v.y()), m_z(v.z()) {}
00148
00150 ThreeVector(const ThreeVector & v)
00151 : m_x(v.x()), m_y(v.y()), m_z(v.z()) {}
00152
00153 void swap( ThreeVector & other );
00154
00155 double x() const { return m_x; }
00156 double y() const { return m_y; }
00157 double z() const { return m_z; }
00158
00159 void setX(double xin) { m_x=xin; }
00160 void setY(double yin) { m_y=yin; }
00161 void setZ(double zin) { m_z=zin; }
00162 void set( double x, double y, double z);
00163
00164 double phi() const;
00165 double theta() const;
00166 double r() const;
00167
00168 void setPhi(double);
00169 void setTheta(double);
00170
00171 double perp2() const;
00172 double perp() const;
00173
00174 ThreeVector & operator = (const ThreeVector &);
00175
00176 bool operator == (const ThreeVector &) const;
00177 bool operator != (const ThreeVector &) const;
00178
00179 private:
00180
00181 double m_x;
00182 double m_y;
00183 double m_z;
00184
00185 };
00186
00187
00188 }
00189
00190 #include "HepMC/SimpleVector.icc"
00191
00192 #endif // HEPMC_SIMPLEVECTOR_H
00193