14from VXDTF.setup_modules
import (setup_gfTCtoSPTCConverters,
18 setup_qualityEstimators)
20from VXDTF.setup_modules_ml
import add_fbdtclassifier_training, add_ml_threehitfilters
34rootInputFileName =
"seed12345nEv1000pGun1_20T.root"
35rootInputFileName =
"MyRootFile.root"
41setFilterType =
'hopfield'
47useOldTFinstead =
False
48oldTFNoSubsetSelection =
True
52activateSegNetAnalizer =
False
55doNewSubsetSelection =
True
56doVirtualIPRemovalb4Fit =
True
58switchFiltersOff =
False
63segNetAnaRFN =
'SegNetAnalyzer_SM_train.root'
64fbdtSamplesFN =
'FBDTClassifier_samples_train_10k.dat'
65fbdtFN =
'FBDTClassifier_1000_3.dat'
81b2.set_log_level(b2.LogLevel.ERROR)
82b2.set_random_seed(initialValue)
84trainerVXDTFLogLevel = b2.LogLevel.INFO
85trainerVXDTFDebugLevel = 10
87TFlogLevel = b2.LogLevel.INFO
90CAlogLevel = b2.LogLevel.DEBUG
93AnalizerlogLevel = b2.LogLevel.INFO
97if (initialValue == 2):
98 print(
"chosen initialvalue 2! " + rootInputFileName)
99 acceptedRawSecMapFiles = [
'lowTestRedesign_1373026662.root']
100elif (initialValue == 0):
101 print(
"chosen initialvalue 0! " + rootInputFileName)
102 acceptedRawSecMapFiles = [
'lowTestRedesign.root']
103elif (initialValue == 3):
104 print(
"chosen initialvalue 3! " + rootInputFileName)
105 acceptedRawSecMapFiles = [
'lowTestRedesign_202608818.root']
106elif (initialValue == 4):
107 print(
"chosen initialvalue 4!! " + rootInputFileName)
108 acceptedRawSecMapFiles = [
'lowTestRedesign_293660864.root']
112elif (initialValue == 5):
113 print(
"chosen initialvalue 5! " + rootInputFileName)
114 acceptedRawSecMapFiles = [
'lowTestRedesign_1120112796.root']
115elif (initialValue == 6):
116 print(
"chosen initialvalue 6! " + rootInputFileName)
117 acceptedRawSecMapFiles = [
'lowTestRedesign_1120112796.root']
119elif (initialValue == 7):
120 print(
"chosen initialvalue 7! (skipCluster-setting=True) " + rootInputFileName)
121 acceptedRawSecMapFiles = [
'lowTestRedesign_1332084337.root']
122elif (initialValue == 8):
123 print(
"chosen initialvalue 8! (skipCluster-setting=True): 200k evtGen events " + rootInputFileName)
124 acceptedRawSecMapFiles = [
'lowTestRedesign_1332084337.root']
125elif (initialValue == 11):
126 print(
"chosen initialvalue 11! (skipCluster-setting=True): 100 pGun events " + rootInputFileName)
127 acceptedRawSecMapFiles = [
'lowTestRedesign_1017144726.root']
128elif (initialValue == 12):
129 print(
"chosen initialvalue 12! (skipCluster-setting=True): 200 pGun events " + rootInputFileName)
130 acceptedRawSecMapFiles = [
'lowTestRedesign_1196763558.root']
131elif (initialValue == 13):
132 print(
"chosen initialvalue 13! (skipCluster-setting=True): 100k pGun events " + rootInputFileName)
133 acceptedRawSecMapFiles = [
'lowTestRedesign_1874442389.root']
137elif (initialValue == 57):
138 print(
"chosen initialvalue 57! setup remark: train: 10k events, 10 tracks per event, theta 60-85°, phi 0-360°, pT 100-145MeV.")
139 acceptedRawSecMapFiles = [
'lowTestRedesign_779994078.root']
140elif (initialValue == 12345):
141 print(
"chosen initialvalue 12345! some dummy setup!")
142 acceptedRawSecMapFiles = [
'lowTestRedesign_349397772.root']
144 print(
"ERROR! no valid initialvalue chosen!")
145 acceptedRawSecMapFiles = [
""]
152rootInputM = b2.register_module(
'RootInput')
153rootInputM.param(
'inputFileName', rootInputFileName)
157eventinfoprinter = b2.register_module(
'EventInfoPrinter')
160gearbox = b2.register_module(
'Gearbox')
162secMapBootStrap = b2.register_module(
'SectorMapBootstrap')
163secMapBootStrap.param(
'ReadSectorMap',
False)
164secMapBootStrap.param(
'WriteSectorMap',
True)
168 newSecMapTrainerBase = b2.register_module(
'SecMapTrainerBase')
169 newSecMapTrainerBase.logging.log_level = trainerVXDTFLogLevel
170 newSecMapTrainerBase.logging.debug_level = trainerVXDTFDebugLevel
171 newSecMapTrainerBase.param(
'spTCarrayName',
'checkedSPTCs')
172 newSecMapTrainerBase.param(
'allowTraining',
True)
176 merger = b2.register_module(
'RawSecMapMerger')
177 merger.logging.log_level = trainerVXDTFLogLevel
178 merger.logging.debug_level = trainerVXDTFDebugLevel
179 merger.param(
'rootFileNames', acceptedRawSecMapFiles)
185geometry = b2.register_module(
'Geometry')
186geometry.param(
'components', [
'BeamPipe',
'MagneticFieldConstant4LimitedRSVD',
190eventCounter = b2.register_module(
'EventCounter')
191eventCounter.logging.log_level = b2.LogLevel.INFO
192eventCounter.param(
'stepSize', evtStepSize)
197 'shiftedL3IssueTestSVDStd-moreThan400MeV_SVD',
198 'shiftedL3IssueTestSVDStd-100to400MeV_SVD',
199 'shiftedL3IssueTestSVDStd-25to100MeV_SVD']
202 [
'shiftedL3IssueTestVXDStd-moreThan400MeV_PXDSVD',
203 'shiftedL3IssueTestVXDStd-100to400MeV_PXDSVD',
204 'shiftedL3IssueTestVXDStd-25to100MeV_PXDSVD'
207 vxdtf = b2.register_module(
'VXDTF')
208 vxdtf.logging.log_level = b2.LogLevel.DEBUG
209 vxdtf.logging.debug_level = 1
210 vxdtf.param(
'sectorSetup', secSetup)
211 vxdtf.param(
'GFTrackCandidatesColName',
'caTracks')
212 vxdtf.param(
'tuneCutoffs', tuneValue)
213 vxdtf.param(
'displayCollector', 2)
214 if oldTFNoSubsetSelection:
215 vxdtf.param(
'filterOverlappingTCs',
'none')
218 oldAnalyzer = b2.register_module(
'TFAnalizer')
219 oldAnalyzer.logging.log_level = b2.LogLevel.INFO
220 oldAnalyzer.param(
'printExtentialAnalysisData',
False)
221 oldAnalyzer.param(
'caTCname',
'caTracks')
222 oldAnalyzer.param(
'acceptedTCname',
'VXDTFoldAcceptedTCS')
223 oldAnalyzer.param(
'lostTCname',
'VXDTFoldLostTCS')
226 trackCandConverter = b2.register_module(
'GFTC2SPTCConverter')
227 trackCandConverter.logging.log_level = b2.LogLevel.WARNING
228 trackCandConverter.param(
'genfitTCName',
'caTracks')
229 trackCandConverter.param(
'SpacePointTCName',
'caSPTCs')
230 trackCandConverter.param(
'NoSingleClusterSVDSP',
'nosingleSP')
231 trackCandConverter.param(
'PXDClusterSP',
'pxdOnly')
232 trackCandConverter.param(
'checkNoSingleSVDSP',
True)
233 trackCandConverter.param(
'checkTrueHits',
False)
234 trackCandConverter.param(
'useSingleClusterSP',
False)
235 trackCandConverter.param(
'skipCluster',
True)
237 segNetProducer = b2.register_module(
'SegmentNetworkProducer')
238 segNetProducer.param(
'CreateNeworks', cNetworks)
239 segNetProducer.param(
'NetworkOutputName',
'test2Hits')
240 segNetProducer.param(
'printNetworks', printNetworks)
241 segNetProducer.param(
'allFiltersOff', switchFiltersOff)
243 segNetProducer.param(
'SpacePointsArrayNames', [
'nosingleSP_relTH'])
244 segNetProducer.logging.log_level = TFlogLevel
245 segNetProducer.logging.debug_level = TFDebugLevel
247 if activateSegNetAnalizer:
248 segNetAnalyzer = b2.register_module(
'SegmentNetworkAnalyzer')
249 segNetAnalyzer.param(
'networkInputName',
'test2Hits')
250 segNetAnalyzer.param(
'rootFileName', segNetAnaRFN)
251 segNetAnalyzer.logging.log_level = b2.LogLevel.INFO
252 segNetAnalyzer.logging.debug_level = 100
255 cellOmat = b2.register_module(
'TrackFinderVXDBasicPathFinder')
257 cellOmat = b2.register_module(
'TrackFinderVXDCellOMat')
258 cellOmat.param(
'printNetworks', printNetworks)
259 cellOmat.param(
'SpacePointTrackCandArrayName',
'caSPTCs')
260 cellOmat.param(
'NetworkName',
'test2Hits')
261 cellOmat.param(
'removeVirtualIP',
False)
262 cellOmat.param(
'strictSeeding', doStrictSeeds)
263 cellOmat.logging.log_level = CAlogLevel
264 cellOmat.logging.debug_level = CADebugLevel
269vxdAnal = b2.register_module(
'TrackFinderVXDAnalizer')
270vxdAnal.param(
'referenceTCname',
'SPTracks')
271vxdAnal.param(
'testTCname',
'caSPTCs')
272vxdAnal.param(
'purityThreshold', 0.7)
273vxdAnal.param(
'ignoreDeadTCs', ignoreDeadTCs)
274vxdAnal.param(
'doEventSummary', doEventSummary)
275vxdAnal.logging.log_level = AnalizerlogLevel
276vxdAnal.logging.debug_level = AnalizerDebugLevel
280 b2.log_to_file(
'testRedesign' + str(initialValue) +
'.log', append=
False)
282 b2.log_to_file(
'testsegNetExecute' + str(initialValue) +
'.log', append=
False)
284main = b2.create_path()
287main.add_module(rootInputM)
288main.add_module(eventinfoprinter)
289main.add_module(gearbox)
290main.add_module(geometry)
291main.add_module(eventCounter)
292main.add_module(secMapBootStrap)
294setup_spCreatorSVD(path=main, nameOutput=
'nosingleSP', createSingleClusterSPs=
False, logLevel=b2.LogLevel.INFO)
296setup_spCreatorPXD(path=main, nameOutput=
'pxdOnly', logLevel=b2.LogLevel.INFO)
297setup_gfTCtoSPTCConverters(
301 gfTCinput=
'mcTracks',
302 sptcOutput=
'checkedSPTCs',
304 logLevel=b2.LogLevel.WARNING)
306vIPRemover = b2.register_module(
'SPTCvirtualIPRemover')
307vIPRemover.param(
'maxTCLengthForVIPKeeping', 0)
308vIPRemover.param(
'tcArrayName',
'caSPTCs')
313setup_sp2thConnector(main,
'pxdOnly',
'nosingleSP',
'_relTH',
True, b2.LogLevel.ERROR, 1)
315 main.add_module(newSecMapTrainerBase)
318 main.add_module(b2.register_module(
'SetupGenfitExtrapolation'))
319 main.add_module(vxdtf)
320 main.add_module(oldAnalyzer)
321 main.add_module(trackCandConverter)
323 main.add_module(merger)
324 main.add_module(segNetProducer)
326 add_fbdtclassifier_training(main,
'test2Hits',
'FBDTClassifier.dat',
False,
True,
327 False, fbdtSamplesFN, 100, 3, 0.15, 0.5, b2.LogLevel.DEBUG, 10)
329 add_ml_threehitfilters(main,
'test2Hits', fbdtFN, 0.989351,
True)
330 if activateSegNetAnalizer:
331 main.add_module(segNetAnalyzer)
332 main.add_module(cellOmat)
334 if doVirtualIPRemovalb4Fit:
335 main.add_module(vIPRemover)
337 setup_qualityEstimators(main, fitType,
'caSPTCs', b2.LogLevel.INFO, 1)
340 if doVirtualIPRemovalb4Fit
is False:
341 main.add_module(vIPRemover)
343 if doNewSubsetSelection:
345 tcNetworkProducer = b2.register_module(
'SPTCNetworkProducer')
346 tcNetworkProducer.param(
'tcArrayName',
'caSPTCs')
347 tcNetworkProducer.param(
'tcNetworkName',
'tcNetwork')
348 main.add_module(tcNetworkProducer)
350 tsEvaluator = b2.register_module(
'TrackSetEvaluatorHopfieldNN')
351 tsEvaluator.logging.log_level = b2.LogLevel.DEBUG
352 tsEvaluator.logging.debug_level = 3
353 tsEvaluator.param(
'tcArrayName',
'caSPTCs')
354 tsEvaluator.param(
'tcNetworkName',
'tcNetwork')
355 main.add_module(tsEvaluator)
357 svdOverlapResolver = b2.register_module(
'SVDOverlapResolver')
358 svdOverlapResolver.param(
'NameSpacePointTrackCands',
'caSPTCs')
359 svdOverlapResolver.param(
'resolveMethod',
'greedy')
361 svdOverlapResolver.logging.log_level = b2.LogLevel.DEBUG
363 main.add_module(vxdAnal)
366 display = b2.register_module(
'Display')
367 display.param(
'showAllPrimaries',
True)
368 main.add_module(display)