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
88fde2cc
Verified
Commit
88fde2cc
authored
1 year ago
by
Tamas Gal
Browse files
Options
Downloads
Patches
Plain Diff
Add calibratedtime and more structs
parent
cac6d6e9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!27
Add calibratedtime and more structs
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
docs/src/api.md
+3
-0
3 additions, 0 deletions
docs/src/api.md
src/KM3io.jl
+3
-2
3 additions, 2 deletions
src/KM3io.jl
src/calibration.jl
+34
-1
34 additions, 1 deletion
src/calibration.jl
src/types.jl
+25
-0
25 additions, 0 deletions
src/types.jl
test/calibration.jl
+6
-0
6 additions, 0 deletions
test/calibration.jl
with
71 additions
and
3 deletions
docs/src/api.md
+
3
−
0
View file @
88fde2cc
...
...
@@ -27,6 +27,8 @@ DAQEvent
EventHeader
SnapshotHit
TriggeredHit
CalibratedSnapshotHit
CalibratedTriggeredHit
UTCTime
UTCExtended
Summaryslice
...
...
@@ -88,6 +90,7 @@ read(filename::AbstractString, T::Type{AcousticsTriggerParameter})
## Calibration
```
@docs
calibrate
calibratetime
combine
floordist
slew
...
...
This diff is collapsed.
Click to expand it.
src/KM3io.jl
+
3
−
2
View file @
88fde2cc
...
...
@@ -40,11 +40,12 @@ export DAQEvent, EventHeader, SnapshotHit, UTCTime, UTCExtended, Summaryslice,
count_active_channels
,
count_fifostatus
,
count_hrvstatus
,
status
,
maximal_udp_sequence_number
,
number_of_udp_packets_received
# Offline dataformat
export
Evt
,
Hit
,
TriggeredHit
,
Trk
,
CalibratedHit
,
XCalibratedHit
,
MCTrk
,
CalibratedMCHit
export
Evt
,
TriggeredHit
,
Trk
,
CalibratedHit
,
XCalibratedHit
,
MCTrk
,
CalibratedMCHit
,
CalibratedSnapshotHit
,
CalibratedTriggeredHit
export
K40Rates
export
calibrate
,
floordist
,
slew
,
combine
export
calibrate
,
calibratetime
,
floordist
,
slew
,
combine
export
besttrack
,
bestjppmuon
,
bestjppshower
,
bestaashower
,
RecStageRange
,
hashistory
,
hasjppmuonprefit
,
hasjppmuonsimplex
,
hasjppmuongandalf
,
...
...
This diff is collapsed.
Click to expand it.
src/calibration.jl
+
34
−
1
View file @
88fde2cc
"""
Apply geometry and time calibration to given hits.
Apply full geometry and time calibration to given hits. This way of calibration
should be used wisely since it creates a very bloaded [`XCalibratedHit`](@ref)
object, which might not be necessary. Often, we only need time the calibration
to be applied.
"""
function
calibrate
(
det
::
Detector
,
hits
)
calibrated_hits
=
Vector
{
XCalibratedHit
}()
...
...
@@ -25,6 +30,34 @@ function calibrate(det::Detector, hits)
calibrated_hits
end
Base
.
time
(
det
::
Detector
,
hit
;
correct_slew
=
true
)
=
time
(
hit
;
correct_slew
=
correct_slew
)
+
getpmt
(
det
,
hit
)
.
t₀
"""
Calibrate the time of a given array of snapshot hits.
"""
function
calibratetime
(
det
::
Detector
,
hits
::
Vector
{
T
})
where
T
<:
SnapshotHit
out
=
sizehint!
(
Vector
{
CalibratedSnapshotHit
}(),
length
(
hits
))
for
h
in
hits
push!
(
out
,
CalibratedSnapshotHit
(
h
.
dom_id
,
h
.
channel_id
,
h
.
t
+
getpmt
(
det
,
h
)
.
t₀
,
h
.
tot
))
end
out
end
"""
Calibrate the time of a given array of triggered hits.
"""
function
calibratetime
(
det
::
Detector
,
hits
::
Vector
{
T
})
where
T
<:
TriggeredHit
out
=
sizehint!
(
Vector
{
CalibratedTriggeredHit
}(),
length
(
hits
))
for
h
in
hits
push!
(
out
,
CalibratedSnapshotHit
(
h
.
dom_id
,
h
.
channel_id
,
h
.
t
+
getpmt
(
det
,
h
)
.
t₀
,
h
.
tot
,
h
.
trigger_mask
))
end
out
end
"""
Combine snapshot and triggered hits to a single hits-vector.
...
...
This diff is collapsed.
Click to expand it.
src/types.jl
+
25
−
0
View file @
88fde2cc
...
...
@@ -60,6 +60,18 @@ end
"""
A calibrated snapshot hit.
"""
struct
CalibratedSnapshotHit
<:
AbstractCalibratedHit
dom_id
::
UInt32
channel_id
::
UInt8
t
::
Float64
tot
::
UInt8
end
"""
A hit which was triggered.
"""
...
...
@@ -71,6 +83,19 @@ struct TriggeredHit <: AbstractDAQHit
trigger_mask
::
UInt64
end
"""
A calibrated triggered hit.
"""
struct
CalibratedTriggeredHit
<:
AbstractCalibratedHit
dom_id
::
UInt32
channel_id
::
UInt8
t
::
Float64
tot
::
UInt8
trigger_mask
::
UInt64
end
struct
XCalibratedHit
<:
AbstractCalibratedHit
dom_id
::
UInt32
...
...
This diff is collapsed.
Click to expand it.
test/calibration.jl
+
6
−
0
View file @
88fde2cc
...
...
@@ -9,6 +9,12 @@ using Test
chits
=
calibrate
(
det
,
hits
)
@test
96
==
length
(
hits
)
@test
96
==
length
(
chits
)
@test
30733918
==
hits
[
1
]
.
t
@test
3.0941664391e7
≈
chits
[
1
]
.
t
chits
=
calibratetime
(
det
,
hits
)
@test
3.0941664391e7
≈
chits
[
1
]
.
t
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