Belle II Software development
dqmNeuro_SW.py
1
8
9import basf2
10import neurotrigger
11import sys
12import os
13
14
16
17# basf2.conditions.override_globaltags()
18# basf2.conditions.append_globaltag('klm_alignment_testing')
19# basf2.conditions.append_globaltag('neurotrigger') # should not be needed
20# basf2.conditions.append_globaltag('online')
21
22
24basf2.set_log_level(basf2.LogLevel.DEBUG)
25basf2.set_debug_level(20)
26
27
28
31main = basf2.create_path()
32
33# Loading filelist and checking for ending: ###
34dstfiles = [sys.argv[1]]
35
36ending = ".root"
37
38print('Files to be processed:')
39for x in dstfiles:
40 print(x)
41
42# Creating output directories with the script's name: ###
43os.makedirs(sys.argv[0].split('.py')[0] + '/data', exist_ok=True)
44os.makedirs(sys.argv[0].split('.py')[0] + '/hist', exist_ok=True)
45
46# Creating filenames for dqm histogram output and root dst output: ###
47outputfile = sys.argv[0].split('.py')[0] + '/hist/histo.' + sys.argv[1].split('/')[-1].split(ending)[0] + '.root'
48dstputfile = sys.argv[0].split('.py')[0] + '/data/dst.' + sys.argv[1].split('/')[-1].split(ending)[0] + '.root'
49
50# adding root input module depending on the input file: ###
51main.add_module("RootInput", inputFileNames=dstfiles)
52
53# loading gearbox and geometry, which is needed for simulation: ###
54main.add_module('Gearbox')
55main.add_module('Geometry')
56
57# show progress at least every 10^maxN events: ###
58main.add_module('Progress', maxN=3)
59
60# add filter to just use events with trg information present: ###
61main.add_module(neurotrigger.filterTRG()) # branchname="CDCTriggerNNInput2DFinderTracks"))
62
63# adding neurotrigger simulations for one hwsim and one swsim case: ###
64# neurotrigger.add_neurotrigger_sim(main)
66
67# adding software neurotrigger simulation from CDCHits on:
68# neurotrigger.add_neuro_simulation(main)
69
70# add reconstruction in case .sroot files were used: ###
71# main.add_module('CDCUnpacker')
72# add matcher modules to match trigger tracks to reco tracks: ###
73
74main.add_module('CDCTriggerRecoMatcher', TrgTrackCollectionName=neurotrigger.hwneurotracks,
75 hitCollectionName=neurotrigger.hwneuroinputsegmenthits, axialOnly=True)
76main.add_module('CDCTriggerRecoMatcher', TrgTrackCollectionName=neurotrigger.hwsimneurotracks,
77 hitCollectionName=neurotrigger.hwneuroinputsegmenthits, axialOnly=True)
78main.add_module('CDCTriggerRecoMatcher', TrgTrackCollectionName=neurotrigger.hwneuroinput2dfindertracks,
79 hitCollectionName=neurotrigger.hwneuroinputsegmenthits, axialOnly=True)
80# main.add_module('CDCTriggerRecoHitMatcher', hitCollectionName=neurotrigger.simsegmenthits)
81# main.add_module('CDCTriggerRecoMatcher', TrgTrackCollectionName=neurotrigger.simneurotracks_swtssw2d,
82# hitCollectionName=neurotrigger.simsegmenthits, axialOnly=True)
83main.add_module('SetupGenfitExtrapolation')
84
85# adding histomanager and the dqm module: ###
86main.add_module('HistoManager',
87 histoFileName=outputfile)
88main.add_module('CDCTriggerNeuroDQM',
89 simNeuroTracksName=neurotrigger.hwsimneurotracks,
90 unpackedNeuroInput2dTracksName=neurotrigger.hwneuroinput2dfindertracks,
91 # simNeuroTracksSWTSSW2DName=neurotrigger.simneurotracks_swtssw2d,
92 # sim2DTracksSWTSName=neurotrigger.sim2dtracks_swts,
93 # simSegmentHitsName=neurotrigger.simsegmenthits,
94 showRecoTracks=True,
95 skipWithoutHWTS=True,
96 maxRecoZDist=-1,
97 maxRecoD0Dist=-1,
98 limitedoutput=False,
99 )
100
101# add root output: ###
102main.add_module('RootOutput', outputFileName=dstputfile)
103
104# run basf2: ###
105basf2.process(main)
106print(basf2.statistics)
def add_neurotrigger_hw(path, nntweightfile=None, debug_level=4, debugout=False, **kwargs)
def filterTRG(path)
Definition: neurotrigger.py:41