Belle II Software development
a01234_trackingEfficiency_oneshot.py
1#!/usr/bin/env python
2
3
10
11
22
23import sys
24import glob
25import basf2 as b2
26from generators import add_evtgen_generator
27from simulation import add_simulation
28from tracking import add_tracking_reconstruction
29import modularAnalysis as ma
30
31b2.set_random_seed(1509)
32
33particleGun = True
34
35release = sys.argv[1]
36
37# roi = {noROI, vxdtf1, vxdtf2}
38# bkg = {noBkg, stdBKG, std2GBKG}
39# vxdtf = {vxdtf1, vxdtf2}
40
41roi = sys.argv[2]
42bkg = sys.argv[3]
43vxdtf = sys.argv[4]
44
45print('Performance evaluated on: ')
46print('simulation: ' + roi + ' ' + bkg)
47print('reconstruction: ' + vxdtf)
48print()
49
50root_file_name_TRK = './' + release + '/oneshotTV_TRK_analysis_' + roi + '_' + bkg + '_' + vxdtf + '_' + release + '.root'
51root_file_name_V0 = './' + release + '/oneshotTV_V0_analysis_' + roi + '_' + bkg + '_' + vxdtf + '_' + release + '.root'
52root_file_name_FTFNT = './' + release + '/oneshotTV_FTFNT_analysis_' + roi + '_' + bkg + '_' + vxdtf + '_' + release + '.root'
53
54bkgFiles = None
55usePXDDataReduction = True
56mcTrackFinding = False
57
58if roi == 'noROI':
59 usePXDDataReduction = False
60
61if bkg == 'stdBKG':
62 bkgFiles = glob.glob('/sw/belle2/bkg/*.root')
63if bkg == 'std2GsmallBKG':
64 bkgFiles = glob.glob('/sw/belle2/bkg/*.root')
65 bkgFiles = bkgFiles + glob.glob('/sw/belle2/bkg.twoPhoton/*usual.root')
66if bkg == 'std2GBKG':
67 bkgFiles = glob.glob('/sw/belle2/bkg/*.root')
68 bkgFiles = bkgFiles + glob.glob('/sw/belle2/bkg.twoPhoton/*.root')
69
70print(bkgFiles)
71
72path = b2.create_path()
73
74eventinfosetter = b2.register_module('EventInfoSetter')
75eventinfosetter.param('expList', [0])
76eventinfosetter.param('runList', [1])
77
78progress = b2.register_module('Progress')
79
80v0matcher = b2.register_module('MCV0Matcher')
81v0matcher.param('V0ColName', 'V0ValidationVertexs')
82v0matcher.logging.log_level = b2.LogLevel.INFO
83
84create_plots_TRK = b2.register_module('TrackingPerformanceEvaluation')
85create_plots_TRK.param('outputFileName', root_file_name_TRK)
86create_plots_TRK.logging.log_level = b2.LogLevel.INFO
87
88
89create_plots_V0 = b2.register_module('V0findingPerformanceEvaluation')
90create_plots_V0.param('outputFileName', root_file_name_V0)
91create_plots_V0.logging.log_level = b2.LogLevel.INFO
92
93create_plots_FTFNT = b2.register_module('FillTrackFitNtuple')
94create_plots_FTFNT.param('outputFileName', root_file_name_FTFNT)
95create_plots_FTFNT.logging.log_level = b2.LogLevel.INFO
96
97
98if particleGun:
99 particleGunModule = b2.register_module('ParticleGun')
100 particleGunModule.param({
101 'pdgCodes': [211, -211],
102 'nTracks': 1,
103 'varyNTracks': False,
104 'momentumGeneration': 'uniformpt',
105 'momentumParams': [0.5, 1.],
106 'thetaGeneration': 'uniform',
107 'thetaParams': [60., 60.],
108 })
109 path.add_module('EventInfoSetter')
110 path.add_module(particleGunModule)
111else:
112 ma.setupEventInfo(100, path)
113 add_evtgen_generator(path, 'signal', None)
114
115path.add_module(progress)
116
117add_simulation(path, None, bkgFiles, None, 1.0, usePXDDataReduction)
118
119add_tracking_reconstruction(
120 path,
121 components=None,
122 pruneTracks=False,
123 mcTrackFinding=mcTrackFinding,
124 skipGeometryAdding=False
125)
126
127
128modList = path.modules()
129for modItem in modList:
130 if modItem.name() == 'V0Finder':
131 modItem.param('Validation', True)
132path.add_module(v0matcher)
133
134path.add_module(create_plots_TRK)
135path.add_module(create_plots_V0)
136path.add_module(create_plots_FTFNT)
137
138b2.process(path)
139
140print(b2.statistics)