hepmc - Diff between revs 147 and 209
Subversion Repositories:
| Rev 147 | Rev 209 | |||
|---|---|---|---|---|
| Line 42... | Line 42... | |||
| 42 | class FourVector { | 42 | class FourVector { | |
| 43 | 43 | |||
| 44 | public: | 44 | public: | |
| 45 | 45 | |||
| 46 | /// constructor requiring at least x, y, and z | 46 | /// constructor requiring at least x, y, and z | |
| 47 | inline FourVector( double xin, double yin, double zin, double tin=0) | - | ||
| - | 47 | FourVector( double xin, double yin, double zin, double tin=0) | ||
| 48 | : m_x(xin), m_y(yin), m_z(zin), m_t(tin) {} | 48 | : m_x(xin), m_y(yin), m_z(zin), m_t(tin) {} | |
| 49 | 49 | |||
| 50 | /// constructor requiring only t | 50 | /// constructor requiring only t | |
| 51 | inline FourVector(double t) | - | ||
| - | 51 | FourVector(double t) | ||
| 52 | : m_x(0), m_y(0), m_z(0), m_t(t) {} | 52 | : m_x(0), m_y(0), m_z(0), m_t(t) {} | |
| 53 | 53 | |||
| 54 | inline FourVector() | - | ||
| - | 54 | FourVector() | ||
| 55 | : m_x(0), m_y(0), m_z(0), m_t(0) {} | 55 | : m_x(0), m_y(0), m_z(0), m_t(0) {} | |
| 56 | 56 | |||
| 57 | /// templated constructor | 57 | /// templated constructor | |
| 58 | /// this is used ONLY if T is not arithmetic | 58 | /// this is used ONLY if T is not arithmetic | |
| 59 | template <class T > | 59 | template <class T > | |
| 60 | inline FourVector( const T& v, | - | ||
| - | 60 | FourVector( const T& v, | ||
| 61 | typename detail::disable_if< detail::is_arithmetic<T>::value, void >::type * = 0 ) | 61 | typename detail::disable_if< detail::is_arithmetic<T>::value, void >::type * = 0 ) | |
| 62 | : m_x(v.x()), m_y(v.y()), m_z(v.z()), m_t(v.t()) {} | 62 | : m_x(v.x()), m_y(v.y()), m_z(v.z()), m_t(v.t()) {} | |
| 63 | 63 | |||
| 64 | /// copy constructor | 64 | /// copy constructor | |
| 65 | inline FourVector(const FourVector & v) | - | ||
| - | 65 | FourVector(const FourVector & v) | ||
| 66 | : m_x(v.x()), m_y(v.y()), m_z(v.z()), m_t(v.t()) {} | 66 | : m_x(v.x()), m_y(v.y()), m_z(v.z()), m_t(v.t()) {} | |
| 67 | 67 | |||
| 68 | void swap( FourVector & other ); //!< swap | 68 | void swap( FourVector & other ); //!< swap | |
| 69 | 69 | |||
| 70 | inline double px() const { return m_x; } //!< return px | - | ||
| 71 | inline double py() const { return m_y; } //!< return py | - | ||
| 72 | inline double pz() const { return m_z; } //!< return pz | - | ||
| 73 | inline double e() const { return m_t; } //!< return E | - | ||
| - | 70 | double px() const { return m_x; } //!< return px | ||
| - | 71 | double py() const { return m_y; } //!< return py | ||
| - | 72 | double pz() const { return m_z; } //!< return pz | ||
| - | 73 | double e() const { return m_t; } //!< return E | ||
| 74 | 74 | |||
| 75 | inline double x() const { return m_x; } //!< return x | - | ||
| 76 | inline double y() const { return m_y; } //!< return y | - | ||
| 77 | inline double z() const { return m_z; } //!< return z | - | ||
| 78 | inline double t() const { return m_t; } //!< return t | - | ||
| - | 75 | double x() const { return m_x; } //!< return x | ||
| - | 76 | double y() const { return m_y; } //!< return y | ||
| - | 77 | double z() const { return m_z; } //!< return z | ||
| - | 78 | double t() const { return m_t; } //!< return t | ||
| 79 | 79 | |||
| 80 | inline double m2() const; //!< Invariant mass squared. | - | ||
| 81 | inline double m() const; //!< Invariant mass. If m2() is negative then -sqrt(-m2()) is returned. | - | ||
| - | 80 | double m2() const; //!< Invariant mass squared. | ||
| - | 81 | double m() const; //!< Invariant mass. If m2() is negative then -sqrt(-m2()) is returned. | ||
| 82 | 82 | |||
| 83 | inline double perp2() const; //!< Transverse component of the spatial vector squared. | - | ||
| 84 | inline double perp() const; //!< Transverse component of the spatial vector (R in cylindrical system). | - | ||
| 85 | inline double mag() const; //!< Magnitude of the spatial vector | - | ||
| - | 83 | double perp2() const; //!< Transverse component of the spatial vector squared. | ||
| - | 84 | double perp() const; //!< Transverse component of the spatial vector (R in cylindrical system). | ||
| - | 85 | double mag() const; //!< Magnitude of the spatial vector | ||
| 86 | 86 | |||
| 87 | // Get spatial vector components in spherical coordinate system. | 87 | // Get spatial vector components in spherical coordinate system. | |
| 88 | inline double theta() const; //!< The polar angle. | - | ||
| 89 | inline double phi() const; //!< The azimuth angle. | - | ||
| 90 | inline double rho() const; //!< spatial vector component magnitude | - | ||
| - | 88 | double theta() const; //!< The polar angle. | ||
| - | 89 | double phi() const; //!< The azimuth angle. | ||
| - | 90 | double rho() const; //!< spatial vector component magnitude | ||
| 91 | 91 | |||
| 92 | inline FourVector & operator = (const FourVector &); //!< make a copy | - | ||
| - | 92 | FourVector & operator = (const FourVector &); //!< make a copy | ||
| 93 | 93 | |||
| 94 | inline bool operator == (const FourVector &) const; //!< equality | - | ||
| 95 | inline bool operator != (const FourVector &) const; //!< inequality | - | ||
| - | 94 | bool operator == (const FourVector &) const; //!< equality | ||
| - | 95 | bool operator != (const FourVector &) const; //!< inequality | ||
| 96 | 96 | |||
| 97 | inline double pseudoRapidity() const; //!< Returns the pseudo-rapidity, i.e. -ln(tan(theta/2)) | - | ||
| 98 | inline double eta() const; //!< Pseudorapidity (of the space part) | - | ||
| - | 97 | double pseudoRapidity() const; //!< Returns the pseudo-rapidity, i.e. -ln(tan(theta/2)) | ||
| - | 98 | double eta() const; //!< Pseudorapidity (of the space part) | ||
| 99 | 99 | |||
| 100 | /// set x, y, z, and t | 100 | /// set x, y, z, and t | |
| 101 | inline void set (double x, double y, double z, double t); | - | ||
| - | 101 | void set (double x, double y, double z, double t); | ||
| 102 | 102 | |||
| 103 | inline void setX(double x) { m_x=x; } //!< set x | - | ||
| 104 | inline void setY(double y) { m_y=y; } //!< set y | - | ||
| 105 | inline void setZ(double z) { m_z=z; } //!< set z | - | ||
| 106 | inline void setT(double t) { m_t=t; } //!< set t | - | ||
| - | 103 | void setX(double x) { m_x=x; } //!< set x | ||
| - | 104 | void setY(double y) { m_y=y; } //!< set y | ||
| - | 105 | void setZ(double z) { m_z=z; } //!< set z | ||
| - | 106 | void setT(double t) { m_t=t; } //!< set t | ||
| 107 | 107 | |||
| 108 | inline void setPx(double x) { m_x=x; } //!< set px | - | ||
| 109 | inline void setPy(double y) { m_y=y; } //!< set py | - | ||
| 110 | inline void setPz(double z) { m_z=z; } //!< set pz | - | ||
| 111 | inline void setE(double t) { m_t=t; } //!< set E | - | ||
| - | 108 | void setPx(double x) { m_x=x; } //!< set px | ||
| - | 109 | void setPy(double y) { m_y=y; } //!< set py | ||
| - | 110 | void setPz(double z) { m_z=z; } //!< set pz | ||
| - | 111 | void setE(double t) { m_t=t; } //!< set E | ||
| - | 112 | |||
| - | 113 | // simple math | ||
| - | 114 | FourVector operator + (const FourVector &) const; //!< addition | ||
| - | 115 | FourVector & operator += (const FourVector &); //!< addition | ||
| - | 116 | FourVector operator - (const FourVector &) const; //!< subtraction | ||
| - | 117 | FourVector & operator -= (const FourVector &); //!< subtraction | ||
| - | 118 | FourVector operator - () const; //!< unary minus | ||
| - | 119 | FourVector & operator *= (double); //!< scale | ||
| 112 | 120 | |||
| 113 | private: | 121 | private: | |
| 114 | 122 | |||
| 115 | double m_x; | 123 | double m_x; | |
| 116 | double m_y; | 124 | double m_y; | |
| Line 132... | Line 140... | |||
| 132 | class ThreeVector { | 140 | class ThreeVector { | |
| 133 | 141 | |||
| 134 | public: | 142 | public: | |
| 135 | 143 | |||
| 136 | /// construct using x, y, and z (only x is required) | 144 | /// construct using x, y, and z (only x is required) | |
| 137 | inline ThreeVector( double xin, double yin =0, double zin =0 ) | - | ||
| - | 145 | ThreeVector( double xin, double yin =0, double zin =0 ) | ||
| 138 | : m_x(xin), m_y(yin), m_z(zin) {} | 146 | : m_x(xin), m_y(yin), m_z(zin) {} | |
| 139 | 147 | |||
| 140 | inline ThreeVector( ) | - | ||
| - | 148 | ThreeVector( ) | ||
| 141 | : m_x(0), m_y(0), m_z(0) {} | 149 | : m_x(0), m_y(0), m_z(0) {} | |
| 142 | 150 | |||
| 143 | /// templated constructor | 151 | /// templated constructor | |
| 144 | /// this is used ONLY if T is not arithmetic | 152 | /// this is used ONLY if T is not arithmetic | |
| 145 | template <class T > | 153 | template <class T > | |
| 146 | inline ThreeVector( const T& v, | - | ||
| - | 154 | ThreeVector( const T& v, | ||
| 147 | typename detail::disable_if< detail::is_arithmetic<T>::value, void >::type * = 0 ) | 155 | typename detail::disable_if< detail::is_arithmetic<T>::value, void >::type * = 0 ) | |
| 148 | : m_x(v.x()), m_y(v.y()), m_z(v.z()) {} | 156 | : m_x(v.x()), m_y(v.y()), m_z(v.z()) {} | |
| 149 | 157 | |||
| 150 | /// copy constructor | 158 | /// copy constructor | |
| 151 | inline ThreeVector(const ThreeVector & v) | - | ||
| - | 159 | ThreeVector(const ThreeVector & v) | ||
| 152 | : m_x(v.x()), m_y(v.y()), m_z(v.z()) {} | 160 | : m_x(v.x()), m_y(v.y()), m_z(v.z()) {} | |
| 153 | 161 | |||
| 154 | void swap( ThreeVector & other ); //!< swap | 162 | void swap( ThreeVector & other ); //!< swap | |
| 155 | 163 | |||
| 156 | inline double x() const { return m_x; } //!< return x | - | ||
| 157 | inline double y() const { return m_y; } //!< return y | - | ||
| 158 | inline double z() const { return m_z; } //!< return z | - | ||
| - | 164 | double x() const { return m_x; } //!< return x | ||
| - | 165 | double y() const { return m_y; } //!< return y | ||
| - | 166 | double z() const { return m_z; } //!< return z | ||
| - | 167 | |||
| - | 168 | void setX(double x) { m_x=x; } //!< set x | ||
| - | 169 | void setY(double y) { m_y=y; } //!< set y | ||
| - | 170 | void setZ(double z) { m_z=z; } //!< set z | ||
| - | 171 | void set( double x, double y, double z); //!< set x, y, and z | ||
| 159 | 172 | |||
| 160 | inline void setX(double x) { m_x=x; } //!< set x | - | ||
| 161 | inline void setY(double y) { m_y=y; } //!< set y | - | ||
| 162 | inline void setZ(double z) { m_z=z; } //!< set z | - | ||
| 163 | inline void set( double x, double y, double z); //!< set x, y, and z | - | ||
| - | 173 | double phi() const; //!< The azimuth angle. | ||
| - | 174 | double theta() const; //!< The polar angle. | ||
| - | 175 | double r() const; //!< The magnitude | ||
| 164 | 176 | |||
| 165 | inline double phi() const; //!< The azimuth angle. | - | ||
| 166 | inline double theta() const; //!< The polar angle. | - | ||
| 167 | inline double r() const; //!< The magnitude | - | ||
| - | 177 | double mag() const; //!< The magnitude (r in spherical coordinate system). | ||
| 168 | 178 | |||
| 169 | inline double mag() const; //!< The magnitude (r in spherical coordinate system). | - | ||
| - | 179 | void setPhi(double); //!< Set phi keeping mag and theta constant (BaBar). | ||
| - | 180 | void setTheta(double); //!< Set theta keeping mag and phi constant (BaBar). | ||
| 170 | 181 | |||
| 171 | inline void setPhi(double); //!< Set phi keeping mag and theta constant (BaBar). | - | ||
| 172 | inline void setTheta(double); //!< Set theta keeping mag and phi constant (BaBar). | - | ||
| - | 182 | double perp2() const; //!< The transverse component squared (rho^2 in cylindrical coordinate system). | ||
| - | 183 | double perp() const; //!< The transverse component (rho in cylindrical coordinate system). | ||
| 173 | 184 | |||
| 174 | inline double perp2() const; //!< The transverse component squared (rho^2 in cylindrical coordinate system). | - | ||
| 175 | inline double perp() const; //!< The transverse component (rho in cylindrical coordinate system). | - | ||
| - | 185 | ThreeVector & operator = (const ThreeVector &); //!< make a copy | ||
| 176 | 186 | |||
| 177 | inline ThreeVector & operator = (const ThreeVector &); //!< make a copy | - | ||
| - | 187 | bool operator == (const ThreeVector &) const; //!< equality | ||
| - | 188 | bool operator != (const ThreeVector &) const; //!< inequality | ||
| 178 | 189 | |||
| 179 | inline bool operator == (const ThreeVector &) const; //!< equality | - | ||
| 180 | inline bool operator != (const ThreeVector &) const; //!< inequality | - | ||
| - | 190 | // simple math | ||
| - | 191 | ThreeVector operator + (const ThreeVector &) const; //!< addition | ||
| - | 192 | ThreeVector & operator += (const ThreeVector &); //!< addition | ||
| - | 193 | ThreeVector operator - (const ThreeVector &) const; //!< subtraction | ||
| - | 194 | ThreeVector & operator -= (const ThreeVector &); //!< subtraction | ||
| - | 195 | ThreeVector operator - () const; //!< unary minus | ||
| - | 196 | ThreeVector & operator *= (double); //!< scale | ||
| 181 | 197 | |||
| 182 | private: | 198 | private: | |
| 183 | 199 | |||
| 184 | double m_x; | 200 | double m_x; | |
| 185 | double m_y; | 201 | double m_y; | |
