Celeritas
0.5.0-56+6b053cd
|
The momentum-energy four-vector (Lorentz vector). More...
#include <FourVector.hh>
Public Types | |
using | Energy = units::MevEnergy |
using | Momentum = units::MevMomentum |
using | Mass = units::MevMass |
Public Member Functions | |
CELER_FUNCTION FourVector & | operator+= (FourVector const &v) |
In-place addition. | |
Static Public Member Functions | |
template<class PTV > | |
static CELER_FUNCTION FourVector | from_particle (PTV const &particle, Real3 const &direction) |
Construct from a particle and direction. | |
static CELER_FUNCTION FourVector | from_mass_momentum (Mass m, Momentum p, Real3 const &direction) |
Construct from rest mass, momentum, direction. More... | |
Public Attributes | |
Real3 | mom {0, 0, 0} |
Particle momentum. | |
real_type | energy {0} |
Particle total energy ( \(\sqrt{p^2 + m^2}\)) | |
The momentum-energy four-vector (Lorentz vector).
The units of this class are implicit: momentum is MevMomentum
and energy is MevEnergy
.
|
inlinestatic |
Construct from rest mass, momentum, direction.
Note that this could be improved by using std::hypot
which yields more accurate answers if the magnitudes of the momentum and mass are very different. However, differences in the implementation of that function can lead to differences across platforms, compilers, and architectures, so for now we use a naive sqrt+ipow.