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
addbf250
Commit
addbf250
authored
4 years ago
by
Zineb Aly
Browse files
Options
Downloads
Patches
Plain Diff
add rec_stages masks
parent
be471afe
Branches
55-new-km3net-dataformat-release-v1-2-3-2
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
km3io/offline.py
+28
-0
28 additions, 0 deletions
km3io/offline.py
with
28 additions
and
0 deletions
km3io/offline.py
+
28
−
0
View file @
addbf250
...
...
@@ -2,6 +2,8 @@ from collections import namedtuple
import
uproot
import
warnings
import
awkward1
as
ak1
import
numba
as
nb
from
.definitions
import
mc_header
,
fitparameters
from
.tools
import
Branch
,
BranchMapper
,
cached_property
,
_to_num
,
_unfold_indices
...
...
@@ -83,6 +85,32 @@ def count_nested(Array, axis=0):
return
ak1
.
count
(
Array
,
axis
=
2
)
@nb.jit
(
nopython
=
True
)
def
_find
(
rec_stages
,
stages
,
builder
):
for
s
in
rec_stages
:
builder
.
begin_list
()
for
i
in
s
:
num_stages
=
len
(
i
)
if
num_stages
==
len
(
stages
):
found
=
0
for
j
in
range
(
num_stages
):
if
i
[
j
]
==
stages
[
j
]:
found
+=
1
if
found
==
num_stages
:
builder
.
append
(
1
)
else
:
builder
.
append
(
0
)
else
:
builder
.
append
(
0
)
builder
.
end_list
()
def
mask
(
rec_stages
,
stages
):
builder
=
ak1
.
ArrayBuilder
()
_find
(
rec_stages
,
ak1
.
Array
(
stages
),
builder
)
return
builder
.
snapshot
()
==
1
def
best_track
(
tracks
,
strategy
=
"
first
"
,
rec_stages
=
None
):
"""
best track selection based on different strategies
...
...
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