Belle II Software development
eclDQManalysis.py
1#!/usr/bin/env python3
2
3
10
11# -----------------------------------------------------------------------------------------------
12# eclDQManalysis creates DQM analysis histograms from raw histograms
13#
14# Usage: basf2 eclDQManalysis.py input_files output_file
15# input_files: one of the raw dqm files placed under /group/belle2/phase3/dqm/
16#
17# output_file: dqm output file placed under /group/belle2/group/detector/ECL/tmp/DQManalysis/
18# -----------------------------------------------------------------------------------------------
19
20import basf2 as b2
21from sys import argv
22
23if len(argv) < 3:
24 print()
25 print(f'Usage: {argv[0]} input_filename output_filename OR {argv[0]} exp run')
26 print()
27 exit(1)
28
29if argv[1].isnumeric() and argv[2].isnumeric():
30 exp = int(argv[1])
31 run = int(argv[2])
32 input_filename = f'/group/belle2/phase3/dqm/dqmsrv1/e{exp:04}/dqmhisto/hltdqm_e{exp:04}r{run:06}.root'
33 output_filename = f'/group/belle2/group/detector/ECL/tmp/DQManalysis/hltdqm_e{exp:04}r{run:06}.root'
34else:
35 input_filename = argv[1]
36 output_filename = argv[2]
37
38b2.set_log_level(b2.LogLevel.INFO)
39
40# Create main path
41main = b2.create_path()
42
43# Modules
44inroot = b2.register_module('DQMHistAnalysisInputRootFile')
45inroot.param('FileList', input_filename)
46inroot.param('SelectHistograms', "ECL/*")
47main.add_module(inroot)
48# main.add_module("DQMHistAutoCanvas") # Plot all Histo from Input not needed
49
50ecl = b2.register_module('DQMHistAnalysisECL')
51main.add_module(ecl)
52
53outroot = b2.register_module('DQMHistAnalysisOutputFile')
54outroot.param('SaveHistos', False) # don't save histograms
55outroot.param('SaveCanvases', True) # save canvases
56outroot.param('HistoFile', output_filename)
57main.add_module(outroot)
58
59b2.print_path(main)
60# Process all events
61b2.process(main)