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