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
0d6b40d1
Verified
Commit
0d6b40d1
authored
2 years ago
by
Tamas Gal
Browse files
Options
Downloads
Patches
Plain Diff
Add calibration
parent
7395f0e8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/calibration.jl
+84
-0
84 additions, 0 deletions
src/calibration.jl
test/calibration.jl
+18
-0
18 additions, 0 deletions
test/calibration.jl
with
102 additions
and
0 deletions
src/calibration.jl
0 → 100644
+
84
−
0
View file @
0d6b40d1
"""
$(SIGNATURES)
Apply geometry and time calibration to given hits.
"""
function
calibrate
(
det
::
Detector
,
hits
)
calibrated_hits
=
Vector
{
CalibratedHit
}()
has_trigger_mask
=
:
trigger_mask
∈
fieldnames
(
eltype
(
hits
))
for
hit
in
hits
dom_id
=
hit
.
dom_id
channel_id
=
hit
.
channel_id
tot
=
hit
.
tot
pos
=
det
[
dom_id
][
channel_id
]
.
pos
dir
=
det
[
dom_id
][
channel_id
]
.
dir
t0
=
det
[
dom_id
][
channel_id
]
.
t₀
t
=
hit
.
t
+
t0
du
=
0
#calibration.du[dom_id]
floor
=
0
#calibration.floor[dom_id]
trigger_mask
=
has_trigger_mask
?
hit
.
trigger_mask
:
0
c_hit
=
CalibratedHit
(
dom_id
,
channel_id
,
t
,
tot
,
trigger_mask
,
pos
,
dir
,
t0
,
du
,
floor
,
Multiplicity
(
0
,
0
)
)
push!
(
calibrated_hits
,
c_hit
)
end
calibrated_hits
end
"""
function floordist(calib::Calibration)
Calculates the average floor distance between neighboured modules.
"""
function
floordist
(
det
::
Detector
)
floordistances
=
Float64
[]
for
s
∈
det
.
strings
# all the modules on the string, except the base module
modules
=
[
m
for
m
in
det
if
m
.
location
.
string
==
s
&&
m
.
location
.
floor
!=
0
]
# collecting the z position for the same PMT channel (0) on each module
push!
(
floordistances
,
mean
(
diff
(
sort
(
collect
(
m
.
pos
.
z
for
m
∈
modules
)))))
end
mean
(
floordistances
)
end
"""
$(SIGNATURES)
Return the time slewing for a ToT.
"""
slew
(
tot
::
Integer
)
=
@inbounds
ifelse
(
tot
<
256
,
SLEWS
[
tot
+
1
],
SLEWS
[
end
])
slew
(
tot
::
AbstractFloat
)
=
slew
(
Int
(
round
(
tot
)))
slew
(
hit
::
AbstractHit
)
=
slew
(
hit
.
tot
)
const
SLEWS
=
[
8.01
,
7.52
,
7.05
,
6.59
,
6.15
,
5.74
,
5.33
,
4.95
,
4.58
,
4.22
,
3.89
,
3.56
,
3.25
,
2.95
,
2.66
,
2.39
,
2.12
,
1.87
,
1.63
,
1.40
,
1.19
,
0.98
,
0.78
,
0.60
,
0.41
,
0.24
,
0.07
,
-
0.10
,
-
0.27
,
-
0.43
,
-
0.59
,
-
0.75
,
-
0.91
,
-
1.08
,
-
1.24
,
-
1.41
,
-
1.56
,
-
1.71
,
-
1.85
,
-
1.98
,
-
2.11
,
-
2.23
,
-
2.35
,
-
2.47
,
-
2.58
,
-
2.69
,
-
2.79
,
-
2.89
,
-
2.99
,
-
3.09
,
-
3.19
,
-
3.28
,
-
3.37
,
-
3.46
,
-
3.55
,
-
3.64
,
-
3.72
,
-
3.80
,
-
3.88
,
-
3.96
,
-
4.04
,
-
4.12
,
-
4.20
,
-
4.27
,
-
4.35
,
-
4.42
,
-
4.49
,
-
4.56
,
-
4.63
,
-
4.70
,
-
4.77
,
-
4.84
,
-
4.90
,
-
4.97
,
-
5.03
,
-
5.10
,
-
5.16
,
-
5.22
,
-
5.28
,
-
5.34
,
-
5.40
,
-
5.46
,
-
5.52
,
-
5.58
,
-
5.63
,
-
5.69
,
-
5.74
,
-
5.80
,
-
5.85
,
-
5.91
,
-
5.96
,
-
6.01
,
-
6.06
,
-
6.11
,
-
6.16
,
-
6.21
,
-
6.26
,
-
6.31
,
-
6.36
,
-
6.41
,
-
6.45
,
-
6.50
,
-
6.55
,
-
6.59
,
-
6.64
,
-
6.68
,
-
6.72
,
-
6.77
,
-
6.81
,
-
6.85
,
-
6.89
,
-
6.93
,
-
6.98
,
-
7.02
,
-
7.06
,
-
7.09
,
-
7.13
,
-
7.17
,
-
7.21
,
-
7.25
,
-
7.28
,
-
7.32
,
-
7.36
,
-
7.39
,
-
7.43
,
-
7.46
,
-
7.50
,
-
7.53
,
-
7.57
,
-
7.60
,
-
7.63
,
-
7.66
,
-
7.70
,
-
7.73
,
-
7.76
,
-
7.79
,
-
7.82
,
-
7.85
,
-
7.88
,
-
7.91
,
-
7.94
,
-
7.97
,
-
7.99
,
-
8.02
,
-
8.05
,
-
8.07
,
-
8.10
,
-
8.13
,
-
8.15
,
-
8.18
,
-
8.20
,
-
8.23
,
-
8.25
,
-
8.28
,
-
8.30
,
-
8.32
,
-
8.34
,
-
8.37
,
-
8.39
,
-
8.41
,
-
8.43
,
-
8.45
,
-
8.47
,
-
8.49
,
-
8.51
,
-
8.53
,
-
8.55
,
-
8.57
,
-
8.59
,
-
8.61
,
-
8.62
,
-
8.64
,
-
8.66
,
-
8.67
,
-
8.69
,
-
8.70
,
-
8.72
,
-
8.74
,
-
8.75
,
-
8.76
,
-
8.78
,
-
8.79
,
-
8.81
,
-
8.82
,
-
8.83
,
-
8.84
,
-
8.86
,
-
8.87
,
-
8.88
,
-
8.89
,
-
8.90
,
-
8.92
,
-
8.93
,
-
8.94
,
-
8.95
,
-
8.96
,
-
8.97
,
-
8.98
,
-
9.00
,
-
9.01
,
-
9.02
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
,
-
9.04
]
This diff is collapsed.
Click to expand it.
test/calibration.jl
0 → 100644
+
18
−
0
View file @
0d6b40d1
using
KM3io
using
KM3NeTTestData
using
Test
@testset
"Hit calibration"
begin
f
=
OnlineFile
(
datapath
(
"online"
,
"km3net_online.root"
))
hits
=
f
.
events
[
1
]
.
snapshot_hits
det
=
Detector
(
datapath
(
"detx"
,
"km3net_offline.detx"
))
chits
=
calibrate
(
det
,
hits
)
@test
96
==
length
(
hits
)
@test
96
==
length
(
chits
)
end
@testset
"floordist()"
begin
det
=
Detector
(
datapath
(
"detx"
,
"km3net_offline.detx"
))
@test
9.61317647058823
≈
floordist
(
det
)
end
This diff is collapsed.
Click to expand it.
Tamas Gal
@tgal
mentioned in commit
a2be84bf
·
2 years ago
mentioned in commit
a2be84bf
mentioned in commit a2be84bfbd4413d625363351bc63cf4068ffb7e8
Toggle commit list
Tamas Gal
@tgal
mentioned in commit
d81e91a1
·
2 years ago
mentioned in commit
d81e91a1
mentioned in commit d81e91a15e961465cb05b3aadc50b757a9328e06
Toggle commit list
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