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