Belle II Software  release-08-01-10
roitest.py
1 #!/usr/bin/env python3
2 
3 
10 
11 import sys
12 
13 import basf2 as b2
14 
15 # command arguments
16 # argvs[1] = input ring buffer name
17 # argvs[2] = output ring buffer name
18 # argvs[3] = port number of hserver
19 # argvs[4] = number of cores for parallel processing
20 argvs = sys.argv
21 argc = len(argvs)
22 
23 # set_log_level(LogLevel.INFO)
24 b2.set_log_level(b2.LogLevel.ERROR)
25 
26 # to avoid undefined symbol
27 geom = b2.register_module("Geometry")
28 
29 # path create
30 main = b2.create_path()
31 
32 
33 # Rbuf2Ds as input module
34 # rbuf2ds = register_module("Rbuf2Ds")
35 # rbuf2ds.param("RingBufferName", argvs[1])
36 # main.add_module(rbuf2ds)
37 
38 # Raw2Ds as input module
39 raw2ds = b2.register_module("Raw2Ds")
40 raw2ds.param("RingBufferName", argvs[1])
41 main.add_module(raw2ds)
42 
43 # Histo Module
44 # histo = register_module('HistoManager')
45 # main.add_module (histo)
46 histo = b2.register_module('DqmHistoManager')
47 histo.param("Port", 9991)
48 histo.param("DumpInterval", 10000)
49 main.add_module(histo)
50 
51 # Monitor module
52 monitor = b2.register_module('MonitorData')
53 main.add_module(monitor)
54 
55 # RoI Related codes here
56 roiGen = b2.register_module('ROIGenerator')
57 param_roiGen = {'ROIListName': 'ROIs',
58  'nROIs': 8, 'Layer': 1, 'Ladder': 1, 'Sensor': 1}
59 roiGen.param(param_roiGen)
60 
61 
62 roiPayloadAssembler = b2.register_module('ROIPayloadAssembler')
63 param_roiPayloadAssembler = {'ROIListName': 'ROIs',
64  'ROIpayloadName': 'ROIpayload'}
65 roiPayloadAssembler.param(param_roiPayloadAssembler)
66 
67 roiReadTest = b2.register_module('ROIReadTest')
68 param_roiReadTest = {'outfileName': 'ROIoutHLT.txt',
69  'ROIpayloadName': 'ROIpayload'}
70 roiReadTest.param(param_roiReadTest)
71 
72 main.add_module(roiGen)
73 main.add_module(roiPayloadAssembler)
74 # main.add_module(roiReadTest)
75 
76 
77 # Ds2Rbuf as output module
78 ds2rbuf = b2.register_module("Ds2Rbuf")
79 ds2rbuf.param("RingBufferName", argvs[2])
80 main.add_module(ds2rbuf)
81 
82 # Progress
83 progress = b2.register_module('Progress')
84 main.add_module(progress)
85 
86 # Debug modules
87 elapsed = b2.register_module('ElapsedTime')
88 elapsed.param('EventInterval', 10000)
89 main.add_module(elapsed)
90 
91 # Process events
92 b2.set_nprocesses(int(argvs[4]))
93 b2.process(main)