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