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
8de00ffc
Commit
8de00ffc
authored
4 years ago
by
Zineb Aly
Browse files
Options
Downloads
Patches
Plain Diff
add is_CC function
parent
38377d76
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
km3io/tools.py
+31
-0
31 additions, 0 deletions
km3io/tools.py
with
31 additions
and
0 deletions
km3io/tools.py
+
31
−
0
View file @
8de00ffc
...
...
@@ -763,3 +763,34 @@ def _find_in_set_single(rec_stages, stages, builder):
else
:
builder
.
append
(
0
)
builder
.
end_list
()
def
is_CC
(
fobj
):
"""
Determin if an event (or events) are a result of a Charged Curent interaction (CC)
or a Neutral Curent interaction (NC).
Parameters
----------
fobj : km3io.offline.OfflineReader
offline neutrino file object.
"""
program
=
fobj
.
header
.
simul
.
program
w2list
=
fobj
.
events
.
w2list
len_w2lists
=
ak1
.
num
(
w2list
,
axis
=
1
)
if
all
(
len_w2lists
<=
7
):
# old nu file have w2list of len 7.
usr
=
fobj
.
events
.
mc_tracks
.
usr_names
cc_flag
=
usr
[:,
0
][:,
3
]
out
=
(
cc_flag
==
b
'
cc
'
)
# not very reliable, found NC files with cc flag!
else
:
if
"
gseagen
"
in
program
.
lower
():
cc_flag
=
w2list
[:,
kw2gsg
.
W2LIST_GSEAGEN_CC
]
out
=
(
cc_flag
>
0
)
if
"
genhen
"
in
program
.
lower
():
cc_flag
=
w2list
[:,
kw2gen
.
W2LIST_GENHEN_CC
]
out
=
(
cc_flag
>
0
)
else
:
raise
ValueError
(
f
"
simulation program
{
fobj
.
header
.
simul
.
program
}
is not implemented.
"
)
return
out
\ No newline at end of file
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