Skip to content

Commit e350cc2

Browse files
rename magnitude => spatial_magnitude (#5)
1 parent df4dd3e commit e350cc2

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

src/coordinate_systems/exyz.jl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ function pz end
5353

5454
"""
5555
56-
magnitude2(::EXYZ, mom)
56+
spatial_magnitude2(::EXYZ, mom)
5757
58-
Return the square of the magnitude of a given four-momentum, i.e. the sum of the squared spatial components.
58+
Return the square of the spatial_magnitude of a given four-momentum, i.e. the sum of the squared spatial components.
5959
6060
!!! example
6161
@@ -67,15 +67,15 @@ Return the square of the magnitude of a given four-momentum, i.e. the sum of the
6767
This function differs from a similar function for the `TLorentzVector` used in the famous `ROOT` library.
6868
6969
"""
70-
@inline function magnitude2(::EXYZ, mom)
70+
@inline function spatial_magnitude2(::EXYZ, mom)
7171
return px(mom)^2 + py(mom)^2 + pz(mom)^2
7272
end
7373

7474
"""
7575
76-
magnitude(::EXYZ,mom)
76+
spatial_magnitude(::EXYZ,mom)
7777
78-
Return the magnitude of a given four-momentum, i.e. the euklidian norm spatial components.
78+
Return the spatial_magnitude of a given four-momentum, i.e. the euklidian norm spatial components.
7979
8080
!!! example
8181
@@ -87,8 +87,8 @@ Return the magnitude of a given four-momentum, i.e. the euklidian norm spatial c
8787
This function differs from a similar function for the `TLorentzVector` used in the famous `ROOT` library.
8888
8989
"""
90-
@inline function magnitude(cs::EXYZ, mom)
91-
return sqrt(magnitude2(mom))
90+
@inline function spatial_magnitude(cs::EXYZ, mom)
91+
return sqrt(spatial_magnitude2(mom))
9292
end
9393

9494
"""
@@ -138,7 +138,7 @@ end
138138
139139
boost_beta(::EXYZ, mom )
140140
141-
Return magnitude of the beta vector for a given four-momentum, i.e. the magnitude of the four-momentum divided by its 0-component.
141+
Return spatial_magnitude of the beta vector for a given four-momentum, i.e. the spatial_magnitude of the four-momentum divided by its 0-component.
142142
143143
!!! example
144144
@@ -147,7 +147,7 @@ Return magnitude of the beta vector for a given four-momentum, i.e. the magnitud
147147
"""
148148
@inline function boost_beta(::EXYZ, mom)
149149
en = energy(mom)
150-
rho = magnitude(mom)
150+
rho = spatial_magnitude(mom)
151151
if !iszero(en)
152152
rho / en
153153
elseif iszero(rho)
@@ -202,7 +202,7 @@ end
202202
203203
transverse_momentum(::EXYZ, mom)
204204
205-
Return the transverse momentum for a given four-momentum, i.e. the magnitude of its transverse components.
205+
Return the transverse momentum for a given four-momentum, i.e. the spatial_magnitude of its transverse components.
206206
207207
!!! example
208208
@@ -327,7 +327,7 @@ Return the theta angle for a given four-momentum, i.e. the polar angle of its sp
327327
328328
!!! example
329329
330-
If `(E,px,py,pz)` is a four-momentum with magnitude `rho`, this is equivalent to `arccos(pz/rho)`, which is also equivalent to `arctan(sqrt(px^2+py^2)/pz)`.
330+
If `(E,px,py,pz)` is a four-momentum with spatial_magnitude `rho`, this is equivalent to `arccos(pz/rho)`, which is also equivalent to `arctan(sqrt(px^2+py^2)/pz)`.
331331
332332
!!! note
333333
@@ -358,7 +358,7 @@ Return the cosine of the theta angle for a given four-momentum.
358358
359359
"""
360360
@inline function cos_theta(::EXYZ, mom)
361-
r = magnitude(mom)
361+
r = spatial_magnitude(mom)
362362
return iszero(r) ? one(px(mom)) : pz(mom) / r
363363
end
364364

src/interface.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ const FOURMOMENTUM_GETTER_FUNCTIONS = (
1919
:px,
2020
:py,
2121
:pz,
22-
:magnitude2,
23-
:magnitude,
22+
:spatial_magnitude2,
23+
:spatial_magnitude,
2424
:invariant_mass2,
2525
:invariant_mass,
2626
:boost_beta,
@@ -49,8 +49,8 @@ for func in FOURMOMENTUM_GETTER_FUNCTIONS
4949
end
5050

5151
const FOURMOMENTUM_GETTER_ALIASSES = Dict(
52-
:mag2 => :magnitude2,
53-
:mag => :magnitude,
52+
:mag2 => :spatial_magnitude2,
53+
:mag => :spatial_magnitude,
5454
:mass2 => :invariant_mass2,
5555
:mass => :invariant_mass,
5656
:pt2 => :transverse_momentum2,

test/xyze.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ mom_onshell = CustomMom(E, x, y, z)
2525
mom_zero = CustomMom(0.0, 0.0, 0.0, 0.0)
2626
mom_offshell = CustomMom(0.0, 0.0, 0.0, m)
2727

28-
@testset "magnitude consistence" for mom in [mom_onshell, mom_offshell, mom_zero]
29-
@test FourMomentumBase.magnitude2(mom) == FourMomentumBase.mag2(mom)
30-
@test FourMomentumBase.magnitude(mom) == FourMomentumBase.mag(mom)
31-
@test isapprox(FourMomentumBase.magnitude(mom), sqrt(FourMomentumBase.magnitude2(mom)))
28+
@testset "spatial_magnitude consistence" for mom in [mom_onshell, mom_offshell, mom_zero]
29+
@test FourMomentumBase.spatial_magnitude2(mom) == FourMomentumBase.mag2(mom)
30+
@test FourMomentumBase.spatial_magnitude(mom) == FourMomentumBase.mag(mom)
31+
@test isapprox(FourMomentumBase.spatial_magnitude(mom), sqrt(FourMomentumBase.spatial_magnitude2(mom)))
3232
end
3333

34-
@testset "magnitude values" begin
35-
@test isapprox(FourMomentumBase.magnitude2(mom_onshell), x^2 + y^2 + z^2)
36-
@test isapprox(FourMomentumBase.magnitude(mom_onshell), sqrt(x^2 + y^2 + z^2))
34+
@testset "spatial_magnitude values" begin
35+
@test isapprox(FourMomentumBase.spatial_magnitude2(mom_onshell), x^2 + y^2 + z^2)
36+
@test isapprox(FourMomentumBase.spatial_magnitude(mom_onshell), sqrt(x^2 + y^2 + z^2))
3737
end
3838

3939
@testset "mass consistence" for mom_on in [mom_onshell, mom_zero]

0 commit comments

Comments
 (0)