Belle II Software  release-05-01-25
evtgen_gen.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
21 
22 from basf2 import *
23 from generators import add_evtgen_generator
24 from modularAnalysis import setupEventInfo
25 from modularAnalysis import loadGearbox
26 from reconstruction import add_mdst_output
27 from optparse import OptionParser
28 from ROOT import Belle2
29 
30 parser = OptionParser()
31 parser.add_option('-n', '--nevents', dest='nevents', default=1000,
32  help='Number of events to process')
33 parser.add_option('-f', '--file', dest='filename',
34  default='B2Kpi_events.root')
35 (options, args) = parser.parse_args()
36 
37 # Suppress messages and warnings during processing:
38 set_log_level(LogLevel.ERROR)
39 
40 
41 # generation of 1000 events according to the specified DECAY table
42 # Y(4S) -> B0 B0bar
43 # one B0->K+pi-, other generic decay
44 mypath = create_path()
45 setupEventInfo(int(options.nevents), mypath)
46 add_evtgen_generator(mypath, 'signal', Belle2.FileSystem.findFile('arich/examples/B2kpi.dec'))
47 
48 # If the simulation and reconstruction is not performed in the sam job,
49 # then the Gearbox needs to be loaded with the loadGearbox() function.
50 loadGearbox(mypath)
51 
52 # dump generated events in MDST format to the output ROOT file
53 add_mdst_output(mypath, True, options.filename)
54 
55 # process all modules added to the mypath path
56 process(mypath)
57 
58 # print out the summary
59 print(statistics)
Belle2::FileSystem::findFile
static std::string findFile(const std::string &path, bool silent=false)
Search for given file or directory in local or central release directory, and return absolute path if...
Definition: FileSystem.cc:147