1
1
2
2
using Random
3
- using FourMomentumBase
3
+ using LorentzVectorBase
4
4
5
5
const ATOL = 1e-15
6
6
const RNG = MersenneTwister (137137 )
@@ -12,11 +12,11 @@ struct CustomMom
12
12
z
13
13
end
14
14
15
- FourMomentumBase . coordinate_system (:: CustomMom ) = FourMomentumBase . EXYZ ()
16
- FourMomentumBase . px (mom:: CustomMom ) = mom. x
17
- FourMomentumBase . py (mom:: CustomMom ) = mom. y
18
- FourMomentumBase . pz (mom:: CustomMom ) = mom. z
19
- FourMomentumBase . energy (mom:: CustomMom ) = mom. e
15
+ LorentzVectorBase . coordinate_system (:: CustomMom ) = LorentzVectorBase . EXYZ ()
16
+ LorentzVectorBase . px (mom:: CustomMom ) = mom. x
17
+ LorentzVectorBase . py (mom:: CustomMom ) = mom. y
18
+ LorentzVectorBase . pz (mom:: CustomMom ) = mom. z
19
+ LorentzVectorBase . energy (mom:: CustomMom ) = mom. e
20
20
21
21
x, y, z = rand (RNG, 3 )
22
22
m = rand (RNG)
@@ -26,114 +26,114 @@ mom_zero = CustomMom(0.0, 0.0, 0.0, 0.0)
26
26
mom_offshell = CustomMom (0.0 , 0.0 , 0.0 , m)
27
27
28
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)))
29
+ @test LorentzVectorBase . spatial_magnitude2 (mom) == LorentzVectorBase . mag2 (mom)
30
+ @test LorentzVectorBase . spatial_magnitude (mom) == LorentzVectorBase . mag (mom)
31
+ @test isapprox (LorentzVectorBase . spatial_magnitude (mom), sqrt (LorentzVectorBase . spatial_magnitude2 (mom)))
32
32
end
33
33
34
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 ))
35
+ @test isapprox (LorentzVectorBase . spatial_magnitude2 (mom_onshell), x^ 2 + y^ 2 + z^ 2 )
36
+ @test isapprox (LorentzVectorBase . spatial_magnitude (mom_onshell), sqrt (x^ 2 + y^ 2 + z^ 2 ))
37
37
end
38
38
39
39
@testset " mass consistence" for mom_on in [mom_onshell, mom_zero]
40
- @test FourMomentumBase . invariant_mass2 (mom_on) == FourMomentumBase . mass2 (mom_on)
41
- @test FourMomentumBase . invariant_mass (mom_on) == FourMomentumBase . mass (mom_on)
40
+ @test LorentzVectorBase . invariant_mass2 (mom_on) == LorentzVectorBase . mass2 (mom_on)
41
+ @test LorentzVectorBase . invariant_mass (mom_on) == LorentzVectorBase . mass (mom_on)
42
42
@test isapprox (
43
- FourMomentumBase . invariant_mass (mom_on),
44
- sqrt (FourMomentumBase . invariant_mass2 (mom_on)),
43
+ LorentzVectorBase . invariant_mass (mom_on),
44
+ sqrt (LorentzVectorBase . invariant_mass2 (mom_on)),
45
45
)
46
46
end
47
47
48
48
@testset " mass value" begin
49
- @test isapprox (FourMomentumBase . invariant_mass2 (mom_onshell), E^ 2 - (x^ 2 + y^ 2 + z^ 2 ))
49
+ @test isapprox (LorentzVectorBase . invariant_mass2 (mom_onshell), E^ 2 - (x^ 2 + y^ 2 + z^ 2 ))
50
50
@test isapprox (
51
- FourMomentumBase . invariant_mass (mom_onshell), sqrt (E^ 2 - (x^ 2 + y^ 2 + z^ 2 ))
51
+ LorentzVectorBase . invariant_mass (mom_onshell), sqrt (E^ 2 - (x^ 2 + y^ 2 + z^ 2 ))
52
52
)
53
53
54
- @test isapprox (FourMomentumBase . invariant_mass (mom_onshell), m)
55
- @test isapprox (FourMomentumBase . invariant_mass (mom_offshell), - m)
56
- @test isapprox (FourMomentumBase . invariant_mass (mom_zero), 0.0 )
54
+ @test isapprox (LorentzVectorBase . invariant_mass (mom_onshell), m)
55
+ @test isapprox (LorentzVectorBase . invariant_mass (mom_offshell), - m)
56
+ @test isapprox (LorentzVectorBase . invariant_mass (mom_zero), 0.0 )
57
57
end
58
58
59
59
@testset " momentum components" begin
60
- @test FourMomentumBase . energy (mom_onshell) == E
61
- @test FourMomentumBase . px (mom_onshell) == x
62
- @test FourMomentumBase . py (mom_onshell) == y
63
- @test FourMomentumBase . pz (mom_onshell) == z
60
+ @test LorentzVectorBase . energy (mom_onshell) == E
61
+ @test LorentzVectorBase . px (mom_onshell) == x
62
+ @test LorentzVectorBase . py (mom_onshell) == y
63
+ @test LorentzVectorBase . pz (mom_onshell) == z
64
64
65
- @test isapprox (FourMomentumBase . boost_beta (mom_onshell), sqrt (x^ 2 + y^ 2 + z^ 2 ) / E)
65
+ @test isapprox (LorentzVectorBase . boost_beta (mom_onshell), sqrt (x^ 2 + y^ 2 + z^ 2 ) / E)
66
66
@test isapprox (
67
- FourMomentumBase . boost_gamma (mom_onshell),
68
- 1 / sqrt (1.0 - FourMomentumBase . boost_beta (mom_onshell)^ 2 ),
67
+ LorentzVectorBase . boost_gamma (mom_onshell),
68
+ 1 / sqrt (1.0 - LorentzVectorBase . boost_beta (mom_onshell)^ 2 ),
69
69
)
70
70
71
- @test FourMomentumBase . energy (mom_zero) == 0.0
72
- @test FourMomentumBase . px (mom_zero) == 0.0
73
- @test FourMomentumBase . py (mom_zero) == 0.0
74
- @test FourMomentumBase . pz (mom_zero) == 0.0
71
+ @test LorentzVectorBase . energy (mom_zero) == 0.0
72
+ @test LorentzVectorBase . px (mom_zero) == 0.0
73
+ @test LorentzVectorBase . py (mom_zero) == 0.0
74
+ @test LorentzVectorBase . pz (mom_zero) == 0.0
75
75
76
- @test isapprox (FourMomentumBase . boost_beta (mom_zero), 0.0 )
77
- @test isapprox (FourMomentumBase . boost_gamma (mom_zero), 1.0 )
76
+ @test isapprox (LorentzVectorBase . boost_beta (mom_zero), 0.0 )
77
+ @test isapprox (LorentzVectorBase . boost_gamma (mom_zero), 1.0 )
78
78
end
79
79
80
80
@testset " transverse coordinates" for mom_on in [mom_onshell, mom_zero]
81
- @test FourMomentumBase . transverse_momentum2 (mom_on) == FourMomentumBase . pt2 (mom_on)
82
- @test FourMomentumBase . transverse_momentum2 (mom_on) == FourMomentumBase . perp2 (mom_on)
83
- @test FourMomentumBase . transverse_momentum (mom_on) == FourMomentumBase . pt (mom_on)
84
- @test FourMomentumBase . transverse_momentum (mom_on) == FourMomentumBase . perp (mom_on)
81
+ @test LorentzVectorBase . transverse_momentum2 (mom_on) == LorentzVectorBase . pt2 (mom_on)
82
+ @test LorentzVectorBase . transverse_momentum2 (mom_on) == LorentzVectorBase . perp2 (mom_on)
83
+ @test LorentzVectorBase . transverse_momentum (mom_on) == LorentzVectorBase . pt (mom_on)
84
+ @test LorentzVectorBase . transverse_momentum (mom_on) == LorentzVectorBase . perp (mom_on)
85
85
86
86
@test isapprox (
87
- FourMomentumBase . transverse_momentum (mom_on),
88
- sqrt (FourMomentumBase . transverse_momentum2 (mom_on)),
87
+ LorentzVectorBase . transverse_momentum (mom_on),
88
+ sqrt (LorentzVectorBase . transverse_momentum2 (mom_on)),
89
89
)
90
90
91
- @test FourMomentumBase . transverse_mass2 (mom_on) == FourMomentumBase . mt2 (mom_on)
92
- @test FourMomentumBase . transverse_mass (mom_on) == FourMomentumBase . mt (mom_on)
91
+ @test LorentzVectorBase . transverse_mass2 (mom_on) == LorentzVectorBase . mt2 (mom_on)
92
+ @test LorentzVectorBase . transverse_mass (mom_on) == LorentzVectorBase . mt (mom_on)
93
93
end
94
94
95
95
@testset " transverse coordiantes value" begin
96
- @test isapprox (FourMomentumBase . transverse_momentum2 (mom_onshell), x^ 2 + y^ 2 )
97
- @test isapprox (FourMomentumBase . transverse_momentum (mom_onshell), sqrt (x^ 2 + y^ 2 ))
98
- @test isapprox (FourMomentumBase . transverse_mass2 (mom_onshell), E^ 2 - z^ 2 )
99
- @test isapprox (FourMomentumBase . transverse_mass (mom_onshell), sqrt (E^ 2 - z^ 2 ))
100
- @test isapprox (FourMomentumBase . transverse_mass (mom_offshell), - m)
101
-
102
- @test isapprox (FourMomentumBase . rapidity (mom_onshell), 0.5 * log ((E + z) / (E - z)))
103
-
104
- @test isapprox (FourMomentumBase . transverse_momentum2 (mom_zero), 0.0 )
105
- @test isapprox (FourMomentumBase . transverse_momentum (mom_zero), 0.0 )
106
- @test isapprox (FourMomentumBase . transverse_mass2 (mom_zero), 0.0 )
107
- @test isapprox (FourMomentumBase . transverse_mass (mom_zero), 0.0 )
96
+ @test isapprox (LorentzVectorBase . transverse_momentum2 (mom_onshell), x^ 2 + y^ 2 )
97
+ @test isapprox (LorentzVectorBase . transverse_momentum (mom_onshell), sqrt (x^ 2 + y^ 2 ))
98
+ @test isapprox (LorentzVectorBase . transverse_mass2 (mom_onshell), E^ 2 - z^ 2 )
99
+ @test isapprox (LorentzVectorBase . transverse_mass (mom_onshell), sqrt (E^ 2 - z^ 2 ))
100
+ @test isapprox (LorentzVectorBase . transverse_mass (mom_offshell), - m)
101
+
102
+ @test isapprox (LorentzVectorBase . rapidity (mom_onshell), 0.5 * log ((E + z) / (E - z)))
103
+
104
+ @test isapprox (LorentzVectorBase . transverse_momentum2 (mom_zero), 0.0 )
105
+ @test isapprox (LorentzVectorBase . transverse_momentum (mom_zero), 0.0 )
106
+ @test isapprox (LorentzVectorBase . transverse_mass2 (mom_zero), 0.0 )
107
+ @test isapprox (LorentzVectorBase . transverse_mass (mom_zero), 0.0 )
108
108
end
109
109
110
110
@testset " spherical coordiantes consistence" for mom_on in [mom_onshell, mom_zero]
111
111
@test isapprox (
112
- FourMomentumBase . cos_theta (mom_on), cos (FourMomentumBase . polar_angle (mom_on))
112
+ LorentzVectorBase . cos_theta (mom_on), cos (LorentzVectorBase . polar_angle (mom_on))
113
113
)
114
114
@test isapprox (
115
- FourMomentumBase . cos_phi (mom_on), cos (FourMomentumBase . azimuthal_angle (mom_on))
115
+ LorentzVectorBase . cos_phi (mom_on), cos (LorentzVectorBase . azimuthal_angle (mom_on))
116
116
)
117
117
@test isapprox (
118
- FourMomentumBase . sin_phi (mom_on), sin (FourMomentumBase . azimuthal_angle (mom_on))
118
+ LorentzVectorBase . sin_phi (mom_on), sin (LorentzVectorBase . azimuthal_angle (mom_on))
119
119
)
120
120
end
121
121
122
122
@testset " spherical coordiantes values" begin
123
123
@test isapprox (
124
- FourMomentumBase . polar_angle (mom_onshell),
125
- atan (FourMomentumBase . transverse_momentum (mom_onshell), z),
124
+ LorentzVectorBase . polar_angle (mom_onshell),
125
+ atan (LorentzVectorBase . transverse_momentum (mom_onshell), z),
126
126
)
127
- @test isapprox (FourMomentumBase . polar_angle (mom_zero), 0.0 )
127
+ @test isapprox (LorentzVectorBase . polar_angle (mom_zero), 0.0 )
128
128
129
- @test isapprox (FourMomentumBase . azimuthal_angle (mom_onshell), atan (y, x))
130
- @test isapprox (FourMomentumBase . azimuthal_angle (mom_zero), 0.0 )
129
+ @test isapprox (LorentzVectorBase . azimuthal_angle (mom_onshell), atan (y, x))
130
+ @test isapprox (LorentzVectorBase . azimuthal_angle (mom_zero), 0.0 )
131
131
end
132
132
133
133
@testset " light-cone coordiantes" begin
134
- @test isapprox (FourMomentumBase . plus_component (mom_onshell), 0.5 * (E + z))
135
- @test isapprox (FourMomentumBase . minus_component (mom_onshell), 0.5 * (E - z))
134
+ @test isapprox (LorentzVectorBase . plus_component (mom_onshell), 0.5 * (E + z))
135
+ @test isapprox (LorentzVectorBase . minus_component (mom_onshell), 0.5 * (E - z))
136
136
137
- @test isapprox (FourMomentumBase . plus_component (mom_zero), 0.0 )
138
- @test isapprox (FourMomentumBase . minus_component (mom_zero), 0.0 )
137
+ @test isapprox (LorentzVectorBase . plus_component (mom_zero), 0.0 )
138
+ @test isapprox (LorentzVectorBase . minus_component (mom_zero), 0.0 )
139
139
end
0 commit comments