hpstr
The Heavy Photon Search Toolkit for Reconstruction (hpstr) provides an interface to physics data from the HPS experiment saved in the LCIO format and converts it into an ROOT based format.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
HpstrConf.py
Go to the documentation of this file.
1import platform
2
3
4class Processor:
5 """! Processor python class."""
6
7 def __init__(self, instance_name, class_name):
8 self.instance_name = instance_name
9 self.class_name = class_name
10 self.parameters = {}
11
12 def toString(self):
13 print("\tProcessor( %s of instance %s )" % (self.instance_name, self.class_name))
14 if len(self.parameters) > 0:
15 print("\t\tParameters: ")
16 for key, value in self.parameters.items():
17 print("\t\t\t [ %s ]: %s" % (key, value))
18
19
20class Process:
21 """! Process python class."""
22 lastProcess = None
23
24 def __init__(self):
25 self.max_events = -1
26 self.input_files = []
27 self.output_files = []
28 self.sequence = []
29 self.libraries = []
30 Process.lastProcess = self
31
32 def add_library(self, lib):
33 """! Add a libraries to the list of libraries to load, searching the appropriate paths to find it,
34 and adding the correct file extension"""
35 systemName = platform.system()
36 if (systemName == "Linux"):
37 libParts = lib.split(".")
38 add_lib = libParts[0]+".so"
39 pass
40 if (systemName == "Darwin"):
41 libParts = lib.split(".")
42 add_lib = libParts[0]+".dylib"
43 pass
44 self.libraries.append(add_lib)
45
46 def printProcess(self):
47 """! Print process."""
48 if (self.max_events > 0): print(" Maximum events to process: %d" % (self.max_events))
49 else: print(" No limit on maximum events to process")
50
51 print("Processor sequence:")
52 for proc in self.sequence:
53 proc.toString()
54 if len(self.input_files) > 0:
55 if len(self.output_files) == len(self.input_files):
56 print("Files:")
57 for i in range(0, len(self.input_files)):
58 print(" '%s' -> '%s'"%(self.input_files[i], self.output_files[i]))
59 else:
60 print("Input files:")
61 for afile in self.input_files:
62 print(" %s"%(afile))
63 if len(self.output_files) > 0:
64 print("Output file:", self.output_files[0])
65 elif len(self.output_files) > 0:
66 print("Output file:", self.output_files[0])
67 if len(self.libraries) > 0:
68 print("Shared libraries to load:")
69 for afile in self.libraries:
70 print(" %s"%(afile))
Process python class.
Definition HpstrConf.py:20
printProcess(self)
Print process.
Definition HpstrConf.py:46
add_library(self, lib)
Add a libraries to the list of libraries to load, searching the appropriate paths to find it,...
Definition HpstrConf.py:32
Processor python class.
Definition HpstrConf.py:4
__init__(self, instance_name, class_name)
Definition HpstrConf.py:7