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