Belle II Software development
processor.py
1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3
4
11
12import sys
13
14import basf2 as b2
15
16# command arguments
17# argvs[1] = input ring buffer name
18# argvs[2] = output ring buffer name
19# argvs[3] = port number of hserver
20# argvs[4] = number of cores for parallel processing
21argvs = sys.argv
22argc = len(argvs)
23
24# set_log_level(LogLevel.INFO)
25b2.set_log_level(b2.LogLevel.ERROR)
26
27# to avoid undefined symbol
28geom = b2.register_module("Geometry")
29
30# path create
31main = b2.create_path()
32
33
34# Rbuf2Ds as input module
35# rbuf2ds = register_module("Rbuf2Ds")
36# rbuf2ds.param("RingBufferName", argvs[1])
37# main.add_module(rbuf2ds)
38
39# Raw2Ds as input module
40raw2ds = b2.register_module("Raw2Ds")
41raw2ds.param("RingBufferName", argvs[1])
42main.add_module(raw2ds)
43
44# Histo Module
45# histo = register_module('HistoManager')
46# main.add_module (histo)
47histo = b2.register_module('DqmHistoManager')
48histo.param("Port", 9991)
49histo.param("DumpInterval", 10000)
50main.add_module(histo)
51
52# Monitor module
53monitor = b2.register_module('MonitorData')
54main.add_module(monitor)
55
56# Ds2Rbuf as output module
57ds2rbuf = b2.register_module("Ds2Rbuf")
58ds2rbuf.param("RingBufferName", argvs[2])
59main.add_module(ds2rbuf)
60
61# Progress
62progress = b2.register_module('Progress')
63main.add_module(progress)
64
65# Debug modules
66elapsed = b2.register_module('ElapsedTime')
67elapsed.param('EventInterval', 10000)
68main.add_module(elapsed)
69
70# Process events
71b2.set_nprocesses(int(argvs[4]))
72b2.process(main)