ThreeMomentum
ThreeMomentum
class ThreeMomentumA Cartesian spatial momentum (px, py, pz).
Three-momenta are used for boost velocities, spatial rotations, and the three-vector part of a relativistic four-momentum.
Examples
from symbolica import S, E
from symbolica.community import hepkit as hep
momentum = hep.ThreeMomentum(3.0, 4.0, 0.0)
p = momentum
first = hep.ThreeMomentum(0.0, 1.0, 0.0)
second = hep.ThreeMomentum(1.0, 0.0, 0.0)
assert momentum.pt == 5.0Parameters
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 |
|---|---|
norm |
Return the Euclidean norm. |
norm_squared |
Return the squared Euclidean norm. |
phi |
Return the azimuthal angle in radians. |
pseudorapidity |
Return the pseudorapidity derived from the momentum direction. |
pt |
Return the transverse-momentum magnitude. |
px |
Return the x component. |
py |
Return the y component. |
pz |
Return the z component. |
norm
ThreeMomentum.norm: builtins.floatReturn the Euclidean norm.
Examples
Using the setup in the ThreeMomentum class example:
hep.ThreeMomentum(3.0, 4.0, 0.0).norm
5.0norm_squared
ThreeMomentum.norm_squared: builtins.floatReturn the squared Euclidean norm.
Examples
Using the setup in the ThreeMomentum class example:
hep.ThreeMomentum(3.0, 4.0, 0.0).norm_squared
25.0phi
ThreeMomentum.phi: builtins.floatReturn the azimuthal angle in radians.
Examples
Using the setup in the ThreeMomentum class example:
hep.ThreeMomentum(1.0, 0.0, 0.0).phi
0.0pseudorapidity
ThreeMomentum.pseudorapidity: builtins.floatReturn the pseudorapidity derived from the momentum direction.
Examples
Using the setup in the ThreeMomentum class example:
abs(hep.ThreeMomentum(1.0, 0.0, 0.0).pseudorapidity) < 1e-12
Truept
ThreeMomentum.pt: builtins.floatReturn the transverse-momentum magnitude.
Examples
Using the setup in the ThreeMomentum class example:
hep.ThreeMomentum(3.0, 4.0, 12.0).pt
5.0px
ThreeMomentum.px: builtins.floatReturn the x component.
Examples
Using the setup in the ThreeMomentum class example:
assert momentum.px == 3.0py
ThreeMomentum.py: builtins.floatReturn the y component.
Examples
Using the setup in the ThreeMomentum class example:
assert momentum.py == 4.0pz
ThreeMomentum.pz: builtins.floatReturn the z component.
Examples
Using the setup in the ThreeMomentum class example:
assert momentum.pz == 0.0Methods
| Name | Description |
|---|---|
__add__ |
Add two spatial momenta component by component. |
__mul__ |
Scale every spatial momentum component. |
__neg__ |
Reverse every spatial momentum component. |
__new__ |
Construct a Cartesian three-momentum. |
__repr__ |
Return a constructor-style representation of the components. |
__rmul__ |
Scale every spatial momentum component from the left. |
__sub__ |
Subtract another spatial momentum component by component. |
_repr_latex_ |
Render the momentum as a mathematical three-vector. |
_repr_pretty_ |
Write the constructor-style form to an IPython pretty printer. |
cross |
Return the vector cross product with another three-momentum. |
delta_phi |
Return the wrapped azimuthal separation from another momentum. |
delta_r |
Return the angular distance in pseudorapidity-azimuth space. |
dot |
Return the Euclidean dot product with another three-momentum. |
on_shell |
Lift this spatial momentum to an on-shell four-momentum. |
__add__
ThreeMomentum.__add__(other: ThreeMomentum) -> ThreeMomentumAdd two spatial momenta component by component.
Examples
Using the setup in the ThreeMomentum class example:
total = first + secondParameters
other(ThreeMomentum) Momentum to add.
__mul__
ThreeMomentum.__mul__(scalar: builtins.float) -> ThreeMomentumScale every spatial momentum component.
Examples
Using the setup in the ThreeMomentum class example:
half_momentum = momentum * 0.5Parameters
scalar(float) Multiplicative scale factor.
__neg__
ThreeMomentum.__neg__() -> ThreeMomentumReverse every spatial momentum component.
Examples
Using the setup in the ThreeMomentum class example:
incoming_convention = hep.ThreeMomentum(3.0, 4.0, 0.0)
outgoing_convention = -incoming_convention
assert outgoing_convention.px == -3.0__new__
ThreeMomentum.__new__(px: builtins.float, py: builtins.float, pz: builtins.float) -> ThreeMomentumConstruct a Cartesian three-momentum.
Examples
Using the setup in the ThreeMomentum class example:
momentum = hep.ThreeMomentum(3.0, 4.0, 0.0)Parameters
px(float) Momentum along the x axis.py(float) Momentum along the y axis.pz(float) Momentum along the z axis.
__repr__
ThreeMomentum.__repr__() -> builtins.strReturn a constructor-style representation of the components.
Examples
Using the setup in the ThreeMomentum class example:
track_momentum = hep.ThreeMomentum(1.0, 2.0, 3.0)
print(f"track momentum: {track_momentum!r}")__rmul__
ThreeMomentum.__rmul__(scalar: builtins.float) -> ThreeMomentumScale every spatial momentum component from the left.
Examples
Using the setup in the ThreeMomentum class example:
half_momentum = 0.5 * momentumParameters
scalar(float) Multiplicative scale factor.
__sub__
ThreeMomentum.__sub__(other: ThreeMomentum) -> ThreeMomentumSubtract another spatial momentum component by component.
Examples
Using the setup in the ThreeMomentum class example:
incoming = hep.ThreeMomentum(3.0, 4.0, 0.0)
outgoing = hep.ThreeMomentum(1.0, 0.0, 0.0)
transfer = incoming - outgoing
assert transfer.px == 2.0Parameters
other(ThreeMomentum) Momentum to subtract.
_repr_latex_
ThreeMomentum._repr_latex_() -> builtins.strRender the momentum as a mathematical three-vector.
Examples
Using the setup in the ThreeMomentum class example:
latex = momentum._repr_latex_()_repr_pretty_
ThreeMomentum._repr_pretty_(pretty: typing.Any, cycle: builtins.bool) -> NoneWrite the constructor-style form to an IPython pretty printer.
Examples
Using the setup in the ThreeMomentum 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.
cross
ThreeMomentum.cross(other: ThreeMomentum) -> ThreeMomentumReturn the vector cross product with another three-momentum.
Examples
Using the setup in the ThreeMomentum class example:
hep.ThreeMomentum(1.0, 0.0, 0.0).cross(hep.ThreeMomentum(0.0, 1.0, 0.0))
ThreeMomentum(0, 0, 1)Parameters
other(ThreeMomentum) Right-hand operand of the cross product.
delta_phi
ThreeMomentum.delta_phi(other: ThreeMomentum) -> builtins.floatReturn the wrapped azimuthal separation from another momentum.
Examples
Using the setup in the ThreeMomentum class example:
first.delta_phi(second)
1.5707963267948966Parameters
other(ThreeMomentum) Momentum whose azimuth is compared.
delta_r
ThreeMomentum.delta_r(other: ThreeMomentum) -> builtins.floatReturn the angular distance in pseudorapidity-azimuth space.
Examples
Using the setup in the ThreeMomentum class example:
separation = first.delta_r(second)
passes_isolation = separation > 0.4Parameters
other(ThreeMomentum) Momentum to compare with this one.
dot
ThreeMomentum.dot(other: ThreeMomentum) -> builtins.floatReturn the Euclidean dot product with another three-momentum.
Examples
Using the setup in the ThreeMomentum class example:
hep.ThreeMomentum(1.0, 0.0, 0.0).dot(hep.ThreeMomentum(2.0, 0.0, 0.0))
2.0Parameters
other(ThreeMomentum) Momentum to contract with this one.
on_shell
ThreeMomentum.on_shell(mass: typing.Optional[builtins.float] = None) -> FourMomentumLift this spatial momentum to an on-shell four-momentum.
Examples
Using the setup in the ThreeMomentum class example:
hep.ThreeMomentum(3.0, 4.0, 0.0).on_shell().energy
5.0Parameters
mass(float, optional) On-shell mass; omitted values describe a massless momentum.