File indexing completed on 2026-08-06 09:38:33
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef ThePEG_Lorentz5Vector_H
0010 #define ThePEG_Lorentz5Vector_H
0011
0012
0013
0014 #include "LorentzVector.h"
0015 #include "Lorentz5Vector.fh"
0016 #include "ThePEG/Utilities/Maths.h"
0017 #include "ThePEG/Utilities/Direction.h"
0018 #include "ThePEG/Utilities/UnitIO.h"
0019 #include "LorentzRotation.h"
0020
0021 namespace ThePEG {
0022
0023 template <typename Value>
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042 class Lorentz5Vector: public LorentzVector<Value> {
0043
0044 public:
0045
0046
0047 using Value2 = decltype(sqr(std::declval<Value>()));
0048
0049 public:
0050
0051
0052 Value x() const { return LorentzVector<Value>::x(); }
0053 Value y() const { return LorentzVector<Value>::y(); }
0054 Value z() const { return LorentzVector<Value>::z(); }
0055 Value t() const { return LorentzVector<Value>::t(); }
0056
0057
0058 public:
0059
0060
0061
0062
0063
0064
0065 Lorentz5Vector() : mm() {}
0066
0067
0068
0069
0070 Lorentz5Vector(Value m)
0071 : LorentzVector<Value>(Value(), Value(), Value(), m), mm(m) {}
0072
0073
0074
0075
0076
0077 Lorentz5Vector(Value x, Value y, Value z, Value t = Value())
0078 : LorentzVector<Value>(x, y, z, t) { rescaleMass(); }
0079
0080
0081
0082
0083
0084 Lorentz5Vector(Value x, Value y, Value z, Value t, Value tau)
0085 : LorentzVector<Value>(x, y, z, t), mm(tau) {}
0086
0087
0088
0089
0090
0091 Lorentz5Vector(const ThreeVector<Value> & p, Value e)
0092 : LorentzVector<Value>(p, e) { rescaleMass(); }
0093
0094
0095
0096
0097
0098 Lorentz5Vector(Value m, const ThreeVector<Value> & p)
0099 : LorentzVector<Value>(p, sqrt(p.mag2() + m*m)), mm(m) {}
0100
0101
0102
0103
0104
0105 Lorentz5Vector(const ThreeVector<Value> & p, Value t, Value tau)
0106 : LorentzVector<Value>(p, t), mm(tau) {}
0107
0108
0109
0110
0111
0112 Lorentz5Vector(const LorentzVector<Value> & p, Value m)
0113 : LorentzVector<Value>(p), mm(m) {}
0114
0115
0116
0117
0118
0119 Lorentz5Vector(const LorentzVector<Value> & p)
0120 : LorentzVector<Value>(p) { rescaleMass(); }
0121
0122
0123
0124
0125 template<class U>
0126 Lorentz5Vector(const Lorentz5Vector<U> & p)
0127 : LorentzVector<Value>(p), mm(p.m) {}
0128
0129
0130
0131
0132
0133
0134
0135 void setTau(Value a) { mm = a; }
0136
0137
0138
0139
0140 void setMass(Value a) { mm = a; }
0141
0142
0143
0144
0145
0146 Lorentz5Vector & operator=(const LorentzVector<Value> & q) {
0147 LorentzVector<Value>::operator=(q);
0148 return *this;
0149 }
0150
0151
0152
0153
0154
0155
0156
0157
0158 void rescaleEnergy() {
0159 LorentzVector<Value>::setT(sqrt(LorentzVector<Value>::vect().mag2() + mass2()));
0160 }
0161
0162
0163
0164
0165
0166 void rescaleRho() {
0167 LorentzVector<Value>::setRho(sqrt(t()*t() - mass2()));
0168 }
0169
0170
0171
0172
0173
0174 void rescaleMass() {
0175 mm = LorentzVector<Value>::m();
0176 }
0177
0178
0179
0180
0181
0182
0183
0184 double massError() const {
0185 return sqrt(abs(Math::relativeError(mass2(),
0186 LorentzVector<Value>::m2())));
0187 }
0188
0189
0190
0191
0192 double energyError() const {
0193 return sqrt(abs(Math::relativeError(t()*t(), mass2()
0194 + LorentzVector<Value>::vect().mag2())));
0195 }
0196
0197
0198
0199
0200 double rhoError() const {
0201 return sqrt(abs(Math::relativeError(LorentzVector<Value>::vect().mag2(),
0202 t()*t() - mass2())));
0203 }
0204
0205
0206
0207
0208
0209
0210
0211
0212 Value2 mass2() const { return mm > Value() ? mm*mm: -mm*mm; }
0213
0214
0215
0216
0217
0218 Value2 tau2() const { return mass2(); }
0219
0220
0221
0222
0223
0224 Value mass() const { return mm; }
0225
0226
0227
0228
0229
0230
0231 Value tau() const { return mass(); }
0232
0233
0234
0235
0236
0237 Value dirPlus() const {
0238 return Direction<0>::pos() ?
0239 LorentzVector<Value>::plus()
0240 :
0241 LorentzVector<Value>::minus();
0242 }
0243
0244
0245
0246
0247
0248 Value dirMinus() const {
0249 return Direction<0>::neg() ?
0250 LorentzVector<Value>::plus()
0251 :
0252 LorentzVector<Value>::minus();
0253 }
0254
0255
0256
0257
0258
0259 Lorentz5Vector & transform(const LorentzRotation & r)
0260 {
0261 LorentzVector<Value>::transform(r.one());
0262 return *this;
0263 }
0264
0265 private:
0266
0267
0268 Value mm;
0269
0270 };
0271
0272
0273 template <typename OStream, typename T, typename UT>
0274 void ounitstream(OStream & os, const Lorentz5Vector<T> & p, UT & u) {
0275 os << ounit(p.x(), u) << ounit(p.y(), u) << ounit(p.z(), u)
0276 << ounit(p.e(), u) << ounit(p.mass(), u);
0277 }
0278
0279
0280 template <typename IStream, typename T, typename UT>
0281 void iunitstream(IStream & is, Lorentz5Vector<T> & p, UT & u) {
0282 T x, y, z, e, mass;
0283 is >> iunit(x, u) >> iunit(y, u) >> iunit(z, u) >> iunit(e, u)
0284 >> iunit(mass, u);
0285 p = Lorentz5Vector<T>(x, y, z, e, mass);
0286 }
0287
0288
0289
0290
0291 template <typename ValueA, typename ValueB>
0292 inline auto
0293 operator*(const Lorentz5Vector<ValueA> & a, const Lorentz5Vector<ValueB> & b)
0294 -> decltype(a.dot(b))
0295 {
0296 return a.dot(b);
0297 }
0298
0299 template <typename ValueA, typename ValueB>
0300 inline auto
0301 operator*(const LorentzVector<ValueA> & a, const Lorentz5Vector<ValueB> & b)
0302 -> decltype(a.dot(b))
0303 {
0304 return a.dot(b);
0305 }
0306
0307 template <typename ValueA, typename ValueB>
0308 inline auto
0309 operator*(const Lorentz5Vector<ValueA> & a, const LorentzVector<ValueB> & b)
0310 -> decltype(a.dot(b))
0311 {
0312 return a.dot(b);
0313 }
0314
0315 template <typename Value>
0316 inline auto
0317 operator*(const Lorentz5Vector<Value> & a, const Lorentz5Vector<Value> & b)
0318 -> decltype(a.dot(b))
0319 {
0320 return a.dot(b);
0321 }
0322
0323 }
0324
0325 #endif