Belle II Software  release-05-01-25
pxd_analysis.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 import basf2 as b2
5 import sys
6 argv = sys.argv
7 
8 # Set the log level to show only error and fatal messages
9 b2.set_log_level(b2.LogLevel.ERROR)
10 # set_log_level(LogLevel.INFO)
11 # set_log_level(LogLevel.DEBUG)
12 
13 # globalTag = 'vxd_commissioning_20181030'
14 globalTag = 'data_reprocessing_prompt'
15 
16 b2.reset_database()
17 b2.use_database_chain()
18 b2.use_central_database(globalTag, b2.LogLevel.WARNING)
19 b2.use_local_database("localdb/database.txt", "localdb")
20 
21 
22 gearbox = b2.register_module('Gearbox')
23 geometry = b2.register_module('Geometry')
24 
25 
26 # Create main path
27 main = b2.create_path()
28 
29 # Modules
30 
31 input = b2.register_module('DQMHistAnalysisInput')
32 input.param('HistMemoryPath', argv[1])
33 input.param('AutoCanvas', False)
34 input.param('AutoCanvasFolders', [])
35 main.add_module(input)
36 
37 # input = register_module('DQMHistAnalysisInputRootFile')
38 # input.param('InputRootFile', argv[1])
39 # main.add_module(input)
40 
41 main.add_module(gearbox, fileName="/geometry/Belle2_earlyPhase3.xml")
42 main.add_module(geometry) # , useDB=True)
43 
44 pxd_charge = b2.register_module('DQMHistAnalysisPXDCharge')
45 pxd_charge.param('histogramDirectoryName', 'PXDER')
46 main.add_module(pxd_charge)
47 
48 pxd_trackcharge = b2.register_module('DQMHistAnalysisPXDTrackCharge')
49 pxd_trackcharge.param('histogramDirectoryName', 'PXDER')
50 main.add_module(pxd_trackcharge)
51 
52 pxd_inj = b2.register_module('DQMHistInjection')
53 main.add_module(pxd_inj)
54 
55 pxd_commode = b2.register_module('DQMHistAnalysisPXDCM')
56 pxd_commode.param('histogramDirectoryName', 'PXDDAQ')
57 main.add_module(pxd_commode)
58 
59 pxd_effi = b2.register_module('DQMHistAnalysisPXDEff')
60 pxd_effi.param('histogramDirectoryName', 'PXDEFF')
61 pxd_effi.param("binsU", 16)
62 pxd_effi.param("binsV", 24)
63 pxd_effi.param("singleHists", False)
64 main.add_module(pxd_effi)
65 
66 pxd_redu = b2.register_module('DQMHistAnalysisPXDReduction')
67 pxd_redu.param('histogramDirectoryName', 'PXDDAQ')
68 main.add_module(pxd_redu)
69 
70 # output = register_module('DQMHistAnalysisOutputFile')
71 # output.param('SaveHistos', False) # don't save histograms
72 # output.param('SaveCanvases', True) # save canvases
73 # main.add_module(output)
74 
75 output = b2.register_module('DQMHistAnalysisOutputRelayMsg')
76 # check that port fit your root canvas server
77 output.param('Port', int(argv[2]))
78 main.add_module(output)
79 
80 # Process all events
81 b2.process(main)