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