Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/coordinate_systems/XYZT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,12 @@ function eta(::XYZT, mom)
return zero(zcomp)
end

@warn "Pseudorapidity (η): transverse momentum is zero! return +/- 10e10"
@warn "Pseudorapidity (η): transverse momentum is zero! return ±Inf"
if zcomp > zero(zcomp)
return 10e10
return oftype(zcomp, Inf)
end

return -10e10
return oftype(zcomp, -Inf)
end

#######################
Expand Down
6 changes: 5 additions & 1 deletion src/getter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -370,9 +370,13 @@ For a four-momentum `(px, py, pz, E)`, this function returns `log(tan(theta/2))`
!!! 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.
a warning is raised, and `±Inf` (depending on the sign of the z-component) is returned as a convention.
This occurs because the pseudorapidity is ill-defined when `pt = 0`.

For compatibility with other software, the returned values might be clamped. In particular:
- With ROOT legacy vectors ([TLorentzVector](https://root.cern.ch/doc/master/classTLorentzVector.html)), use `clamp(eta(lv), -1e11, 1e11)`.
- With ROOT [GenVector](https://root.cern/doc/master/group__GenVector.html) classes (`ROOT::Math::LorentzVector`, `ROOT::Math::XYZTVector`), use `clamp(eta(lv), z(lv) - 22756, z(lv) + 22756)`.

# 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).
Expand Down
4 changes: 2 additions & 2 deletions test/XYZT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ end
@test isapprox(LorentzVectorBase.eta(lvec_non_zero), 0.5 * log((1 + cth) / (1 - cth)))

@test isapprox(LorentzVectorBase.eta(lvec_zero), 0.0)
@test isapprox(LorentzVectorBase.eta(CustomLVector(0.0, 0.0, 1.0, 0.0)), 10e10)
@test isapprox(LorentzVectorBase.eta(CustomLVector(0.0, 0.0, -1.0, 0.0)), -10e10)
@test LorentzVectorBase.eta(CustomLVector(0.0, 0.0, 1.0, 0.0)) == Inf
@test LorentzVectorBase.eta(CustomLVector(0.0, 0.0, -1.0, 0.0)) == -Inf
end

@testset "spherical coordinates consistence" for lvec in [lvec_non_zero, lvec_zero]
Expand Down
Loading