Belle II Software development
evtgen_rec.py
1#!/usr/bin/env python3
2
3
10
11import basf2 as b2
12from optparse import OptionParser
13import os
14# --------------------------------------------------------------------
15# Example of using ARICH reconstruction
16# needs reconstructed tracks (Tracks), extrapolated to ARICH (ExtHits)
17# (generated by evtgen_sim.py)
18# Produces root file with flat ntuple from ARICHNtuple module
19# --------------------------------------------------------------------
20
21parser = OptionParser()
22parser.add_option('-f', '--file', dest='filename',
23 default='ARICHRec.root')
24(options, args) = parser.parse_args()
25
26home = os.environ['BELLE2_LOCAL_DIR']
27
28# Suppress messages and warnings during processing:
29b2.set_log_level(b2.LogLevel.ERROR)
30
31# Create path
32main = b2.create_path()
33
34# input root file
35input_module = b2.register_module('RootInput')
36input_module.param('inputFileName', home + "/ARICHEvents.root")
37main.add_module(input_module)
38
39# Histogram manager immediately after master module
40histo = b2.register_module('HistoManager')
41histo.param('histoFileName', 'DQMhistograms.root') # File to save histograms
42main.add_module(histo)
43
44# Gearbox: access to database (xml files)
45main.add_module('Gearbox')
46
47# Geometry
48geometry = b2.register_module('Geometry')
49geometry.param('components', ['ARICH'])
50main.add_module(geometry)
51
52# ARICH digitizer
53main.add_module('ARICHDigitizer')
54
55# convert ARICHDigits to ARICHHits
56main.add_module('ARICHFillHits')
57
58# ARICH reconstruction
59# calculate PID likelihoods for all tracks
60main.add_module('ARICHReconstructor')
61
62# ARICH Ntuple
63# create flat ntuple for performance analysis
64arichNtuple = b2.register_module('ARICHNtuple')
65arichNtuple.param('outputFile', options.filename)
66main.add_module(arichNtuple)
67
68# ARICH DQM
69# create DQM occupancy plots
70main.add_module('ARICHDQM')
71
72# Uncomment to store DataStore content to root file
73# output = register_module('RootOutput')
74# output.param('outputFileName', 'DataStore.root')
75# main.add_module(output)
76
77# Show progress of processing
78main.add_module('Progress')
79
80# Process events
81b2.process(main)
82
83# Print call statistics
84print(b2.statistics)