Belle II Software  release-08-01-10
RecvSendCOPPERDummy.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 # Set the log level to show only error and fatal messages
31 b2.set_log_level(b2.LogLevel.ERROR)
32 b2.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])
40 packer = b2.register_module('DummyDataSource')
41 packer.param('NodeID', int(argvs[2])) # COPPER node ID (stored in RawHeader)
42 use_shm_flag = int(argvs[4])
43 packer.param('UseShmFlag', use_shm_flag)
44 packer.param('NodeName', argvs[5])
45 
46 # File output
47 dump = b2.register_module('RootOutput')
48 dump.param('outputFileName', 'root_output.root')
49 
50 # Sender
51 sender = b2.register_module('Serializer')
52 sender.param('DestPort', 30000)
53 # sender.param('LocalHostName', 'cpr006')
54 sender.param('LocalHostName', argvs[1])
55 
56 # Create main path
57 main = b2.create_path()
58 
59 # Add modules to main path
60 main.add_module(packer)
61 # if use_shm_flag != 0:
62 # main.add_module(histo)
63 # main.add_module(monitor)
64 # main.add_module(dump)
65 main.add_module(sender)
66 
67 # Process all events
68 b2.process(main)