3 @author Riley Xu - rixu@cern.ch
5 @brief This file declares functions that configure the tools and algorithms in FPGATrackSimAlgorithms.
8 from FPGATrackSimHough.FPGATrackSimHoughConf
import FPGATrackSimRoadUnionTool, FPGATrackSimHoughTransformTool, FPGATrackSimHough1DShiftTool
9 from FPGATrackSimLRT.FPGATrackSimLRTConf
import FPGATrackSimHoughTransform_d0phi0_Tool, FPGATrackSimLLPDoubletHoughTransformTool
11 import FPGATrackSimMaps.FPGATrackSimMapConfig
as FPGATrackSimMaps
14 return [
int(v)
for v
in string.split(
',')
if v !=
'' ]
18 Converts a list of floats in string form to an actual list. This is needed since
19 trfArgClasses doesn't have a argFloatList class
21 return [
float(v)
for v
in floatStr.split(
',')
if v !=
'' ]
25 Applies the parameters in the supplied tag to the given FPGATrackSimAlgorithm object.
29 'FPGATrackSimPatternMatchTool': [
32 'FPGATrackSimSectorMatchTool': [
35 'FPGATrackSimTrackFitterTool': [
41 'DoMissingHitsChecks',
47 for param
in params[obj.getType()]:
48 setattr(obj, param, tag[param])
53 Creates and adds the Hough transform tools to the tool svc
56 union = FPGATrackSimRoadUnionTool()
58 if algo_tag[
'xVar'] ==
'phi':
59 x_min = algo_tag[
'phi_min']
60 x_max = algo_tag[
'phi_max']
62 raise NotImplementedError(
"x != phi")
64 x_buffer = (x_max - x_min) / algo_tag[
'xBins'] * algo_tag[
'xBufferBins']
68 if algo_tag[
'yVar'] ==
'q/pt':
69 y_min = algo_tag[
'qpt_min']
70 y_max = algo_tag[
'qpt_max']
72 raise NotImplementedError(
"y != q/pt")
74 y_buffer = (y_max - y_min) / algo_tag[
'yBins'] * algo_tag[
'yBufferBins']
79 nSlice = FPGATrackSimMaps.getNSubregions(map_tag)
if algo_tag[
'slicing']
else 1
81 d0_list = algo_tag[
'd0_slices']
or [0]
84 for iSlice
in range(nSlice):
85 t = FPGATrackSimHoughTransformTool(
"HoughTransform_" +
str(d0) +
'_' +
str(iSlice))
87 t.subRegion = iSlice
if nSlice > 1
else -1
94 t.nBins_x = algo_tag[
'xBins'] + 2 * algo_tag[
'xBufferBins']
95 t.nBins_y = algo_tag[
'yBins'] + 2 * algo_tag[
'yBufferBins']
96 t.threshold = algo_tag[
'threshold']
97 t.convolution = algo_tag[
'convolution']
98 t.combine_layers = algo_tag[
'combine_layers']
99 t.scale = algo_tag[
'scale']
100 t.convSize_x = algo_tag[
'convSize_x']
101 t.convSize_y = algo_tag[
'convSize_y']
102 t.traceHits = doHitTracing
103 t.localMaxWindowSize = algo_tag[
'localMaxWindowSize']
104 t.fieldCorrection = algo_tag[
'fieldCorrection']
105 if algo_tag[
'DoDeltaGPhis']:
106 t.IdealGeoRoads =
True
108 t.hitExtend_x = algo_tag[
'hitExtend_x']
110 t.hitExtend_x =
intList(algo_tag[
'hitExtend_x'])
117 from AthenaCommon.AppMgr
import ToolSvc
127 Creates and adds the Hough transform tools to the tool svc
130 union = FPGATrackSimRoadUnionTool(
"LRTRoadUnionTool")
132 if algo_tag[
'lrt_straighttrack_xVar'] ==
'phi':
133 x_min = algo_tag[
'lrt_straighttrack_phi_min']
134 x_max = algo_tag[
'lrt_straighttrack_phi_max']
136 raise NotImplementedError(
"x != phi")
138 x_buffer = (x_max - x_min) / algo_tag[
'lrt_straighttrack_xBins'] * algo_tag[
'lrt_straighttrack_xBufferBins']
142 if algo_tag[
'lrt_straighttrack_yVar'] ==
'd0':
143 y_min = algo_tag[
'lrt_straighttrack_d0_min']
144 y_max = algo_tag[
'lrt_straighttrack_d0_max']
146 raise NotImplementedError(
"y != d0")
148 y_buffer = (y_max - y_min) / algo_tag[
'lrt_straighttrack_yBins'] * algo_tag[
'lrt_straighttrack_yBufferBins']
153 nSlice = FPGATrackSimMaps.getNSubregions(map_tag)
if algo_tag[
'lrt_straighttrack_slicing']
else 1
155 for iSlice
in range(nSlice):
156 t = FPGATrackSimHoughTransform_d0phi0_Tool(
"HoughTransform_d0phi0_" +
str(iSlice))
158 t.subRegion = iSlice
if nSlice > 1
else -1
163 t.nBins_x = algo_tag[
'lrt_straighttrack_xBins'] + 2 * algo_tag[
'lrt_straighttrack_xBufferBins']
164 t.nBins_y = algo_tag[
'lrt_straighttrack_yBins'] + 2 * algo_tag[
'lrt_straighttrack_yBufferBins']
165 t.threshold = algo_tag[
'lrt_straighttrack_threshold']
166 t.convolution = algo_tag[
'lrt_straighttrack_convolution']
167 t.combine_layers = algo_tag[
'lrt_straighttrack_combine_layers']
168 t.scale = algo_tag[
'lrt_straighttrack_scale']
169 t.convSize_x = algo_tag[
'lrt_straighttrack_convSize_x']
170 t.convSize_y = algo_tag[
'lrt_straighttrack_convSize_y']
171 t.traceHits = doHitTracing
172 t.stereo = algo_tag[
'lrt_straighttrack_stereo']
173 t.localMaxWindowSize = algo_tag[
'lrt_straighttrack_localMaxWindowSize']
176 t.hitExtend_x = algo_tag[
'lrt_straighttrack_hitExtend_x']
178 t.hitExtend_x =
intList(algo_tag[
'lrt_straighttrack_hitExtend_x'])
185 from AthenaCommon.AppMgr
import ToolSvc
192 union = FPGATrackSimRoadUnionTool()
195 nSlice = FPGATrackSimMaps.getNSubregions(map_tag)
if algo_tag[
'slicing']
else 1
197 splitpt=algo_tag[
'splitpt']
198 for ptstep
in range(splitpt):
199 qpt_min = algo_tag[
'qpt_min']
200 qpt_max = algo_tag[
'qpt_max']
201 lowpt = qpt_min + (qpt_max-qpt_min)/splitpt*ptstep
202 highpt = qpt_min + (qpt_max-qpt_min)/splitpt*(ptstep+1)
204 for iSlice
in range(nSlice):
205 tool = FPGATrackSimHough1DShiftTool(
"Hough1DShift_" +
str(iSlice)+((
"_pt{}".
format(ptstep))
if splitpt>1
else ""))
206 tool.subRegion = iSlice
if nSlice > 1
else -1
207 if algo_tag[
'radiiFile']
is not None:
208 tool.radiiFile = algo_tag[
'radiiFile']
209 tool.phi_min = algo_tag[
'phi_min']
210 tool.phi_max = algo_tag[
'phi_max']
212 tool.qpT_max = highpt
213 tool.nBins = algo_tag[
'xBins']
215 tool.variableExtend =
True
216 tool.phiRangeCut = algo_tag[
'phiRangeCut']
220 tool.threshold = algo_tag[
'threshold'][0]
223 tool.hitExtend = algo_tag[
'hitExtend_x']
225 tool.hitExtend =
floatList(algo_tag[
'hitExtend_x'])
231 from AthenaCommon.AppMgr
import ToolSvc
236 tool = FPGATrackSimLLPDoubletHoughTransformTool()
237 tool.nBins_x = algo_tag[
'lrt_doublet_d0_bins']
238 tool.d0_range = algo_tag[
'lrt_doublet_d0_range']
239 tool.nBins_y = algo_tag[
'lrt_doublet_qpt_bins']
240 tool.qpT_range = algo_tag[
'lrt_doublet_qpt_range']
241 from AthenaCommon.AppMgr
import ToolSvc
247 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
249 from AthenaMonitoringKernel.GenericMonitoringTool
import GenericMonitoringTool
254 if flags.Trigger.FPGATrackSim.singleTrackSample:
258 etamins={0:0.1, 1:0.7, 2:1.2, 3: 2.0, 4: 3.2}
259 etamaxs={0:0.3, 1:0.9, 2:1.4, 3: 2.2, 4: 3.4}
260 etamin=etamins.get(flags.Trigger.FPGATrackSim.region,0.1)
261 etamax=etamaxs.get(flags.Trigger.FPGATrackSim.region,0.3)
263 monTool.defineHistogram(
'regionID', path=
'EXPERT', type=
'TH1I', title=
'regionID', xbins=nbin, xmin=low, xmax=high)
264 monTool.defineHistogram(
'nHits_1st', path=
'EXPERT', type=
'TH1I', title=
'nHits_1st', xbins=nbin, xmin=low, xmax=high)
265 monTool.defineHistogram(
'nHits_1st_unmapped', path=
'EXPERT', type=
'TH1I', title=
'nHits_1st_unmapped', xbins=nbin, xmin=low, xmax=high)
266 monTool.defineHistogram(
'nroads_1st', path=
'EXPERT', type=
'TH1I', title=
'nroads_1st', xbins=nbin, xmin=low, xmax=high)
267 monTool.defineHistogram(
'nroads_1st_postfilter', path=
'EXPERT', type=
'TH1I', title=
'nroads_1st_postfilter', xbins=nbin, xmin=low, xmax=high)
268 monTool.defineHistogram(
'layerIDs_1st', path=
'EXPERT', type=
'TH1I', title=
'layerIDs_1st', xbins=20, xmin=-0.5, xmax = 19.5)
269 monTool.defineHistogram(
'chi2_1st_all', path=
'EXPERT', type=
'TH1F', title=
'chi2_1st_all', xbins=nbin, xmin=low, xmax=high)
270 monTool.defineHistogram(
'chi2_1st_afterOLR', path=
'EXPERT', type=
'TH1F', title=
'chi2_1st_afterOLR', xbins=nbin, xmin=0, xmax=10.0)
271 monTool.defineHistogram(
'best_chi2_1st', path=
'EXPERT', type=
'TH1F', title=
'best_chi2_1st', xbins=nbin, xmin=low, xmax=high)
272 monTool.defineHistogram(
'ntrack_1st', path=
'EXPERT', type=
'TH1F', title=
'ntrack_1st', xbins=nbin, xmin=low, xmax=high)
273 monTool.defineHistogram(
'ntrack_1st_afterOLR', path=
'EXPERT', type=
'TH1F', title=
'ntrack_1st_afterOLR', xbins=nbin, xmin=low, xmax=high)
274 monTool.defineHistogram(
'eff_road,pT', path=
'EXPERT', type=
'TEfficiency', title=
'eff_road_pt', xbins=20, xmin=0, xmax=100)
275 monTool.defineHistogram(
'eff_track,pT', path=
'EXPERT', type=
'TEfficiency', title=
'eff_track_pt', xbins=20, xmin=0, xmax=100)
276 monTool.defineHistogram(
'eff_track_chi2,pT', path=
'EXPERT', type=
'TEfficiency', title=
'eff_track_chi2_pt', xbins=20, xmin=0, xmax=100)
277 monTool.defineHistogram(
'eff_road,pT_zoom', path=
'EXPERT', type=
'TEfficiency', title=
'eff_road_pt_zoom', xbins=10, xmin=0, xmax=10)
278 monTool.defineHistogram(
'eff_track,pT_zoom', path=
'EXPERT', type=
'TEfficiency', title=
'eff_track_pt_zoom', xbins=10, xmin=0, xmax=10)
279 monTool.defineHistogram(
'eff_track_chi2,pT_zoom', path=
'EXPERT', type=
'TEfficiency', title=
'eff_track_chi2_pt_zoom', xbins=10, xmin=0, xmax=10)
280 monTool.defineHistogram(
'eff_road,eta', path=
'EXPERT', type=
'TEfficiency', title=
'eff_road_eta', xbins = 20, xmin=etamin, xmax=etamax)
281 monTool.defineHistogram(
'eff_track,eta', path=
'EXPERT', type=
'TEfficiency', title=
'eff_track_eta', xbins = 20, xmin=etamin, xmax=etamax)
282 monTool.defineHistogram(
'eff_track_chi2,eta', path=
'EXPERT', type=
'TEfficiency', title=
'eff_track_chi2_eta', xbins = 20, xmin=etamin, xmax=etamax)
283 monTool.defineHistogram(
'eff_road,phi', path=
'EXPERT', type=
'TEfficiency', title=
'eff_road_phi', xbins = 20, xmin=flags.Trigger.FPGATrackSim.ActiveConfig.phiMin, xmax=flags.Trigger.FPGATrackSim.ActiveConfig.phiMax)
284 monTool.defineHistogram(
'eff_track,phi', path=
'EXPERT', type=
'TEfficiency', title=
'eff_track_phi', xbins = 20, xmin=flags.Trigger.FPGATrackSim.ActiveConfig.phiMin, xmax=flags.Trigger.FPGATrackSim.ActiveConfig.phiMax)
285 monTool.defineHistogram(
'eff_track_chi2,phi', path=
'EXPERT', type=
'TEfficiency', title=
'eff_track_chi2_phi', xbins = 20, xmin=flags.Trigger.FPGATrackSim.ActiveConfig.phiMin, xmax=flags.Trigger.FPGATrackSim.ActiveConfig.phiMax)
286 monTool.defineHistogram(
'eff_road,d0', path=
'EXPERT', type=
'TEfficiency', title=
'eff_road_d0', xbins = 20, xmin = -2.0, xmax = 2.0)
287 monTool.defineHistogram(
'eff_track,d0', path=
'EXPERT', type=
'TEfficiency', title=
'eff_track_d0', xbins = 20, xmin = -2.0, xmax = 2.0)
288 monTool.defineHistogram(
'eff_track_chi2,d0', path=
'EXPERT', type=
'TEfficiency', title=
'eff_track_chi2_d0', xbins = 20, xmin = -2.0, xmax = 2.0)
289 monTool.defineHistogram(
'eff_road,z0', path=
'EXPERT', type=
'TEfficiency', title=
'eff_road_z0', xbins = 20, xmin = -150, xmax = 150.0)
290 monTool.defineHistogram(
'eff_track,z0', path=
'EXPERT', type=
'TEfficiency', title=
'eff_track_z0', xbins = 20, xmin = -150.0, xmax = 150.0)
291 monTool.defineHistogram(
'eff_track_chi2,z0', path=
'EXPERT', type=
'TEfficiency', title=
'eff_track_chi2_z0', xbins = 20, xmin = -150.0, xmax = 150.0)
293 result.setPrivateTools(monTool)
298 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
300 from AthenaMonitoringKernel.GenericMonitoringTool
import GenericMonitoringTool
306 etamins={0:0.1, 1:0.7, 2:1.2, 3: 2.0, 4: 3.2}
307 etamaxs={0:0.3, 1:0.9, 2:1.4, 3: 2.2, 4: 3.4}
308 etamin=etamins.get(flags.Trigger.FPGATrackSim.region,0.1)
309 etamax=etamaxs.get(flags.Trigger.FPGATrackSim.region,0.3)
311 monTool.defineHistogram(
'nHits_2nd', path=
'EXPERT', type=
'TH1I', title=
'nHits_2nd', xbins=nbin, xmin=low, xmax=high)
312 monTool.defineHistogram(
'nHits_2nd_unmapped', path=
'EXPERT', type=
'TH1I', title=
'nHits_2nd_unmapped', xbins=nbin, xmin=low, xmax=high)
313 monTool.defineHistogram(
'nroads_2nd', path=
'EXPERT', type=
'TH1I', title=
'nroads_2nd', xbins=nbin, xmin=low, xmax=high)
314 monTool.defineHistogram(
'nroads_2nd_postfilter', path=
'EXPERT', type=
'TH1I', title=
'nroads_2nd_postfilter', xbins=nbin, xmin=low, xmax=high)
315 monTool.defineHistogram(
'layerIDs_2nd', path=
'EXPERT', type=
'TH1I', title=
'layerIDs_2nd', xbins=20, xmin=-0.5, xmax = 19.5)
316 monTool.defineHistogram(
'chi2_2nd_all', path=
'EXPERT', type=
'TH1F', title=
'chi2_2nd_all', xbins=nbin, xmin=low, xmax=high)
317 monTool.defineHistogram(
'chi2_2nd_afterOLR', path=
'EXPERT', type=
'TH1F', title=
'chi2_2nd_afterOLR', xbins=nbin, xmin=0, xmax=10.0)
318 monTool.defineHistogram(
'best_chi2_2nd', path=
'EXPERT', type=
'TH1F', title=
'best_chi2_2nd', xbins=nbin, xmin=low, xmax=high)
319 monTool.defineHistogram(
'ntrack_2nd', path=
'EXPERT', type=
'TH1F', title=
'ntrack_2nd', xbins=nbin, xmin=low, xmax=high)
320 monTool.defineHistogram(
'ntrack_2nd_afterOLR', path=
'EXPERT', type=
'TH1F', title=
'ntrack_2nd_afterOLR', xbins=nbin, xmin=low, xmax=high)
321 monTool.defineHistogram(
'eff_road_2nd,pT', path=
'EXPERT', type=
'TEfficiency', title=
'eff_road_pt', xbins=20, xmin=0, xmax=100)
322 monTool.defineHistogram(
'eff_track_2nd,pT', path=
'EXPERT', type=
'TEfficiency', title=
'eff_track_pt', xbins=20, xmin=0, xmax=100)
323 monTool.defineHistogram(
'eff_track_chi2_2nd,pT', path=
'EXPERT', type=
'TEfficiency', title=
'eff_track_chi2_pt', xbins=20, xmin=0, xmax=100)
324 monTool.defineHistogram(
'eff_road_2nd,pT_zoom', path=
'EXPERT', type=
'TEfficiency', title=
'eff_road_pt_zoom', xbins=10, xmin=0, xmax=10)
325 monTool.defineHistogram(
'eff_track_2nd,pT_zoom', path=
'EXPERT', type=
'TEfficiency', title=
'eff_track_pt_zoom', xbins=10, xmin=0, xmax=10)
326 monTool.defineHistogram(
'eff_track_chi2_2nd,pT_zoom', path=
'EXPERT', type=
'TEfficiency', title=
'eff_track_chi2_pt_zoom', xbins=10, xmin=0, xmax=10)
327 monTool.defineHistogram(
'eff_road_2nd,eta', path=
'EXPERT', type=
'TEfficiency', title=
'eff_road_eta', xbins = 20, xmin=etamin, xmax=etamax)
328 monTool.defineHistogram(
'eff_track_2nd,eta', path=
'EXPERT', type=
'TEfficiency', title=
'eff_track_eta', xbins = 20, xmin=etamin, xmax=etamax)
329 monTool.defineHistogram(
'eff_track_chi2_2nd,eta', path=
'EXPERT', type=
'TEfficiency', title=
'eff_track_chi2_eta', xbins = 20, xmin=etamin, xmax=etamax)
330 monTool.defineHistogram(
'eff_road_2nd,phi', path=
'EXPERT', type=
'TEfficiency', title=
'eff_road_phi', xbins = 20, xmin=flags.Trigger.FPGATrackSim.ActiveConfig.phiMin, xmax=flags.Trigger.FPGATrackSim.ActiveConfig.phiMax)
331 monTool.defineHistogram(
'eff_track_2nd,phi', path=
'EXPERT', type=
'TEfficiency', title=
'eff_track_phi', xbins = 20, xmin=flags.Trigger.FPGATrackSim.ActiveConfig.phiMin, xmax=flags.Trigger.FPGATrackSim.ActiveConfig.phiMax)
332 monTool.defineHistogram(
'eff_track_chi2_2nd,phi', path=
'EXPERT', type=
'TEfficiency', title=
'eff_track_chi2_phi', xbins = 20, xmin=flags.Trigger.FPGATrackSim.ActiveConfig.phiMin, xmax=flags.Trigger.FPGATrackSim.ActiveConfig.phiMax)
333 monTool.defineHistogram(
'eff_road_2nd,d0', path=
'EXPERT', type=
'TEfficiency', title=
'eff_road_d0', xbins = 20, xmin = -2.0, xmax = 2.0)
334 monTool.defineHistogram(
'eff_track_2nd,d0', path=
'EXPERT', type=
'TEfficiency', title=
'eff_track_d0', xbins = 20, xmin = -2.0, xmax = 2.0)
335 monTool.defineHistogram(
'eff_track_chi2_2nd,d0', path=
'EXPERT', type=
'TEfficiency', title=
'eff_track_chi2_d0', xbins = 20, xmin = -2.0, xmax = 2.0)
336 monTool.defineHistogram(
'eff_road_2nd,z0', path=
'EXPERT', type=
'TEfficiency', title=
'eff_road_z0', xbins = 20, xmin = -150, xmax = 150.0)
337 monTool.defineHistogram(
'eff_track_2nd,z0', path=
'EXPERT', type=
'TEfficiency', title=
'eff_track_z0', xbins = 20, xmin = -150.0, xmax = 150.0)
338 monTool.defineHistogram(
'eff_track_chi2_2nd,z0', path=
'EXPERT', type=
'TEfficiency', title=
'eff_track_chi2_z0', xbins = 20, xmin = -150.0, xmax = 150.0)
340 result.setPrivateTools(monTool)