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