ThreeMomentum
symbolica.community.hepkit Class
ThreeMomentum(px: float, py: float, pz: float) A 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
pxfloatMomentum component along the x axis.
pyfloatMomentum component along the y axis.
pzfloatMomentum component along the z axis.
Constructor
#Construct a Cartesian three-momentum.
Examples
Using the setup in the ThreeMomentum class example:
momentum = hep.ThreeMomentum(3.0, 4.0, 0.0)Parameters
| Name | Type | Default | Description |
|---|---|---|---|
px | float | — | Momentum along the x axis. |
py | float | — | Momentum along the y axis. |
pz | float | — | Momentum along the z axis. |
Member details
px
Property · read-only#px: floatReturn the x component.
Examples
Using the setup in the ThreeMomentum class example:
assert momentum.px == 3.0py
Property · read-only#py: floatReturn the y component.
Examples
Using the setup in the ThreeMomentum class example:
assert momentum.py == 4.0pz
Property · read-only#pz: floatReturn the z component.
Examples
Using the setup in the ThreeMomentum class example:
assert momentum.pz == 0.0norm_squared
Property · read-only#norm_squared: floatReturn the squared Euclidean norm.
Examples
Using the setup in the ThreeMomentum class example:
hep.ThreeMomentum(3.0, 4.0, 0.0).norm_squarednorm
Property · read-only#norm: floatReturn the Euclidean norm.
Examples
Using the setup in the ThreeMomentum class example:
hep.ThreeMomentum(3.0, 4.0, 0.0).normpt
Property · read-only#pt: floatReturn the transverse-momentum magnitude.
Examples
Using the setup in the ThreeMomentum class example:
hep.ThreeMomentum(3.0, 4.0, 12.0).ptphi
Property · read-only#phi: floatReturn the azimuthal angle in radians.
Examples
Using the setup in the ThreeMomentum class example:
hep.ThreeMomentum(1.0, 0.0, 0.0).phipseudorapidity
Property · read-only#pseudorapidity: 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-12dot
Method#dot(other: ThreeMomentum) -> 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))Parameters
| Name | Type | Default | Description |
|---|---|---|---|
other | ThreeMomentum | — | Momentum to contract with this one. |
cross
Method#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))Parameters
| Name | Type | Default | Description |
|---|---|---|---|
other | ThreeMomentum | — | Right-hand operand of the cross product. |
delta_phi
Method#delta_phi(other: ThreeMomentum) -> floatReturn the wrapped azimuthal separation from another momentum.
Examples
Using the setup in the ThreeMomentum class example:
first.delta_phi(second)Parameters
| Name | Type | Default | Description |
|---|---|---|---|
other | ThreeMomentum | — | Momentum whose azimuth is compared. |
delta_r
Method#delta_r(other: ThreeMomentum) -> 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
| Name | Type | Default | Description |
|---|---|---|---|
other | ThreeMomentum | — | Momentum to compare with this one. |
__add__
Method#__add__(other: ThreeMomentum) -> ThreeMomentumAdd two spatial momenta component by component.
Examples
Using the setup in the ThreeMomentum class example:
total = first + secondParameters
| Name | Type | Default | Description |
|---|---|---|---|
other | ThreeMomentum | — | Momentum to add. |
__sub__
Method#__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
| Name | Type | Default | Description |
|---|---|---|---|
other | ThreeMomentum | — | Momentum to subtract. |
__neg__
Method#__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__mul__
Method#__mul__(scalar: float) -> ThreeMomentumScale every spatial momentum component.
Examples
Using the setup in the ThreeMomentum class example:
half_momentum = momentum * 0.5Parameters
| Name | Type | Default | Description |
|---|---|---|---|
scalar | float | — | Multiplicative scale factor. |
__rmul__
Method#__rmul__(scalar: float) -> ThreeMomentumScale every spatial momentum component from the left.
Examples
Using the setup in the ThreeMomentum class example:
half_momentum = 0.5 * momentumParameters
| Name | Type | Default | Description |
|---|---|---|---|
scalar | float | — | Multiplicative scale factor. |
on_shell
Method#on_shell(mass: Optional[float] = None) -> FourMomentum Lift 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().energyParameters
| Name | Type | Default | Description |
|---|---|---|---|
mass | Optional[ | None | On-shell mass; omitted values describe a massless momentum. |
__repr__
Method#__repr__() -> 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}")_repr_latex_
Method#_repr_latex_() -> strRender the momentum as a mathematical three-vector.
Examples
Using the setup in the ThreeMomentum class example:
latex = momentum._repr_latex_()_repr_pretty_
Method#_repr_pretty_(pretty: Any, cycle: bool) -> None Write 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
| Name | Type | Default | Description |
|---|---|---|---|
pretty | Any | — | The IPython pretty-printer object. |
cycle | bool | — | Whether this object is part of a recursive formatting cycle. |
View generated signature source: docs/api/python/feynkit-community.pyi:11361