39arg_parser = argparse.ArgumentParser(description=
'Sector Map Training:\
40 Trains and stores SecMap from provided data sample.\n\
41 Usage: basf2 trainSecMap.py -- --train_sample traindata.root --secmap trainedSecMap.root')
43arg_parser.add_argument(
'--train_sample',
'-i', type=str, nargs=
'*',
44 help=
'List of prepared training data file names which will be used for the training of the SecMap')
45arg_parser.add_argument(
'--secmap',
'-s', type=str,
46 help=
'Inclusion of the root file containing the trained SecMap for the application of the VXDTF2.')
47arg_parser.add_argument(
52 help=
'Relative threshold (in %) used to prune the sector maps. Will remove X % of the least used subgraphs.')
54arguments = arg_parser.parse_args(sys.argv[1:])
55train_data = arguments.train_sample
56secmap_name = arguments.secmap
57relThreshold = arguments.threshold
58assert len(train_data) > 0,
'No data sample for training provided!'
62b2.set_log_level(b2.LogLevel.ERROR)
63b2.log_to_file(
'logVXDTF2Training.log', append=
False)
67path = b2.create_path()
72eventinfosetter = b2.register_module(
'EventInfoSetter')
76if os.environ.get(
'USE_BEAST2_GEOMETRY'):
78eventinfosetter.param(
"expList", [exp_number])
79path.add_module(eventinfosetter)
82gearbox = b2.register_module(
'Gearbox')
83path.add_module(gearbox)
86geometry = b2.register_module(
'Geometry')
87path.add_module(geometry)
92secMapBootStrap = b2.register_module(
'SectorMapBootstrap')
93secMapBootStrap.param(
'ReadSectorMap',
False)
94secMapBootStrap.param(
'WriteSectorMap',
True)
96 secMapBootStrap.param(
'SectorMapsOutputFile', secmap_name)
97elif os.environ.get(
'USE_BEAST2_GEOMETRY'):
98 secMapBootStrap.param(
'SectorMapsOutputFile',
'SectorMaps_Beast2.root')
99path.add_module(secMapBootStrap)
102merger = b2.register_module(
'RawSecMapMerger')
103merger.param(
'rootFileNames', train_data)
104merger.param(
'threshold', relThreshold)
105path.add_module(merger)