Skip to content

Commit 12079ac

Browse files
Cluster sequence utilities and reconstruction animation (#65)
* Add ranking of jets Utility function that returns a ranking of initial jets according to some value, by default p_T Used to assign stable values to subsequently reconstructed jets based on their constituents, e.g., for mapping to colours for plotting * Add intermediate state and plotting Add a method to retrieve the intermediate state of a reconstruction (using a special struct, JetWithAncestors) Plotter for this intermediate state, which preserves colours based on a ranking of primary clusters (defaults to p_T ranking) * Fix bug in reco_state Use the jetp_index of the parent's history entry, instead of the history entry index (which is wrong) Add merge_steps method to count the number of meaningful iterations in the reconstruction process (used to get the number of animation steps) * Add reconstruction animation function animatereco() calculates all of the intermediate states during the reconstruction and plots them with meshplot, creating an animation output * Add feature to plot ancestors Option to plot all ancestors of a growing jet, using the colour of the jet they merge to * Shifting perspective Allow passing of tuple of two numbers for axis view options that give the starting and ending points for the axis view Code refomatted * Wrap colormap values When there are > length(colormap) starting clusters the extra ones are clipped, so instead wrap back to the start of the colormap N.B. There is an assumption here that the colormap has 256 categorical values, which may not be true. However, I can't currently find an easy way to inspect a colormap Symbol and extract the length * Use variable for colormap end * Add title and end frames options Title does what it says on the tin... End frames extend the animation at the end * Minor updates Ignore video files in the example directory Remove unneeded dependencies from jetreco.jl * Improved documentation Add Documenter setup to use @autodocs to generate all public and internal documentation. Use @ref links to refer to methods and types in main documentation pages. Move get_all_ancestors() method to ClusterSequence (it is not visualisation). Add logo for the package!
1 parent 889b9e4 commit 12079ac

18 files changed

+748
-54
lines changed

docs/Project.toml

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
[deps]
2+
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
23
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
34
JetReconstruction = "44e8cb2c-dfab-4825-9c70-d4808a591196"
5+
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
46

57
[compat]
68
Documenter = "1.4"

docs/make.jl

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
using Documenter
2+
using CairoMakie
23
using JetReconstruction
34

4-
makedocs(sitename = "JetReconstruction.jl")
5+
push!(LOAD_PATH, "../ext/")
6+
7+
include(joinpath(@__DIR__, "..", "ext", "JetVisualisation.jl"))
8+
9+
makedocs(sitename = "JetReconstruction.jl",
10+
pages = [
11+
"Home" => "index.md",
12+
"Examples" => "examples.md",
13+
"Reference" => Any["Public API" => "lib/public.md",
14+
"Internal API" => "lib/internal.md",
15+
"Visualisation API" => "lib/visualisation.md"]
16+
])
517

618
deploydocs(repo = "github.com/JuliaHEP/JetReconstruction.jl.git",
719
push_preview = true)

docs/src/assets/logo.png

31.1 KB
Loading

docs/src/assets/logo.svg

+180
Loading

docs/src/examples.md

+5
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,8 @@ Similar to `visualise-jets.jl` this notebook will produce a visualisation of jet
4444
reconstruction in the browser. This is a 3D plot where all the initial energy
4545
deposits are visualised, with colours that indicate in which final cluster the
4646
deposit ended up in.
47+
48+
## `animate-reconstruction.jl`
49+
50+
Performs jet reconstruction and then produces and animation of the process,
51+
showing how the jets merge from their different constituents.

docs/src/index.md

+18-23
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,16 @@ inclusive ``k_\text{T}``.
1616

1717
## Reconstruction Interface
1818

19-
The main interface for reconstruction is:
19+
The main interface for reconstruction is [`jet_reconstruct`](@ref), called as, e.g.,
2020

21-
```@docs
22-
jet_reconstruct(particles; p = -1, R = 1.0, recombine = +, strategy = RecoStrategy.Best)
21+
```julia
22+
jet_reconstruct(particles; p = -1, R = 1.0)
2323
```
2424

25-
The object returned is a `ClusterSequence`, which internally tracks all merge steps.
25+
Where `particles` is a collection of 4-vector objects to reconstruct.
2626

27-
```@docs
28-
ClusterSequence
29-
```
27+
The object returned is a [`ClusterSequence`](@ref), which internally tracks all
28+
merge steps.
3029

3130
## Strategy
3231

@@ -38,9 +37,12 @@ Three strategies are available for the different algorithms:
3837
| `RecoStrategy.N2Plain` | Global matching of particles at each interation (works well for low $N$) | `plain_jet_reconstruct` |
3938
| `RecoStrategy.N2Tiled` | Use tiles of radius $R$ to limit search space (works well for higher $N$) | `tiled_jet_reconstruct` |
4039

41-
Generally one can use the `jet_reconstruct` interface, shown above, as the *Best* strategy safely as the overhead is extremely low. That interface supports a `strategy` option to switch to a different option.
40+
Generally one can use the `jet_reconstruct` interface, shown above, as the
41+
*Best* strategy safely as the overhead is extremely low. That interface supports
42+
a `strategy` option to switch to a different option.
4243

43-
Another option, if one wishes to use a specific strategy, is to call that strategy's interface directly, e.g.,
44+
Another option, if one wishes to use a specific strategy, is to call that
45+
strategy's interface directly, e.g.,
4446

4547
```julia
4648
# For N2Plain strategy called directly
@@ -54,19 +56,8 @@ Note that there is no `strategy` option in these interfaces.
5456
To obtain final jets both inclusive (``p_T`` cut) and exclusive (``n_{jets}`` or
5557
``d_{ij}`` cut) selections are supported:
5658

57-
```@docs
58-
inclusive_jets(clusterseq::ClusterSequence, ptmin = 0.0)
59-
```
60-
61-
```@docs
62-
exclusive_jets(clusterseq::ClusterSequence; dcut = nothing, njets = nothing)
63-
```
64-
65-
The number of exclusive jets passing a particular `dcut` can be obtained:
66-
67-
```@docs
68-
n_exclusive_jets(clusterseq::ClusterSequence; dcut::AbstractFloat)
69-
```
59+
- [inclusive_jets(clusterseq::ClusterSequence, ptmin = 0.0)](@ref)
60+
- [exclusive_jets(clusterseq::ClusterSequence; dcut = nothing, njets = nothing)](@ref)
7061

7162
### Sorting
7263

@@ -79,7 +70,7 @@ sorted_jets = sort!(inclusive_jets(cs::ClusterSequence; ptmin=5.0),
7970
by=JetReconstruction.energy, rev=true)
8071
```
8172

82-
## Plotting
73+
## Plotting and Animation
8374

8475
![illustration](assets/jetvis.png)
8576

@@ -91,6 +82,10 @@ directory.
9182
The plotting code is a package extension and will load if the one of the `Makie`
9283
modules is loaded in the environment.
9384

85+
The [`animatereco`](@ref) function will animate the reconstruction sequence, given a
86+
`ClusterSequence` object. See the function documentation for the many options
87+
that can be customised.
88+
9489
## Serialisation
9590

9691
The package also provides methods such as `loadjets`, `loadjets!`, and

docs/src/lib/internal.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Jet Reconstruction Internal Documentation
2+
3+
Documentation for `JetReconstruction.jl`'s internal methods and types.
4+
5+
N.B. no guarantee is made of stability of these interfaces or types.
6+
7+
```@meta
8+
CollapsedDocStrings = true
9+
```
10+
11+
## Index
12+
13+
```@index
14+
Pages = ["internal.md"]
15+
```
16+
17+
## Public Interface
18+
19+
```@autodocs
20+
Modules = [JetReconstruction]
21+
Public = false
22+
Order = [:function, :type]
23+
```

docs/src/lib/public.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Jet Reconstruction Public Documentation
2+
3+
Documentation for `JetReconstruction.jl`'s public interfaces.
4+
5+
## Index
6+
7+
```@index
8+
Pages = ["public.md"]
9+
```
10+
11+
## Public Methods and Types
12+
13+
```@autodocs
14+
Modules = [JetReconstruction]
15+
Private = false
16+
Order = [:function, :type]
17+
```

docs/src/lib/visualisation.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Jet Visualisation Documentation
2+
3+
Documentation for visualisation interfaces extension module.
4+
5+
## Index
6+
7+
```@index
8+
Pages = ["visualisation.md"]
9+
```
10+
11+
## Jet Visualisation Public Interfaces
12+
13+
```@autodocs
14+
Modules = [JetVisualisation]
15+
Order = [:function]
16+
```

examples/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# Ignore visualisation outputs
22
*.pdf
33
*.png
4+
*.mp4

examples/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,8 @@ colours that indicate in which final cluster the deposit ended up in.
2929
This notebook will produce a visualisation of jet reconstruction in the browser.
3030
This is a 3D plot where all the initial energy deposits are visualised, with
3131
colours that indicate in which final cluster the deposit ended up in.
32+
33+
## `animate-reconstruction.jl`
34+
35+
Performs jet reconstruction and then produces and animation of the process,
36+
showing how the jets merge from their different constituents.

0 commit comments

Comments
 (0)