Belle II Software development
RecvSendCOPPERDummy.py
1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3
4
11
12
25
26import basf2 as b2
27import sys
28argvs = sys.argv
29
30# Set the log level to show only error and fatal messages
31b2.set_log_level(b2.LogLevel.ERROR)
32b2.set_log_level(b2.LogLevel.INFO)
33
34# Dummy data generator
35# print argvs[1]
36# print argvs[2]
37# print argvs[3]
38# max_event = int(argvs[3])
39# nodeid = int(argvs[2])
40packer = b2.register_module('DummyDataSource')
41packer.param('NodeID', int(argvs[2])) # COPPER node ID (stored in RawHeader)
42use_shm_flag = int(argvs[4])
43packer.param('UseShmFlag', use_shm_flag)
44packer.param('NodeName', argvs[5])
45
46# File output
47dump = b2.register_module('RootOutput')
48dump.param('outputFileName', 'root_output.root')
49
50# Sender
51sender = b2.register_module('Serializer')
52sender.param('DestPort', 30000)
53# sender.param('LocalHostName', 'cpr006')
54sender.param('LocalHostName', argvs[1])
55
56# Create main path
57main = b2.create_path()
58
59# Add modules to main path
60main.add_module(packer)
61# if use_shm_flag != 0:
62# main.add_module(histo)
63# main.add_module(monitor)
64# main.add_module(dump)
65main.add_module(sender)
66
67# Process all events
68b2.process(main)