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
1f4a1136
Commit
1f4a1136
authored
5 years ago
by
Johannes Schumann
Browse files
Options
Downloads
Patches
Plain Diff
Restructuring of the jobcard functions
parent
598fa4f0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1
Merge python environment
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
km3buu/jobcard.py
+47
-48
47 additions, 48 deletions
km3buu/jobcard.py
with
47 additions
and
48 deletions
km3buu/jobcard.py
+
47
−
48
View file @
1f4a1136
...
...
@@ -14,6 +14,9 @@ __status__ = "Development"
INPUT_PATH
=
"
/opt/buuinput2019/
"
_PROCESS_LOOKUP
=
{
"
cc
"
:
2
,
"
nc
"
:
3
,
"
anticc
"
:
-
2
,
"
antinc
"
:
-
3
}
_FLAVOUR_LOOKUP
=
{
"
electron
"
:
1
,
"
muon
"
:
2
,
"
tau
"
:
3
}
class
Jobcard
(
object
):
"""
...
...
@@ -25,45 +28,11 @@ class Jobcard(object):
The input path pointing to the GiBUU lookup data which should be used
"""
def
__init__
(
self
,
input_path
=
INPUT_PATH
):
self
.
input_path
=
input_path
self
.
input_path
=
"'
%s
'"
%
input_path
self
.
_groups
=
{}
# Default [input]
self
.
add_property
(
"
input
"
,
"
path_to_input
"
,
input_path
)
self
.
add_property
(
"
input
"
,
"
numTimeSteps
"
,
0
)
self
.
add_property
(
"
input
"
,
"
numEnsembles
"
,
100000
)
self
.
add_property
(
"
input
"
,
"
delta_T
"
,
0.2
)
self
.
add_property
(
"
input
"
,
"
num_runs_SameEnergy
"
,
1
)
# Default [target]
self
.
add_property
(
"
target
"
,
"
Z
"
,
1
)
self
.
add_property
(
"
target
"
,
"
A
"
,
1
)
def
set_target
(
self
,
Z
,
A
):
"""
Set the interaction target nucleus
Parameters
----------
A: int
Number of nucleons in the nucleus
Z: int
Number of protons in the nucleus
"""
self
.
add_property
(
"
target
"
,
"
Z
"
,
Z
)
self
.
add_property
(
"
target
"
,
"
A
"
,
A
)
@property
def
timesteps
(
self
):
"""
input/numTimeSteps property
"""
return
self
.
_groups
[
"
input
"
][
"
numTimeSteps
"
]
@timesteps.setter
def
timesteps
(
self
,
timesteps
):
self
.
_groups
[
"
input
"
][
"
numTimeSteps
"
]
=
timesteps
def
add_property
(
self
,
group
,
name
,
value
):
"""
Add a property to the jobcard
def
set_property
(
self
,
group
,
name
,
value
):
"""
Set a property to the jobcard
Parameters
----------
...
...
@@ -78,6 +47,11 @@ class Jobcard(object):
self
.
_groups
[
group
]
=
{}
self
.
_groups
[
group
][
name
]
=
value
def
remove_property
(
self
,
group
,
name
):
del
self
.
_groups
[
group
][
name
]
if
len
(
self
.
_groups
[
group
])
==
0
:
del
self
.
_groups
[
group
]
def
__str__
(
self
):
retval
=
""
for
group
,
attrs
in
self
.
_groups
.
items
():
...
...
@@ -85,27 +59,52 @@ class Jobcard(object):
continue
retval
+=
"
&%s
\n
"
%
group
for
attr
,
value
in
attrs
.
items
():
if
type
(
value
)
is
str
:
retval
+=
"
\t
%s =
'
%s
'
\n
"
%
(
attr
,
value
)
elif
type
(
value
)
is
bool
:
retval
+=
"
\t
%s = .%s.
\n
"
%
(
attr
,
value
)
if
type
(
value
)
is
bool
:
retval
+=
"
\t
%s = .%s.
\n
"
%
(
attr
,
str
(
value
).
lower
())
else
:
retval
+=
"
\t
%s = %s
\n
"
%
(
attr
,
value
)
retval
+=
"
/
\n\n
"
return
retval
class
NeutrinoJobcard
(
Jobcard
):
def
generate_neutrino_jobcard
(
process
,
flavour
,
energy
,
target
,
input_path
=
INPUT_PATH
):
"""
Jobcard object
for neutrino interaction
s
Generate a jobcard
for neutrino interaction
Parameters
----------
process: str
Interaction channel [
"
CC
"
,
"
NC
"
,
"
antiCC
"
,
"
antiNC
"
]
flavour: str
Flavour [
"
electron
"
,
"
muon
"
,
"
tau
"
]
energy: float
Initial energy of the neutrino in GeV
target: (int, int)
(Z, A) describing the target nukleon
input_path: str
The input path pointing to the GiBUU lookup data which should be used
"""
def
__init__
(
self
,
input_path
=
INPUT_PATH
):
super
(
NeutrinoJobcard
,
self
).
__init__
(
input_path
)
## Default [input]
self
.
add_property
(
"
input
"
,
"
eventtype
"
,
5
)
self
.
add_property
(
"
input
"
,
"
localEnsemble
"
,
True
)
jc
=
Jobcard
(
input_path
)
# NEUTRINO
jc
.
set_property
(
"
neutrino_inducted
"
,
"
process_ID
"
,
_PROCESS_LOOKUP
[
process
.
lower
()])
jc
.
set_property
(
"
neutrino_inducted
"
,
"
flavour_ID
"
,
_FLAVOUR_LOOKUP
[
flavour
.
lower
()])
jc
.
set_property
(
"
neutrino_inducted
"
,
"
nuXsectionMode
"
,
6
)
jc
.
set_property
(
"
neutrino_inducted
"
,
"
includeDIS
"
,
True
)
jc
.
set_property
(
"
neutrino_inducted
"
,
"
printAbsorptionXS
"
,
"
T
"
)
# INPUT
jc
.
set_property
(
"
input
"
,
"
numTimeSteps
"
,
0
)
jc
.
set_property
(
"
input
"
,
"
eventtype
"
,
5
)
jc
.
set_property
(
"
input
"
,
"
numEnsembles
"
,
100000
)
jc
.
set_property
(
"
input
"
,
"
delta_T
"
,
0.2
)
jc
.
set_property
(
"
input
"
,
"
localEnsemble
"
,
True
)
jc
.
set_property
(
"
input
"
,
"
num_runs_SameEnergy
"
,
1
)
# TARGET
jc
.
set_property
(
"
target
"
,
"
Z
"
,
target
[
0
])
jc
.
set_property
(
"
target
"
,
"
A
"
,
target
[
1
])
return
jc
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