From f57260b58442dc4d779cca3465d93c31c07a3511 Mon Sep 17 00:00:00 2001
From: Johannes Schumann <johannes.schumann@fau.de>
Date: Fri, 29 Jan 2021 13:38:48 +0100
Subject: [PATCH] Add simul field to km3net-dataformat header

---
 km3buu/output.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/km3buu/output.py b/km3buu/output.py
index 66ebca0..602e55e 100644
--- a/km3buu/output.py
+++ b/km3buu/output.py
@@ -24,9 +24,11 @@ from scipy.interpolate import UnivariateSpline
 from scipy.spatial.transform import Rotation
 import scipy.constants as constants
 import mendeleev
+from datetime import datetime
 
 from .jobcard import Jobcard, read_jobcard, PDGID_LOOKUP
 from .config import Config, read_default_media_compositions
+from .__version__ import version
 
 try:
     import ROOT
@@ -111,7 +113,8 @@ EMPTY_KM3NET_HEADER_DICT = {
     "seabottom": "0",
     "DAQ": "0",
     "tgen": "0",
-    "primary": "0"
+    "primary": "0",
+    "simul": ""
 }
 
 
@@ -429,6 +432,9 @@ def write_detector_file(gibuu_output,
     head = ROOT.Head()
     header_dct = EMPTY_KM3NET_HEADER_DICT.copy()
 
+    timestamp = datetime.now()
+    header_dct["simul"] = "KM3BUU %s %s".format(version,
+                                                now.strftime("%Y%m%d %H%M%S"))
     header_dct["can"] = "{:.1f} {:.1f} {:.1f}".format(*can)
     header_dct["tgen"] = "{:.1f}".format(livetime)
     header_dct["flux"] = "{:d} 0 0".format(nu_type)
-- 
GitLab