43 def create_argument_parser(self, **kwds):
44 """Translate the command-lne arguments to basf2-job paramete
r"""
45 argument_parser = super().create_argument_parser(**kwds)
47 argument_parser.add_argument(
51 default=self.output_folder,
52 help='Folder where the output files are written to. If the folder does not exist create it. '
55 argument_parser.add_argument(
59 help='Run in batch mode and do not show each event.'
62 argument_parser.add_argument(
66 help='Swtich to activate the legacy implementation written in python'
69 argument_parser.add_argument(
70 "--use_time_in_filename",
72 help='Use the current time in the names of the generated files'
75 argument_parser.add_argument(
78 default=self.filename_prefix,
79 help='Prefix to the names of the generated files'
82 argument_parser.add_argument(
87 const='TrackFinderMCTruthRecoTracks',
88 default=self.finder_module,
89 help='Generate the mc tracks using the TrackFinderMCTruthRecoTracks. Short hand for -f TrackFinderMCTruthRecoTracks'
92 subparser_description = \
94Various options to configure what shall be drawn in the display.
95Note that some options are only relevant, if the cellular automaton finder in the CDC has been run before.
97 draw_argument_group = argument_parser.add_argument_group(
99 description=subparser_description
102 cdc_display_module = self.cdc_display_module
104 if self.show_all_drawoptions:
105 drawoptions = cdc_display_module.all_drawoptions
107 drawoptions = cdc_display_module.drawoptions
109 for option in sorted(drawoptions):
110 options_flag = f"--{option.replace('_', '-')} "
112 draw_argument_group.add_argument(
116 default=getattr(cdc_display_module, option)
119 return argument_parser
121 def configure(self, arguments):
122 """Configure the basf2 job script using the translated command-line arguments"""
123 super().configure(arguments)
125 cdc_display_module = self.cdc_display_module
127 cdc_display_module.output_folder = arguments.output_folder
128 cdc_display_module.interactive = arguments.interactive
130 cdc_display_module.use_python = arguments.use_python
131 cdc_display_module.use_cpp = not arguments.use_python
132 cdc_display_module.use_time_in_filename = arguments.use_time_in_filename
133 cdc_display_module.filename_prefix = arguments.filename_prefix
135 if self.show_all_drawoptions:
136 drawoptions = cdc_display_module.all_drawoptions
138 drawoptions = cdc_display_module.drawoptions
140 for option in drawoptions:
142 is_active_option = getattr(arguments, option)
143 except AttributeError:
146 print('Setting', option, 'to', is_active_option)
147 setattr(cdc_display_module, option, is_active_option)