Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
KM3io.jl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
common
KM3io.jl
Commits
6e95b711
Verified
Commit
6e95b711
authored
2 years ago
by
Tamas Gal
Browse files
Options
Downloads
Patches
Plain Diff
Clean up names
parent
64ed53d2
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
README.md
+6
-6
6 additions, 6 deletions
README.md
src/daq.jl
+5
-5
5 additions, 5 deletions
src/daq.jl
src/root/online.jl
+17
-48
17 additions, 48 deletions
src/root/online.jl
src/types.jl
+20
-4
20 additions, 4 deletions
src/types.jl
with
48 additions
and
63 deletions
README.md
+
6
−
6
View file @
6e95b711
...
...
@@ -50,12 +50,12 @@ julia> event = f.events[1]
KM3io
.
DAQEvent
with
96
snapshot
and
18
triggered
hits
julia
>
event
.
triggered_hits
[
4
:
8
]
5
-
element
Vector
{
KM3io
.
KM3NETDAQ
TriggeredHit
}
:
KM3io
.
KM3NETDAQ
TriggeredHit
(
808447186
,
0x00
,
30733214
,
0x19
,
0x0000000000000016
)
KM3io
.
KM3NETDAQ
TriggeredHit
(
808447186
,
0x01
,
30733214
,
0x15
,
0x0000000000000016
)
KM3io
.
KM3NETDAQ
TriggeredHit
(
808447186
,
0x02
,
30733215
,
0x15
,
0x0000000000000016
)
KM3io
.
KM3NETDAQ
TriggeredHit
(
808447186
,
0x03
,
30733214
,
0x1c
,
0x0000000000000016
)
KM3io
.
KM3NETDAQ
TriggeredHit
(
808451907
,
0x07
,
30733441
,
0x1e
,
0x0000000000000004
)
5
-
element
Vector
{
KM3io
.
TriggeredHit
}
:
KM3io
.
TriggeredHit
(
808447186
,
0x00
,
30733214
,
0x19
,
0x0000000000000016
)
KM3io
.
TriggeredHit
(
808447186
,
0x01
,
30733214
,
0x15
,
0x0000000000000016
)
KM3io
.
TriggeredHit
(
808447186
,
0x02
,
30733215
,
0x15
,
0x0000000000000016
)
KM3io
.
TriggeredHit
(
808447186
,
0x03
,
30733214
,
0x1c
,
0x0000000000000016
)
KM3io
.
TriggeredHit
(
808451907
,
0x07
,
30733441
,
0x1e
,
0x0000000000000004
)
julia
>
for
event
∈
f
.
events
@show
event
.
header
.
frame_index
length
(
event
.
snapshot_hits
)
...
...
This diff is collapsed.
Click to expand it.
src/daq.jl
+
5
−
5
View file @
6e95b711
...
...
@@ -17,10 +17,10 @@ function Base.read(s::IO, ::Type{T}; legacy=false) where T<:DAQEvent
trigger_mask
=
read
(
s
,
Int64
)
overlays
=
read
(
s
,
Int32
)
header
=
KM3NETDAQ
EventHeader
(
det_id
,
run_id
,
timeslice_id
,
timestamp
,
ticks
,
trigger_counter
,
trigger_mask
,
overlays
)
header
=
EventHeader
(
det_id
,
run_id
,
timeslice_id
,
timestamp
,
ticks
,
trigger_counter
,
trigger_mask
,
overlays
)
n_triggered_hits
=
read
(
s
,
Int32
)
triggered_hits
=
Vector
{
KM3NETDAQ
TriggeredHit
}()
triggered_hits
=
Vector
{
TriggeredHit
}()
sizehint!
(
triggered_hits
,
n_triggered_hits
)
@inbounds
for
i
∈
1
:
n_triggered_hits
dom_id
=
read
(
s
,
Int32
)
...
...
@@ -28,11 +28,11 @@ function Base.read(s::IO, ::Type{T}; legacy=false) where T<:DAQEvent
time
=
bswap
(
read
(
s
,
Int32
))
tot
=
read
(
s
,
UInt8
)
trigger_mask
=
read
(
s
,
Int64
)
push!
(
triggered_hits
,
KM3NETDAQ
TriggeredHit
(
dom_id
,
channel_id
,
time
,
tot
,
trigger_mask
))
push!
(
triggered_hits
,
TriggeredHit
(
dom_id
,
channel_id
,
time
,
tot
,
trigger_mask
))
end
n_hits
=
read
(
s
,
Int32
)
snapshot_hits
=
Vector
{
KM3NETDAQ
SnapshotHit
}()
snapshot_hits
=
Vector
{
SnapshotHit
}()
sizehint!
(
snapshot_hits
,
n_hits
)
@inbounds
for
i
∈
1
:
n_hits
dom_id
=
read
(
s
,
Int32
)
...
...
@@ -41,7 +41,7 @@ function Base.read(s::IO, ::Type{T}; legacy=false) where T<:DAQEvent
tot
=
read
(
s
,
UInt8
)
key
=
(
dom_id
,
channel_id
,
time
,
tot
)
triggered
=
false
push!
(
snapshot_hits
,
KM3NETDAQ
SnapshotHit
(
dom_id
,
channel_id
,
time
,
tot
))
push!
(
snapshot_hits
,
SnapshotHit
(
dom_id
,
channel_id
,
time
,
tot
))
end
T
(
header
,
snapshot_hits
,
triggered_hits
)
...
...
This diff is collapsed.
Click to expand it.
src/root/online.jl
+
17
−
48
View file @
6e95b711
struct
KM3NETDAQSnapshotHit
<:
UnROOT
.
CustomROOTStruct
dom_id
::
Int32
channel_id
::
UInt8
t
::
Int32
tot
::
UInt8
end
function
UnROOT.readtype
(
io
,
T
::
Type
{
KM3NETDAQSnapshotHit
})
function
UnROOT.readtype
(
io
,
T
::
Type
{
SnapshotHit
})
T
(
UnROOT
.
readtype
(
io
,
Int32
),
read
(
io
,
UInt8
),
read
(
io
,
Int32
),
read
(
io
,
UInt8
))
end
function
UnROOT.interped_data
(
rawdata
,
rawoffsets
,
::
Type
{
Vector
{
KM3NETDAQSnapshotHit
}},
::
Type
{
T
})
where
{
T
<:
UnROOT
.
JaggType
}
UnROOT
.
splitup
(
rawdata
,
rawoffsets
,
KM3NETDAQSnapshotHit
,
skipbytes
=
10
)
end
struct
KM3NETDAQTriggeredHit
<:
UnROOT
.
CustomROOTStruct
dom_id
::
Int32
channel_id
::
UInt8
t
::
Int32
tot
::
UInt8
trigger_mask
::
UInt64
function
UnROOT.interped_data
(
rawdata
,
rawoffsets
,
::
Type
{
Vector
{
SnapshotHit
}},
::
Type
{
T
})
where
{
T
<:
UnROOT
.
JaggType
}
UnROOT
.
splitup
(
rawdata
,
rawoffsets
,
SnapshotHit
,
skipbytes
=
10
)
end
UnROOT
.
packedsizeof
(
::
Type
{
KM3NETDAQTriggeredHit
})
=
24
# incl. cnt and vers
function
UnROOT.readtype
(
io
,
T
::
Type
{
KM3NETDAQTriggeredHit
})
UnROOT
.
packedsizeof
(
::
Type
{
TriggeredHit
})
=
24
# incl. cnt and vers
function
UnROOT.readtype
(
io
,
T
::
Type
{
TriggeredHit
})
dom_id
=
UnROOT
.
readtype
(
io
,
Int32
)
channel_id
=
read
(
io
,
UInt8
)
tdc
=
read
(
io
,
Int32
)
...
...
@@ -30,24 +16,12 @@ function UnROOT.readtype(io, T::Type{KM3NETDAQTriggeredHit})
trigger_mask
=
UnROOT
.
readtype
(
io
,
UInt64
)
T
(
dom_id
,
channel_id
,
tdc
,
tot
,
trigger_mask
)
end
function
UnROOT.interped_data
(
rawdata
,
rawoffsets
,
::
Type
{
Vector
{
KM3NETDAQTriggeredHit
}},
::
Type
{
T
})
where
{
T
<:
UnROOT
.
JaggType
}
UnROOT
.
splitup
(
rawdata
,
rawoffsets
,
KM3NETDAQTriggeredHit
,
skipbytes
=
10
)
function
UnROOT.interped_data
(
rawdata
,
rawoffsets
,
::
Type
{
Vector
{
TriggeredHit
}},
::
Type
{
T
})
where
{
T
<:
UnROOT
.
JaggType
}
UnROOT
.
splitup
(
rawdata
,
rawoffsets
,
TriggeredHit
,
skipbytes
=
10
)
end
struct
KM3NETDAQEventHeader
detector_id
::
Int32
run
::
Int32
frame_index
::
Int32
UTC_seconds
::
UInt32
UTC_16nanosecondcycles
::
UInt32
trigger_counter
::
UInt64
trigger_mask
::
UInt64
overlays
::
UInt32
end
packedsizeof
(
::
Type
{
KM3NETDAQEventHeader
})
=
76
function
UnROOT.readtype
(
io
::
IO
,
T
::
Type
{
KM3NETDAQEventHeader
})
packedsizeof
(
::
Type
{
EventHeader
})
=
76
function
UnROOT.readtype
(
io
::
IO
,
T
::
Type
{
EventHeader
})
skip
(
io
,
18
)
detector_id
=
UnROOT
.
readtype
(
io
,
Int32
)
run
=
UnROOT
.
readtype
(
io
,
Int32
)
...
...
@@ -62,15 +36,10 @@ function UnROOT.readtype(io::IO, T::Type{KM3NETDAQEventHeader})
overlays
=
UnROOT
.
readtype
(
io
,
UInt32
)
T
(
detector_id
,
run
,
frame_index
,
UTC_seconds
,
UTC_16nanosecondcycles
,
trigger_counter
,
trigger_mask
,
overlays
)
end
function
UnROOT.interped_data
(
rawdata
,
rawoffsets
,
::
Type
{
KM3NETDAQ
EventHeader
},
::
Type
{
T
})
where
{
T
<:
UnROOT
.
JaggType
}
UnROOT
.
splitup
(
rawdata
,
rawoffsets
,
KM3NETDAQ
EventHeader
,
jagged
=
false
)
function
UnROOT.interped_data
(
rawdata
,
rawoffsets
,
::
Type
{
EventHeader
},
::
Type
{
T
})
where
{
T
<:
UnROOT
.
JaggType
}
UnROOT
.
splitup
(
rawdata
,
rawoffsets
,
EventHeader
,
jagged
=
false
)
end
struct
DAQEvent
header
::
KM3NETDAQEventHeader
snapshot_hits
::
Vector
{
KM3NETDAQSnapshotHit
}
triggered_hits
::
Vector
{
KM3NETDAQTriggeredHit
}
end
function
Base.show
(
io
::
IO
,
e
::
DAQEvent
)
print
(
io
,
"
$
(typeof(e)) with
$
(length(e.snapshot_hits)) snapshot and
$
(length(e.triggered_hits)) triggered hits"
)
end
...
...
@@ -90,9 +59,9 @@ struct OnlineFile
function
OnlineFile
(
filename
::
AbstractString
)
customstructs
=
Dict
(
"KM3NETDAQ::JDAQEvent.snapshotHits"
=>
Vector
{
KM3NETDAQ
SnapshotHit
},
"KM3NETDAQ::JDAQEvent.triggeredHits"
=>
Vector
{
KM3NETDAQ
TriggeredHit
},
"KM3NETDAQ::JDAQEvent.KM3NETDAQ::JDAQEventHeader"
=>
KM3NETDAQ
EventHeader
"KM3NETDAQ::JDAQEvent.snapshotHits"
=>
Vector
{
SnapshotHit
},
"KM3NETDAQ::JDAQEvent.triggeredHits"
=>
Vector
{
TriggeredHit
},
"KM3NETDAQ::JDAQEvent.KM3NETDAQ::JDAQEventHeader"
=>
EventHeader
)
fobj
=
UnROOT
.
ROOTFile
(
filename
,
customstructs
=
customstructs
)
...
...
@@ -118,15 +87,15 @@ end
function
read_headers
(
f
::
OnlineFile
)
data
,
offsets
=
UnROOT
.
array
(
f
.
fobj
,
"KM3NET_EVENT/KM3NET_EVENT/KM3NETDAQ::JDAQEventHeader"
;
raw
=
true
)
UnROOT
.
splitup
(
data
,
offsets
,
KM3NETDAQ
EventHeader
;
jagged
=
false
)
UnROOT
.
splitup
(
data
,
offsets
,
EventHeader
;
jagged
=
false
)
end
function
read_snapshot_hits
(
f
::
OnlineFile
)
data
,
offsets
=
UnROOT
.
array
(
f
.
fobj
,
"KM3NET_EVENT/KM3NET_EVENT/snapshotHits"
;
raw
=
true
)
UnROOT
.
splitup
(
data
,
offsets
,
KM3NETDAQ
SnapshotHit
,
skipbytes
=
10
)
UnROOT
.
splitup
(
data
,
offsets
,
SnapshotHit
,
skipbytes
=
10
)
end
function
read_triggered_hits
(
f
::
OnlineFile
)
data
,
offsets
=
UnROOT
.
array
(
f
.
fobj
,
"KM3NET_EVENT/KM3NET_EVENT/triggeredHits"
;
raw
=
true
)
UnROOT
.
splitup
(
data
,
offsets
,
KM3NETDAQ
TriggeredHit
,
skipbytes
=
10
)
UnROOT
.
splitup
(
data
,
offsets
,
TriggeredHit
,
skipbytes
=
10
)
end
This diff is collapsed.
Click to expand it.
src/types.jl
+
20
−
4
View file @
6e95b711
...
...
@@ -34,11 +34,10 @@ abstract type AbstractDAQHit<:AbstractHit end
abstract type
AbstractMCHit<:AbstractHit
end
struct
SnapshotHit
<:
AbstractDAQHit
channel_id
::
UInt8
dom_id
::
UInt32
t
::
Float64
channel_id
::
UInt8
t
::
Int32
tot
::
UInt8
trigger_mask
::
Int64
end
struct
TriggeredHit
<:
AbstractDAQHit
...
...
@@ -46,5 +45,22 @@ struct TriggeredHit <: AbstractDAQHit
channel_id
::
UInt8
t
::
Int32
tot
::
UInt8
trigger_mask
::
Int64
trigger_mask
::
UInt64
end
struct
EventHeader
detector_id
::
Int32
run
::
Int32
frame_index
::
Int32
UTC_seconds
::
UInt32
UTC_16nanosecondcycles
::
UInt32
trigger_counter
::
UInt64
trigger_mask
::
UInt64
overlays
::
UInt32
end
struct
DAQEvent
header
::
EventHeader
snapshot_hits
::
Vector
{
SnapshotHit
}
triggered_hits
::
Vector
{
TriggeredHit
}
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment