Skip to content

Commit

Permalink
Small fixes (#69)
Browse files Browse the repository at this point in the history
* Ignore profile outputs

* Increase font size for plots

This is much better for legible labels on the plots for presentations

* Format update for visualise pluto script

* Reformat...
  • Loading branch information
graeme-a-stewart authored Jul 16, 2024
1 parent b49a8f3 commit 3739cce
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 17 deletions.
2 changes: 2 additions & 0 deletions examples/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
*.pdf
*.png
*.mp4
# Ignore profiling outputs
profile/*
32 changes: 16 additions & 16 deletions examples/visualise-jets-pluto.jl
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
### A Pluto.jl notebook ###
# v0.19.42

# Do not format this code, it's under the control of the Pluto.jl notebook
#! format: off
# v0.19.45

using Markdown
using InteractiveUtils

# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
macro bind(def, element)
quote
local iv = try Base.loaded_modules[Base.PkgId(Base.UUID("6e696c72-6542-2067-7265-42206c756150"), "AbstractPlutoDingetjes")].Bonds.initial_value catch; b -> missing; end
local iv = try
Base.loaded_modules[Base.PkgId(Base.UUID("6e696c72-6542-2067-7265-42206c756150"),
"AbstractPlutoDingetjes")].Bonds.initial_value
catch
b -> missing
end
local el = $(esc(element))
global $(esc(def)) = Core.applicable(Base.get, el) ? Base.get(el) : iv(el)
el
Expand Down Expand Up @@ -39,36 +41,35 @@ This Pluto script visualises the result of a jet reconstruction process.
Use the sliders below to change the reconstructed event, the algorithm and the jet radius parameter."""

# ╔═╡ 0642cc6e-290e-4e01-9882-5c12d7585ead


# ╔═╡ 4e569f74-570b-4b30-9ea7-9cbc420f50f8
md"Event number:"

# ╔═╡ 83030910-8d00-4949-b69e-fa492b61db6b
@bind event_no PlutoUI.Slider(1:100, show_value=true)
@bind event_no PlutoUI.Slider(1:100, show_value = true)

# ╔═╡ 306f6e66-788c-4a95-a9df-3ac4c37cf776
md"``k_T`` algorithm power (-1=Anti-``k_T``, 0 = Cambridge/Aachen, 1=Inclusive kT)"

# ╔═╡ 864d7a31-b634-4edc-b6c4-0835fee53304
@bind power PlutoUI.Slider(-1:1, show_value=true)
@bind power PlutoUI.Slider(-1:1, show_value = true)

# ╔═╡ 9f7988a5-041e-4a83-9da9-d48db34cea98
md"Jet radius parameter"

# ╔═╡ 187315d4-ac3c-4847-ae00-e7da1b27d63f
@bind radius PlutoUI.Slider(range(start=0.4, stop=2.0, step=0.1), show_value=true)
@bind radius PlutoUI.Slider(range(start = 0.4, stop = 2.0, step = 0.1), show_value = true)

# ╔═╡ 79f24ec1-a63e-4e96-bd67-49661125be66
input_file = joinpath(dirname(pathof(JetReconstruction)), "..", "test", "data", "events.hepmc3.gz")
input_file = joinpath(dirname(pathof(JetReconstruction)), "..", "test", "data",
"events.hepmc3.gz")

# ╔═╡ 7d7a8b11-19b3-4b83-a0b1-8201b74b588e
events::Vector{Vector{PseudoJet}} = read_final_state_particles(input_file,
maxevents = event_no, skipevents = event_no);
events::Vector{Vector{PseudoJet}} = read_final_state_particles(input_file,
maxevents = event_no,
skipevents = event_no);

# ╔═╡ 2a899d67-71f3-4fe0-8104-7633a44a06a8
cs = jet_reconstruct(events[1], p=power, R=radius)
cs = jet_reconstruct(events[1], p = power, R = radius)

# ╔═╡ b5fd4e96-d073-4e5f-8de1-41addaa0dc3d
jetreco_vis = jetsplot(events[1], cs; Module = GLMakie)
Expand All @@ -78,7 +79,6 @@ display(jetreco_vis);

# ╔═╡ Cell order:
# ╟─dff6a188-2cbe-11ef-32d0-73c4c05efad2
# ╠═0642cc6e-290e-4e01-9882-5c12d7585ead
# ╠═cf88f2f9-bf19-47e2-ae04-b4476eb26efb
# ╠═24dd666c-49be-4c44-9b9d-d27128c1ffbb
# ╠═0a1a8211-507b-4dc0-9060-0d18a5a695a4
Expand Down
8 changes: 7 additions & 1 deletion ext/JetVisualisation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ module JetVisualisation
using JetReconstruction
using Makie

# Set font size generally (as opposed to xlabelsize=20, etc.)
const jetreco_theme = Theme(fontsize = 24)

"""
jetsplot(objects, cs::ClusterSequence; barsize_phi=0.1, barsize_eta=0.1, colormap=:glasbey_hv_n256, Module=Main)
Expand Down Expand Up @@ -85,6 +88,7 @@ function JetReconstruction.jetsplot(objects, idx_arrays; barsize_phi = 0.1,

pts = sqrt.(JetReconstruction.pt2.(objects))

set_theme!(jetreco_theme)
Module.meshscatter(Module.Point3f.(JetReconstruction.phi.(objects),
JetReconstruction.rapidity.(objects), 0pts);
color = cs,
Expand All @@ -94,7 +98,7 @@ function JetReconstruction.jetsplot(objects, idx_arrays; barsize_phi = 0.1,
figure = (size = (700, 600),),
axis = (type = Module.Axis3, perspectiveness = 0.5, azimuth = 2.6,
elevation = 0.5,
xlabel = "ϕ", ylabel = "η", zlabel = "kt",
xlabel = L"\phi", ylabel = L"y", zlabel = L"p_T",
limits = (nothing, nothing, nothing, nothing, 0,
findmax(pts)[1] + 10)),
shading = NoShading)
Expand Down Expand Up @@ -131,6 +135,7 @@ function JetReconstruction.jetsplot(cs::ClusterSequence,
max_pt = max(max_pt, JetReconstruction.pt(jet))
end

set_theme!(jetreco_theme)
fig, ax, plt_obj = Module.meshscatter(jet_plot_points;
markersize = jet_plot_marker_size,
marker = jet_plot_marker,
Expand Down Expand Up @@ -281,6 +286,7 @@ function JetReconstruction.animatereco(cs::ClusterSequence, filename;
@lift(perspective[1]+$it_obs / merge_steps *
(perspective[2] - perspective[1])) : perspective

set_theme!(jetreco_theme)
ax = (type = Axis3, title = isnothing(title) ? "" : title,
xlabel = L"\phi", ylabel = L"y", zlabel = L"p_T",
limits = (0, 2π, min_rap - 0.5, max_rap + 0.5, 0, max_pt + 10),
Expand Down

0 comments on commit 3739cce

Please sign in to comment.