Belle II Software  release-08-01-10
processor.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 = b2.register_module("Rbuf2Ds")
35 rbuf2ds.param("RingBufferName", argvs[1])
36 main.add_module(rbuf2ds)
37 
38 # Raw2Ds as input module
39 # raw2ds = 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 
47 histo = b2.register_module('DqmHistoManager')
48 # histo.param("Port", 9991)
49 histo.param("Port", 10391)
50 histo.param("DumpInterval", 10000)
51 main.add_module(histo)
52 
53 # Sampler module
54 sample = b2.register_module('Ds2Sample')
55 sample.param('RingBufferName', argvs[2])
56 main.add_module(sample)
57 
58 # Monitor module
59 # monitor = register_module('MonitorData')
60 # main.add_module(monitor)
61 
62 # PXD monitor
63 unpacker = b2.register_module('PXDUnpacker')
64 unpacker.param("IgnoreDATCON", True)
65 main.add_module(unpacker)
66 
67 PXDRawDQM = b2.register_module('PXDRawDQM')
68 main.add_module(PXDRawDQM)
69 
70 # Progress
71 progress = b2.register_module('Progress')
72 main.add_module(progress)
73 
74 # Debug modules
75 elapsed = b2.register_module('ElapsedTime')
76 elapsed.param('EventInterval', 10000)
77 main.add_module(elapsed)
78 
79 
80 # Process events
81 b2.set_nprocesses(int(argvs[4]))
82 b2.process(main)