Skip to content
Snippets Groups Projects
Verified Commit adf97260 authored by Tamas Gal's avatar Tamas Gal :speech_balloon:
Browse files

Formatting

parent bda62d71
No related branches found
No related tags found
No related merge requests found
...@@ -6,56 +6,71 @@ using InteractiveUtils ...@@ -6,56 +6,71 @@ using InteractiveUtils
# ╔═╡ 6f448138-0b23-11ef-1b83-859c53214856 # ╔═╡ 6f448138-0b23-11ef-1b83-859c53214856
begin begin
using CairoMakie using CairoMakie
using LumenManufaktur using LumenManufaktur
end end
# ╔═╡ 7292e824-7de9-4d1f-ab2d-895f6fadfd88 # ╔═╡ 7292e824-7de9-4d1f-ab2d-895f6fadfd88
pkgversion(LumenManufaktur) pkgversion(LumenManufaktur)
# ╔═╡ 2a28e349-c9a1-4fb1-a06b-b1b616c20597 # ╔═╡ 2a28e349-c9a1-4fb1-a06b-b1b616c20597
directlightfrommuon(LMParameters(), LumenManufaktur.KM3NeTPMT, 5.23, π, π/2) directlightfrommuon(LMParameters(), LumenManufaktur.KM3NeTPMT, 5.23, π, π / 2)
# ╔═╡ aa28dd35-653e-4433-b0af-4d6050696bc2 # ╔═╡ aa28dd35-653e-4433-b0af-4d6050696bc2
directlightfrommuon(LMParameters(), LumenManufaktur.KM3NeTPMT, 1.15, π/1.5, π/2, 0.01) directlightfrommuon(LMParameters(), LumenManufaktur.KM3NeTPMT, 1.15, π / 1.5, π / 2, 0.01)
# ╔═╡ c89f6755-8dfe-4f8e-a640-d5f52b21c9b6 # ╔═╡ c89f6755-8dfe-4f8e-a640-d5f52b21c9b6
let let
fig = Figure(size = (600, 400)); fig = Figure(size = (600, 400))
ax = Axis( ax = Axis(
fig[1, 1], fig[1, 1],
xlabel = "distance between muon and PMT / m", xlabel = "distance between muon and PMT / m",
ylabel = "npe", ylabel = "npe",
xgridstyle = :dash, xgridstyle = :dash,
ygridstyle = :dash ygridstyle = :dash,
) )
Rs = range(1, 10, 1000) Rs = range(1, 10, 1000)
params = LMParameters(dispersion_model=BaileyDispersion(240)) params = LMParameters(dispersion_model = BaileyDispersion(240))
pmt = LumenManufaktur.KM3NeTPMT pmt = LumenManufaktur.KM3NeTPMT
lines!(ax, Rs, [directlightfrommuon(params, pmt, R, π, π/2) for R in Rs], label="θ = π") lines!(
lines!(ax, Rs, [directlightfrommuon(params, pmt, R, π/2, π/2) for R in Rs], label="θ = π/2") ax,
axislegend(; position = :rt) Rs,
fig [directlightfrommuon(params, pmt, R, π, π / 2) for R in Rs],
label = "θ = π",
)
lines!(
ax,
Rs,
[directlightfrommuon(params, pmt, R, π / 2, π / 2) for R in Rs],
label = "θ = π/2",
)
axislegend(; position = :rt)
fig
end end
# ╔═╡ b6bd1af8-f5af-4536-b903-f894f4bee50f # ╔═╡ b6bd1af8-f5af-4536-b903-f894f4bee50f
let let
fig = Figure(size = (600, 400)); fig = Figure(size = (600, 400))
ax = Axis( ax = Axis(
fig[1, 1], fig[1, 1],
xlabel = "PMT zenith angle [rad]", xlabel = "PMT zenith angle [rad]",
ylabel = "npe", ylabel = "npe",
xgridstyle = :dash, xgridstyle = :dash,
ygridstyle = :dash ygridstyle = :dash,
) )
θs = range(-π, π, 1000) θs = range(-π, π, 1000)
params = LMParameters(dispersion_model=BaileyDispersion(240)) params = LMParameters(dispersion_model = BaileyDispersion(240))
pmt = LumenManufaktur.KM3NeTPMT pmt = LumenManufaktur.KM3NeTPMT
for R in 2:10 for R = 2:10
lines!(ax, θs, [directlightfrommuon(params, pmt, R, θ, π/2) for θ in θs], label="R = $R m") lines!(
end ax,
axislegend(; position = :ct) θs,
fig [directlightfrommuon(params, pmt, R, θ, π / 2) for θ in θs],
label = "R = $R m",
)
end
axislegend(; position = :ct)
fig
end end
# ╔═╡ a3027c77-7f9f-4309-bca2-7a6288eba83a # ╔═╡ a3027c77-7f9f-4309-bca2-7a6288eba83a
...@@ -68,27 +83,23 @@ LumenManufaktur.Kopelevich() ...@@ -68,27 +83,23 @@ LumenManufaktur.Kopelevich()
LumenManufaktur.KM3NeTPMT LumenManufaktur.KM3NeTPMT
# ╔═╡ a196cb83-6423-4360-b335-0c2fa55183b5 # ╔═╡ a196cb83-6423-4360-b335-0c2fa55183b5
ANTARESPMT = LumenManufaktur.PMTModel( ANTARESPMT = LumenManufaktur.PMTModel(440e-4, λ -> rand() * 20, λ -> rand())
440e-4,
λ -> rand()*20,
λ -> rand(),
)
# ╔═╡ 4d6f0b13-98ea-407a-b23d-23ac47df4a3e # ╔═╡ 4d6f0b13-98ea-407a-b23d-23ac47df4a3e
let let
fig = Figure(size = (600, 400)); fig = Figure(size = (600, 400))
ax = Axis( ax = Axis(
fig[1, 1], fig[1, 1],
xlabel = "distance between muon and PMT / m", xlabel = "distance between muon and PMT / m",
ylabel = "npe", ylabel = "npe",
xgridstyle = :dash, xgridstyle = :dash,
ygridstyle = :dash ygridstyle = :dash,
) )
Rs = range(1, 10, 1000) Rs = range(1, 10, 1000)
params = LMParameters(dispersion_model=BaileyDispersion(240)) params = LMParameters(dispersion_model = BaileyDispersion(240))
pmt = LumenManufaktur.KM3NeTPMT pmt = LumenManufaktur.KM3NeTPMT
lines!(ax, Rs, [directlightfrommuon(params, ANTARESPMT, R, π, π/2) for R in Rs]) lines!(ax, Rs, [directlightfrommuon(params, ANTARESPMT, R, π, π / 2) for R in Rs])
fig fig
end end
# ╔═╡ 00000000-0000-0000-0000-000000000001 # ╔═╡ 00000000-0000-0000-0000-000000000001
......
...@@ -34,23 +34,23 @@ end ...@@ -34,23 +34,23 @@ end
@inline function refractionindexgroup(dp::BaileyDispersion, λ) @inline function refractionindexgroup(dp::BaileyDispersion, λ)
n = refractionindexphase(dp, λ) n = refractionindexphase(dp, λ)
y = dispersionphase(dp, λ) y = dispersionphase(dp, λ)
n / (1.0 + y*λ/n) n / (1.0 + y * λ / n)
end end
@inline function dispersionphase(dp::BaileyDispersion, λ) @inline function dispersionphase(dp::BaileyDispersion, λ)
x = 1.0 / λ x = 1.0 / λ
-(x^2)*(dp.a2 + x*(2.0*dp.a3 + x*3.0*dp.a4)) -(x^2) * (dp.a2 + x * (2.0 * dp.a3 + x * 3.0 * dp.a4))
end end
@inline function dispersiongroup(dp::BaileyDispersion, λ) @inline function dispersiongroup(dp::BaileyDispersion, λ)
x = 1.0 / λ x = 1.0 / λ
n = refractionindexphase(dp, λ) n = refractionindexphase(dp, λ)
np = dispersionphase(dp, λ) np = dispersionphase(dp, λ)
npp = x^3*(2.0*dp.a2 + x*(6.0*dp.a3 + x*12.0*dp.a4)) npp = x^3 * (2.0 * dp.a2 + x * (6.0 * dp.a3 + x * 12.0 * dp.a4))
ng = n / (1.0 + np*λ/n) ng = n / (1.0 + np * λ / n)
ng^2 * (2*np^2 - n*npp) * λ / (n^3); ng^2 * (2 * np^2 - n * npp) * λ / (n^3)
end end
""" """
...@@ -71,9 +71,9 @@ function wavelength(dp::BaileyDispersion, n, w, eps) ...@@ -71,9 +71,9 @@ function wavelength(dp::BaileyDispersion, n, w, eps)
v = w v = w
while true while true
y = refractionindexgroup(dp, v) y = refractionindexgroup(dp, v)
abs(y - n) < eps && break abs(y - n) < eps && break
v += (n - y) / dispersiongroup(dp, v) v += (n - y) / dispersiongroup(dp, v)
end end
v v
......
...@@ -13,7 +13,12 @@ The parameter set for light detection. ...@@ -13,7 +13,12 @@ The parameter set for light detection.
- `scattering_probability_model`: the scattering probability model (default: p00075) - `scattering_probability_model`: the scattering probability model (default: p00075)
- `absorption_model`: the absorption model - `absorption_model`: the absorption model
""" """
Base.@kwdef struct LMParameters{D<:DispersionModel,S<:ScatteringModel,SP<:ScatteringProbabilityModel,A<:AbsorptionModel} Base.@kwdef struct LMParameters{
D<:DispersionModel,
S<:ScatteringModel,
SP<:ScatteringProbabilityModel,
A<:AbsorptionModel,
}
minimum_distance::Float64 = 1.0e-1 minimum_distance::Float64 = 1.0e-1
module_radius::Float64 = 0.25 module_radius::Float64 = 0.25
lambda_min::Float64 = 300.0 lambda_min::Float64 = 300.0
......
...@@ -49,7 +49,7 @@ Model specific function to describe light scattering probability in water (p0007 ...@@ -49,7 +49,7 @@ Model specific function to describe light scattering probability in water (p0007
g = 0.924 g = 0.924
f = 0.17 f = 0.17
f * rayleigh(x) + (1.0 - f) * henyey_greenstein(g, x) f * rayleigh(x) + (1.0 - f) * henyey_greenstein(g, x)
end end
""" """
...@@ -61,7 +61,7 @@ Light scattering probability in water (Heneyey-Greenstein). ...@@ -61,7 +61,7 @@ Light scattering probability in water (Heneyey-Greenstein).
- `x`: cosine scattering angle - `x`: cosine scattering angle
""" """
@inline function henyey_greenstein(x) @inline function henyey_greenstein(x)
g = 0.924; g = 0.924
return henyey_greenstein(g, x) return henyey_greenstein(g, x)
end end
...@@ -76,9 +76,9 @@ Light scattering probability in water (Heneyey-Greenstein). ...@@ -76,9 +76,9 @@ Light scattering probability in water (Heneyey-Greenstein).
""" """
@inline function henyey_greenstein(g, x) @inline function henyey_greenstein(g, x)
a0 = (1.0 - g^2) / (4π) a0 = (1.0 - g^2) / (4π)
y = 1.0 + g^2 - 2.0*g*x y = 1.0 + g^2 - 2.0 * g * x
a0 / (y*sqrt(y)) a0 / (y * sqrt(y))
end end
""" """
...@@ -101,8 +101,8 @@ Light scattering probability in water (Rayleigh). ...@@ -101,8 +101,8 @@ Light scattering probability in water (Rayleigh).
- `x`: cosine scattering angle - `x`: cosine scattering angle
""" """
@inline function rayleigh(g, x) @inline function rayleigh(g, x)
a0 = 1.0 / (1.0 + g/3.0) / (4π) a0 = 1.0 / (1.0 + g / 3.0) / (4π)
a0 * (1.0 + g*x^2) a0 * (1.0 + g * x^2)
end end
...@@ -119,21 +119,21 @@ Get the inverse of the attenuation length [m^-1]. ...@@ -119,21 +119,21 @@ Get the inverse of the attenuation length [m^-1].
""" """
function inverseattenuationlength(::Scatteringp00075, l_abs, ls, cts) function inverseattenuationlength(::Scatteringp00075, l_abs, ls, cts)
1.0 / l_abs + inverseattenuationlengthinterpolator(cts) / ls; 1.0 / l_abs + inverseattenuationlengthinterpolator(cts) / ls
end end
""" """
Interpolator for the p00075 model based inverse attenutation calculation. Interpolator for the p00075 model based inverse attenutation calculation.
""" """
const inverseattenuationlengthinterpolator = let const inverseattenuationlengthinterpolator = let
xs = range(-1, 1; length=100000) xs = range(-1, 1; length = 100000)
dx = xs.step.hi dx = xs.step.hi
xs = collect(xs) xs = collect(xs)
ys = Float64[] ys = Float64[]
W = 0.0 W = 0.0
for x in xs for x in xs
push!(ys, W) push!(ys, W)
W += 2π * dx * scatteringprobability(Scatteringp00075(), x+0.5*dx) W += 2π * dx * scatteringprobability(Scatteringp00075(), x + 0.5 * dx)
end end
# xs[1] = 0.0 # xs[1] = 0.0
# xs[end] = 1.0 # xs[end] = 1.0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment