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