Belle II Software development
RecvSendCOPPER.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
30if len(argvs) < 6:
31 print('Usage : RecvSendCOPPER.py <COPPER hostname> <COPPER node ID> ')
32 print('<bit flag of FINNESEs> <Use NSM(Network Shared Memory)? yes=1/no=0> <NSM nodename>')
33 sys.exit()
34
35# Set the log level to show only error and fatal messages
36b2.set_log_level(b2.LogLevel.INFO)
37
38# Reader
39# reader = register_module('HSLBReaderArray')
40reader = b2.register_module('DeSerializerCOPPER')
41reader.param('NodeID', int(argvs[2])) # COPPER node ID (stored in RawHeader)
42reader.param('FinesseBitFlag', int(argvs[3]))
43use_shm_flag = int(argvs[4])
44reader.param('UseShmFlag', use_shm_flag)
45reader.param('NodeName', argvs[5])
46reader.param('MaxTime', -1.)
47reader.param('MaxEventNum', -1)
48
49# reader.param('DumpFileName', 'COPPERdump.dat' )
50
51# Monitor module
52monitor = b2.register_module('MonitorDataCOPPER')
53
54# File output
55dump = b2.register_module('RootOutput')
56dump.param('outputFileName', 'root_output.root')
57
58# Sender
59sender = b2.register_module('Serializer')
60sender.param('DestPort', 30000)
61# sender.param('LocalHostName', 'cpr006')
62sender.param('LocalHostName', argvs[1])
63
64# Create main path
65main = b2.create_path()
66
67# Add modules to main path
68main.add_module(reader)
69# if use_shm_flag != 0:
70# main.add_module(monitor)
71# main.add_module(dump)
72main.add_module(sender)
73
74# Process all events
75b2.process(main)