Belle II Software development
B2A103-SimulateAndReconstruct.py
1#!/usr/bin/env python3
2
3
10
11
26
27import basf2 as b2
28from mdst import add_mdst_output
29from simulation import add_simulation
30from reconstruction import add_reconstruction
31from modularAnalysis import inputMdst
32
33# We previously generated events but we want to simulate them with the
34# currently best values, not whatever was valid back then. So we have to
35# disable reuse of the same globaltag from when the events were generated
36b2.conditions.disable_globaltag_replay()
37
38# create path
39my_path = b2.create_path()
40
41# load input ROOT file
42inputMdst(filename=b2.find_file('B2pi0D_D2hh_D2hhh_B2munu_evtgen.root', 'examples', False),
43 path=my_path)
44
45# simulation
46add_simulation(path=my_path)
47
48# reconstruction
49add_reconstruction(path=my_path)
50
51# dump in MDST format
52add_mdst_output(path=my_path,
53 mc=True,
54 filename='B2pi0D_D2hh_D2hhh_B2munu.root')
55
56# Show progress of processing
57my_path.add_module('ProgressBar')
58
59# Process the events
60b2.process(my_path)
61
62# print out the summary
63print(b2.statistics)