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

Cleanup

parent 6e27570c
No related branches found
No related tags found
No related merge requests found
......@@ -23,7 +23,7 @@ function main()
event = first(f.offline)
muon = bestjppmuon(event)
#hits = select_hits(event.hits, muon)
#hits = select_cherenkov_hits(event.hits, muon)
hits = filter(h->h.dom_id != 808950076 && h.channel_id != 3, event.hits)
hits = select_first_hits(hits; n=5, maxtot=256)
......@@ -116,44 +116,4 @@ function main()
end
"""
Select hits within a specific Cherenkov time window with respect to the given track.
"""
function select_hits(hits::T, track; mintot=20, maxtot=255, tmin=-50, tmax=500) where T
hits = filter(h -> mintot < h.tot < maxtot, hits)
out = T()
for hit in hits
chit = cherenkov(track, hit)
if tmin < chit.Δt < tmax
push!(out, hit)
end
end
sort(out; by=h->h.t)
end
"""
Select the first `n` hits on each PMT.
"""
function select_first_hits(hits::T; n=1, mintot=20, maxtot=255) where T
hits = filter(h -> mintot < h.tot < maxtot, hits)
out = T()
sort!(hits; by=h->h.t)
pmts = Dict{Tuple{Int, Int}, Int}()
for hit in hits
pmtkey = (hit.dom_id, hit.channel_id)
if !(pmtkey in keys(pmts))
pmts[pmtkey] = 1
end
pmts[pmtkey] > n && continue
pmts[pmtkey] += 1
push!(out, hit)
end
out
end
main()
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