Skip to content

Commit 5c0655d

Browse files
Improved examples and dependencies (#48)
* Tidy up info messages Exclusive jet messages should be debug Format Pseudojet.jl * Rename Cambridge algorithm to CA Give Aachen their due! * Simplified example Remove the machinery for timing and profiling in order to have a simpler example * Rename example codes to be clearer Simple example is now just called jetreco.jl Example with timing and profiling is called instrumented-jetreco.jl * Change message level An info message should be debug * Switch from power to algorithm Power as a proxy for algorithm only works for pp reconstruction algorithms As the intention is to add ee algorithms too, then move to using algorithm name as the steering parameter * Basic jet visualisation example Read an event from a HepMC3 file, reconstruct and then visualise it (save to file) Fixes to JetViz.jl to allow it to be used more easily from example scripts by specifying JetReconstruction module and using namespace * Fix event selector and allow output file to be named Fix the event selector to the odd way that the HepMC3 reader works (to be changed!) Allow output file to be specified * Restructure dependencies Remove all extra dependencies from main package Move JetVisualisation code to an extension (weak depends on CairoMakie) Add separate Project.toml for examples, with extra packages * Used shared try_parse include All the example scripts need this to change CLI options to strategy and algorithm enums * Add README for examples Finesse the weak dependency to be Makie rather than a specific backend (CairoMakie, GLMakie, etc.) Ignore graphics outputs in the example directory * Add visualisation example notebook Uses WGLMakie to render in the browser * Update documentation * Trim whitespace around figure * Minor README update * Version updates Add version numbers for all dependencies Bump minimum Julia to 1.9 (needed for package extensions) Tweak LICENSE file authors and year * Fix LaTeX markup Use $` `$ as the underscores mess things up otherwise
1 parent 63faefa commit 5c0655d

19 files changed

+810
-348
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
fail-fast: false
1919
matrix:
2020
version:
21-
- '1.8'
21+
- '1.9'
2222
- '1'
2323
- 'nightly'
2424
os:

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2022 Atell Krasnopolski
3+
Copyright (c) 2022-2024 The Authors, CERN
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Project.toml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,31 @@
11
name = "JetReconstruction"
22
uuid = "44e8cb2c-dfab-4825-9c70-d4808a591196"
33
authors = ["Atell Krasnopolski <[email protected]>", "Graeme A Stewart <[email protected]", "Philippe Gras <[email protected]>"]
4-
version = "0.2.0"
4+
version = "0.3.0"
55

66
[deps]
77
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
8-
ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63"
9-
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
108
EnumX = "4e289a0a-7415-4d19-859d-a7e5c4648b56"
11-
FlameGraphs = "08572546-2f56-4bcf-ba4e-bab62c3a3f89"
129
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
1310
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
1411
LoopVectorization = "bdcacae8-1622-11e9-2a5c-532679323890"
1512
LorentzVectorHEP = "f612022c-142a-473f-8cfd-a09cf3793c6c"
1613
LorentzVectors = "3f54b04b-17fc-5cd4-9758-90c048d965e3"
17-
Profile = "9abbd945-dff8-562f-b5e8-e1ebf5ef1b79"
18-
ProfileSVG = "132c30aa-f267-4189-9183-c8a63c7e05e6"
19-
StatProfilerHTML = "a8a75453-ed82-57c9-9e16-4cd1196ecbf5"
14+
15+
[weakdeps]
16+
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
17+
18+
[extensions]
19+
JetVisualisation = "Makie"
2020

2121
[compat]
22+
Accessors = "0.1.36"
23+
EnumX = "1.0.4"
24+
JSON = "0.21.4"
25+
Makie = "0.21"
2226
LorentzVectorHEP = "0.1.6"
23-
julia = "1.8"
27+
LorentzVectors = "0.4.3"
28+
julia = "1.9"
2429

2530
[extras]
2631
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

README.md

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Algorithms used are based on the C++ FastJet package (<https://fastjet.fr>,
1010
[hep-ph/0512210](https://arxiv.org/abs/hep-ph/0512210),
1111
[arXiv:1111.6097](https://arxiv.org/abs/1111.6097)), reimplemented natively in Julia.
1212

13-
The algorithms include anti-${k}_\text{T}$, Cambridge/Aachen and inclusive $k_\text{T}$.
13+
The algorithms include anti-$`{k}_\text{T}`$, Cambridge/Aachen and inclusive $`k_\text{T}`$.
1414

1515
### Interface
1616

@@ -71,9 +71,11 @@ plain_jet_reconstruct(particles::Vector{T}; p = -1, R = 1.0, recombine = +)
7171

7272
Note that there is no `strategy` option in these interfaces.
7373

74-
### Example
74+
### Examples
7575

76-
See the `examples/jetreco.jl` script for a full example of how to call jet reconstruction.
76+
In the examples directory there are a number of example scripts.
77+
78+
See the `jetreco.jl` script for an example of how to call jet reconstruction.
7779

7880
```sh
7981
julia --project=. examples/jetreco.jl --maxevents=100 --nsamples=1 --strategy=N2Plain test/data/events.hepmc3
@@ -82,21 +84,40 @@ julia --project=. examples/jetreco.jl --maxevents=100 --nsamples=1 --strategy=N2
8284
...
8385
```
8486

85-
The example also shows how to use `JetReconstruction.HepMC3` to read HepMC3 ASCII files (via the `read_final_state_particles()` wrapper).
87+
There are options to explicitly set the algorithm (use `--help` to see these).
88+
89+
The example also shows how to use `JetReconstruction.HepMC3` to read HepMC3
90+
ASCII files (via the `read_final_state_particles()` wrapper).
91+
92+
Further examples, which show visualisation, timing measurements, profiling, etc.
93+
are given - see the `README.md` file in the examples directory.
94+
95+
Note that due to additional dependencies the `Project.toml` file for the
96+
examples is different from the package itself.
8697

8798
### Plotting
8899

89-
![illustration](img/illustration.jpeg)
100+
![illustration](img/jetvis.png)
101+
102+
To visualise the clustered jets as a 3d bar plot (see illustration above) we now
103+
use `Makie.jl`. See the `jetsplot` function in `ext/JetVisualisation.jl` and its
104+
documentation for more. There are two worked examples in the `examples`
105+
directory.
90106

91-
To visualise the clustered jets as a 3d bar plot (see illustration above) we now use `Makie.jl`. See the `jetsplot` function and its documentation for more.
107+
The plotting code is a package extension and will load if the one of the `Makie`
108+
modules is loaded in the environment.
92109

93110
### Serialisation
94111

95-
The package also provides methods such as `loadjets`, `loadjets!`, and `savejets` that one can use to save and load objects on/from disk easily in a very flexible format. See documentation for more.
112+
The package also provides methods such as `loadjets`, `loadjets!`, and
113+
`savejets` that one can use to save and load objects on/from disk easily in a
114+
very flexible format. See documentation for more.
96115

97116
## Reference
98117

99-
Although it has been developed further since the CHEP2023 conference, the CHEP conference proceedings, [arXiv:2309.17309](https://arxiv.org/abs/2309.17309), should be cited if you use this package:
118+
Although it has been developed further since the CHEP2023 conference, the CHEP
119+
conference proceedings, [arXiv:2309.17309](https://arxiv.org/abs/2309.17309),
120+
should be cited if you use this package:
100121

101122
```bibtex
102123
@misc{stewart2023polyglot,

examples/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Ignore visualisation outputs
2+
*.pdf
3+
*.png

examples/Project.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[deps]
2+
ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63"
3+
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
4+
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
5+
FlameGraphs = "08572546-2f56-4bcf-ba4e-bab62c3a3f89"
6+
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
7+
JetReconstruction = "44e8cb2c-dfab-4825-9c70-d4808a591196"
8+
LorentzVectorHEP = "f612022c-142a-473f-8cfd-a09cf3793c6c"
9+
Profile = "9abbd945-dff8-562f-b5e8-e1ebf5ef1b79"
10+
ProfileSVG = "132c30aa-f267-4189-9183-c8a63c7e05e6"
11+
StatProfilerHTML = "a8a75453-ed82-57c9-9e16-4cd1196ecbf5"
12+
WGLMakie = "276b4fcb-3e11-5398-bf8b-a0c2d153d008"

examples/README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# JetReconstruction.jl Examples
2+
3+
This directory has a number of example files that show how to used the
4+
`JetReconstruction.jl` package.
5+
6+
Because of extra dependencies in these scripts, one must use the `Project.toml`
7+
file in this directory.
8+
9+
## `jetreco.jl`
10+
11+
This is a basic jet reconstruction example that shows how to call the package to
12+
perform a jet reconstruction, with different algorithms and (optionally)
13+
strategy, producing exclusive and inclusive jet selections.
14+
15+
## `instrumented-jetreco.jl`
16+
17+
This is a more sophisticated example that allows performance measurements to be
18+
made of the reconstruction, as well as profiling (flamegraphs and memory
19+
profiling).
20+
21+
## `visualise-jets.jl`
22+
23+
This script will produce a PNG/PDF showing the results of a jet reconstruction.
24+
This is a 3D plot where all the initial energy deposits are visualised, with
25+
colours that indicate in which final cluster the deposit ended up in.
26+
27+
## `visualise-jets.ipynb`
28+
29+
This notebook will produce a visualisation of jet reconstruction in the browser.
30+
This is a 3D plot where all the initial energy deposits are visualised, with
31+
colours that indicate in which final cluster the deposit ended up in.

0 commit comments

Comments
 (0)