Belle II Software  release-08-01-10
executionTime.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 
20 
21 import sys
22 import basf2 as b2
23 from svd.executionTime_utils import SVDExtraEventStatisticsModule
24 import simulation as simu
25 import tracking as trk
26 
27 import glob
28 
29 tag = "test"
30 if len(sys.argv) == 2:
31  tag = sys.argv[1]
32 
33 # EXAMPLE OF EXECUTION TIME MEASUREMENT
34 main = b2.create_path()
35 
36 b2.set_random_seed(1)
37 
38 # set the exp/run event informations
39 eventinfosetter = b2.register_module('EventInfoSetter')
40 eventinfosetter.param('expList', [0])
41 eventinfosetter.param('runList', [1])
42 eventinfosetter.param('evtNumList', [10])
43 main.add_module(eventinfosetter)
44 
45 # generate signal
46 main.add_module('EvtGenInput')
47 
48 # add default simulation
49 bkgDir = '/group/belle2/BGFile/OfficialBKG/early_phase3/prerelease-04-00-00a/overlay/phase31/BGx1/set0/*.root'
50 bg = glob.glob(bkgDir)
51 if len(bg) == 0:
52  b2.B2ERROR('No files found in ', bkgDir)
53  sys.exit()
54 simu.add_simulation(main, bkgfiles=bg, usePXDDataReduction=False, forceSetPXDDataReduction=True)
55 
56 # add default tracking reconstruction
57 trk.add_tracking_reconstruction(main)
58 
59 # add offline ZS for ExecutionTime module
60 main.add_module(
61  'SVDZeroSuppressionEmulator',
62  SNthreshold=5,
63  ShaperDigits='SVDShaperDigits',
64  ShaperDigitsIN='SVDShaperDigitsZS5',
65  FADCmode=True)
66 
67 main.add_module(SVDExtraEventStatisticsModule("SVDExecutionTime_"+str(tag)+".root"))
68 
69 main.add_module('Progress')
70 
71 b2.process(main)
72 
73 print(b2.statistics)