Belle II Software development
a02_trackingEfficiency_simulateData.py
1#!/usr/bin/env python
2
3
10
11
20
21import sys
22import glob
23import basf2 as b2
24from simulation import add_simulation
25
26
27b2.set_random_seed(1509)
28
29release = sys.argv[1]
30
31# roi = {noROI, vxdtf1, vxdtf2}
32# bkg = {noBkg, stdBKG, std2GBKG}
33
34roi = sys.argv[2]
35bkg = sys.argv[3]
36
37usePXDDataReduction = True
38
39if (roi == 'noROI'):
40 usePXDDataReduction = False
41
42bkgFiles = None
43
44if bkg == 'stdBKG':
45 bkgFiles = glob.glob('/sw/belle2/bkg/*.root')
46if bkg == 'std2GsmallBKG':
47 bkgFiles = glob.glob('/sw/belle2/bkg/*.root')
48 bkgFiles = bkgFiles + glob.glob('/sw/belle2/bkg.twoPhoton/*usual.root')
49if bkg == 'std2GBKG':
50 bkgFiles = glob.glob('/sw/belle2/bkg/*.root')
51 bkgFiles = bkgFiles + glob.glob('/sw/belle2/bkg.twoPhoton/*.root')
52
53print('background: ' + bkg)
54if(usePXDDataReduction):
55 print('simulating PXD Data Reduction')
56else:
57 print('NOT simulating PXD Data Reduction')
58print('using vxdtf2')
59
60print(release)
61
62input_filename = './' + release + '/TV_data_' + release + '_1509.root'
63output_filename = './' + release + '/TV_sim_' + bkg + '_' + roi + '_' + release + '.root'
64
65print(output_filename)
66
67path = b2.create_path()
68
69progress = b2.register_module('Progress')
70
71root_output = b2.register_module('RootOutput')
72root_output.param('outputFileName', output_filename)
73
74root_input = b2.register_module('RootInput')
75root_input.param('inputFileName', input_filename)
76
77path.add_module(root_input)
78path.add_module(progress)
79
80add_simulation(path, None, bkgFiles, None, 1.0, usePXDDataReduction)
81
82path.add_module(root_output)
83
84b2.process(path)
85print(b2.statistics)