Belle II Software  release-08-01-10
RecvSendCOPPER.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 
25 
26 import basf2 as b2
27 import sys
28 argvs = sys.argv
29 
30 if 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
36 b2.set_log_level(b2.LogLevel.INFO)
37 
38 # Reader
39 # reader = register_module('HSLBReaderArray')
40 reader = b2.register_module('DeSerializerCOPPER')
41 reader.param('NodeID', int(argvs[2])) # COPPER node ID (stored in RawHeader)
42 reader.param('FinesseBitFlag', int(argvs[3]))
43 use_shm_flag = int(argvs[4])
44 reader.param('UseShmFlag', use_shm_flag)
45 reader.param('NodeName', argvs[5])
46 reader.param('MaxTime', -1.)
47 reader.param('MaxEventNum', -1)
48 
49 # reader.param('DumpFileName', 'COPPERdump.dat' )
50 
51 # Monitor module
52 monitor = b2.register_module('MonitorDataCOPPER')
53 
54 # File output
55 dump = b2.register_module('RootOutput')
56 dump.param('outputFileName', 'root_output.root')
57 
58 # Sender
59 sender = b2.register_module('Serializer')
60 sender.param('DestPort', 30000)
61 # sender.param('LocalHostName', 'cpr006')
62 sender.param('LocalHostName', argvs[1])
63 
64 # Create main path
65 main = b2.create_path()
66 
67 # Add modules to main path
68 main.add_module(reader)
69 # if use_shm_flag != 0:
70 # main.add_module(monitor)
71 # main.add_module(dump)
72 main.add_module(sender)
73 
74 # Process all events
75 b2.process(main)