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