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

Add an option to draw simplified DOMs

parent 5a9afef4
No related branches found
No related tags found
No related merge requests found
Pipeline #58086 failed
......@@ -46,6 +46,18 @@ As seen in the example above, the detector geometry is "updated" using `update!(
Tracks and hits can be added in a similar way, but using `add!(hits)`.
Check out the `scripts/vhe_paper.jl` script for more inspiration.
## Performance Issues
If you encounter any performance issues, you can remove e.g. the detailed DOM rendering
by passing `simplified_doms=true` to `update!(detector; ...)`, like
```julia
julia> update!(d; simplified_doms=true)
```
Make sure not to overuse `add!(hits)`, since each hit cloud adds some overhead to the
animation loop, even if not fully displayed.
## Keybindings
You can use <kbd>&larr;</kbd> and <kbd>&rarr;</kbd> to go back and forth in time and <kbd>R</kbd> to reset the time.
......
......@@ -264,7 +264,7 @@ function generate_hit_positions(hits; pmt_distance=5, hit_distance=2)
end
function update!(rba::RBA, det::Detector; dom_diameter=0.4, pmt_diameter=0.076, dom_scaling=5, with_basegrid=true)
function update!(rba::RBA, det::Detector; simplified_doms=false, dom_diameter=0.4, pmt_diameter=0.076, dom_scaling=5, with_basegrid=true)
scene = rba.scene
det_center = center(det)
rba.center = det_center
......@@ -287,25 +287,28 @@ function update!(rba::RBA, det::Detector; dom_diameter=0.4, pmt_diameter=0.076,
plots = rba._plots["Detector"] = []
opticalmodules = [m for m in det if isopticalmodule(m)]
pmt_positions = Position{Float64}[]
for m in det
!isopticalmodule(m) && continue
for pmt in m
push!(pmt_positions, pmt.pos + pmt.dir*dom_diameter*dom_scaling - pmt.dir*pmt_diameter*dom_scaling)
end
end
push!(plots, meshscatter!(
scene,
pmt_positions,
markersize=pmt_diameter*dom_scaling,
color=RGBAf(1.0, 1.0, 1.0, 0.4)
))
push!(plots, meshscatter!(
scene,
[m.pos for m opticalmodules],
markersize=dom_diameter*dom_scaling,
color=RGBAf(0.3, 0.3, 0.3, 0.8)
))
if !simplified_doms
pmt_positions = Position{Float64}[]
for m in det
!isopticalmodule(m) && continue
for pmt in m
push!(pmt_positions, pmt.pos + pmt.dir*dom_diameter*dom_scaling - pmt.dir*pmt_diameter*dom_scaling)
end
end
push!(plots, meshscatter!(
scene,
pmt_positions,
markersize=pmt_diameter*dom_scaling,
color=RGBAf(1.0, 1.0, 1.0, 0.4)
))
end
# basemodules = [m for m ∈ det if isbasemodule(m)]
# push!(plots, meshscatter!(
# scene,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment