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 # from simulation import register_simulation
16 # from reconstruction import register_reconstruction
17 
18 b2.set_log_level(b2.LogLevel.ERROR)
19 
20 argvs = sys.argv
21 argc = len(argvs)
22 
23 # print argvs[1]
24 # print argc
25 # argvs[1] = input ring buffer
26 # argvs[2] = input ring buffer
27 # argvs[3] = RoI queue name
28 
29 print("MQname = " + argvs[3])
30 
31 # detecor components to be reconstructed
32 components = [
33  'MagneticField',
34  'BeamPipe',
35  'PXD',
36  'SVD',
37  'CDC',
38  'TOP',
39  'ARICH',
40  'BKLM',
41  'ECL',
42 ]
43 
44 # Register modules to declare objects
45 # register_simulation(components)
46 # register_reconstruction(components)
47 
48 # Register RoI related modules for object decoding
49 # roiGen = register_module('ROIGenerator')
50 # roiPayloadAssembler = register_module('ROIPayloadAssembler')
51 
52 # to avoid undefined symbol
53 geom = b2.register_module("Geometry")
54 
55 # create a main path
56 main = b2.create_path()
57 
58 # Add input module
59 # input = register_module("SeqRootInput")
60 # input.param ( "inputFileName", "/fcdisk1-1/data/sim/sim-evtgen.sroot")
61 # main.add_module(input)
62 
63 # Add output module
64 # output= register_module("SeqRootOutput")
65 # output.param ( "outputFileName", "/dev/null" )
66 # main.add_module(output)
67 
68 # Add Rbuf2Ds
69 rbuf2ds = b2.register_module("Rbuf2Ds")
70 # rbuf2ds = register_module("FastRbuf2Ds")
71 rbuf2ds.param("RingBufferName", argvs[1])
72 main.add_module(rbuf2ds)
73 
74 # RoI related codes here
75 # roiReadTest = register_module('ROIReadTest')
76 # param_roiReadTest = {'outfileName': 'ROIoutReceiver.txt',
77 # 'ROIpayloadName': 'ROIpayload'}
78 # roiReadTest.param(param_roiReadTest)
79 # main.add_module(roiReadTest)
80 
81 # RoI sender
82 roisender = b2.register_module('ROISender')
83 roisender.param("MessageQueueName", argvs[3])
84 roisender.param("MessageQueueDepth", 20)
85 roisender.param("MessageSize", 16384)
86 roisender.param("ROIpayloadName", "ROIpayload")
87 main.add_module(roisender)
88 
89 # Add Progress
90 progress = b2.register_module("Progress")
91 progress.param('maxN', 4)
92 main.add_module(progress)
93 
94 # Add Elapsed Time
95 etime = b2.register_module("ElapsedTime")
96 etime.param("EventInterval", 20000)
97 main.add_module(etime)
98 
99 # Add Ds2Raw
100 ds2raw = b2.register_module("Ds2Raw")
101 ds2raw.param("RingBufferName", argvs[2])
102 main.add_module(ds2raw)
103 
104 
105 # Run
106 b2.process(main)