Belle II Software development
DQM_IP.py
1#!/usr/bin/env python3
2
3
10
11import basf2 as b2
12import sys
13argv = sys.argv
14
15
16# Set the log level to show only error and fatal messages
17# set_log_level(LogLevel.ERROR)
18b2.set_log_level(b2.LogLevel.INFO)
19# set_log_level(LogLevel.DEBUG)
20# set_debug_level(1000)
21
22# Create main path
23main = b2.create_path()
24
25# Modules
26inroot = b2.register_module('DQMHistAnalysisInputRootFile')
27inroot.param('InputRootFile', sys.argv[1])
28main.add_module(inroot)
29
30# input = register_module('DQMHistAnalysisInput')
31# input.param('HistMemoryPath', argv[1])
32# main.add_module(input)
33
34# main.add_module("DQMHistAutoCanvas") # Plot all Histo from Input not needed
35
36ip_x = b2.register_module('DQMHistAnalysisIP')
37ip_x.param("HistoName", "IPMonitoring/Y4S_Vertex.X")
38ip_x.param('PVName', 'DQM:Beam:IP:X:')
39main.add_module(ip_x)
40
41ip_y = b2.register_module('DQMHistAnalysisIP')
42ip_y.param("HistoName", "IPMonitoring/Y4S_Vertex.Y")
43ip_y.param('PVName', 'DQM:Beam:IP:Y:')
44main.add_module(ip_y)
45
46ip_z = b2.register_module('DQMHistAnalysisIP')
47ip_z.param("HistoName", "IPMonitoring/Y4S_Vertex.Z")
48ip_z.param('PVName', 'DQM:Beam:IP:Z:')
49main.add_module(ip_z)
50
51
52epicsarray = b2.register_module('DQMHistOutputToEPICS')
53epicsarray.param('HistoList', [
54 ['IPMonitoring/Y4S_Vertex.X', 'DQM:Beam:IP:X:Proj', 'DQM:Beam:IP:X:Proj:Last'],
55 ['IPMonitoring/Y4S_Vertex.Y', 'DQM:Beam:IP:Y:Proj', 'DQM:Beam:IP:Y:Proj:Last'],
56 ['IPMonitoring/Y4S_Vertex.Z', 'DQM:Beam:IP:Z:Proj', 'DQM:Beam:IP:Z:Proj:Last'],
57])
58
59main.add_module(epicsarray)
60
61# outroot = register_module('DQMHistAnalysisOutputFile')
62# outroot.param('SaveHistos', False) # don't save histograms
63# outroot.param('SaveCanvases', True) # save canvases
64# main.add_module(outroot)
65
66output = b2.register_module('DQMHistAnalysisOutputRelayMsg')
67# check that port fit your root canvas server
68output.param('Port', int(argv[2]))
69main.add_module(output)
70
71
72b2.print_path(main)
73# Process all events
74b2.process(main)