17 """Prepare and execute a basf2 job to read generated events or generate new events then display the CDC tracks"""
20 output_folder = tempfile.gettempdir()
26 show_all_drawoptions =
False
39 """Get the display module"""
41 return cdc_display_module
44 """Translate the command-lne arguments to basf2-job parameter"""
47 argument_parser.add_argument(
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(
79 help=
'Prefix to the names of the generated files'
82 argument_parser.add_argument(
87 const=
'TrackFinderMCTruthRecoTracks',
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
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
122 """Configure the basf2 job script using the translated command-line arguments"""
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
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)
149 def create_path(self):
150 """Create the basf2 path"""
151 main_path = super().create_path()
def cdc_display_module(self)
def create_argument_parser(self, **kwds)
_cdc_display_module
Use the CDCSVGDisplay module to draw the CDC and tracks/hits.
def configure(self, arguments)
bool show_all_drawoptions
Switch to also show draw command line options only related to the cellular automaton track finder.
tempfile output_folder
Destination folder for displays.
str filename_prefix
Prefix of the output files.
None finder_module
Name of the finder module to be used - can be everything that is accepted by tracking....