Reference

Contents

Index

Interface

Supported coordinate systems

LorentzVectorBase.XYZTType
XYZT <: AbstractCoordinateSystem

Represents the Cartesian coordinate system for four-vectors, where the components are labeled as (x, y, z, t).

To use this coordinate system with a custom four-vector type, you must implement the following interface methods:

LorentzVectorBase.x(::CustomFourVector)  # Returns the x-component
LorentzVectorBase.y(::CustomFourVector)  # Returns the y-component
LorentzVectorBase.z(::CustomFourVector)  # Returns the z-component
LorentzVectorBase.t(::CustomFourVector)  # Returns the time component

Example

The following example demonstrates how to define a custom four-vector type and implement the required interface:

julia> struct CustomLVector
           x
           y
           z
           t
       end

julia> LorentzVectorBase.coordinate_system(::CustomLVector) = LorentzVectorBase.XYZT()

julia> LorentzVectorBase.x(lv::CustomLVector) = lv.x

julia> LorentzVectorBase.y(lv::CustomLVector) = lv.y

julia> LorentzVectorBase.z(lv::CustomLVector) = lv.z

julia> LorentzVectorBase.t(lv::CustomLVector) = lv.t

julia> c = CustomLVector(1, 2, 3, 4)
CustomLVector(1, 2, 3, 4)

julia> @assert isapprox(LorentzVectorBase.spatial_magnitude(c), sqrt(1^2 + 2^2 + 3^2))

By implementing these methods, the custom type CustomLVector becomes compatible with LorentzVectorBase operations in the XYZT coordinate system.

source
LorentzVectorBase.PxPyPzEType
PxPyPzE <: AbstractCoordinateSystem

Represents the Cartesian coordinate system for four-momenta, where the components are labeled as (px, py, pz, E). This system is commonly used in high-energy physics to describe the momentum and energy of particles.

To use this coordinate system with a custom four-momentum type, you must implement the following interface methods:

LorentzVectorBase.px(::CustomFourMomentum)  # Returns the x-component of momentum
LorentzVectorBase.py(::CustomFourMomentum)  # Returns the y-component of momentum
LorentzVectorBase.pz(::CustomFourMomentum)  # Returns the z-component of momentum
LorentzVectorBase.E(::CustomFourMomentum)   # Returns the energy component

Example

The following example demonstrates how to define a custom four-momentum type and implement the required interface:

julia> struct CustomFourMomentum
           px
           py
           pz
           E
       end

julia> LorentzVectorBase.coordinate_system(::CustomFourMomentum) = LorentzVectorBase.PxPyPzE()

julia> LorentzVectorBase.px(p::CustomFourMomentum) = p.px

julia> LorentzVectorBase.py(p::CustomFourMomentum) = p.py

julia> LorentzVectorBase.pz(p::CustomFourMomentum) = p.pz

julia> LorentzVectorBase.E(p::CustomFourMomentum) = p.E

julia> p = CustomFourMomentum(1.0, 2.0, 3.0, 4.0)
CustomFourMomentum(1.0, 2.0, 3.0, 4.0)

julia> isapprox(LorentzVectorBase.spatial_magnitude(p), sqrt(1.0^2 + 2.0^2 + 3.0^2))
true

By implementing these methods, the custom type CustomFourMomentum becomes compatible with LorentzVectorBase operations in the PxPyPzE coordinate system.

source
LorentzVectorBase.PtEtaPhiMType
PtEtaPhiM <: AbstractCoordinateSystem

Represents the cylindrical coordinate system for four-momenta, commonly used in high-energy physics. This system expresses four-momentum components in terms of transverse momentum (pt), pseudorapidity (eta), azimuthal angle (phi), and mass (mass).

To use this coordinate system with a custom four-momentum type, you must implement the following interface methods:

LorentzVectorBase.pt(::CustomFourMomentum)    # Returns the transverse momentum
LorentzVectorBase.eta(::CustomFourMomentum)   # Returns the pseudorapidity
LorentzVectorBase.phi(::CustomFourMomentum)   # Returns the azimuthal angle
LorentzVectorBase.mass(::CustomFourMomentum)  # Returns the mass

Example

The following example demonstrates how to define a custom four-momentum type and implement the required interface:

