Belle II Software  release-05-01-25
eclDQManalysis.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 # -----------------------------------------------------------------------------------------------
5 # BASF2 (Belle Analysis Framework 2)
6 # Copyright(C) 2020 Belle II Collaboration
7 #
8 # Author: The Belle II Collaboration
9 # Contributors: Dmitry Matvienko, Iana Antonova (dmitry.matvienko@gmail.com, yanansk11@gmail.com)
10 #
11 # This software is provided "as is" without any warranty.
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 import sys
23 argv = sys.argv
24 
25 if len(argv) < 3:
26  print()
27  print('Usage: %s input_filename output_filename' % argv[0])
28  print()
29  exit(1)
30 
31 b2.set_log_level(b2.LogLevel.INFO)
32 
33 # Create main path
34 main = b2.create_path()
35 
36 # Modules
37 inroot = b2.register_module('DQMHistAnalysisInputRootFile')
38 inroot.param('FileList', argv[1])
39 inroot.param('SelectHistograms', "ECL/*")
40 main.add_module(inroot)
41 
42 ecl = b2.register_module('DQMHistAnalysisECL')
43 main.add_module(ecl)
44 
45 outroot = b2.register_module('DQMHistAnalysisOutputFile')
46 outroot.param('SaveHistos', False) # don't save histograms
47 outroot.param('SaveCanvases', True) # save canvases
48 outroot.param('HistoFile', argv[2])
49 main.add_module(outroot)
50 
51 b2.print_path(main)
52 # Process all events
53 b2.process(main)