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