26 from setup_modules
import setup_RTCtoSPTCConverters
32 parser = argparse.ArgumentParser(description=
'Training sample preparation:\
33 Prepare a data sample to train the sector map.\n\
34 Usage: basf2 traininPreparation.py -i dataSample.root -- --enable_selection boolean')
41 help=
'enable the selection of training sample based on track parameters')
49 help=
"By default only RecoTracks with valid fit are taken for training. Using this option will disable that. ")
51 arguments = parser.parse_args()
52 use_noKick = arguments.use_NoKick
60 b2.set_log_level(b2.LogLevel.ERROR)
61 b2.log_to_file(
'logVXDTF2Preparation.log', append=
False)
68 path = b2.create_path()
72 rootInputM = b2.register_module(
'RootInput')
73 path.add_module(rootInputM)
76 eventinfoprinter = b2.register_module(
'EventInfoPrinter')
77 path.add_module(eventinfoprinter)
79 path.add_module(
"PrintCollections", printForEvent=1)
83 gearbox = b2.register_module(
'Gearbox')
84 path.add_module(gearbox)
87 geometry = b2.register_module(
'Geometry')
88 path.add_module(geometry)
97 spCreatorPXD = b2.register_module(
'PXDSpacePointCreator')
98 spCreatorPXD.param(
'NameOfInstance',
'PXDSpacePointCreator')
99 spCreatorPXD.param(
'SpacePoints',
'PXDSpacePoints')
100 path.add_module(spCreatorPXD)
102 spCreatorSVD = b2.register_module(
'SVDSpacePointCreator')
103 spCreatorSVD.param(
'OnlySingleClusterSpacePoints',
False)
104 spCreatorSVD.param(
'NameOfInstance',
'SVDSpacePointCreator')
105 spCreatorSVD.param(
'SpacePoints',
'SVDSpacePoints')
106 path.add_module(spCreatorSVD)
111 setup_RTCtoSPTCConverters(path=path,
112 SVDSPscollection=
'SVDSpacePoints',
113 PXDSPscollection=
'PXDSpacePoints',
114 RTCinput=
'MCRecoTracks',
115 sptcOutput=
'checkedSPTCs',
117 logLevel=b2.LogLevel.ERROR,
118 useNoKick=use_noKick,
119 useOnlyFittedTracks=
True)
127 secMapBootStrap = b2.register_module(
'SectorMapBootstrap')
128 secMapBootStrap.param(
'ReadSectorMap',
False)
129 secMapBootStrap.param(
'WriteSectorMap',
False)
130 path.add_module(secMapBootStrap)
135 if os.environ.get(
'USE_BEAST2_GEOMETRY'):
141 nameTag +=
'_SVDOnly'
144 SecMapTrainerBase = b2.register_module(
'VXDTFTrainingDataCollector')
145 SecMapTrainerBase.param(
'NameTag', nameTag)
146 SecMapTrainerBase.param(
'SpacePointTrackCandsName',
'checkedSPTCs')
148 path.add_module(SecMapTrainerBase)
151 path.add_module(
'Progress')
153 path.add_module(
"PrintCollections", printForEvent=1)