Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
KM3BUU
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
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
simulation
KM3BUU
Commits
8e2a6967
Commit
8e2a6967
authored
2 years ago
by
Johannes Schumann
Browse files
Options
Downloads
Patches
Plain Diff
Give option to suppress warnings for kin energy calc
parent
cd5837a8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
km3buu/physics.py
+11
-4
11 additions, 4 deletions
km3buu/physics.py
with
11 additions
and
4 deletions
km3buu/physics.py
+
11
−
4
View file @
8e2a6967
...
@@ -23,7 +23,7 @@ from .config import read_default_media_compositions
...
@@ -23,7 +23,7 @@ from .config import read_default_media_compositions
DENSITY_SEA_WATER
=
read_default_media_compositions
()[
"
SeaWater
"
][
"
density
"
]
DENSITY_SEA_WATER
=
read_default_media_compositions
()[
"
SeaWater
"
][
"
density
"
]
MUON_SHOWER_E_PER_TRACK_LENGTH
=
4.7
#dx/dE [m/GeV]
MUON_SHOWER_E_PER_TRACK_LENGTH
=
4.7
#
dx/dE [m/GeV]
MUON_MASS
=
Particle
.
from_string
(
"
mu
"
).
mass
/
1e3
MUON_MASS
=
Particle
.
from_string
(
"
mu
"
).
mass
/
1e3
ELEC_PARAMS
=
{
ELEC_PARAMS
=
{
...
@@ -109,7 +109,6 @@ HE_PARAMS = {
...
@@ -109,7 +109,6 @@ HE_PARAMS = {
def
_get_particle_rest_mass
(
pdgid
):
def
_get_particle_rest_mass
(
pdgid
):
@np.vectorize
@np.vectorize
def
vfunc
(
x
):
def
vfunc
(
x
):
try
:
try
:
...
@@ -122,7 +121,7 @@ def _get_particle_rest_mass(pdgid):
...
@@ -122,7 +121,7 @@ def _get_particle_rest_mass(pdgid):
return
masses
[
invmap
]
return
masses
[
invmap
]
def
get_kinetic_energy
(
energy
,
pdgid
):
def
get_kinetic_energy
(
energy
,
pdgid
,
warning
=
True
):
"""
"""
Returns the kinetic energy
Returns the kinetic energy
...
@@ -132,9 +131,17 @@ def get_kinetic_energy(energy, pdgid):
...
@@ -132,9 +131,17 @@ def get_kinetic_energy(energy, pdgid):
Total energy of the given particle
Total energy of the given particle
pdgid: int
pdgid: int
PDGID of the given particle
PDGID of the given particle
warning: boolean
Show the warning on negative value passed to np.sqrt
"""
"""
mass
=
np
.
array
(
_get_particle_rest_mass
(
pdgid
))
mass
=
np
.
array
(
_get_particle_rest_mass
(
pdgid
))
return
np
.
sqrt
(
ak
.
to_numpy
(
energy
)
**
2
-
mass
**
2
)
import
warnings
with
warnings
.
catch_warnings
():
if
not
warning
:
warnings
.
filterwarnings
(
'
ignore
'
,
r
'
invalid value encountered in sqrt
'
)
retval
=
np
.
sqrt
(
ak
.
to_numpy
(
energy
)
**
2
-
mass
**
2
)
return
retval
def
visible_energy
(
energy
,
pdgid
):
def
visible_energy
(
energy
,
pdgid
):
...
...
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