@@ -5,11 +5,11 @@ using LorentzVectorBase
5
5
const ATOL = 1e-15
6
6
const RNG = MersenneTwister (137137 )
7
7
8
- struct CustomMom
9
- px
10
- py
11
- pz
12
- E
8
+ struct CustomMom{T}
9
+ px:: T
10
+ py:: T
11
+ pz:: T
12
+ E:: T
13
13
end
14
14
15
15
LorentzVectorBase. coordinate_system (:: CustomMom ) = LorentzVectorBase. PxPyPzE ()
112
112
@test isapprox (LorentzVectorBase. sin_phi (mom_on), sin (LorentzVectorBase. phi (mom_on)))
113
113
end
114
114
115
+ @testset " Ranges for angles: (θ,ϕ) ∈ [0,π] x [-π,π]" begin
116
+ p = CustomMom (1.0 , sqrt (3 ), 1.0 , 8.0 )
117
+ θ = acos (1 / sqrt (5 ))
118
+ ϕ = π / 3
119
+ #
120
+ @test LorentzVectorBase. polar_angle (p) ≈ θ
121
+ @test LorentzVectorBase. azimuthal_angle (p) ≈ ϕ
122
+
123
+ p = CustomMom (1.0 , sqrt (3 ), - 1.0 , 8.0 )
124
+ @test LorentzVectorBase. polar_angle (p) ≈ π - θ
125
+ @test LorentzVectorBase. azimuthal_angle (p) ≈ ϕ
126
+
127
+ p = CustomMom (- 1.0 , sqrt (3 ), 1.0 , 8.0 )
128
+ @test LorentzVectorBase. polar_angle (p) ≈ θ
129
+ @test LorentzVectorBase. azimuthal_angle (p) ≈ π - ϕ
130
+
131
+ p = CustomMom (- 1.0 , sqrt (3 ), - 1.0 , 8.0 )
132
+ @test LorentzVectorBase. polar_angle (p) ≈ π - θ
133
+ @test LorentzVectorBase. azimuthal_angle (p) ≈ π - ϕ
134
+ #
135
+ p = CustomMom (- 1.0 , - sqrt (3 ), - 1.0 , 8.0 )
136
+ @test LorentzVectorBase. azimuthal_angle (p) ≈ - π + ϕ
137
+ #
138
+ p = CustomMom (1.0 , - sqrt (3 ), - 1.0 , 8.0 )
139
+ @test LorentzVectorBase. azimuthal_angle (p) ≈ - ϕ
140
+ end
141
+
115
142
@testset " spherical coordiantes values" begin
116
143
@test isapprox (
117
144
LorentzVectorBase. polar_angle (mom_onshell), atan (LorentzVectorBase. pt (mom_onshell), pz)
0 commit comments