From a70c27dd6218ae2147ce1875862f48fb3b8da6bb Mon Sep 17 00:00:00 2001 From: Johannes Schumann <johannes.schumann@fau.de> Date: Sun, 9 Feb 2020 02:23:08 +0100 Subject: [PATCH] First jobcard functionality --- km3buu/jobcard.py | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 km3buu/jobcard.py diff --git a/km3buu/jobcard.py b/km3buu/jobcard.py new file mode 100644 index 0000000..7467fcf --- /dev/null +++ b/km3buu/jobcard.py @@ -0,0 +1,46 @@ +# Filename: jobcard.py +""" +Tools for creation of GiBUU jobcards + +""" + +__author__ = "Johannes Schumann" +__copyright__ = "Copyright 2020, Johannes Schumann and the KM3NeT collaboration." +__credits__ = [] +__license__ = "MIT" +__maintainer__ = "Johannes Schumann" +__email__ = "jschumann@km3net.de" +__status__ = "Development" + +INPUT_PATH = "/opt/buuinput2019/" + + +class Jobcard(object): + def __init__(self, input_path=INPUT_PATH): + self.input_path = input_path + self._groups = { + "input": {"path_to_input": input_path} + } + + def add_property(self, group, name, value) + self._groups[group][name] = value + + def __str__(self): + retval = "" + for group, attrs in self._groups.items(): + 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) + else: + retval += "\t%s = %s\n" % (attr, value) + retval += "/\n" + return retval + + + +class NeutrinoJobcard(Jobcard): + def __init__(self, input_path=INPUT_PATH): + super(NeutrinoJobcard, self).__init__(input_path) -- GitLab