Belle II Software  release-08-01-10
RecvStream1.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 
18 
19 import basf2 as b2
20 import sys
21 argvs = sys.argv
22 if len(argvs) != 4:
23  print('Usage : RecvStream1.py <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
27 b2.set_log_level(b2.LogLevel.INFO)
28 
29 # Modules
30 receiver = b2.register_module('DeSerializerPC')
31 dump = b2.register_module('SeqRootOutput')
32 converter = b2.register_module('Convert2RawDet')
33 
34 # Receiver
35 receiver.param('NodeID', 3) # ROPC node ID (only used for Run control)
36 receiver.param('NumConn', 2)
37 receiver.param('HostNameFrom', ['localhost', 'localhost'])
38 receiver.param('PortFrom', [34008, 34009])
39 receiver.param('EventDataBufferWords', 4801)
40 receiver.param('MaxTime', -1.)
41 receiver.param('MaxEventNum', -1)
42 receiver.param('NodeName', argvs[3]) # node name for Run control
43 use_shm_flag = int(argvs[1])
44 receiver.param('UseShmFlag', use_shm_flag)
45 
46 # Dump
47 dump.param('outputFileName', 'root_output.sroot')
48 
49 # Sender
50 sender = b2.register_module('Serializer')
51 sender.param('DestPort', 36000)
52 sender.param('LocalHostName', 'localhost')
53 
54 # Create main path
55 main = b2.create_path()
56 
57 # Add modules to main path
58 main.add_module(receiver)
59 main.add_module(converter)
60 main.add_module(dump)
61 # main.add_module(sender)
62 
63 # Process all events
64 b2.process(main)