Belle II Software  release-08-01-10
RecvOnlyCOPPER.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 nodeID> <bit flag of FINNESEs> '
32  '<Use shared memory? yes=1/no=0> <nodename>')
33  sys.exit()
34 
35 # Set the log level to show only error and fatal messages
36 b2.set_log_level(b2.LogLevel.ERROR)
37 b2.set_log_level(b2.LogLevel.INFO)
38 
39 # Reader
40 # reader = register_module('HSLBReaderArray')
41 reader = b2.register_module('DeSerializerCOPPER')
42 reader.param('NodeID', int(argvs[2]))
43 reader.param('FinesseBitFlag', int(argvs[3]))
44 use_shm_flag = int(argvs[4])
45 reader.param('UseShmFlag', use_shm_flag)
46 reader.param('NodeName', argvs[5])
47 # reader.param('DumpFileName', 'COPPERdump.dat' )
48 
49 # Histo Module
50 # histo = register_module('HistoManager')
51 # main.add_module (histo)
52 histo = b2.register_module('DqmHistoManager')
53 histo.param('HostName', 'ropc04')
54 histo.param('Port', 9991)
55 histo.param('DumpInterval', 10)
56 
57 histo.param('HistoFileName', 'histo_file_'.join([argvs[1], '.root']))
58 
59 # Monitor module
60 monitor = b2.register_module('MonitorDataCOPPER')
61 
62 # Sender
63 sender = b2.register_module('Serializer')
64 sender.param('DestPort', 30000)
65 # sender.param('LocalHostName', 'cpr006')
66 sender.param('LocalHostName', argvs[1])
67 
68 # Create main path
69 main = b2.create_path()
70 
71 # Add modules to main path
72 main.add_module(reader)
73 # if use_shm_flag != 0:
74 # main.add_module(histo)
75 # main.add_module(monitor)
76 # main.add_module(sender)
77 
78 # Process all events
79 b2.process(main)