Skip to content

Commit

Permalink
add Lb2pKg model (#34)
Browse files Browse the repository at this point in the history
* json file for Lb2pKg

* Updated json file and docs .qmd file for Lb2pKg

* Add .qmd file and modified json file

* [pre-commit.ci] auto fixes from pre-commit.com hooks

* update deps.
- no Graphs
- up TBDsIO.jl, HadronicLineshapes.jl

* introduced MomentumPower for FF

* test of lineshape computation

* MAINT: make page name lower case

* MAINT: git-ignore Quaro output files

* DOC: switch Julia notebook order

* MAINT: remove temporary files

* update masses to approximate

* fix couplings weights

* add BlattWeisskopf for 1405

* add Dalitz and projections to docs

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Mikhail Mikhasenko <[email protected]>
Co-authored-by: Remco de Boer <[email protected]>
  • Loading branch information
4 people committed May 21, 2024
1 parent c1451c9 commit 0c8f4b9
Show file tree
Hide file tree
Showing 5 changed files with 2,514 additions and 57 deletions.
3 changes: 3 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.jupyter_cache/
*.html
*.ipynb
/.quarto/
execute-results/
site_libs/
1 change: 1 addition & 0 deletions docs/_quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ website:
- section: Julia
contents:
- julia/lc2pkpi.qmd
- julia/lb2pkg.qmd
- section: Python
contents:
- python/lc2pkpi.qmd
66 changes: 9 additions & 57 deletions docs/julia/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ project_hash = "e40973e8a6fbb9a08333ee74ae05bd4d2aa9d2f4"
uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f"
version = "1.1.1"

[[deps.ArnoldiMethod]]
deps = ["LinearAlgebra", "Random", "StaticArrays"]
git-tree-sha1 = "62e51b39331de8911e4a7ff6f5aaf38a5f4cc0ae"
uuid = "ec485272-7323-5ecc-a04f-4719b315124d"
version = "0.2.0"

[[deps.Artifacts]]
uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"

Expand Down Expand Up @@ -94,12 +88,6 @@ deps = ["Artifacts", "Libdl"]
uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae"
version = "1.1.1+0"

[[deps.Compose]]
deps = ["Base64", "Colors", "DataStructures", "Dates", "IterTools", "JSON", "LinearAlgebra", "Measures", "Printf", "Random", "Requires", "Statistics", "UUIDs"]
git-tree-sha1 = "bf6570a34c850f99407b494757f5d7ad233a7257"
uuid = "a81c6b42-2e10-5240-aca2-a61377ecd94b"
version = "0.9.5"

[[deps.ConcurrentUtilities]]
deps = ["Serialization", "Sockets"]
git-tree-sha1 = "6cbbd4d241d7e6579ab354737f4dd95ca43946e1"
Expand Down Expand Up @@ -162,10 +150,6 @@ git-tree-sha1 = "9e2f36d3c96a820c678f2f1f1782582fcf685bae"
uuid = "8bb1440f-4735-579b-a4ab-409b98df4dab"
version = "1.9.1"

[[deps.Distributed]]
deps = ["Random", "Serialization", "Sockets"]
uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"

[[deps.DocStringExtensions]]
deps = ["LibGit2"]
git-tree-sha1 = "2fb1e02f2b635d0845df5d7c167fec4dd739b00d"
Expand Down Expand Up @@ -212,9 +196,9 @@ uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee"

[[deps.FixedPointNumbers]]
deps = ["Statistics"]
git-tree-sha1 = "335bfdceacc84c5cdf16aadc768aa5ddfc5383cc"
git-tree-sha1 = "05882d6995ae5c12bb5f36dd2ed3f61c98cbb172"
uuid = "53c48c17-4a7d-5ca2-90c5-79b7896eea93"
version = "0.8.4"
version = "0.8.5"

[[deps.Fontconfig_jll]]
deps = ["Artifacts", "Bzip2_jll", "Expat_jll", "FreeType2_jll", "JLLWrappers", "Libdl", "Libuuid_jll", "Zlib_jll"]
Expand Down Expand Up @@ -273,24 +257,12 @@ git-tree-sha1 = "7c82e6a6cd34e9d935e9aa4051b66c6ff3af59ba"
uuid = "7746bdde-850d-59dc-9ae8-88ece973131d"
version = "2.80.2+0"

[[deps.GraphPlot]]
deps = ["ArnoldiMethod", "ColorTypes", "Colors", "Compose", "DelimitedFiles", "Graphs", "LinearAlgebra", "Random", "SparseArrays"]
git-tree-sha1 = "5cd479730a0cb01f880eff119e9803c13f214cab"
uuid = "a2cc645c-3eea-5389-862e-a155d0052231"
version = "0.5.2"

[[deps.Graphite2_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "344bf40dcab1073aca04aa0df4fb092f920e4011"
uuid = "3b182d85-2403-5c21-9c21-1e1f0cc25472"
version = "1.3.14+0"

[[deps.Graphs]]
deps = ["ArnoldiMethod", "Compat", "DataStructures", "Distributed", "Inflate", "LinearAlgebra", "Random", "SharedArrays", "SimpleTraits", "SparseArrays", "Statistics"]
git-tree-sha1 = "899050ace26649433ef1af25bc17a815b3db52b7"
uuid = "86223c79-3864-5bf0-83f7-82e725a168b6"
version = "1.9.0"

[[deps.Grisu]]
git-tree-sha1 = "53bb909d1151e57e2484c3d1b53e19552b887fb2"
uuid = "42e2da0e-8278-4e71-bc24-59509adca0fe"
Expand All @@ -304,23 +276,18 @@ version = "1.10.8"

[[deps.HadronicLineshapes]]
deps = ["Parameters", "QuadGK", "StaticArrays"]
git-tree-sha1 = "a5a003ce9e1203fb41a51e1d36d4a6cf82c40f13"
git-tree-sha1 = "a8ad741e2299f02a9f52378060d66befd4bdd8f7"
repo-rev = "main"
repo-url = "https://github.com/mmikhasenko/HadronicLineshapes.jl"
uuid = "49c9d978-1f9d-4e96-a984-0a9783c0b9bf"
version = "0.2.0"
version = "0.3.0"

[[deps.HarfBuzz_jll]]
deps = ["Artifacts", "Cairo_jll", "Fontconfig_jll", "FreeType2_jll", "Glib_jll", "Graphite2_jll", "JLLWrappers", "Libdl", "Libffi_jll", "Pkg"]
git-tree-sha1 = "129acf094d168394e80ee1dc4bc06ec835e510a3"
uuid = "2e76f6c2-a576-52d4-95c1-20adfe4de566"
version = "2.8.1+1"

[[deps.Inflate]]
git-tree-sha1 = "ea8031dea4aff6bd41f1df8f2fdfb25b33626381"
uuid = "d25df0c9-e2be-5dd7-82c8-3ad0b3e990b9"
version = "0.1.4"

[[deps.InlineStrings]]
deps = ["Parsers"]
git-tree-sha1 = "9cc2baf75c6d09f9da536ddf58eb2f29dedaf461"
Expand All @@ -341,11 +308,6 @@ git-tree-sha1 = "630b497eafcc20001bba38a4651b327dcfc491d2"
uuid = "92d709cd-6900-40b7-9082-c6be49f344b6"
version = "0.2.2"

[[deps.IterTools]]
git-tree-sha1 = "42d5f897009e7ff2cf88db414a389e5ed1bdd023"
uuid = "c8e1da08-722c-5040-9ed9-7db0dc04731e"
version = "1.10.0"

[[deps.IteratorInterfaceExtensions]]
git-tree-sha1 = "a3f24677c21f5bbe9d2a714f95dcd58337fb2856"
uuid = "82899510-4779-5014-852e-03e436cf321d"
Expand Down Expand Up @@ -825,10 +787,6 @@ git-tree-sha1 = "e2cc6d8c88613c05e1defb55170bf5ff211fbeac"
uuid = "efcf1570-3423-57d1-acb7-fd33fddbac46"
version = "1.1.1"

[[deps.SharedArrays]]
deps = ["Distributed", "Mmap", "Random", "Serialization"]
uuid = "1a1011a3-84de-559e-8e89-a11a2f7dc383"

[[deps.Showoff]]
deps = ["Dates", "Grisu"]
git-tree-sha1 = "91eddf657aca81df9ae6ceb20b959ae5653ad1de"
Expand All @@ -840,12 +798,6 @@ git-tree-sha1 = "874e8867b33a00e784c8a7e4b60afe9e037b74e1"
uuid = "777ac1f9-54b0-4bf8-805c-2214025038e7"
version = "1.1.0"

[[deps.SimpleTraits]]
deps = ["InteractiveUtils", "MacroTools"]
git-tree-sha1 = "5d7e3f4e11935503d3ecaf7186eac40602e7d231"
uuid = "699a6c99-e7fa-54fc-8d76-47d257e15c1d"
version = "0.9.4"

[[deps.Sockets]]
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"

Expand Down Expand Up @@ -946,12 +898,12 @@ uuid = "e6563dab-9ca1-5843-bde3-2ccf38d63843"
version = "0.11.2"

[[deps.ThreeBodyDecaysIO]]
deps = ["DataFrames", "GraphPlot", "Graphs", "HadronicLineshapes", "JSON", "OrderedCollections", "Parameters", "ThreeBodyDecays"]
git-tree-sha1 = "cfd6e74d4ebe316d8c44640d78c05e4fc29e4288"
deps = ["DataFrames", "HadronicLineshapes", "JSON", "OrderedCollections", "Parameters", "ThreeBodyDecays"]
git-tree-sha1 = "553720fbc7779bc22d7d20207b9a7f140df803ac"
repo-rev = "main"
repo-url = "https://github.com/mmikhasenko/ThreeBodyDecaysIO.jl"
uuid = "418e7ecf-680e-4cb5-ad61-5e2f006aefac"
version = "0.1.1"
version = "0.2.1"

[[deps.TranscodingStreams]]
git-tree-sha1 = "5d54d076465da49d6746c647022f3b3674e64156"
Expand Down Expand Up @@ -987,9 +939,9 @@ version = "0.4.1"

[[deps.Unitful]]
deps = ["Dates", "LinearAlgebra", "Random"]
git-tree-sha1 = "3c793be6df9dd77a0cf49d80984ef9ff996948fa"
git-tree-sha1 = "352edac1ad17e018186881b051960bfca78a075a"
uuid = "1986cc42-f94f-5a68-af5c-568840ba703d"
version = "1.19.0"
version = "1.19.1"

[deps.Unitful.extensions]
ConstructionBaseUnitfulExt = "ConstructionBase"
Expand Down
180 changes: 180 additions & 0 deletions docs/julia/lb2pkg.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
---
jupyter: julia-amplitude-serialization-1.10
---

# $\Lambda_b^0 \to p K^- \gamma$

This page demostrates deserialization and evaluation of an amplitude model for the decay $\Lambda_b^0 \to p K^- \gamma$. The resonant structure is studied using proton-proton collision data recorded at centre-of-mass energies of $7$, $8$, and $13$ TeV collected with the LHCb detector, [INSPIRE-HEP 2765817](https://inspirehep.net/literature/2765817).

```{julia}
#| code-fold: true
#| code-summary: Activate environment
#| output: false
import Pkg
Pkg.activate(@__DIR__)
Pkg.instantiate()
using ThreeBodyDecaysIO
using ThreeBodyDecaysIO.ThreeBodyDecays
using ThreeBodyDecaysIO.HadronicLineshapes
using ThreeBodyDecaysIO.Parameters
using ThreeBodyDecaysIO.DataFrames
using ThreeBodyDecaysIO.JSON
using Measurements
using Statistics
using QuadGK
using Plots
theme(:wong2, frame=:box, grid=false, minorticks=true,
guidefontvalign=:top, guidefonthalign=:right,
foreground_color_legend=nothing,
xlim=(:auto, :auto), ylim=(:auto, :auto),
lab="")
```

## Function definitions

Non-standard lineshapes are used to model resonances that do not conform to a simple `BreitWigner` distributions, or a `MultichannelBreitWigner` has to be defined explicitly.
The code below defines a new `NonResonant` lineshape, and its deserialization method. In this case this is just a constant.

```{julia}
struct NonResonant <: HadronicLineshapes.AbstractFlexFunc
m::Float64
end
function (BW::NonResonant)(σ)
@unpack m = BW
1.0
end
function ThreeBodyDecaysIO.dict2instance(::Type{NonResonant}, dict)
@unpack mass = dict
return NonResonant(mass)
end
```

## Deserialization of Objects to a Workspace

Model components are deserialized from a JSON file into computational objects within a workspace for further manipulation. First, functions representing lineshapes and formfactors are built. Following this, distributions are processed and added to the workspace.

```{julia}
input = open(joinpath(@__DIR__, "..", "..", "models", "Lb2pKg.json")) do io
JSON.parse(io)
end
workspace = Dict{String,Any}()
@unpack functions = input
for fn in functions
@unpack name, type = fn
instance_type = eval(Symbol(type))
workspace[name] = dict2instance(instance_type, fn)
end
@unpack distributions = input
for dist in distributions
@unpack name, type = dist
instance_type = eval(Symbol(type))
workspace[name] = dict2instance(instance_type, distributions[1]; workspace)
end
```

## Validation

The integrity of the model is checked by validating the value of distributions at a few phase space points.
The table lists the validation checkes and their status ("🟢" ($<10^{-12}$), "🟡" ($<10^{-2}$) or "🔴" $\ge10^{-2}$) for the difference between the reference and computed values.

```{julia}
#| code-fold: true
#| code-summary: A loop over validation points
df = let
@unpack misc, parameter_points = input
@unpack amplitude_model_checksums = misc
map(amplitude_model_checksums) do check_point_info
@unpack name, value, distribution = check_point_info
#
# pull distribution
dist = workspace[distribution]
# pull correct parameter point
parameter_points_dict = array2dict(parameter_points; key="name")
# find the point in the list of points
parameter_point = parameter_points_dict[name]
# compute, compare
_parameters = array2dict(parameter_point["parameters"];
key="name", apply=v -> v["value"])
#
function label_diff(diff; levels=[1e-2, 1e-12])
_diff = abs(diff)
_diff < levels[2] && return '🟢'
_diff < levels[1] && return '🟡'
return '🔴'
end
computed_value = dist(_parameters)
status = label_diff(value - computed_value)
(; Distribution=distribution, Reference=value, Computed_value=computed_value,
Point=name, Status=status)
end |> DataFrame
end
```

## Visualization

The model descibing the decay is fetched from the workspace

```{julia}
model_dist = [v for (k, v) in workspace if v isa HadronicUnpolarizedIntensity] |> first;
model = model_dist.model
```

### Dalitz plot

The Dalitz plot shows the probability distribution across two dimensional phase space of the decay in the range of mass $m_{pK^{-}}$ from $1.5$ to $2.5 GeV/c^2$.

```{julia}
#| code-fold: true
#| code-summary: Dalitz plot plotting
let
ms = masses(model)
#
σ3v = range(lims3(ms)[1], 2.5^2, 100)[2:end-1]
σ2v = range(5, 27, 30)[2:end-1]
#
_model = model
f(σs) = Kibble(σs, ms^2) > 0 ? NaN : unpolarized_intensity(model, σs)
calv = [
f(Invariants(ms; σ3, σ2)) for σ2 in σ2v, σ3 in σ3v]
heatmap(σ3v, σ2v, calv)
end
```

The projection of the model onto a mass variable is shown by black line.
Contributions from individual resonances are shown by the colored lines.

```{julia}
#| code-fold: true
#| code-summary: Computation of projections
let k = 3
i, j = ij_from_k(k)
xlab = "m($i$j) [GeV]"
model = model_dist.model
#
mlims = (sqrt(lims(3, masses(model))[1]), 2.5)
mv = range(mlims..., 200) |> shift_by_half
#
plot()
plot!(mv, lab="Total") do m
I = Base.Fix1(unpolarized_intensity, model)
m * quadgk(projection_integrand(I, masses(model), m^2; k), 0, 1)[1]
end
chain_names = Set(model.names) |> collect |> sort
for name in chain_names
_model = model[model.names.==name]
plot!(mv, lab=name) do m
I = Base.Fix1(unpolarized_intensity, _model)
m * quadgk(projection_integrand(I, masses(_model), m^2; k), 0, 1)[1]
end
end
plot!(; xlab)
end
```
Loading

0 comments on commit 0c8f4b9

Please sign in to comment.