Belle II Software development
eventT0DQMAnalysisExample.py
1#!/usr/bin/env python3
2
3
10
11# illustrative run:
12# basf2 eventT0DQMAnalysisEfficiency.py dqm_e0014r000921.root 100
13
14import basf2 as b2
15import sys
16import re
17from basf2 import conditions as b2conditions
18
19mypath = b2.Path()
20inputFile = sys.argv[1]
21exp_nr = int(re.findall(r'\d+', inputFile)[0])
22run_nr = int(re.findall(r'\d+', inputFile)[1])
23nevt = int(sys.argv[2]) # number of events
24
25# setup database
26b2conditions.reset()
27b2conditions.override_globaltags()
28b2conditions.globaltags = ["online"]
29
30inroot = b2.register_module('DQMHistAnalysisInputRootFile')
31inroot.param('FileList', inputFile)
32inroot.param('SelectHistograms', ['EventT0*/*'])
33inroot.param('Experiment', exp_nr)
34inroot.param('RunList', [run_nr])
35inroot.param('EventsList', [nevt])
36mypath.add_module(inroot)
37# mypath.add_module("DQMHistAutoCanvas") # Plot all Histo from Input not needed
38
39dqmEff = b2.register_module('DQMHistAnalysisEventT0')
40dqmEff.set_log_level(b2.LogLevel.INFO)
41dqmEff.param("printCanvas", True)
42mypath.add_module(dqmEff)
43
44outroot = b2.register_module('DQMHistAnalysisOutputMonObj')
45outroot.param('ProcID', 'online') # set processing ID
46outroot.param('exp', exp_nr)
47outroot.param('run', run_nr)
48outroot.param('nevt', nevt)
49outroot.param('TreeFile', 'run_tree_eventT0.root')
50mypath.add_module(outroot)
51
52# Process the events
53b2.print_path(mypath)
54b2.process(mypath)
55
56# print out the summary
57print(b2.statistics)