Belle II Software  release-08-01-10
B2A103-SimulateAndReconstruct.py
1 #!/usr/bin/env python3
2 
3 
10 
11 
26 
27 import basf2 as b2
28 from mdst import add_mdst_output
29 from simulation import add_simulation
30 from reconstruction import add_reconstruction
31 from 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
36 b2.conditions.disable_globaltag_replay()
37 
38 # create path
39 my_path = b2.create_path()
40 
41 # load input ROOT file
42 inputMdst(filename=b2.find_file('B2pi0D_D2hh_D2hhh_B2munu_evtgen.root', 'examples', False),
43  path=my_path)
44 
45 # simulation
46 add_simulation(path=my_path)
47 
48 # reconstruction
49 add_reconstruction(path=my_path)
50 
51 # dump in MDST format
52 add_mdst_output(path=my_path,
53  mc=True,
54  filename='B2pi0D_D2hh_D2hhh_B2munu.root')
55 
56 # Show progress of processing
57 my_path.add_module('ProgressBar')
58 
59 # Process the events
60 b2.process(my_path)
61 
62 # print out the summary
63 print(b2.statistics)