Belle II Software development
EvtGenGenerationOnly.py
1#!/usr/bin/env python3
2
3
10
11import os
12import sys
13import basf2
14from generators import add_evtgen_generator
15
16# interpret the first input argument as decay file to facilitate testing of dec-files
17dec_file = None
18final_state = 'mixed'
19if len(sys.argv) > 1:
20 dec_file = os.path.abspath(sys.argv[1])
21 final_state = 'signal'
22 print("using following decay file: " + dec_file)
23
24
25# main path
26main = basf2.create_path()
27
28# event info setter
29main.add_module("EventInfoSetter", expList=0, runList=1, evtNumList=100)
30
31# EvtGen
32add_evtgen_generator(path=main, finalstate=final_state, signaldecfile=dec_file)
33
34# run
35main.add_module("Progress")
36main.add_module("RootOutput", outputFileName="evtgen_upsilon4s.root")
37main.add_module("PrintMCParticles", logLevel=basf2.LogLevel.DEBUG, onlyPrimaries=False)
38
39# generate events
40basf2.process(main)
41
42# show call statistics
43print(basf2.statistics)