Skip to content

Commit a898c3d

Browse files
authored
feat: add aligned_four_vectors function and tests (#70)
1 parent 9a6548f commit a898c3d

File tree

4 files changed

+96
-1
lines changed

4 files changed

+96
-1
lines changed

.cspell/project.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ refζ
4040
refζs
4141
Registrator
4242
servedocs
43+
sinθ
4344
subchannel
4445
sumrules
4546
typeof

src/ThreeBodyDecays.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export cosθ12, cosθ23, cosθ31
2121
export σiofk, σjofk
2222
export σ1of2, σ2of3, σ3of1, σ1of3, σ2of1, σ3of2
2323
export breakup, breakup_Rk, breakup_ij
24+
export aligned_four_vectors
2425
include("kinematics.jl")
2526

2627
export minusone

src/kinematics.jl

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ Kibble(σs, msq) = Kallen(
77
Kallen(msq[4], msq[2], σs[2]),
88
Kallen(msq[4], msq[3], σs[3]),
99
)
10-
#
10+
11+
1112
"""
1213
σjofk(z,σi,msq; k::Int)
1314
@@ -92,3 +93,52 @@ function breakup_ij(ms; k)
9293
(i, j) = ij_from_k(k)
9394
return σ -> breakup(sqrt(σ), ms[i], ms[j])
9495
end
96+
97+
"""
98+
aligned_four_vectors(σs,ms; k::Int)
99+
100+
Computes the four-momenta of the three particles in the center of momentum frame aligning the k-th particle with the -z-axis.
101+
102+
## Arguments
103+
- `σs`: Tuple of mandelstam variables,
104+
- `ms`: Tuple of masses in the order m1, m2, m3, m0.
105+
- `k`: Index of the particle to be aligned with the -z-axis.
106+
107+
## Returns
108+
109+
A tuple of three four-momenta in the form of (px, py, pz, E).
110+
111+
## Example
112+
````julia
113+
ms = ThreeBodyMasses(1.0, 1.0, 1.0; m0=4.0)
114+
σs = x2σs([0.5, 0.5], ms; k=2)
115+
p1, p2, p3 = aligned_four_vectors(σs, ms; k=1)
116+
````
117+
"""
118+
function aligned_four_vectors(σs, ms; k::Int)
119+
#
120+
i, j = ij_from_k(k)
121+
m0 = ms[4]
122+
s = m0^2
123+
#
124+
mi, mj, mk = ms[i], ms[j], ms[k]
125+
σi, σj, σk = σs[i], σs[j], σs[k]
126+
misq, mjsq, mksq = (mi, mj, mk) .^ 2
127+
#
128+
Ei = (s + misq - σi) / (2m0)
129+
Ej = (s + mjsq - σj) / (2m0)
130+
Ek = (s + mksq - σk) / (2m0)
131+
#
132+
p3i = sqrt(Kallen(s, misq, σi)) / (2m0)
133+
p3j = sqrt(Kallen(s, mjsq, σj)) / (2m0)
134+
p3k = sqrt(Kallen(s, mksq, σk)) / (2m0)
135+
#
136+
cosθ = -cosζ(wr(k, i, 0), σs, ms^2) # pi-angle(1,2) in rest of 0
137+
sinθ = sqrt(1 - cosθ^2)
138+
#
139+
pk = (0, 0, -p3k, Ek)
140+
pi = (p3i * sinθ, 0, p3i * cosθ, Ei)
141+
pj = (-p3i * sinθ, 0, p3k - p3i * cosθ, Ej)
142+
#
143+
return circleorigin(-k, (pi, pj, pk))
144+
end

test/test_invariants.jl

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,46 @@ rp = randomPoint(tbsS)
8989
@test Kibble(rp.σs, tbsS.ms^2) < 0
9090
@test Tuple(rp.two_λs) collect(itr(tbsS.two_js))
9191
end
92+
93+
94+
@testset "Aligned four vectors" begin
95+
# Test 1: Check four-momentum conservation
96+
p1, p2, p3 = aligned_four_vectors(σs, ms; k = 1)
97+
@test all(p1 .+ p2 .+ p3 .≈ (0, 0, 0, ms.m0))
98+
#
99+
# aligned vector k, px=0, is on kth place
100+
@test aligned_four_vectors(σs, ms; k = 1)[1][1] == 0.0
101+
@test aligned_four_vectors(σs, ms; k = 2)[2][1] == 0.0
102+
@test aligned_four_vectors(σs, ms; k = 3)[3][1] == 0.0
103+
104+
metric = (-1, -1, -1, 1)
105+
# Test 2: Check mass shell conditions
106+
@test sum(p1 .^ 2 .* metric) ms.m1^2
107+
@test sum(p2 .^ 2 .* metric) ms.m2^2
108+
@test sum(p3 .^ 2 .* metric) ms.m3^2
109+
110+
# Test 3: Verify invariant masses
111+
@test sum((p2 .+ p3) .^ 2 .* metric) σs.σ1
112+
@test sum((p3 .+ p1) .^ 2 .* metric) σs.σ2
113+
@test sum((p1 .+ p2) .^ 2 .* metric) σs.σ3
114+
end
115+
116+
@testset "Aligned four vectors are cyclic" begin
117+
p1_1, p2_1, p3_1 = aligned_four_vectors(σs, ms; k = 1)
118+
#
119+
p1_2, p2_2, p3_2 = aligned_four_vectors(
120+
MandelstamTuple{Float64}((σs[3], σs[1], σs[2])),
121+
ThreeBodyMasses(ms[3], ms[1], ms[2]; ms.m0);
122+
k = 2,
123+
)
124+
#
125+
p1_3, p2_3, p3_3 = aligned_four_vectors(
126+
MandelstamTuple{Float64}((σs[2], σs[3], σs[1])),
127+
ThreeBodyMasses(ms[2], ms[3], ms[1]; ms.m0);
128+
k = 3,
129+
)
130+
#
131+
@test all(p1_1 .≈ p2_2 .≈ p3_3)
132+
@test all(p2_1 .≈ p3_2 .≈ p1_3)
133+
@test all(p3_1 .≈ p1_2 .≈ p2_3)
134+
end

0 commit comments

Comments
 (0)