8 from .
import utilities
12 from ROOT
import Belle2
16 return logging.getLogger(__name__)
22 """Configure for a bare-bones basf2 job"""
27 description =
"Empty execution of basf2"
32 raise ValueError(
"Received_unknown unknown argument")
36 """provide name of this object"""
37 return self.__class__.__name__
40 """Configure basf2 job script from command-line arguments then run it"""
45 """Create the basf2 path then run the job"""
53 """Process the basf2 path"""
56 get_logger().info(
'Start processing')
57 basf2.print_path(path)
59 get_logger().info(
"\n%s", str(basf2.statistics))
62 """Convert the command-line arguments to a basf2 job script"""
64 arguments = argument_parser.parse_args()
68 """Save the command-line arguments as key-value pairs"""
71 for (key, value)
in list(vars(arguments).items()):
74 if hasattr(self, key):
75 get_logger().info(
"Setting %s to %s", key, value)
76 setattr(self, key, value)
79 """Parse the command-line arguments to a basf2 job script"""
81 return argument_parser
84 """Create a new basf2 path"""
85 path = basf2.create_path()
89 """Hook that gives the opportunity to check the path for consistency before processing it"""
95 class MinimalRun(EmptyRun):
96 """Configure for a minimal basf2 job"""
99 description =
"Minimally populated execution of basf2"
108 root_input_file =
None
117 """Convert command-line arguments to basf2 argument list"""
119 master_argument_group = argument_parser.add_argument_group(
"Master arguments")
122 master_argument_group.add_argument(
125 default=argparse.SUPPRESS,
126 dest=
'root_input_file',
127 help=
'File path to the ROOT file from which the simulated events shall be loaded.'
130 master_argument_group.add_argument(
136 help=
'Number of events to be generated',
139 master_argument_group.add_argument(
143 default=argparse.SUPPRESS,
145 help=
'The random number generator seed to be set before the processing starts.',
148 master_argument_group.add_argument(
152 default=argparse.SUPPRESS,
154 help=
'The number of parallel processes to be used for processing.',
157 master_argument_group.add_argument(
158 '--n-events-to-skip',
159 dest=
'n_events_to_skip',
160 default=argparse.SUPPRESS,
162 help=
'The number of events to skip',
165 return argument_parser
168 """Create and configure the basf2 path"""
175 environment.setNumberEventsOverride(self.
n_events)
180 path.add_module(
'EventInfoSetter',
189 path.add_module(
'RootInput',
194 path.add_module(
'Progress')
198 environment.setNumberProcessesOverride(self.
n_processes)