Skip to content

Commit 9464c18

Browse files
authored
feat: Add cosθ projection integrand for three-body decay analysis (#71)
* feat: Add cosθ projection integrand for three-body decay analysis - Implement `project_cosθij_intergand` function to project onto cos(θij) - Add new function to ThreeBodyDecays module exports - Include test case to verify cosθ projection integral matches phase space integral * formatting and cspell
1 parent 3f718a8 commit 9464c18

File tree

4 files changed

+76
-7
lines changed

4 files changed

+76
-7
lines changed

.cspell/project.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ guidefontvalign
1818
helicities
1919
helicity
2020
imag
21+
intergand
2122
issequential
2223
jldoctest
2324
JPAC

src/ThreeBodyDecays.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ include("decay_model.jl")
7474
export change_basis_3from1, change_basis_1from2, change_basis_2from3
7575
include("cross_channel.jl")
7676

77-
export phase_space_integrand, projection_integrand
77+
export phase_space_integrand
78+
export projection_integrand, project_cosθij_intergand
7879
include("integrand.jl")
7980

8081
end # module ThreeBodyDecays

src/integrand.jl

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
phase_space_integrand(function_σs, ms; k::Int)
2+
phase_space_integrand(function_σs, ms; k::Int)
33
44
Calculate the phase space integrand for a given function `function_σs`,
55
and mass tuple `ms`. The key argument `k` specifies the mapping: `σk->[0,1]`, zk->[0,1].
@@ -38,7 +38,7 @@ function phase_space_integrand(function_σs, ms; k::Int)
3838
end
3939

4040
"""
41-
projection_integrand(function_σs, ms, σk; k)
41+
projection_integrand(function_σs, ms, σk; k)
4242
4343
Calculate the projection integrand for a given function `function_σs`,
4444
mass tuple `ms`, and Mandelstam variable `σk`, with `k` specified by a keyword argument.
@@ -53,9 +53,9 @@ It returns an integrand function of x, x ∈ [0,1] to pass to a numerical integr
5353
# Usage
5454
```julia
5555
plot(4.2, 4.6) do e1
56-
I = Base.Fix1(unpolarized_intensity, model)
57-
integrand = projection_integrand(I, masses(model), e1^2; k = 3)
58-
e1 * quadgk(integrand, 0, 1)[1]
56+
I = Base.Fix1(unpolarized_intensity, model)
57+
integrand = projection_integrand(I, masses(model), e1^2; k = 3)
58+
e1 * quadgk(integrand, 0, 1)[1]
5959
end
6060
```
6161
"""
@@ -72,3 +72,42 @@ function projection_integrand(function_σs, ms, σk; k)
7272
end
7373
return integrand
7474
end
75+
76+
"""
77+
project_cosθij_intergand(fs, ms, z; k)
78+
79+
Calculate the integrand for projecting onto cos(θij) for a given function `fs`,
80+
mass tuple `ms`, and cosine value `z`, with `k` specifying the spectator.
81+
Returns an integrand function of x ∈ [0,1] to pass to a numerical integrator.
82+
83+
# Arguments
84+
- `fs`: A function that takes a MandelstamTuple and returns a scalar.
85+
- `ms`: A MassTuple containing the masses.
86+
- `z`: The cosine value to project onto.
87+
- `k`: The spectator index.
88+
89+
# Returns
90+
- An integrand function for numerical integration.
91+
92+
# Example
93+
```julia
94+
let Nb = 100
95+
[sum(range(-1, 1, Nb)) do z
96+
integrand = project_cosθij_intergand(I, ms, z; k)
97+
quadgk(integrand, 0, 1)[1] * 2/Nb
98+
end for k in 1:3]
99+
end
100+
```
101+
"""
102+
function project_cosθij_intergand(fs, ms, z; k)
103+
i, j = ij_from_k(k)
104+
mi, mj, mk, m0 = ms[i], ms[j], ms[k], ms[4]
105+
106+
function integrand(xσk)
107+
σs = x2σs([xσk, (z + 1) / 2], ms; k)
108+
σk = σs[k]
109+
jac = sqrt(Kallen(σk, mk^2, m0^2) * Kallen(σk, mi^2, mj^2)) / σk
110+
return fs(σs) / 2 * jac * ((m0 - mk)^2 - (mi + mj)^2)
111+
end
112+
return integrand
113+
end

test/test_integrals.jl

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using ThreeBodyDecays
2+
using QuadGK
23
using Test
34
using Cuba
4-
using QuadGK
55

66
@testset "phase space mapping" begin
77
ms = ThreeBodyMasses(0.141, 0.142, 0.143; m0 = 3.09)
@@ -36,3 +36,31 @@ end
3636
@test quadgk(projection_integrand(σs -> 1, ms, 0.7^2; k = 3), 0, 1)[1]
3737
8.26409477583501
3838
end
39+
40+
@testset "cosθ projection integral" begin
41+
ms = ThreeBodyMasses(0.141, 0.142, 0.143; m0 = 3.09)
42+
I = σs -> σs[1] * σs[2] - σs[3] # Unit amplitude for testing
43+
44+
# Test integration over cosθ matches phase space integral
45+
Nb = 500
46+
# Integration over cosθ
47+
cosθ_integral = [
48+
sum(range(-1, 1, Nb)) do z
49+
integrand = project_cosθij_intergand(I, ms, z; k)
50+
quadgk(integrand, 0, 1)[1] * 2 / Nb
51+
end for k = 1:3
52+
]
53+
54+
# Integration over σk
55+
σk_integral = [
56+
sum(range(lims(ms; k)..., Nb)) do σk
57+
integrand = projection_integrand(I, ms, σk; k)
58+
quadgk(integrand, 0, 1)[1] * diff(collect(lims(ms; k)))[1] / Nb
59+
end for k = 1:3
60+
]
61+
62+
# Both methods should give approximately the same result
63+
@test isapprox(cosθ_integral[1], σk_integral[1], rtol = 1e-2)
64+
@test isapprox(cosθ_integral[2], σk_integral[2], rtol = 1e-2)
65+
@test isapprox(cosθ_integral[3], σk_integral[3], rtol = 1e-2)
66+
end

0 commit comments

Comments
 (0)