FourMomentum
FourMomentum
class FourMomentumA relativistic four-momentum in (energy, px, py, pz) order.
The class provides collider observables, invariant products, rotations, and boosts while keeping the component convention explicit.
Examples
from symbolica import S, E
from symbolica.community import hepkit as hep
momentum = hep.FourMomentum(5.0, 3.0, 4.0, 0.0)
p = momentum
first = hep.FourMomentum(5.0, 0.0, 5.0, 0.0)
second = hep.FourMomentum(5.0, 5.0, 0.0, 0.0)
assert momentum.mass_squared == 0.0Parameters
energy(float) Energy component.px(float) Momentum component along the x axis.py(float) Momentum component along the y axis.pz(float) Momentum component along the z axis.
Attributes
| Name | Description |
|---|---|
energy |
Return the energy component. |
mass |
Return the invariant mass. |
mass_squared |
Return the invariant mass squared. |
phi |
Return the azimuthal angle in radians. |
pseudorapidity |
Return the pseudorapidity of the spatial momentum. |
pt |
Return the transverse-momentum magnitude. |
px |
Return the x component of spatial momentum. |
py |
Return the y component of spatial momentum. |
pz |
Return the z component of spatial momentum. |
rapidity |
Return the longitudinal rapidity. |
spatial |
Return the spatial three-momentum. |
energy
FourMomentum.energy: builtins.floatReturn the energy component.
Examples
Using the setup in the FourMomentum class example:
assert momentum.energy == 5.0mass
FourMomentum.mass: builtins.floatReturn the invariant mass.
Examples
Using the setup in the FourMomentum class example:
hep.FourMomentum(5.0, 0.0, 0.0, 0.0).mass
5.0mass_squared
FourMomentum.mass_squared: builtins.floatReturn the invariant mass squared.
Examples
Using the setup in the FourMomentum class example:
hep.FourMomentum(5.0, 3.0, 4.0, 0.0).mass_squared
0.0phi
FourMomentum.phi: builtins.floatReturn the azimuthal angle in radians.
Examples
Using the setup in the FourMomentum class example:
hep.FourMomentum(1.0, 1.0, 0.0, 0.0).phi
0.0pseudorapidity
FourMomentum.pseudorapidity: builtins.floatReturn the pseudorapidity of the spatial momentum.
Examples
Using the setup in the FourMomentum class example:
abs(hep.FourMomentum(1.0, 1.0, 0.0, 0.0).pseudorapidity) < 1e-12
Truept
FourMomentum.pt: builtins.floatReturn the transverse-momentum magnitude.
Examples
Using the setup in the FourMomentum class example:
hep.FourMomentum(13.0, 3.0, 4.0, 12.0).pt
5.0px
FourMomentum.px: builtins.floatReturn the x component of spatial momentum.
Examples
Using the setup in the FourMomentum class example:
assert momentum.px == 3.0py
FourMomentum.py: builtins.floatReturn the y component of spatial momentum.
Examples
Using the setup in the FourMomentum class example:
assert momentum.py == 4.0pz
FourMomentum.pz: builtins.floatReturn the z component of spatial momentum.
Examples
Using the setup in the FourMomentum class example:
assert momentum.pz == 0.0rapidity
FourMomentum.rapidity: builtins.floatReturn the longitudinal rapidity.
Examples
Using the setup in the FourMomentum class example:
hep.FourMomentum(1.0, 1.0, 0.0, 0.0).rapidity
0.0spatial
FourMomentum.spatial: ThreeMomentumReturn the spatial three-momentum.
Examples
Using the setup in the FourMomentum class example:
hep.FourMomentum(5.0, 3.0, 4.0, 0.0).spatial.pt
5.0Methods
| Name | Description |
|---|---|
__add__ |
Add two four-momenta component by component. |
__mul__ |
Scale every four-momentum component. |
__neg__ |
Reverse the four-momentum flow convention. |
__new__ |
Construct a four-momentum from energy and Cartesian spatial components. |
__repr__ |
Return a constructor-style representation of the components. |
__rmul__ |
Scale every four-momentum component from the left. |
__sub__ |
Subtract another four-momentum component by component. |
_repr_latex_ |
Render the momentum as a contravariant four-vector. |
_repr_pretty_ |
Write the constructor-style form to an IPython pretty printer. |
components |
Return (energy, px, py, pz). |
delta_phi |
Return the wrapped azimuthal separation from another momentum. |
delta_r |
Return the distance in rapidity-azimuth space. |
dot |
Return the Minkowski dot product with another four-momentum. |
flux |
Return the decay denominator 2E or the invariant two-particle flux |
__add__
FourMomentum.__add__(other: FourMomentum) -> FourMomentumAdd two four-momenta component by component.
Examples
Using the setup in the FourMomentum class example:
(first + second).energy == first.energy + second.energy
TrueParameters
other(FourMomentum) Momentum to add.
__mul__
FourMomentum.__mul__(scalar: builtins.float) -> FourMomentumScale every four-momentum component.
Examples
Using the setup in the FourMomentum class example:
half_momentum = momentum * 0.5Parameters
scalar(float) Multiplicative scale factor.
__neg__
FourMomentum.__neg__() -> FourMomentumReverse the four-momentum flow convention.
Examples
Using the setup in the FourMomentum class example:
incoming_convention = hep.FourMomentum(5.0, 3.0, 4.0, 0.0)
outgoing_convention = -incoming_convention
assert outgoing_convention.energy == -5.0__new__
FourMomentum.__new__(
energy: builtins.float,
px: builtins.float,
py: builtins.float,
pz: builtins.float,
) -> FourMomentumConstruct a four-momentum from energy and Cartesian spatial components.
Examples
Using the setup in the FourMomentum class example:
momentum = hep.FourMomentum(5.0, 3.0, 4.0, 0.0)Parameters
energy(float) Temporal component.px(float) Momentum along the x axis.py(float) Momentum along the y axis.pz(float) Momentum along the z axis.
__repr__
FourMomentum.__repr__() -> builtins.strReturn a constructor-style representation of the components.
Examples
Using the setup in the FourMomentum class example:
muon_momentum = hep.FourMomentum(5.0, 3.0, 4.0, 0.0)
print(f"muon four-momentum: {muon_momentum!r}")__rmul__
FourMomentum.__rmul__(scalar: builtins.float) -> FourMomentumScale every four-momentum component from the left.
Examples
Using the setup in the FourMomentum class example:
half_momentum = 0.5 * momentumParameters
scalar(float) Multiplicative scale factor.
__sub__
FourMomentum.__sub__(other: FourMomentum) -> FourMomentumSubtract another four-momentum component by component.
Examples
Using the setup in the FourMomentum class example:
(first - second).energy == first.energy - second.energy
TrueParameters
other(FourMomentum) Momentum to subtract.
_repr_latex_
FourMomentum._repr_latex_() -> builtins.strRender the momentum as a contravariant four-vector.
Examples
Using the setup in the FourMomentum class example:
latex = momentum._repr_latex_()_repr_pretty_
FourMomentum._repr_pretty_(pretty: typing.Any, cycle: builtins.bool) -> NoneWrite the constructor-style form to an IPython pretty printer.
Examples
Using the setup in the FourMomentum class example:
from IPython.lib.pretty import pretty
text = pretty(momentum)Parameters
pretty(object) The IPython pretty-printer object.cycle(bool) Whether this object is part of a recursive formatting cycle.
components
FourMomentum.components() -> tuple[builtins.float, builtins.float, builtins.float, builtins.float]Return (energy, px, py, pz).
Examples
Using the setup in the FourMomentum class example:
hep.FourMomentum(5.0, 3.0, 4.0, 0.0).components()
(5.0, 3.0, 4.0, 0.0)delta_phi
FourMomentum.delta_phi(other: FourMomentum) -> builtins.floatReturn the wrapped azimuthal separation from another momentum.
Examples
Using the setup in the FourMomentum class example:
first.delta_phi(second)
1.5707963267948966Parameters
other(FourMomentum) Momentum whose azimuth is compared.
delta_r
FourMomentum.delta_r(other: FourMomentum) -> builtins.floatReturn the distance in rapidity-azimuth space.
Examples
Using the setup in the FourMomentum class example:
separation = first.delta_r(second)
same_jet = separation < 0.4Parameters
other(FourMomentum) Momentum to compare with this one.
dot
FourMomentum.dot(other: FourMomentum) -> builtins.floatReturn the Minkowski dot product with another four-momentum.
Examples
Using the setup in the FourMomentum class example:
momentum.dot(momentum)
0.0Parameters
other(FourMomentum) Momentum to contract with this one.
flux
FourMomentum.flux(other: typing.Optional[FourMomentum] = None) -> builtins.floatReturn the decay denominator 2E or the invariant two-particle flux.
Inputs must be physical, future-directed on-shell momenta. Decay rates refer to this momentum’s frame; the rest-frame result is 2M. No unit conversion, spin/color average or symmetry factor is included.
Examples
Using the setup in the FourMomentum class example:
p = hep.FourMomentum(5.0, 0.0, 0.0, 5.0)
q = hep.FourMomentum(5.0, 0.0, 0.0, -5.0)
p.flux(q)
200.0Parameters
other(FourMomentum | None) Other incoming momentum; None selects a decay in this frame.