Belle II Software development
DQMHistAnalysisSVDMiraBelle_test.py
1#!/usr/bin/env python3
2
3
10
11# script to test module which create monitoring variables for SVD
12#
13# Usage: basf2 DQMHistAnalysisSVDMiraBelle_test.py input_files
14# input_files: one of the raw dqm files placed under /group/belle2/phase3/dqm/dqmsrv1/
15#
16# i.e basf2 DQMHistAnalysisSVDMiraBelle_test.py /group/belle2/phase3/dqm/dqmsrv1/e0018/dqmhisto/erecodqm_e0018r001313.root
17# Output file in format: mon_e0018r001313_online.root contains moniotring variables which can be pinted by script:
18# dqm/analysis/examples/printDQMFile.C
19
20import basf2 as b2
21import os
22import sys
23import re
24
25argv = sys.argv
26if len(argv) < 2:
27 print(f'\nUsage: {argv[0]} input_filename\n')
28 exit(1)
29inputFile = sys.argv[1]
30
31directory, fileName = os.path.split(inputFile)
32exp_nr = int(re.findall(r'\d+', fileName)[0])
33run_nr = int(re.findall(r'\d+', fileName)[1])
34
35# Set log level
36b2.set_log_level(b2.LogLevel.INFO)
37
38# Create main path
39main = b2.create_path()
40
41# Load histograms from file
42main.add_module('DQMHistAnalysisInputRootFile',
43 Experiment=0,
44 RunList=[0],
45 FileList=[inputFile],
46 EventsList=[1],
47 SelectHistograms=["SVDExpReco/*",
48 "SVDClsTrk/*",
49 "SVDEfficiency/*"],
50 EventInterval=1,
51 NullHistogramMode=False)
52# main.add_module("DQMHistAutoCanvas") # Plot all Histo from Input not needed
53
54# Run analysis module
55main.add_module('DQMHistAnalysisSVDOnMiraBelle')
56
57# Save canvases based on histograms used to prepare monitoring variables and monitoring variables to root file
58main.add_module('DQMHistAnalysisOutputMonObj',
59 exp=exp_nr,
60 run=run_nr)
61
62# Process the events
63b2.print_path(main)
64b2.process(main)
65
66# print out the summary
67print(b2.statistics)