Belle II Software development
roitest.py
1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3
4
11
12import sys
13
14import basf2 as b2
15# from simulation import register_simulation
16# from reconstruction import register_reconstruction
17
18b2.set_log_level(b2.LogLevel.ERROR)
19
20argvs = sys.argv
21argc = 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
29print("MQname = " + argvs[3])
30
31# detecor components to be reconstructed
32components = [
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
53geom = b2.register_module("Geometry")
54
55# create a main path
56main = 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
69rbuf2ds = b2.register_module("Rbuf2Ds")
70# rbuf2ds = register_module("FastRbuf2Ds")
71rbuf2ds.param("RingBufferName", argvs[1])
72main.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
82roisender = b2.register_module('ROISender')
83roisender.param("MessageQueueName", argvs[3])
84roisender.param("MessageQueueDepth", 20)
85roisender.param("MessageSize", 16384)
86roisender.param("ROIpayloadName", "ROIpayload")
87main.add_module(roisender)
88
89# Add Progress
90progress = b2.register_module("Progress")
91progress.param('maxN', 4)
92main.add_module(progress)
93
94# Add Elapsed Time
95etime = b2.register_module("ElapsedTime")
96etime.param("EventInterval", 20000)
97main.add_module(etime)
98
99# Add Ds2Raw
100ds2raw = b2.register_module("Ds2Raw")
101ds2raw.param("RingBufferName", argvs[2])
102main.add_module(ds2raw)
103
104
105# Run
106b2.process(main)