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
bf87a9b8
Commit
bf87a9b8
authored
3 years ago
by
Johannes Schumann
Browse files
Options
Downloads
Patches
Plain Diff
Update w2list fields
parent
b3d25b32
No related branches found
No related tags found
1 merge request
!19
Resolve "ICHAN type"
Pipeline
#24585
passed with warnings
3 years ago
Stage: test
Stage: coverage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
km3buu/output.py
+31
-5
31 additions, 5 deletions
km3buu/output.py
with
31 additions
and
5 deletions
km3buu/output.py
+
31
−
5
View file @
bf87a9b8
...
...
@@ -23,6 +23,7 @@ import uproot
from
scipy.interpolate
import
UnivariateSpline
,
interp1d
from
scipy.spatial.transform
import
Rotation
import
scipy.constants
as
constants
from
scipy.optimize
import
curve_fit
import
mendeleev
from
datetime
import
datetime
...
...
@@ -230,19 +231,18 @@ W2LIST_LOOKUP = {
"
COLUMN_DEPTH
"
:
3
,
"
P_EARTH
"
:
4
,
"
WATER_INT_LEN
"
:
5
,
"
P_SCALE
"
:
6
,
"
BX
"
:
7
,
"
BY
"
:
8
,
"
ICHAN
"
:
9
,
"
CC
"
:
10
,
"
DISTAMAX
"
:
11
,
"
WATERXSEC
"
:
12
,
"
XSEC
"
:
13
,
"
DXSEC
"
:
14
,
"
TARGETA
"
:
15
,
"
TARGETZ
"
:
16
,
"
VERINCAN
"
:
17
,
"
LEPINCAN
"
:
18
,
"
GIBUU_WEIGHT
"
:
19
"
GIBUU_WEIGHT
"
:
23
,
"
GIBUU_SCAT_TYPE
"
:
24
}
W2LIST_LENGTH
=
max
(
W2LIST_LOOKUP
.
values
())
+
1
...
...
@@ -300,9 +300,11 @@ class GiBUUOutput:
self
.
_min_energy
=
np
.
nan
self
.
_max_energy
=
np
.
nan
self
.
_generated_events
=
-
1
self
.
_flux_index
=
np
.
nan
try
:
self
.
_read_flux_file
()
self
.
_determine_flux_index
()
except
OSError
:
self
.
_read_single_energy
()
...
...
@@ -577,6 +579,22 @@ class GiBUUOutput:
def
generated_events
(
self
):
return
self
.
_generated_events
def
_determine_flux_index
(
self
):
def
fluxfunc
(
x
,
a
,
b
):
return
a
*
x
**
b
mask
=
~
np
.
isclose
(
self
.
flux_data
[
"
events
"
],
0
)
popt
,
pcov
=
curve_fit
(
fluxfunc
,
self
.
flux_data
[
"
energy
"
][
mask
],
self
.
flux_data
[
"
events
"
][
mask
],
p0
=
[
1
,
-
1
])
self
.
_flux_index
=
popt
[
1
]
@property
def
flux_index
(
self
):
return
self
.
_flux_index
def
write_detector_file
(
gibuu_output
,
ofile
=
"
gibuu.offline.root
"
,
...
...
@@ -703,6 +721,7 @@ def write_detector_file(gibuu_output,
# Event Information (w2list)
evt
.
w2list
.
resize
(
W2LIST_LENGTH
)
evt
.
w2list
[
W2LIST_LOOKUP
[
"
PS
"
]]
=
global_generation_weight
evt
.
w2list
[
W2LIST_LOOKUP
[
"
EG
"
]]
=
gibuu_output
.
flux_index
evt
.
w2list
[
W2LIST_LOOKUP
[
"
XSEC_MEAN
"
]]
=
mean_xsec_func
(
event
.
lepIn_E
)
evt
.
w2list
[
W2LIST_LOOKUP
[
"
XSEC
"
]]
=
event
.
xsec
evt
.
w2list
[
W2LIST_LOOKUP
[
"
TARGETA
"
]]
=
gibuu_output
.
A
...
...
@@ -710,10 +729,17 @@ def write_detector_file(gibuu_output,
evt
.
w2list
[
W2LIST_LOOKUP
[
"
BX
"
]]
=
bjorkenx
[
mc_event_id
]
evt
.
w2list
[
W2LIST_LOOKUP
[
"
BY
"
]]
=
bjorkeny
[
mc_event_id
]
evt
.
w2list
[
W2LIST_LOOKUP
[
"
CC
"
]]
=
ichan
evt
.
w2list
[
W2LIST_LOOKUP
[
"
ICHAN
"
]]
=
event
.
evType
evt
.
w2list
[
W2LIST_LOOKUP
[
"
ICHAN
"
]]
=
SCATTERING_TYPE_TO_GENIE
[
event
.
evType
]
evt
.
w2list
[
W2LIST_LOOKUP
[
"
VERINCAN
"
]]
=
1
evt
.
w2list
[
W2LIST_LOOKUP
[
"
LEPINCAN
"
]]
=
1
evt
.
w2list
[
W2LIST_LOOKUP
[
"
GIBUU_WEIGHT
"
]]
=
event
.
weight
evt
.
w2list
[
W2LIST_LOOKUP
[
"
GIBUU_SCAT_TYPE
"
]]
=
event
.
evType
#TODO
evt
.
w2list
[
W2LIST_LOOKUP
[
"
DXSEC
"
]]
=
np
.
nan
evt
.
w2list
[
W2LIST_LOOKUP
[
"
COLUMN_DEPTH
"
]]
=
np
.
nan
evt
.
w2list
[
W2LIST_LOOKUP
[
"
P_EARTH
"
]]
=
np
.
nan
evt
.
w2list
[
W2LIST_LOOKUP
[
"
WATER_INT_LEN
"
]]
=
np
.
nan
# Vertex Position
vtx_pos
=
np
.
array
(
geometry
.
random_pos
())
...
...
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