File indexing completed on 2025-01-18 10:01:10
0001
0002
0003
0004 #ifndef HEPMC_SIMPLEVECTOR_H
0005 #define HEPMC_SIMPLEVECTOR_H
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 #include "HepMC/enable_if.h"
0027 #include "HepMC/is_arithmetic.h"
0028
0029
0030 namespace HepMC {
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042 class FourVector {
0043
0044 public:
0045
0046
0047 FourVector( double xin, double yin, double zin, double tin=0)
0048 : m_x(xin), m_y(yin), m_z(zin), m_t(tin) {}
0049
0050
0051 FourVector(double tin)
0052 : m_x(0), m_y(0), m_z(0), m_t(tin) {}
0053
0054 FourVector()
0055 : m_x(0), m_y(0), m_z(0), m_t(0) {}
0056
0057
0058
0059 template <class T >
0060 FourVector( const T& v,
0061 typename detail::disable_if< detail::is_arithmetic<T>::value, void >::type * = 0 )
0062 : m_x(v.x()), m_y(v.y()), m_z(v.z()), m_t(v.t()) {}
0063
0064
0065 FourVector(const FourVector & v)
0066 : m_x(v.x()), m_y(v.y()), m_z(v.z()), m_t(v.t()) {}
0067
0068 void swap( FourVector & other );
0069
0070 double px() const { return m_x; }
0071 double py() const { return m_y; }
0072 double pz() const { return m_z; }
0073 double e() const { return m_t; }
0074
0075 double x() const { return m_x; }
0076 double y() const { return m_y; }
0077 double z() const { return m_z; }
0078 double t() const { return m_t; }
0079
0080 double m2() const;
0081 double m() const;
0082
0083 double perp2() const;
0084 double perp() const;
0085
0086
0087 double theta() const;
0088 double phi() const;
0089 double rho() const;
0090
0091 FourVector & operator = (const FourVector &);
0092
0093 bool operator == (const FourVector &) const;
0094 bool operator != (const FourVector &) const;
0095
0096 double pseudoRapidity() const;
0097 double eta() const;
0098
0099
0100 void set (double x, double y, double z, double t);
0101
0102 void setX(double xin) { m_x=xin; }
0103 void setY(double yin) { m_y=yin; }
0104 void setZ(double zin) { m_z=zin; }
0105 void setT(double tin) { m_t=tin; }
0106
0107 void setPx(double xin) { m_x=xin; }
0108 void setPy(double yin) { m_y=yin; }
0109 void setPz(double zin) { m_z=zin; }
0110 void setE(double tin) { m_t=tin; }
0111
0112 private:
0113
0114 double m_x;
0115 double m_y;
0116 double m_z;
0117 double m_t;
0118
0119 };
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131 class ThreeVector {
0132
0133 public:
0134
0135
0136 ThreeVector( double xin, double yin =0, double zin =0 )
0137 : m_x(xin), m_y(yin), m_z(zin) {}
0138
0139 ThreeVector( )
0140 : m_x(0), m_y(0), m_z(0) {}
0141
0142
0143
0144 template <class T >
0145 ThreeVector( const T& v,
0146 typename detail::disable_if< detail::is_arithmetic<T>::value, void >::type * = 0 )
0147 : m_x(v.x()), m_y(v.y()), m_z(v.z()) {}
0148
0149
0150 ThreeVector(const ThreeVector & v)
0151 : m_x(v.x()), m_y(v.y()), m_z(v.z()) {}
0152
0153 void swap( ThreeVector & other );
0154
0155 double x() const { return m_x; }
0156 double y() const { return m_y; }
0157 double z() const { return m_z; }
0158
0159 void setX(double xin) { m_x=xin; }
0160 void setY(double yin) { m_y=yin; }
0161 void setZ(double zin) { m_z=zin; }
0162 void set( double x, double y, double z);
0163
0164 double phi() const;
0165 double theta() const;
0166 double r() const;
0167
0168 void setPhi(double);
0169 void setTheta(double);
0170
0171 double perp2() const;
0172 double perp() const;
0173
0174 ThreeVector & operator = (const ThreeVector &);
0175
0176 bool operator == (const ThreeVector &) const;
0177 bool operator != (const ThreeVector &) const;
0178
0179 private:
0180
0181 double m_x;
0182 double m_y;
0183 double m_z;
0184
0185 };
0186
0187
0188 }
0189
0190 #include "HepMC/SimpleVector.icc"
0191
0192 #endif
0193