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
5a0b9a7c
Commit
5a0b9a7c
authored
2 years ago
by
Johannes Schumann
Browse files
Options
Downloads
Plain Diff
Merge branch 'fix_header' into 'master'
Fix header See merge request
!30
parents
b94671aa
a0efd7fa
No related branches found
No related tags found
1 merge request
!30
Fix header
Pipeline
#28478
failed
2 years ago
Stage: test
Stage: coverage
Stage: doc
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
km3buu/geometry.py
+18
-8
18 additions, 8 deletions
km3buu/geometry.py
km3buu/output.py
+7
-4
7 additions, 4 deletions
km3buu/output.py
with
25 additions
and
12 deletions
km3buu/geometry.py
+
18
−
8
View file @
5a0b9a7c
...
...
@@ -37,13 +37,13 @@ class DetectorVolume(ABC):
pass
@abstractmethod
def
header_entr
y
(
self
):
def
header_entr
ies
(
self
):
"""
Returns the header information for the detector volume geometry
Returns
-------
tuple (
header_key
,
header_information
)
dict {
header_key
:
header_information
}
"""
pass
...
...
@@ -102,10 +102,15 @@ class CanVolume(DetectorVolume):
pos_z
=
np
.
random
.
uniform
(
self
.
_zmin
,
self
.
_zmax
)
return
(
pos_x
,
pos_y
,
pos_z
)
def
header_entry
(
self
):
key
=
"
can
"
value
=
"
{} {} {}
"
.
format
(
self
.
_zmin
,
self
.
_zmax
,
self
.
_radius
)
return
key
,
value
def
header_entries
(
self
,
nevents
=
0
):
retdct
=
dict
()
key
=
"
genvol
"
value
=
"
{} {} {} {} {}
"
.
format
(
self
.
_zmin
,
self
.
_zmax
,
self
.
_radius
,
self
.
_volume
,
nevents
)
retdct
[
key
]
=
value
key
=
"
fixedcan
"
value
=
"
0 0 {} {} {}
"
.
format
(
self
.
_zmin
,
self
.
_zmax
,
self
.
_radius
)
return
retdct
class
SphericalVolume
(
DetectorVolume
):
...
...
@@ -140,9 +145,14 @@ class SphericalVolume(DetectorVolume):
pos
=
(
pos_x
,
pos_y
,
pos_z
)
return
tuple
(
np
.
add
(
self
.
_coord_origin
,
pos
))
def
header_entry
(
self
):
def
header_entries
(
self
,
nevents
=
0
):
retdct
=
dict
()
key
=
"
sphere
"
value
=
"
radius: {} center_x: {} center_y: {} center_z: {}
"
.
format
(
self
.
_radius
,
self
.
_coord_origin
[
0
],
self
.
_coord_origin
[
1
],
self
.
_coord_origin
[
2
])
return
key
,
value
retdct
[
key
]
=
value
key
=
"
genvol
"
value
=
"
0 0 {} {} {}
"
.
format
(
self
.
_radius
,
self
.
_volume
,
nevents
)
retdct
[
key
]
=
value
return
retdct
This diff is collapsed.
Click to expand it.
km3buu/output.py
+
7
−
4
View file @
5a0b9a7c
...
...
@@ -176,7 +176,8 @@ EMPTY_KM3NET_HEADER_DICT = {
"
norma
"
:
"
0 0
"
,
"
tgen
"
:
"
0
"
,
"
simul
"
:
""
,
"
primary
"
:
"
0
"
"
primary
"
:
"
0
"
,
"
genvol
"
:
"
0 0 0 0 0
"
}
PARTICLE_MC_STATUS
=
{
...
...
@@ -707,12 +708,12 @@ def write_detector_file(gibuu_output,
global_generation_weight
=
gibuu_output
.
global_generation_weight
(
4
*
np
.
pi
)
mean_xsec_func
=
gibuu_output
.
mean_xsec
head
=
ROOT
.
Head
()
header_dct
=
EMPTY_KM3NET_HEADER_DICT
.
copy
()
header_dct
[
"
target
"
]
=
element
.
name
key
,
value
=
geometry
.
header_entry
()
header_dct
[
key
]
=
value
for
k
,
v
in
geometry
.
header_entries
(
gibuu_output
.
_generated_events
//
no_files
).
items
():
header_dct
[
k
]
=
v
header_dct
[
"
coord_origin
"
]
=
"
{} {} {}
"
.
format
(
*
geometry
.
coord_origin
)
header_dct
[
"
flux
"
]
=
"
{:d} 0 0
"
.
format
(
nu_type
)
header_dct
[
"
cut_nu
"
]
=
"
{:.2f} {:.2f} -1 1
"
.
format
(
gibuu_output
.
energy_min
,
...
...
@@ -740,6 +741,7 @@ def write_detector_file(gibuu_output,
tree
.
Branch
(
"
Evt
"
,
evt
,
32000
,
4
)
mc_trk_id
=
0
head
=
ROOT
.
Head
()
for
k
,
v
in
header_dct
.
items
():
head
.
set_line
(
k
,
v
)
head
.
Write
(
"
Head
"
)
...
...
@@ -831,6 +833,7 @@ def write_detector_file(gibuu_output,
tree
.
Fill
()
outfile
.
Write
()
outfile
.
Close
()
del
head
del
outfile
del
evt
del
tree
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