julia> struct CustomFourMomentum
           pt
           eta
           phi
           mass
       end

julia> LorentzVectorBase.coordinate_system(::CustomFourMomentum) = LorentzVectorBase.PtEtaPhiM()

julia> LorentzVectorBase.pt(p::CustomFourMomentum) = p.pt

julia> LorentzVectorBase.eta(p::CustomFourMomentum) = p.eta

julia> LorentzVectorBase.phi(p::CustomFourMomentum) = p.phi

julia> LorentzVectorBase.mass(p::CustomFourMomentum) = p.mass

julia> p = CustomFourMomentum(10.0, 2.5, 1.57, 0.105)
CustomFourMomentum(10.0, 2.5, 1.57, 0.105)

julia> isapprox(LorentzVectorBase.polar_angle(p), 2 * atan(exp(-2.5)))
true

By implementing these methods, the custom type CustomFourMomentum becomes compatible with LorentzVectorBase operations in the PtEtaPhiM coordinate system.

source

Supported getter functions

LorentzVectorBase.pxFunction
px(lv)

Return the x-component of a given Lorentz-vector-like lv.

Example

For a four-momentum `(px, py, pz, E)`, this function returns the `px` component.

See Also

source
LorentzVectorBase.pyFunction
py(lv)

Return the y-component of a given Lorentz-vector-like lv.

Example

For a four-momentum (px, py, pz, E), this function returns the py component.

See Also

source
LorentzVectorBase.pzFunction
pz(lv)

Return the z-component of a given Lorentz-vector-like lv.

Example

For a four-momentum (px, py, pz, E), this function returns the pz component.

See Also

source
LorentzVectorBase.EFunction
E(lv)

Return the energy component (E) of a given Lorentz-vector-like lv.

Example

For a four-momentum (px, py, pz, E), this function returns the E component.

See Also

source
LorentzVectorBase.ptFunction
pt(lv)

Return the transverse momentum ($p_T$) of a given Lorentz-vector-like lv, defined as the Euclidean magnitude of the momentum components in the x-y plane.

Example

For a four-momentum (px, py, pz, E), this function returns \sqrt(px^2 + py^2).

Notes

  • The transverse components are defined with respect to the z-axis (3-axis), representing the perpendicular momentum to this axis.

See Also

  • pt2: For the squared transverse momentum.
source
LorentzVectorBase.pt2Function
pt2(lv)

Return the squared transverse momentum ($p_T^2$) of a given Lorentz-vector-like lv. The transverse momentum is defined with respect to the z-axis (3-axis) and is the sum of the squares of the x- and y-components.

Example

For a four-momentum (px, py, pz, E), this function returns px^2 + py^2.

Notes

  • The transverse components are the momentum projections in the x-y plane, perpendicular to the z-axis.

See Also

  • pt: For the transverse momentum.
source
LorentzVectorBase.etaFunction
eta(lv)

Return the pseudorapidity ($\eta$) of a given Lorentz-vector-like lv. The pseudorapidity is a commonly used quantity in high-energy physics, particularly in collider experiments, and is defined as:

\[ \eta = -\log(\tan(\theta/ 2))\]

where $\theta$ is the polar angle of the Lorentz-vector-like relative to the z-axis.

Example

For a four-momentum (px, py, pz, E), this function log(tan(theta/2)) where theta is given by the polar_angle.

Warning

If the transverse momentum (pt) is zero (i.e., the particle is aligned with the beam axis), a warning is raised, and a large pseudorapidity value (±10e10) is returned as a convention. This occurs because the pseudorapidity is ill-defined when pt = 0.

