Belle II Software  release-05-02-19
DQMHistAnalysisSVD_test.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 # script to analyze raw histograms from DQM modules
5 #
6 # Usage: basf2 DQMHistAnalysisSVD_test.py input_files
7 # input_files: one of the raw dqm files placed under /group/belle2/phase3/dqm/dqmsrv1/
8 #
9 # i.e basf2 DQMHistAnalysisSVD_test.py /group/belle2/phase3/dqm/dqmsrv1/e0018/dqmhisto/erecodqm_e0018r001313.root
10 # -----------------------------------------------------------------------------------------------
11 
12 
13 import basf2 as b2
14 import sys
15 
16 argv = sys.argv
17 if len(argv) < 2:
18  print('\nUsage: %s input_filename\n' % argv[0])
19  exit(1)
20 inputFile = sys.argv[1]
21 
22 # Set log level
23 b2.set_log_level(b2.LogLevel.INFO)
24 
25 # Create main path
26 main = b2.create_path()
27 
28 # Load histograms from file
29 main.add_module('DQMHistAnalysisInputRootFile',
30  Experiment=0,
31  RunList=[0],
32  FileList=[inputFile],
33  EventsList=[1],
34  SelectHistograms=["DQMInfo/rtype",
35  "SVDExpReco/*",
36  "SVDUnpacker/DQMUnpackerHisto",
37  "SVDClsTrk/SVDTRK_ClusterTimeV456",
38  "SVDEfficiency/*"],
39  EventInterval=1,
40  NullHistogramMode=False,
41  AutoCanvas=False)
42 
43 main.add_module('Gearbox')
44 main.add_module('Geometry')
45 
46 # Analysis module to calculate occupancy of each sensor and check control plots
47 main.add_module('DQMHistAnalysisSVDGeneral')
48 
49 # Analysis module to calculate efficiency of each sensor
50 main.add_module('DQMHistAnalysisSVDEfficiency')
51 
52 # Output canvases to root file
53 main.add_module('DQMHistAnalysisOutputFile',
54  HistoFile="output_dqmHistAnalysis.root",
55  SaveHistos=False,
56  SaveCanvases=True)
57 
58 # Process all event at main path
59 b2.process(main)
60 
61 # Print modules' statistics
62 print(b2.statistics)