Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
km3io
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
km3py
km3io
Commits
ca464566
Commit
ca464566
authored
2 years ago
by
Manu Le Guirriec
Committed by
Tamas Gal
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Create a tool to check nanobeacon flag in trigger mask
parent
cba08523
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!73
Create a tool to check nanobeacon flag in trigger mask
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/km3io/tools.py
+11
-0
11 additions, 0 deletions
src/km3io/tools.py
tests/test_tools.py
+11
-0
11 additions, 0 deletions
tests/test_tools.py
with
22 additions
and
0 deletions
src/km3io/tools.py
+
11
−
0
View file @
ca464566
...
...
@@ -536,3 +536,14 @@ def is_3dmuon(trigger_mask):
A value or an array of the trigger_mask, either of an event, or a hit.
"""
return
is_bit_set
(
trigger_mask
,
ktrg
.
JTRIGGER3DMUON
)
def
is_nanobeacon
(
trigger_mask
):
"""
Returns True if the trigger mask contains the nano-beacon flag.
Parameters
----------
trigger_mask : int or array(int)
A value or an array of the trigger_mask, either of an event, or a hit.
"""
return
is_bit_set
(
trigger_mask
,
ktrg
.
JTRIGGERNB
)
This diff is collapsed.
Click to expand it.
tests/test_tools.py
+
11
−
0
View file @
ca464566
...
...
@@ -31,6 +31,7 @@ from km3io.tools import (
is_3dshower
,
is_mxshower
,
is_3dmuon
,
is_nanobeacon
,
)
OFFLINE_FILE
=
OfflineReader
(
data_path
(
"
offline/km3net_offline.root
"
))
...
...
@@ -642,3 +643,13 @@ class TestTriggerMaskChecks(unittest.TestCase):
[
False
,
False
,
False
,
True
,
False
,
False
,
True
,
False
,
True
,
True
],
list
(
is_3dmuon
(
GENHEN_OFFLINE_FILE
.
events
.
trigger_mask
)),
)
def
test_is_nanobeacon
(
self
):
assert
np
.
allclose
(
[
False
,
False
,
False
,
False
,
False
,
False
,
False
,
False
,
False
,
False
],
list
(
is_nanobeacon
(
OFFLINE_FILE
.
events
.
trigger_mask
)),
)
assert
np
.
allclose
(
[
False
,
False
,
False
,
False
,
False
,
False
,
False
,
False
,
False
,
False
],
list
(
is_nanobeacon
(
GENHEN_OFFLINE_FILE
.
events
.
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