From 88e22b07487fad73e33e982654a30305e4bcf534 Mon Sep 17 00:00:00 2001
From: Johannes Schumann <johannes.schumann@fau.de>
Date: Tue, 4 Apr 2023 03:25:07 +0000
Subject: [PATCH] Timestep option

---
 km3buu/cmd.py     | 10 +++++++++-
 km3buu/jobcard.py |  7 +++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/km3buu/cmd.py b/km3buu/cmd.py
index a32b5a2..3dd6e29 100755
--- a/km3buu/cmd.py
+++ b/km3buu/cmd.py
@@ -60,6 +60,13 @@ ARGPARSE_GENERAL_PARAMS = [{
     "help": "The number of nucleons/protons in the target nucleus",
     "metavar": ("A", "Z"),
     "required": True
+}, {
+    "option_strings": ["--timesteps", "-x"],
+    "dest": "timesteps",
+    "type": int,
+    "help": "The number of timesteps performed by GiBUU",
+    "required": False
+    "default": -1
 }, {
     "option_strings": ["--geometry", "-g"],
     "dest":
@@ -208,7 +215,8 @@ def main():
                                    args.target,
                                    seed=args.seed,
                                    fluxfile=fluxfile,
-                                   do_decay=args.decay)
+                                   do_decay=args.decay,
+                                   timesteps=args.timesteps)
 
     jc["neutrinoanalysis"]["outputEvents"] = True
     jc["neutrinoanalysis"]["inclusiveAnalysis"] = False
diff --git a/km3buu/jobcard.py b/km3buu/jobcard.py
index 2077aaf..5399df8 100644
--- a/km3buu/jobcard.py
+++ b/km3buu/jobcard.py
@@ -109,6 +109,7 @@ def generate_neutrino_jobcard(events,
                               photon_propagation=True,
                               fluxfile=None,
                               seed=None,
+                              timesteps=-1,
                               input_path=INPUT_PATH):  # pragma: no cover
     """
     Generate a jobcard for neutrino interaction
@@ -138,6 +139,9 @@ def generate_neutrino_jobcard(events,
     seed: int (default: 0)
         Input seed for the random number generator in GiBUU 
         (0: some seed will be drawn based on system time)
+    timesteps: int (default: -1)
+        Number of timesteps done by GiBUU
+        (-1: Default value from GiBUU is used)
     input_path: str
         The input path pointing to the GiBUU lookup data which should be used
     """
@@ -151,6 +155,9 @@ def generate_neutrino_jobcard(events,
     jc["target"]["a"] = target[0]
     # EVENTS
     run_events = int(100000 / target[1])
+    # FSI
+    if timesteps >= 0:
+        jc["input"]["numTimeSteps"] = timesteps
     if events < run_events:
         run_events = events
         runs = 1
-- 
GitLab