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
50af017b
Verified
Commit
50af017b
authored
2 years ago
by
Tamas Gal
Browse files
Options
Downloads
Patches
Plain Diff
Restructure tools
parent
394d9921
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/KM3io.jl
+4
-1
4 additions, 1 deletion
src/KM3io.jl
src/tools/general.jl
+0
-37
0 additions, 37 deletions
src/tools/general.jl
src/tools/reconstruction.jl
+65
-0
65 additions, 0 deletions
src/tools/reconstruction.jl
src/tools/trigger.jl
+36
-0
36 additions, 0 deletions
src/tools/trigger.jl
with
105 additions
and
38 deletions
src/KM3io.jl
+
4
−
1
View file @
50af017b
...
...
@@ -61,7 +61,10 @@ include("daq.jl")
include
(
"acoustics.jl"
)
include
(
"calibration.jl"
)
include
(
"tools.jl"
)
include
(
"tools/general.jl"
)
include
(
"tools/trigger.jl"
)
include
(
"tools/reconstruction.jl"
)
include
(
"physics.jl"
)
end
# module
This diff is collapsed.
Click to expand it.
src/tools.jl
→
src/tools
/general
.jl
+
0
−
37
View file @
50af017b
"""
Return `true` if the passed object (hit, event, ...) was triggered by any trigger algorithm.
"""
triggered
(
e
)
=
e
.
trigger_mask
>
0
"""
Return `true` if the n-th bit of `a` is set, `false` otherwise.
"""
nthbitset
(
n
,
a
)
=
Bool
((
a
>>
n
)
&
1
)
"""
$(METHODLIST)
Return `true` the 3D Muon trigger bit is set.
"""
is3dmuon
(
e
::
DAQEvent
)
=
nthbitset
(
TRIGGER
.
JTRIGGER3DMUON
,
e
.
header
.
trigger_mask
)
is3dmuon
(
x
)
=
nthbitset
(
TRIGGER
.
JTRIGGER3DMUON
,
x
)
"""
$(METHODLIST)
Return `true` if the 3D Shower trigger bit is set.
"""
is3dshower
(
e
::
DAQEvent
)
=
nthbitset
(
TRIGGER
.
JTRIGGER3DSHOWER
,
e
.
header
.
trigger_mask
)
is3dshower
(
x
)
=
nthbitset
(
TRIGGER
.
JTRIGGER3DSHOWER
,
x
)
"""
$(METHODLIST)
Return `true` if the MX Shower trigger bit is set.
"""
ismxshower
(
x
)
=
nthbitset
(
TRIGGER
.
JTRIGGERMXSHOWER
,
x
)
ismxshower
(
e
::
DAQEvent
)
=
nthbitset
(
TRIGGER
.
JTRIGGERMXSHOWER
,
e
.
header
.
trigger_mask
)
"""
$(METHODLIST)
Return `true` if the NanoBeacon trigger bit is set.
"""
isnb
(
x
)
=
nthbitset
(
TRIGGER
.
JTRIGGERNB
,
x
)
isnb
(
e
::
DAQEvent
)
=
nthbitset
(
TRIGGER
.
JTRIGGERNB
,
e
.
header
.
trigger_mask
)
"""
Return the most frequent value of a given iterable.
"""
...
...
This diff is collapsed.
Click to expand it.
src/tools/reconstruction.jl
0 → 100644
+
65
−
0
View file @
50af017b
"""
This struct is used to represent a range of reconstruction stages. These are
well-defined integers (see [KM3NeT
Dataformat](https://git.km3net.de/common/km3net-dataformat/-/blob/master/definitions/reconstruction.csv))
for each reconstruction algorithm and are stored in a vector named `rec_stages`
of each [`Trk`](@ref).
```jldoctest
julia> using KM3io
julia> rsr = RecStageRange(KM3io.RECONSTRUCTION.JMUONBEGIN, KM3io.RECONSTRUCTION.JMUONEND)
RecStageRange{Int64}(0, 99)
julia> KM3io.RECONSTRUCTION.JMUONSIMPLEX ∈ rsr
true
julia> KM3io.RECONSTRUCTION.AASHOWERFITPREFIT ∈ rsr
false
julia> 23 ∈ rsr
true
julia> 523 ∈ rsr
false
```
"""
struct
RecStageRange
{
T
<:
Integer
}
lower
::
T
upper
::
T
end
Base
.
in
(
rec_stage
::
T
,
rsr
::
RecStageRange
)
where
T
<:
Integer
=
rsr
.
lower
<=
rec_stage
<=
rsr
.
upper
function
hashistory
(
t
::
Trk
,
rec_type
::
Integer
,
rsr
::
RecStageRange
)
rec_type
!=
t
.
rec_type
&&
return
false
for
rec_stage
in
t
.
rec_stages
!
(
rec_stage
∈
rsr
)
&&
return
false
end
true
end
function
hashistory
(
t
::
Trk
,
rec_type
::
Integer
,
rec_stage
::
Integer
)
rec_type
!=
t
.
rec_type
&&
return
false
rec_stage
∈
t
.
rec_stages
end
hasjppmuonprefit
(
t
::
Trk
)
=
hashistory
(
t
,
RECONSTRUCTION
.
JPP_RECONSTRUCTION_TYPE
,
RECONSTRUCTION
.
JMUONPREFIT
)
hasjppmuonsimplex
(
t
::
Trk
)
=
hashistory
(
t
,
RECONSTRUCTION
.
JPP_RECONSTRUCTION_TYPE
,
RECONSTRUCTION
.
JMUONSIMPLEX
)
hasjppmuongandalf
(
t
::
Trk
)
=
hashistory
(
t
,
RECONSTRUCTION
.
JPP_RECONSTRUCTION_TYPE
,
RECONSTRUCTION
.
JMUONGANDALF
)
hasjppmuonenergy
(
t
::
Trk
)
=
hashistory
(
t
,
RECONSTRUCTION
.
JPP_RECONSTRUCTION_TYPE
,
RECONSTRUCTION
.
JMUONENERGY
)
hasjppmuonstart
(
t
::
Trk
)
=
hashistory
(
t
,
RECONSTRUCTION
.
JPP_RECONSTRUCTION_TYPE
,
RECONSTRUCTION
.
JMUONSTART
)
hasjppmuonfit
(
t
::
Trk
)
=
hashistory
(
t
,
RECONSTRUCTION
.
JPP_RECONSTRUCTION_TYPE
,
RecStageRange
(
RECONSTRUCTION
.
JMUONBEGIN
,
RECONSTRUCTION
.
JMUONEND
))
hasshowerprefit
(
t
::
Trk
)
=
hashistory
(
t
,
RECONSTRUCTION
.
JPP_RECONSTRUCTION_TYPE
,
RECONSTRUCTION
.
JSHOWERPREFIT
)
hasshowerpositionfit
(
t
::
Trk
)
=
hashistory
(
t
,
RECONSTRUCTION
.
JPP_RECONSTRUCTION_TYPE
,
RECONSTRUCTION
.
JSHOWERPOSITIONFIT
)
hasshowercompletefit
(
t
::
Trk
)
=
hashistory
(
t
,
RECONSTRUCTION
.
JPP_RECONSTRUCTION_TYPE
,
RECONSTRUCTION
.
JSHOWERCOMPLETEFIT
)
hasshowerfit
(
t
::
Trk
)
=
hashistory
(
t
,
RECONSTRUCTION
.
JPP_RECONSTRUCTION_TYPE
,
RecStageRange
(
RECONSTRUCTION
.
JSHOWERBEGIN
,
RECONSTRUCTION
.
JSHOWEREND
))
hasaashowerfit
(
t
::
Trk
)
=
hashistory
(
t
,
RECONSTRUCTION
.
AANET_RECONSTRUCTION_TYPE
,
RecStageRange
(
RECONSTRUCTION
.
AASHOWERBEGIN
,
RECONSTRUCTION
.
AASHOWEREND
))
hasreconstructedjppmuon
(
e
::
Evt
)
=
any
(
hasjppmuonfit
,
e
.
trks
)
hasreconstructedjppshower
(
e
::
Evt
)
=
any
(
hasshowerfit
,
e
.
trks
)
hasreconstructedaashower
(
e
::
Evt
)
=
any
(
hasaashowerfit
,
e
.
trks
)
function
besttrack
(
e
::
Evt
,
rsr
::
RecStageRange
)
error
(
"not implemented yet"
)
end
This diff is collapsed.
Click to expand it.
src/tools/trigger.jl
0 → 100644
+
36
−
0
View file @
50af017b
"""
Return `true` if the passed object (hit, event, ...) was triggered by any trigger algorithm.
"""
triggered
(
e
)
=
e
.
trigger_mask
>
0
"""
$(METHODLIST)
Return `true` the 3D Muon trigger bit is set.
"""
is3dmuon
(
e
::
DAQEvent
)
=
nthbitset
(
TRIGGER
.
JTRIGGER3DMUON
,
e
.
header
.
trigger_mask
)
is3dmuon
(
x
)
=
nthbitset
(
TRIGGER
.
JTRIGGER3DMUON
,
x
)
"""
$(METHODLIST)
Return `true` if the 3D Shower trigger bit is set.
"""
is3dshower
(
e
::
DAQEvent
)
=
nthbitset
(
TRIGGER
.
JTRIGGER3DSHOWER
,
e
.
header
.
trigger_mask
)
is3dshower
(
x
)
=
nthbitset
(
TRIGGER
.
JTRIGGER3DSHOWER
,
x
)
"""
$(METHODLIST)
Return `true` if the MX Shower trigger bit is set.
"""
ismxshower
(
x
)
=
nthbitset
(
TRIGGER
.
JTRIGGERMXSHOWER
,
x
)
ismxshower
(
e
::
DAQEvent
)
=
nthbitset
(
TRIGGER
.
JTRIGGERMXSHOWER
,
e
.
header
.
trigger_mask
)
"""
$(METHODLIST)
Return `true` if the NanoBeacon trigger bit is set.
"""
isnb
(
x
)
=
nthbitset
(
TRIGGER
.
JTRIGGERNB
,
x
)
isnb
(
e
::
DAQEvent
)
=
nthbitset
(
TRIGGER
.
JTRIGGERNB
,
e
.
header
.
trigger_mask
)
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