Skip to content
Snippets Groups Projects
Commit 49e91906 authored by Manu Le Guirriec's avatar Manu Le Guirriec
Browse files

Create DAQSummaryslice object

parent c7dabdb5
No related branches found
No related tags found
1 merge request!35DAQSummaryslice stream
......@@ -100,6 +100,7 @@ struct CHClient{T}
end
CHTag(::Type{T}) where T = error("No controlhost tag defined for type '$(T)'")
CHTag(::Type{DAQEvent}) = CHTag("IO_EVT")
CHTag(::Type{DAQSummaryslice}) = CHTag("IO_SUM")
CHClient(ip::IPv4, port::Integer, tags::Vector{CHTag}) = CHClient{CHMessage}(ip, port, tags)
CHClient{T}(ip::IPv4, port::Integer) where T = CHClient{T}(ip, port, [CHTag(T)])
Base.eltype(::CHClient{T}) where T = T
......
# Online DAQ readout
using StaticArrays
function Base.read(s::IO, ::Type{T}; legacy=false) where T<:DAQEvent
length = read(s, Int32)
......@@ -52,3 +53,39 @@ function Base.read(s::IO, ::Type{T}; legacy=false) where T<:DAQEvent
T(header, snapshot_hits, triggered_hits)
end
function Base.read(s::IO, ::Type{T}; legacy=false) where T<:DAQSummaryslice
length = read(s, Int32)
type = read(s, Int32)
version = Int16(0)
!legacy && (version = read(s, Int16))
detector_id = read(s, Int32)
run_id = read(s, Int32)
frame_index = read(s, Int32)
utc_seconds = read(s, UInt32)
utc_16nanosecondcycles = read(s, UInt32) # 16ns ticks
header = SummarysliceHeader(
detector_id,
run_id,
frame_index,
UTCExtended(utc_seconds, utc_16nanosecondcycles)
)
n_frames = read(s, Int32)
summary_frames = Vector{SummaryFrame}()
sizehint!(summary_frames, n_frames)
@inbounds for i 1:n_frames
dom_id = read(s, Int32)
daq = read(s, UInt32)
status = read(s,UInt32)
fifo = read(s,UInt32)
status3 = read(s,UInt32)
status4 = read(s,UInt32)
rates = @SVector [read(s,UInt8) for i 1:31]
push!(summary_frames, SummaryFrame(dom_id, daq, status, fifo, status3, status4, rates))
end
T(header, summary_frames)
end
......@@ -44,6 +44,7 @@ ROOTFile,
# Online dataformat
DAQEvent,
DAQSummaryslice,
EventHeader,
SnapshotHit,
SummaryFrame,
......
......@@ -205,3 +205,13 @@ struct DAQEvent
snapshot_hits::Vector{SnapshotHit}
triggered_hits::Vector{TriggeredHit}
end
"""
DAQSummaryslice from JLigier
"""
struct DAQSummaryslice
header::SummarysliceHeader
summary_frames::Vector{SummaryFrame}
end
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