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
5ad36930
Commit
5ad36930
authored
2 years ago
by
Johannes Schumann
Browse files
Options
Downloads
Patches
Plain Diff
Add in CAN check to CAN only geometry
parent
69ebd75c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!47
Resolve "Muon Propagation"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
km3buu/geometry.py
+25
-0
25 additions, 0 deletions
km3buu/geometry.py
with
25 additions
and
0 deletions
km3buu/geometry.py
+
25
−
0
View file @
5ad36930
...
...
@@ -244,6 +244,31 @@ class CanVolume(DetectorVolume):
else
:
return
pos
def
in_can
(
self
,
pos
):
"""
Check if position is inside the CAN
Parameters
----------
pos: np.array
The positions which should be checked
Return
------
boolean / np.array
"""
if
type
(
pos
)
is
tuple
or
pos
.
ndim
==
1
:
pos
=
np
.
reshape
(
pos
,
(
-
1
,
3
))
zmask
=
(
pos
[:,
2
]
>=
self
.
_zmin
)
&
(
pos
[:,
2
]
<=
self
.
_zmax
)
r2
=
(
pos
[:,
0
]
-
self
.
_coord_origin
[
0
])
**
2
+
\
(
pos
[:,
1
]
-
self
.
_coord_origin
[
1
])
**
2
rmask
=
r2
<
(
self
.
_radius
**
2
)
mask
=
zmask
&
rmask
if
len
(
mask
)
==
1
:
return
mask
[
0
]
else
:
return
mask
def
random_dir
(
self
,
n
=
1
):
phi
=
np
.
random
.
uniform
(
0
,
2
*
np
.
pi
,
n
)
cos_theta
=
np
.
random
.
uniform
(
self
.
_cosZmin
,
self
.
_cosZmax
,
n
)
...
...
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