32 arg_parser = argparse.ArgumentParser(description=
'Sector Map Training:\
33 Trains and stores SecMap from provided data sample.\n\
34 Usage: basf2 trainSecMap.py -- --train_sample traindata.root --secmap trainedSecMap.root')
36 arg_parser.add_argument(
'--train_sample',
'-i', type=str, action=
'append',
37 help=
'List of prepared training data file names which will be used for the training of the SecMap')
38 arg_parser.add_argument(
'--secmap',
'-s', type=str,
39 help=
'Inclusion of the root file containing the trained SecMap for the application of the VXDTF2.')
41 arguments = arg_parser.parse_args(sys.argv[1:])
42 train_data = arguments.train_sample
43 secmap_name = arguments.secmap
44 assert len(train_data) > 0,
'No data sample for training provided!'
48 set_log_level(LogLevel.ERROR)
49 log_to_file(
'logVXDTF2Training.log', append=
False)
58 eventinfosetter = register_module(
'EventInfoSetter')
62 if os.environ.get(
'USE_BEAST2_GEOMETRY'):
64 eventinfosetter.param(
"expList", [exp_number])
65 path.add_module(eventinfosetter)
68 gearbox = register_module(
'Gearbox')
69 path.add_module(gearbox)
72 geometry = register_module(
'Geometry')
73 path.add_module(geometry)
78 secMapBootStrap = register_module(
'SectorMapBootstrap')
79 secMapBootStrap.param(
'ReadSectorMap',
False)
80 secMapBootStrap.param(
'WriteSectorMap',
True)
82 secMapBootStrap.param(
'SectorMapsOutputFile', secmap_name)
83 elif os.environ.get(
'USE_BEAST2_GEOMETRY'):
84 secMapBootStrap.param(
'SectorMapsOutputFile',
'SectorMaps_Beast2.root')
85 path.add_module(secMapBootStrap)
88 merger = register_module(
'RawSecMapMerger')
89 merger.param(
'rootFileNames', train_data)
90 path.add_module(merger)