Notes

  • Pseudorapidity is approximately equal to the rapidity $y$ in the ultra-relativistic limit (when the particle's mass is negligible compared to its energy).

See Also

  • rapidity: For the rapidity of the Lorentz-vector-like.
source
LorentzVectorBase.phiFunction
phi(lv)

Return the azimuthal angle ($\phi$) of the Lorentz-vector-like lv.

The azimuthal angle is the angle between the x-axis and the projection of the Lorentz-vector-like on the x-y plane.

Example

If ``(x, y, z, t)`` is a four-vector, this is equivalent to ``atan(y / x)``.
Note

The azimuthal angle is defined with respect to the z-axis.

See Also

source
LorentzVectorBase.spatial_magnitudeFunction
spatial_magnitude(lv)

Return the spatial magnitude of the Lorentz-vector-like lv, i.e., the magnitude of its spatial components.

Example

If the Lorentz-vector-like is a four-vector (x, y, z, t), this function returns \sqrt(x^2 + y^2 + z^2).

Warning

This function differs from the TLorentzVector::P() function in the ROOT library.

source
LorentzVectorBase.spatial_magnitude2Function
spatial_magnitude2(lv)

Return the square of the spatial magnitude of the Lorentz-vector-like lv, i.e., the sum of the squares of its spatial components.

Example

If the Lorentz-vector-like is four-vector (x, y, z, t), this function returns x^2 + y^2 + z^2.

Warning

This function differs from the TLorentzVector::P2() function in the ROOT library.

source
LorentzVectorBase.massFunction
mass(lv)

Return the invariant mass of the Lorentz-vector-like lv, computed as the square root of the Minkowski inner product of the four-vector components with itself.

Example

For a four-momentum (px, py, pz, E), this function returns \sqrt(E^2 - (px^2 + py^2 + pz^2)).

Notes

  • If the squared invariant mass m^2 is negative, this function returns -\sqrt(-m^2) to ensure a real result. This can happen in certain unphysical cases where the energy component is smaller than the spatial momentum magnitude.

See Also

  • mass2: For the squared invariant mass calculation.
source
LorentzVectorBase.mass2Function
mass2(lv)

Return the squared invariant mass of the Lorentz-vector-like lv, computed as the Minkowski inner product of the four-vector components with itself.

Example

For a four-momentum (px, py, pz, E), this function returns E^2 - (px^2 + py^2 + pz^2).

See Also

  • mass: For the invariant mass, i.e., the square root of this value.
source
LorentzVectorBase.boost_betaFunction
boost_beta(lv)

Return the magnitude of the velocity ($\beta$) of a particle as a fraction of the speed of light of the Lorentz-vector-like lv.

Example

For a four-momentum (px, py, pz, E), this function returns \sqrt(px^2 + py^2 + pz^2) / E.

Throws

  • ArgumentError if the time (energy) component is zero while the spatial components are non-zero, as this results in an undefined velocity.

Notes

  • If both the time (energy) and spatial components are zero, the function returns zero ($\beta = 0$), as this represents a stationary object with no motion.

See Also

  • boost_gamma: For the relativistic gamma factor, which depends on $\beta$.
source
LorentzVectorBase.boost_gammaFunction
boost_gamma(lv)

Return the relativistic gamma factor ($\gamma$) for the Lorentz-vector-like lv.

Example

For a four-momentum (px, py, pz, E) with velocity $\beta$, this function returns $1 / \sqrt(1 - \beta^2)$.

See Also

  • boost_beta: For the velocity $\beta$, which is used to compute $\gamma$.
source
LorentzVectorBase.mt2Function
mt2(lv)

Return the squared transverse mass ($m_T^2$) of a given Lorentz-vector-like lv, which is the difference between the squared time- (energy-) and the squared z-component.

Example

For a four-momentum (px, py, pz, E), this function returns E^2 - pz^2.

Notes

  • The transverse components are defined with respect to the z-axis (3-axis), indicating a projection in the x-y plane.

See Also

  • mt: For the transverse mass.
source
LorentzVectorBase.mtFunction
mt(lv)

Return the transverse mass ($m_T$) of a given Lorentz-vector-like lv, calculated as the square root of the squared transverse mass. The transverse mass is often used in high-energy physics to describe the effective mass of a system when only the transverse components are considered.

Example

For a four-momentum (px, py, pz, E), this function returns \sqrt(E^2 - pz^2).

Notes

  • If the squared transverse mass (mT^2) is negative, the function returns -\sqrt(-mT^2) to

handle the imaginary mass situation that can occur in some relativistic systems.

  • The transverse components are defined with respect to the z-axis (3-axis), indicating momentum in the x-y plane.

Throws

  • May include a warning if the transverse mass is negative, depending on user settings.

See Also

  • mt2: For the squared transverse mass.
source
LorentzVectorBase.rapidityFunction
rapidity(lv)

Return the rapidity for a given Lorentz-vector-like lv.

The rapidity $y$ is defined as:

\[y = \frac{1}{2}\log((E + p_z) / (E - p_z))\]

where E is the energy (time- or 0-component of the Lorentz-vector-like), and pz is the component along the z-axis.

Example

For a four-vector (px, py, pz, E), this function calculates the rapidity as:

y = 0.5 * log((E + pz) / (E - pz))

Notes

  • Rapidity is preferred over pseudorapidity when mass effects are significant, as it takes into account the energy and longitudinal momentum of the particle. In contrast, pseudorapidity depends only on the particle's direction and ignores mass.
  • The transverse components of the momentum are defined with respect to the 3-axis (beam axis).
  • Rapidity is Lorentz-invariant under boosts along the z-axis, making it useful for comparisons between different reference frames in collider experiments.
Warning

If the particle's energy E is equal to its longitudinal momentum pz, resulting in a denominator of zero in the logarithm, the function will raise an error as rapidity is ill-defined in this case.

See Also

source
LorentzVectorBase.polar_angleFunction
polar_angle(lv)

Return the polar angle ($\theta$) of the Lorentz-vector-like lv.

Example

If the Lorentz-vector-like is a four-vector $(x, y, z, t)$, this is equivalent to $\arccos(z / \sqrt{x^2 + y^2 + z^2})$.

Note

If the Lorentz-vector-like is zero, the function returns zero for the angle.

See Also

source
LorentzVectorBase.cos_thetaFunction
cos_theta(lv)

Return the cosine of the polar angle ($\theta$) of the Lorentz-vector-like lv.

Depending on the coordinate system, this might be an equivalent but faster version of cos(polar_angle(lv)).

Example

If $(x, y, z, t)$ is a four-vector, this is equivalent to $z / \sqrt{x^2 + y^2 + z^2}$.

See Also

source
LorentzVectorBase.cos_phiFunction
cos_phi(lv)

Return the cosine of the azimuthal angle ($\phi$) of the Lorentz-vector-like lv.

Depending on the coordinate system, this might be an equivalent but faster version of cos(phi(lv)).

Example

If $(x, y, z, t)$ is a four-momentum, this is equivalent to $x / \sqrt{x^2 + y^2}$.

See Also

source
LorentzVectorBase.sin_phiFunction
sin_phi(lv)

Return the sine of the azimuthal angle ($\phi$) of the Lorentz-vector-like lv.

Depending on the coordinate system, this might be an equivalent but faster version of sin(phi(lv)).

Example

If $(x, y, z, t)$ is a four-momentum, this is equivalent to $y / \sqrt{x^2 + y^2}$.

See Also

source
LorentzVectorBase.plus_componentFunction
plus_component(lv)

Return the plus component ($p^+$) of the Lorentz-vector-like lv in light-cone coordinates.

This component is defined as (t + z) / 2, where t is the time (or energy) component and z is the third spatial component of the Lorentz-vector-like.

Example

If (x, y, z, t) is a four-vector, this is equivalent to (t + z) / 2.

Warning

This definition differs from the light-cone coordinate definitions commonly used in general relativity.

source
LorentzVectorBase.minus_componentFunction
minus_component(lv)

Return the minus component ($p^-$) of the Lorentz-vector-like lv in light-cone coordinates.

This component is defined as (t - z) / 2, where t is the time (or energy) component and z is the third spatial component of the Lorentz-vector-like.

Example

If (x, y, z, t) is a four-vector, this is equivalent to (t - z) / 2.

Warning

This definition differs from the light-cone coordinate definitions commonly used in general relativity.

source

Utility

LorentzVectorBase.available_accessorsFunction
available_accessors()

Returns a list of available accessor functions for four-momentum components.

This function gathers all defined accessor methods (such as px, py, pz, E, etc.) that are available for any custom four-momentum type implementing the LorentzVectorBase interface.

Example

julia> LorentzVectorBase.available_accessors()
38-element Vector{Symbol}:
 :x
 :y
 :z
 :t
 :energy
 :px
 :py
 ...

This allows users to query which accessor functions are available for any custom four-momentum type.

source