Belle II Software  release-08-01-10
evtgen_rec.py
1 #!/usr/bin/env python3
2 
3 
10 
11 import basf2 as b2
12 from optparse import OptionParser
13 import 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 
21 parser = OptionParser()
22 parser.add_option('-f', '--file', dest='filename',
23  default='ARICHRec.root')
24 (options, args) = parser.parse_args()
25 
26 home = os.environ['BELLE2_LOCAL_DIR']
27 
28 # Suppress messages and warnings during processing:
29 b2.set_log_level(b2.LogLevel.ERROR)
30 
31 # Create path
32 main = b2.create_path()
33 
34 # input root file
35 input_module = b2.register_module('RootInput')
36 input_module.param('inputFileName', home + "/ARICHEvents.root")
37 main.add_module(input_module)
38 
39 # Histogram manager immediately after master module
40 histo = b2.register_module('HistoManager')
41 histo.param('histoFileName', 'DQMhistograms.root') # File to save histograms
42 main.add_module(histo)
43 
44 # Gearbox: access to database (xml files)
45 main.add_module('Gearbox')
46 
47 # Geometry
48 geometry = b2.register_module('Geometry')
49 geometry.param('components', ['ARICH'])
50 main.add_module(geometry)
51 
52 # ARICH digitizer
53 main.add_module('ARICHDigitizer')
54 
55 # convert ARICHDigits to ARICHHits
56 main.add_module('ARICHFillHits')
57 
58 # ARICH reconstruction
59 # calculate PID likelihoods for all tracks
60 main.add_module('ARICHReconstructor')
61 
62 # ARICH Ntuple
63 # create flat ntuple for performance analysis
64 arichNtuple = b2.register_module('ARICHNtuple')
65 arichNtuple.param('outputFile', options.filename)
66 main.add_module(arichNtuple)
67 
68 # ARICH DQM
69 # create DQM occupancy plots
70 main.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
78 main.add_module('Progress')
79 
80 # Process events
81 b2.process(main)
82 
83 # Print call statistics
84 print(b2.statistics)