Belle II Software  release-08-00-10
evtgen_gen.py
1 #!/usr/bin/env python3
2 
3 
10 
11 
27 
28 import basf2 as b2
29 from generators import add_evtgen_generator
30 from modularAnalysis import setupEventInfo
31 from mdst import add_mdst_output
32 from optparse import OptionParser
33 
34 parser = OptionParser()
35 parser.add_option('-n', '--nevents', dest='nevents', default=1000,
36  help='Number of events to process')
37 parser.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:
42 b2.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
47 mypath = b2.create_path()
48 setupEventInfo(int(options.nevents), mypath)
49 add_evtgen_generator(mypath, 'signal', b2.find_file('arich/examples/B2kpi.dec'))
50 
51 # dump generated events in MDST format to the output ROOT file
52 add_mdst_output(mypath, True, options.filename)
53 
54 # process all modules added to the mypath path
55 b2.process(mypath)
56 
57 # print out the summary
58 print(b2.statistics)