Belle II Software  release-08-01-10
pxd_analysis.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 # Set the log level to show only error and fatal messages
17 b2.set_log_level(b2.LogLevel.ERROR)
18 # set_log_level(LogLevel.INFO)
19 # set_log_level(LogLevel.DEBUG)
20 
21 # globalTag = 'vxd_commissioning_20181030'
22 globalTag = 'data_reprocessing_prompt'
23 
24 b2.conditions.prepend_globaltag(globalTag)
25 b2.conditions.prepend_testing_payloads("localdb/database.txt")
26 
27 
28 gearbox = b2.register_module('Gearbox')
29 geometry = b2.register_module('Geometry')
30 
31 
32 # Create main path
33 main = b2.create_path()
34 
35 # Modules
36 
37 input = b2.register_module('DQMHistAnalysisInput')
38 input.param('HistMemoryPath', argv[1])
39 main.add_module(input)
40 # main.add_module("DQMHistAutoCanvas") # Plot all Histo from Input not needed
41 
42 # input = register_module('DQMHistAnalysisInputRootFile')
43 # input.param('InputRootFile', argv[1])
44 # main.add_module(input)
45 
46 main.add_module(gearbox, fileName="/geometry/Belle2_earlyPhase3.xml")
47 main.add_module(geometry) # , useDB=True)
48 
49 pxd_charge = b2.register_module('DQMHistAnalysisPXDCharge')
50 pxd_charge.param('histogramDirectoryName', 'PXDER')
51 main.add_module(pxd_charge)
52 
53 pxd_trackcharge = b2.register_module('DQMHistAnalysisPXDTrackCharge')
54 pxd_trackcharge.param('histogramDirectoryName', 'PXDER')
55 main.add_module(pxd_trackcharge)
56 
57 pxd_inj = b2.register_module('DQMHistInjection')
58 main.add_module(pxd_inj)
59 
60 pxd_commode = b2.register_module('DQMHistAnalysisPXDCM')
61 pxd_commode.param('histogramDirectoryName', 'PXDDAQ')
62 main.add_module(pxd_commode)
63 
64 pxd_effi = b2.register_module('DQMHistAnalysisPXDEff')
65 pxd_effi.param('histogramDirectoryName', 'PXDEFF')
66 pxd_effi.param("binsU", 16)
67 pxd_effi.param("binsV", 24)
68 pxd_effi.param("singleHists", False)
69 main.add_module(pxd_effi)
70 
71 pxd_redu = b2.register_module('DQMHistAnalysisPXDReduction')
72 pxd_redu.param('histogramDirectoryName', 'PXDDAQ')
73 main.add_module(pxd_redu)
74 
75 # output = register_module('DQMHistAnalysisOutputFile')
76 # output.param('SaveHistos', False) # don't save histograms
77 # output.param('SaveCanvases', True) # save canvases
78 # main.add_module(output)
79 
80 output = b2.register_module('DQMHistAnalysisOutputRelayMsg')
81 # check that port fit your root canvas server
82 output.param('Port', int(argv[2]))
83 main.add_module(output)
84 
85 # Process all events
86 b2.process(main)