Belle II Software  release-08-01-10
generate_test_data.py
1 #!/usr/bin/env python3
2 
3 
10 
11 import basf2 as b2
12 import sys
13 
14 b2.set_log_level(b2.LogLevel.INFO)
15 
16 if len(sys.argv) != 6:
17  print('Usage: basf2 generate_test_data.py data_output_directory experiment_number run_number_low run_number_high num_events')
18  sys.exit(1)
19 
20 output_dir = sys.argv[1]
21 experiment = int(sys.argv[2])
22 run_low = int(sys.argv[3])
23 run_high = int(sys.argv[4])
24 nevents = int(sys.argv[5])
25 
26 runs = [run for run in range(run_low, run_high+1)]
27 print(runs)
28 
29 main = b2.create_path()
30 main.add_module('EventInfoSetter', expList=[experiment]*len(runs), runList=runs, evtNumList=[nevents]*len(runs))
31 main.add_module('RootOutput',
32  outputFileName=output_dir + '/DST_exp{:d}_run{:d}_run{:d}.root'.format(experiment, run_low, run_high))
33 b2.process(main)
34 print(b2.statistics)