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