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