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