Belle II Software development
evtgen_gen.py
1#!/usr/bin/env python3
2
3
10
11
27
28import basf2 as b2
29from generators import add_evtgen_generator
30from modularAnalysis import setupEventInfo
31from mdst import add_mdst_output
32from optparse import OptionParser
33
34parser = OptionParser()
35parser.add_option('-n', '--nevents', dest='nevents', default=1000,
36 help='Number of events to process')
37parser.add_option('-f', '--file', dest='filename',
38 default='B2Kpi_events.root')
39(options, args) = parser.parse_args()
40
41# Suppress messages and warnings during processing:
42b2.set_log_level(b2.LogLevel.ERROR)
43
44# generation of 1000 events according to the specified DECAY table
45# Y(4S) -> B0 B0bar
46# one B0->K+pi-, other generic decay
47mypath = b2.create_path()
48setupEventInfo(int(options.nevents), mypath)
49add_evtgen_generator(mypath, 'signal', b2.find_file('arich/examples/B2kpi.dec'))
50
51# dump generated events in MDST format to the output ROOT file
52add_mdst_output(mypath, True, options.filename)
53
54# process all modules added to the mypath path
55b2.process(mypath)
56
57# print out the summary
58print(b2.statistics)