Belle II Software development
RecvStream0.py
1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3
4
11
12
18
19import basf2 as b2
20import sys
21argvs = sys.argv
22if len(argvs) != 5:
23 print('Usage : RecvStream0.py <COPPER hostname> <Use NSM(Network Shared Memory)? yes=1/no=0> <port # of eb0> <NSM nodename>')
24 sys.exit()
25
26# Set the log level to show only error and fatal messages
27b2.set_log_level(b2.LogLevel.INFO)
28
29# Modules
30receiver = b2.register_module('DeSerializerPrePC')
31dump = b2.register_module('RootOutput')
32output = b2.register_module('PrintData')
33
34# Receiver
35receiver.param('NodeID', 3) # ROPC node ID (only used for Run control)
36receiver.param('NumConn', 1)
37receiver.param('HostNameFrom', [argvs[1], 'aiueohost'])
38receiver.param('PortFrom', [30000, 30000])
39receiver.param('EventDataBufferWords', 4801)
40receiver.param('MaxTime', -1.)
41receiver.param('MaxEventNum', -1)
42receiver.param('NodeName', argvs[4]) # node name for Run control
43use_shm_flag = int(argvs[2])
44receiver.param('UseShmFlag', use_shm_flag)
45
46# Dump
47dump.param('outputFileName', 'root_output.root')
48
49# Sender
50sender = b2.register_module('Serializer')
51sender.param('DestPort', int(argvs[3]))
52sender.param('LocalHostName', 'localhost')
53
54# Create main path
55main = b2.create_path()
56
57# Add modules to main path
58main.add_module(receiver)
59# main.add_module(dump)
60main.add_module(sender)
61
62# Process all events
63b2.process(main)