2 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
3 from AthenaConfiguration.ComponentFactory
import CompFactory
4 from AthenaCommon.Logging
import AthenaLogger
5 from PathResolver
import PathResolver
8 log = AthenaLogger(__name__)
11 from FPGATrackSimConfTools
import FPGATrackSimDataPrepConfig
12 from FPGATrackSimConfTools
import FPGATrackSimSecondStageConfig
17 assert(fields.startswith(
'towers'))
25 FPGATrackSimWriteOutput = CompFactory.FPGATrackSimOutputHeaderTool(
"FPGATrackSimWriteOutput")
26 FPGATrackSimWriteOutput.InFileName = [
"test.root"]
29 FPGATrackSimWriteOutput.RWstatus =
"HEADER"
30 FPGATrackSimWriteOutput.THistSvc = CompFactory.THistSvc()
31 result.addPublicTool(FPGATrackSimWriteOutput, primary=
True)
38 FPGATrackSimBankSvc = CompFactory.FPGATrackSimBankSvc()
39 pathBankSvc = flags.Trigger.FPGATrackSim.bankDir
if flags.Trigger.FPGATrackSim.bankDir !=
'' else f
'/eos/atlas/atlascerngroupdisk/det-htt/HTTsim/{flags.GeoModel.AtlasVersion}/21.9.16/'+FPGATrackSimDataPrepConfig.getBaseName(flags)+
'/SectorBanks/'
41 FPGATrackSimBankSvc.constantsNoGuess_1st = [
42 f
'{pathBankSvc}corrgen_raw_8L_skipPlane0.gcon',
43 f
'{pathBankSvc}corrgen_raw_8L_skipPlane1.gcon',
44 f
'{pathBankSvc}corrgen_raw_8L_skipPlane2.gcon',
45 f
'{pathBankSvc}corrgen_raw_8L_skipPlane3.gcon',
46 f
'{pathBankSvc}corrgen_raw_8L_skipPlane4.gcon',
47 f
'{pathBankSvc}corrgen_raw_8L_skipPlane5.gcon',
48 f
'{pathBankSvc}corrgen_raw_8L_skipPlane6.gcon',
49 f
'{pathBankSvc}corrgen_raw_8L_skipPlane7.gcon']
50 FPGATrackSimBankSvc.constantsNoGuess_2nd = [
51 f
'{pathBankSvc}corrgen_raw_13L_skipPlane0.gcon',
52 f
'{pathBankSvc}corrgen_raw_13L_skipPlane1.gcon',
53 f
'{pathBankSvc}corrgen_raw_13L_skipPlane2.gcon',
54 f
'{pathBankSvc}corrgen_raw_13L_skipPlane3.gcon',
55 f
'{pathBankSvc}corrgen_raw_13L_skipPlane4.gcon',
56 f
'{pathBankSvc}corrgen_raw_13L_skipPlane5.gcon',
57 f
'{pathBankSvc}corrgen_raw_13L_skipPlane6.gcon',
58 f
'{pathBankSvc}corrgen_raw_13L_skipPlane7.gcon']
59 layers=
"5L" if flags.Trigger.FPGATrackSim.ActiveConfig.genScan
else "9L"
60 FPGATrackSimBankSvc.constants_1st = f
'{pathBankSvc}corrgen_raw_{layers}_reg{flags.Trigger.FPGATrackSim.region}_checkGood1.gcon'
61 FPGATrackSimBankSvc.constants_2nd = f
'{pathBankSvc}corrgen_raw_13L_reg{flags.Trigger.FPGATrackSim.region}_checkGood1.gcon'
62 FPGATrackSimBankSvc.sectorBank_1st = f
'{pathBankSvc}sectorsHW_raw_{layers}_reg{flags.Trigger.FPGATrackSim.region}_checkGood1.patt'
63 FPGATrackSimBankSvc.sectorBank_2nd = f
'{pathBankSvc}sectorsHW_raw_13L_reg{flags.Trigger.FPGATrackSim.region}_checkGood1.patt'
64 FPGATrackSimBankSvc.sectorSlices = f
'{pathBankSvc}slices_{layers}_reg{flags.Trigger.FPGATrackSim.region}.root'
67 import FPGATrackSimConfTools.FPGATrackSimTagConfig
as FPGATrackSimTagConfig
68 bank_tag = FPGATrackSimTagConfig.getTags(stage=
'bank')[
'bank']
69 FPGATrackSimBankSvc.sectorQPtBins = bank_tag[
'sectorQPtBins']
70 FPGATrackSimBankSvc.qptAbsBinning = bank_tag[
'qptAbsBinning']
72 result.addService(FPGATrackSimBankSvc, create=
True, primary=
True)
78 RF = CompFactory.FPGATrackSimRoadUnionTool()
80 xBins = flags.Trigger.FPGATrackSim.ActiveConfig.xBins
81 xBufferBins = flags.Trigger.FPGATrackSim.ActiveConfig.xBufferBins
82 yBins = flags.Trigger.FPGATrackSim.ActiveConfig.yBins
83 yBufferBins = flags.Trigger.FPGATrackSim.ActiveConfig.yBufferBins
84 xMin = flags.Trigger.FPGATrackSim.ActiveConfig.phiMin
85 xMax = flags.Trigger.FPGATrackSim.ActiveConfig.phiMax
86 xBuffer = (xMax - xMin) / xBins * xBufferBins
89 yMin = flags.Trigger.FPGATrackSim.ActiveConfig.qptMin
90 yMax = flags.Trigger.FPGATrackSim.ActiveConfig.qptMax
91 yBuffer = (yMax - yMin) / yBins * yBufferBins
96 FPGATrackSimMapping = result.getPrimaryAndMerge(FPGATrackSimDataPrepConfig.FPGATrackSimMappingCfg(flags))
98 HoughTransform = CompFactory.FPGATrackSimHoughTransformTool(
"HoughTransform_0_" +
str(number))
99 HoughTransform.FPGATrackSimEventSelectionSvc = result.getPrimaryAndMerge(FPGATrackSimDataPrepConfig.FPGATrackSimEventSelectionCfg(flags))
101 HoughTransform.FPGATrackSimMappingSvc = FPGATrackSimMapping
102 HoughTransform.combine_layers = flags.Trigger.FPGATrackSim.ActiveConfig.combineLayers
103 HoughTransform.convSize_x = flags.Trigger.FPGATrackSim.ActiveConfig.convSizeX
104 HoughTransform.convSize_y = flags.Trigger.FPGATrackSim.ActiveConfig.convSizeY
105 HoughTransform.convolution = flags.Trigger.FPGATrackSim.ActiveConfig.convolution
106 HoughTransform.d0_max = 0
107 HoughTransform.d0_min = 0
108 HoughTransform.fieldCorrection = flags.Trigger.FPGATrackSim.ActiveConfig.fieldCorrection
109 HoughTransform.hitExtend_x = flags.Trigger.FPGATrackSim.ActiveConfig.hitExtendX
110 HoughTransform.localMaxWindowSize = flags.Trigger.FPGATrackSim.ActiveConfig.localMaxWindowSize
111 HoughTransform.nBins_x = xBins + 2 * xBufferBins
112 HoughTransform.nBins_y = yBins + 2 * yBufferBins
113 HoughTransform.phi_max = xMax
114 HoughTransform.phi_min = xMin
115 HoughTransform.qpT_max = yMax
116 HoughTransform.qpT_min = yMin
117 HoughTransform.scale = flags.Trigger.FPGATrackSim.ActiveConfig.scale
118 HoughTransform.subRegion = number
119 HoughTransform.threshold = flags.Trigger.FPGATrackSim.ActiveConfig.threshold
120 HoughTransform.traceHits =
True
121 HoughTransform.IdealGeoRoads = (flags.Trigger.FPGATrackSim.ActiveConfig.IdealGeoRoads
and flags.Trigger.FPGATrackSim.tracking)
122 HoughTransform.useSpacePoints = flags.Trigger.FPGATrackSim.spacePoints
124 tools.append(HoughTransform)
127 result.addPublicTool(RF, primary=
True)
133 RF = CompFactory.FPGATrackSimRoadUnionTool()
134 splitpt=flags.Trigger.FPGATrackSim.Hough1D.splitpt
135 FPGATrackSimMapping = result.getPrimaryAndMerge(FPGATrackSimDataPrepConfig.FPGATrackSimMappingCfg(flags))
136 for ptstep
in range(splitpt):
137 qpt_min = flags.Trigger.FPGATrackSim.Hough1D.qptMin
138 qpt_max = flags.Trigger.FPGATrackSim.Hough1D.qptMax
139 lowpt = qpt_min + (qpt_max-qpt_min)/splitpt*ptstep
140 highpt = qpt_min + (qpt_max-qpt_min)/splitpt*(ptstep+1)
142 for iSlice
in range(nSlice):
143 tool = CompFactory.FPGATrackSimHough1DShiftTool(
"Hough1DShift" +
str(iSlice)+((
"_pt{}".
format(ptstep))
if splitpt>1
else ""))
144 tool.subRegion = iSlice
if nSlice > 1
else -1
145 tool.phiMin = flags.Trigger.FPGATrackSim.Hough1D.phiMin
146 tool.phiMax = flags.Trigger.FPGATrackSim.Hough1D.phiMax
149 tool.nBins = flags.Trigger.FPGATrackSim.Hough1D.xBins
151 tool.variableExtend =
True
152 tool.drawHitMasks =
False
153 tool.phiRangeCut = flags.Trigger.FPGATrackSim.Hough1D.phiRangeCut
157 tool.threshold = flags.Trigger.FPGATrackSim.Hough1D.threshold[0]
158 tool.hitExtend = flags.Trigger.FPGATrackSim.Hough1D.hitExtendX
159 tool.FPGATrackSimEventSelectionSvc = result.getPrimaryAndMerge(FPGATrackSimDataPrepConfig.FPGATrackSimEventSelectionCfg(flags))
161 tool.FPGATrackSimMappingSvc = FPGATrackSimMapping
162 tool.IdealGeoRoads = (flags.Trigger.FPGATrackSim.ActiveConfig.IdealGeoRoads
and flags.Trigger.FPGATrackSim.tracking)
163 tool.useSpacePoints = flags.Trigger.FPGATrackSim.spacePoints
168 result.addPublicTool(RF, primary=
True)
177 cutset = importlib.import_module(flags.Trigger.FPGATrackSim.GenScan.genScanCuts).cuts[flags.Trigger.FPGATrackSim.region]
181 if (cutset[
"parSet"]==
"PhiSlicedKeyLyrPars") :
182 Binning = CompFactory.FPGATrackSimGenScanPhiSlicedKeyLyrBinning(
"GenScanBinning")
184 log.error(
"Unknown Binning")
185 Binning.rin=cutset[
"rin"]
186 Binning.rout=cutset[
"rout"]
187 Binning.OutputLevel=flags.Trigger.FPGATrackSim.loglevel
190 Monitor = CompFactory.FPGATrackSimGenScanMonitoring(
"GenScanMonitoring")
191 Monitor.THistSvc = CompFactory.THistSvc()
192 Monitor.OutputLevel=flags.Trigger.FPGATrackSim.loglevel
195 tool = CompFactory.FPGATrackSimGenScanTool(
"GenScanTool")
196 tool.FPGATrackSimEventSelectionSvc = result.getPrimaryAndMerge(FPGATrackSimDataPrepConfig.FPGATrackSimEventSelectionCfg(flags))
198 tool.FPGATrackSimMappingSvc = result.getPrimaryAndMerge(FPGATrackSimDataPrepConfig.FPGATrackSimMappingCfg(flags))
199 tool.Monitoring = Monitor
200 tool.Binning = Binning
201 tool.OutputLevel=flags.Trigger.FPGATrackSim.loglevel
204 tool.binFilter=flags.Trigger.FPGATrackSim.GenScan.binFilter
205 tool.reversePairDir=flags.Trigger.FPGATrackSim.GenScan.reverse
206 tool.applyPairFilter=
True
207 tool.applyPairSetFilter=
True
211 tool.d0FractionalPadding =0.05
212 tool.z0FractionalPadding =0.05
213 tool.etaFractionalPadding =0.05
214 tool.phiFractionalPadding =0.05
215 tool.qOverPtFractionalPadding =0.05
218 for (cut,val)
in cutset.items():
219 setattr(tool,cut,val)
223 RoadUnion = CompFactory.FPGATrackSimRoadUnionTool()
224 RoadUnion.tools = [tool,]
225 result.addPublicTool(RoadUnion, primary=
True)
231 DataFlowTool = CompFactory.FPGATrackSimDataFlowTool()
232 DataFlowTool.FPGATrackSimEventSelectionSvc = result.getPrimaryAndMerge(FPGATrackSimDataPrepConfig.FPGATrackSimEventSelectionCfg(flags))
233 DataFlowTool.FPGATrackSimMappingSvc = result.getPrimaryAndMerge(FPGATrackSimDataPrepConfig.FPGATrackSimMappingCfg(flags))
234 DataFlowTool.Chi2ndofCut = flags.Trigger.FPGATrackSim.ActiveConfig.chi2cut
235 DataFlowTool.THistSvc = CompFactory.THistSvc()
236 result.setPrivateTools(DataFlowTool)
241 HoughRootOutputTool = CompFactory.FPGATrackSimHoughRootOutputTool()
242 HoughRootOutputTool.FPGATrackSimEventSelectionSvc = result.getPrimaryAndMerge(FPGATrackSimDataPrepConfig.FPGATrackSimEventSelectionCfg(flags))
243 HoughRootOutputTool.FPGATrackSimMappingSvc = result.getPrimaryAndMerge(FPGATrackSimDataPrepConfig.FPGATrackSimMappingCfg(flags))
244 HoughRootOutputTool.THistSvc = CompFactory.THistSvc()
245 result.setPrivateTools(HoughRootOutputTool)
250 LRTRoadFinder =CompFactory.FPGATrackSimHoughTransform_d0phi0_Tool()
252 LRTRoadFinder.FPGATrackSimMappingSvc = result.getPrimaryAndMerge(FPGATrackSimDataPrepConfig.FPGATrackSimMappingCfg(flags))
253 LRTRoadFinder.combine_layers = flags.Trigger.FPGATrackSim.ActiveConfig.lrtStraighttrackCombineLayers
254 LRTRoadFinder.convolution = flags.Trigger.FPGATrackSim.ActiveConfig.lrtStraighttrackConvolution
255 LRTRoadFinder.hitExtend_x = flags.Trigger.FPGATrackSim.ActiveConfig.lrtStraighttrackHitExtendX
256 LRTRoadFinder.scale = flags.Trigger.FPGATrackSim.ActiveConfig.scale
257 LRTRoadFinder.threshold = flags.Trigger.FPGATrackSim.ActiveConfig.lrtStraighttrackThreshold
258 result.setPrivateTools(LRTRoadFinder)
263 NNTrackTool = CompFactory.FPGATrackSimNNTrackTool()
264 NNTrackTool.THistSvc = CompFactory.THistSvc()
265 NNTrackTool.FPGATrackSimMappingSvc = result.getPrimaryAndMerge(FPGATrackSimDataPrepConfig.FPGATrackSimMappingCfg(flags))
267 NNTrackTool.IdealGeoRoads = (flags.Trigger.FPGATrackSim.ActiveConfig.IdealGeoRoads
and flags.Trigger.FPGATrackSim.tracking)
268 NNTrackTool.useSpacePoints = flags.Trigger.FPGATrackSim.spacePoints
and not flags.Trigger.FPGATrackSim.ActiveConfig.genScan
271 result.setPrivateTools(NNTrackTool)
276 TF_1st = CompFactory.FPGATrackSimTrackFitterTool(
"FPGATrackSimTrackFitterTool_1st")
277 TF_1st.GuessHits = flags.Trigger.FPGATrackSim.ActiveConfig.guessHits
278 TF_1st.IdealCoordFitType = flags.Trigger.FPGATrackSim.ActiveConfig.idealCoordFitType
280 TF_1st.FPGATrackSimMappingSvc = result.getPrimaryAndMerge(FPGATrackSimDataPrepConfig.FPGATrackSimMappingCfg(flags))
281 TF_1st.chi2DofRecoveryMax = flags.Trigger.FPGATrackSim.ActiveConfig.chi2DoFRecoveryMax
282 TF_1st.chi2DofRecoveryMin = flags.Trigger.FPGATrackSim.ActiveConfig.chi2DoFRecoveryMin
283 TF_1st.doMajority = flags.Trigger.FPGATrackSim.ActiveConfig.doMajority
284 TF_1st.nHits_noRecovery = flags.Trigger.FPGATrackSim.ActiveConfig.nHitsNoRecovery
285 TF_1st.DoDeltaGPhis = flags.Trigger.FPGATrackSim.ActiveConfig.doDeltaGPhis
286 TF_1st.DoMissingHitsChecks = flags.Trigger.FPGATrackSim.ActiveConfig.doMissingHitsChecks
287 TF_1st.IdealGeoRoads = (flags.Trigger.FPGATrackSim.ActiveConfig.IdealGeoRoads
and flags.Trigger.FPGATrackSim.tracking)
288 TF_1st.useSpacePoints = flags.Trigger.FPGATrackSim.spacePoints
and not flags.Trigger.FPGATrackSim.ActiveConfig.genScan
290 result.addPublicTool(TF_1st, primary=
True)
295 OR_1st = CompFactory.FPGATrackSimOverlapRemovalTool(
"FPGATrackSimOverlapRemovalTool_1st")
296 OR_1st.ORAlgo =
"Normal"
297 OR_1st.doFastOR =flags.Trigger.FPGATrackSim.ActiveConfig.doFastOR
298 OR_1st.NumOfHitPerGrouping = 3
299 OR_1st.FPGATrackSimMappingSvc = result.getPrimaryAndMerge(FPGATrackSimDataPrepConfig.FPGATrackSimMappingCfg(flags))
300 OR_1st.MinChi2 = flags.Trigger.FPGATrackSim.ActiveConfig.chi2cut
301 if flags.Trigger.FPGATrackSim.ActiveConfig.hough
or flags.Trigger.FPGATrackSim.ActiveConfig.hough1D:
302 OR_1st.nBins_x = flags.Trigger.FPGATrackSim.ActiveConfig.xBins + 2 * flags.Trigger.FPGATrackSim.ActiveConfig.xBufferBins
303 OR_1st.nBins_y = flags.Trigger.FPGATrackSim.ActiveConfig.yBins + 2 * flags.Trigger.FPGATrackSim.ActiveConfig.yBufferBins
304 OR_1st.localMaxWindowSize = flags.Trigger.FPGATrackSim.ActiveConfig.localMaxWindowSize
305 OR_1st.roadSliceOR = flags.Trigger.FPGATrackSim.ActiveConfig.roadSliceOR
307 result.addPublicTool(OR_1st, primary=
True)
311 newFlags = flags.cloneAndReplace(
"Trigger.FPGATrackSim.ActiveConfig",
"Trigger.FPGATrackSim." + flags.Trigger.FPGATrackSim.algoTag)
315 name=
"FPGATrackSimSpacepointRoadFilterTool_1st"
317 name=
"FPGATrackSimSpacepointRoadFilterTool_2st"
318 SPRoadFilter = CompFactory.FPGATrackSimSpacepointRoadFilterTool(name)
319 SPRoadFilter.filtering = flags.Trigger.FPGATrackSim.ActiveConfig.spacePointFiltering
320 SPRoadFilter.minSpacePlusPixel = flags.Trigger.FPGATrackSim.minSpacePlusPixel
321 SPRoadFilter.isSecondStage = secondStage
323 if (flags.Trigger.FPGATrackSim.ActiveConfig.hough1D):
324 SPRoadFilter.threshold = flags.Trigger.FPGATrackSim.Hough1D.threshold[0]
326 SPRoadFilter.threshold = flags.Trigger.FPGATrackSim.ActiveConfig.threshold[0]
327 SPRoadFilter.setSectors = (flags.Trigger.FPGATrackSim.ActiveConfig.IdealGeoRoads
and flags.Trigger.FPGATrackSim.tracking)
335 if not flags.Trigger.FPGATrackSim.wrapperFileName:
336 from InDetConfig.InDetPrepRawDataFormationConfig
import AthenaTrkClusterizationCfg
339 theFPGATrackSimLogicalHitsProcessAlg=CompFactory.FPGATrackSimLogicalHitsProcessAlg()
340 theFPGATrackSimLogicalHitsProcessAlg.writeOutputData = flags.Trigger.FPGATrackSim.ActiveConfig.writeOutputData
341 theFPGATrackSimLogicalHitsProcessAlg.tracking = flags.Trigger.FPGATrackSim.tracking
342 theFPGATrackSimLogicalHitsProcessAlg.doOverlapRemoval = flags.Trigger.FPGATrackSim.doOverlapRemoval
343 theFPGATrackSimLogicalHitsProcessAlg.DoMissingHitsChecks = flags.Trigger.FPGATrackSim.ActiveConfig.doMissingHitsChecks
344 theFPGATrackSimLogicalHitsProcessAlg.DoHoughRootOutput = flags.Trigger.FPGATrackSim.ActiveConfig.houghRootoutput
345 theFPGATrackSimLogicalHitsProcessAlg.NumOfHitPerGrouping = flags.Trigger.FPGATrackSim.ActiveConfig.NumOfHitPerGrouping
346 theFPGATrackSimLogicalHitsProcessAlg.DoNNTrack = flags.Trigger.FPGATrackSim.ActiveConfig.trackNNAnalysis
347 theFPGATrackSimLogicalHitsProcessAlg.runOnRDO =
not flags.Trigger.FPGATrackSim.wrapperFileName
348 theFPGATrackSimLogicalHitsProcessAlg.eventSelector = result.getPrimaryAndMerge(FPGATrackSimDataPrepConfig.FPGATrackSimEventSelectionCfg(flags))
349 theFPGATrackSimLogicalHitsProcessAlg.TrackScoreCut = flags.Trigger.FPGATrackSim.ActiveConfig.chi2cut
351 FPGATrackSimMaping = result.getPrimaryAndMerge(FPGATrackSimDataPrepConfig.FPGATrackSimMappingCfg(flags))
352 theFPGATrackSimLogicalHitsProcessAlg.FPGATrackSimMapping = FPGATrackSimMaping
355 if flags.Trigger.FPGATrackSim.tracking:
358 if (flags.Trigger.FPGATrackSim.ActiveConfig.hough1D):
360 elif (flags.Trigger.FPGATrackSim.ActiveConfig.genScan):
365 if (flags.Trigger.FPGATrackSim.ActiveConfig.etaPatternFilter):
366 EtaPatternFilter = CompFactory.FPGATrackSimEtaPatternFilterTool()
367 EtaPatternFilter.FPGATrackSimMappingSvc = FPGATrackSimMaping
368 EtaPatternFilter.threshold = flags.Trigger.FPGATrackSim.Hough1D.threshold[0]
369 EtaPatternFilter.EtaPatterns = flags.Trigger.FPGATrackSim.mapsDir+
"/"+FPGATrackSimDataPrepConfig.getBaseName(flags)+
".patt"
370 theFPGATrackSimLogicalHitsProcessAlg.RoadFilter = EtaPatternFilter
371 theFPGATrackSimLogicalHitsProcessAlg.FilterRoads =
True
373 if (flags.Trigger.FPGATrackSim.ActiveConfig.phiRoadFilter):
374 RoadFilter2 = CompFactory.FPGATrackSimPhiRoadFilterTool()
375 RoadFilter2.FPGATrackSimMappingSvc = FPGATrackSimMaping
376 RoadFilter2.threshold = flags.Trigger.FPGATrackSim.Hough1D.threshold[0]
377 RoadFilter2.fieldCorrection = flags.Trigger.FPGATrackSim.ActiveConfig.fieldCorrection
379 windows = [flags.Trigger.FPGATrackSim.Hough1D.phifilterwindow
for i
in range(len(flags.Trigger.FPGATrackSim.ActiveConfig.hitExtendX))]
380 RoadFilter2.window = windows
382 theFPGATrackSimLogicalHitsProcessAlg.RoadFilter2 = RoadFilter2
383 theFPGATrackSimLogicalHitsProcessAlg.FilterRoads2 =
True
388 LRTRoadFilter = CompFactory.FPGATrackSimLLPRoadFilterTool()
389 result.addPublicTool(LRTRoadFilter)
390 theFPGATrackSimLogicalHitsProcessAlg.LRTRoadFilter = LRTRoadFilter
392 theFPGATrackSimLogicalHitsProcessAlg.LRTRoadFinder = result.getPrimaryAndMerge(
LRTRoadFinderCfg(flags))
393 theFPGATrackSimLogicalHitsProcessAlg.NNTrackTool = result.getPrimaryAndMerge(
NNTrackToolCfg(flags))
400 if flags.Trigger.FPGATrackSim.spacePoints
and not flags.Trigger.FPGATrackSim.ActiveConfig.genScan:
402 theFPGATrackSimLogicalHitsProcessAlg.Spacepoints =
True
405 if flags.Trigger.FPGATrackSim.ActiveConfig.lrt:
406 assert flags.Trigger.FPGATrackSim.ActiveConfig.lrtUseBasicHitFilter != flags.Trigger.FPGATrackSim.ActiveConfig.lrtUseMlHitFilter,
'Inconsistent LRT hit filtering setup, need either ML of Basic filtering enabled'
407 assert flags.Trigger.FPGATrackSim.ActiveConfig.lrtUseStraightTrackHT != flags.Trigger.FPGATrackSim.ActiveConfig.lrtUseDoubletHT,
'Inconsistent LRT HT setup, need either double or strightTrack enabled'
408 theFPGATrackSimLogicalHitsProcessAlg.doLRT =
True
409 theFPGATrackSimLogicalHitsProcessAlg.LRTHitFiltering = (
not flags.Trigger.FPGATrackSim.ActiveConfig.lrtSkipHitFiltering)
411 from FPGATrackSimAlgorithms.FPGATrackSimAlgorithmConfig
import FPGATrackSimLogicalHitsProcessAlgMonitoringCfg
414 result.addEventAlgo(theFPGATrackSimLogicalHitsProcessAlg)
421 if __name__ ==
"__main__":
422 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
423 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
430 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
431 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN4
435 FinalProtoTrackChainxAODTracksKey=
"xAODFPGAProtoTracks"
436 flags.Detector.EnableCalo =
False
439 flags.Tracking.ITkMainPass.doAthenaToActsSpacePoint=
True
440 flags.Tracking.ITkMainPass.doAthenaToActsCluster=
True
441 from TrkConfig.TrkConfigFlags
import TrackingComponent
442 flags.Tracking.recoChain = [TrackingComponent.ActsChain]
443 flags.Acts.doRotCorrection =
False
446 from InDetTrackPerfMon.InDetTrackPerfMonFlags
import initializeIDTPMConfigFlags, initializeIDTPMTrkAnaConfigFlags
449 flags.PhysVal.IDTPM.outputFilePrefix =
"myIDTPM_CA"
450 flags.PhysVal.IDTPM.plotsDefFileList =
"InDetTrackPerfMon/PlotsDefFileList_default.txt"
451 flags.PhysVal.IDTPM.plotsCommonValuesFile =
"InDetTrackPerfMon/PlotsDefCommonValues.json"
452 flags.PhysVal.OutputFileName = flags.PhysVal.IDTPM.outputFilePrefix +
'.HIST.root'
453 flags.Output.doWriteAOD_IDTPM =
True
454 flags.Output.AOD_IDTPMFileName = flags.PhysVal.IDTPM.outputFilePrefix +
'.AOD_IDTPM.pool.root'
455 flags.PhysVal.IDTPM.trkAnaCfgFile =
"InDetTrackPerfMon/EFTrkAnaConfig_example.json"
459 flags.PhysVal.IDTPM.TrkAnaEF.TrigTrkKey = f
"{FinalProtoTrackChainxAODTracksKey}TrackParticles"
460 flags.PhysVal.IDTPM.TrkAnaDoubleRatio.TrigTrkKey = f
"{FinalProtoTrackChainxAODTracksKey}TrackParticles"
462 flags.PhysVal.doExample =
False
464 flags.Concurrency.NumThreads=1
466 flags.Scheduler.ShowDataDeps=
True
467 flags.Scheduler.CheckDependencies=
True
472 assert not flags.Trigger.FPGATrackSim.pipeline.startswith(
'F-4'),
"ERROR You are trying to run an F-4* pipeline! This is not yet supported!"
473 assert not flags.Trigger.FPGATrackSim.pipeline.startswith(
'F-5'),
"ERROR You are trying to run an F-5* pipeline! This is not yet supported!"
475 if (flags.Trigger.FPGATrackSim.pipeline.startswith(
'F-1')):
476 print(
"You are trying to run an F-!* pipeline! I am going to run the Data Prep chain for you and nothing else!")
477 FPGATrackSimDataPrepConfig.runDataPrepChain()
478 elif (flags.Trigger.FPGATrackSim.pipeline.startswith(
'F-2')):
479 print(
"You are trying to run an F-2* pipeline! I am auto-configuring the 1D bitshift for you, including eta pattern filters and phi road filters")
480 flags.Trigger.FPGATrackSim.Hough.etaPatternFilter =
True
481 flags.Trigger.FPGATrackSim.Hough.phiRoadFilter =
True
482 flags.Trigger.FPGATrackSim.Hough.hough1D =
True
483 flags.Trigger.FPGATrackSim.Hough.hough =
False
484 elif (flags.Trigger.FPGATrackSim.pipeline.startswith(
'F-3')):
485 print(
"You are trying to run an F-3* pipeline! I am auto-configuring the 2D HT for you, and disabling the eta pattern filter and phi road filter. Whether you wanted to or not")
486 flags.Trigger.FPGATrackSim.Hough.etaPatternFilter =
False
487 flags.Trigger.FPGATrackSim.Hough.phiRoadFilter =
False
488 flags.Trigger.FPGATrackSim.Hough.hough1D =
False
489 flags.Trigger.FPGATrackSim.Hough.hough =
True
490 elif (flags.Trigger.FPGATrackSim.pipeline !=
""):
491 raise AssertionError(
"ERROR You are trying to run the pipeline " + flags.Trigger.FPGATrackSim.pipeline +
" which is not yet supported!")
493 if (
not flags.Trigger.FPGATrackSim.pipeline.startswith(
'F-1')):
495 splitPipeline=flags.Trigger.FPGATrackSim.pipeline.split(
'-')
496 trackingOption=9999999
497 if (len(splitPipeline) > 1): trackingOption=
int(splitPipeline[1])
498 if (trackingOption < 9999999):
499 trackingOptionMod = (trackingOption % 100)
500 if (trackingOptionMod == 0):
501 print(
"You are trying to run the linearized chi2 fit as part of a pipeline! I am going to enable this for you whether you want to or not")
502 flags.Trigger.FPGATrackSim.tracking =
True
503 flags.Trigger.FPGATrackSim.Hough.trackNNAnalysis =
False
504 elif (trackingOptionMod == 10):
505 print(
"You are trying to run the NN fake rejection as part of a pipeline! I am going to enable this for you whether you want to or not")
506 flags.Trigger.FPGATrackSim.tracking =
True
507 flags.Trigger.FPGATrackSim.Hough.trackNNAnalysis =
True
509 raise AssertionError(
"ERROR Your tracking option for the pipeline = " +
str(trackingOption) +
" is not yet supported!")
511 if isinstance(flags.Trigger.FPGATrackSim.wrapperFileName, str):
512 log.info(
"wrapperFile is string, converting to list")
513 flags.Trigger.FPGATrackSim.wrapperFileName = [flags.Trigger.FPGATrackSim.wrapperFileName]
514 flags.Input.Files =
lambda f: [f.Trigger.FPGATrackSim.wrapperFileName]
517 flags = flags.cloneAndReplace(
"Tracking.ActiveConfig",
"Tracking.MainPass")
520 acc.addService(CompFactory.THistSvc(Output = [
"EXPERT DATAFILE='monitoring.root', OPT='RECREATE'"]))
522 if (flags.Trigger.FPGATrackSim.Hough.houghRootoutput):
523 acc.addService(CompFactory.THistSvc(Output = [
"TRIGFPGATrackSimHOUGHOUTPUT DATAFILE='HoughRootOutput.root', OPT='RECREATE'"]))
525 acc.addService(CompFactory.THistSvc(Output = [
"FPGATRACKSIMOUTPUT DATAFILE='test.root', OPT='RECREATE'"]))
527 if (flags.Trigger.FPGATrackSim.Hough.genScan):
528 acc.addService(CompFactory.THistSvc(Output = [
"GENSCAN DATAFILE='genscan.root', OPT='RECREATE'"]))
530 if not flags.Trigger.FPGATrackSim.wrapperFileName:
531 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
535 from xAODTruthCnv.xAODTruthCnvConfig
import GEN_AOD2xAODCfg
538 from JetRecConfig.JetRecoSteering
import addTruthPileupJetsToOutputCfg
541 if flags.Detector.EnableCalo:
542 from CaloRec.CaloRecoConfig
import CaloRecoCfg
545 if flags.Tracking.recoChain:
546 from InDetConfig.TrackRecoConfig
import InDetTrackRecoCfg
550 acc.merge(FPGATrackSimDataPrepConfig.FPGATrackSimDataPrepAlgCfg(flags))
554 if flags.Trigger.FPGATrackSim.Hough.secondStage:
555 acc.merge(FPGATrackSimSecondStageConfig.FPGATrackSimSecondStageAlgCfg(flags))
557 if flags.Trigger.FPGATrackSim.doEDMConversion:
558 acc.merge(FPGATrackSimDataPrepConfig.FPGAConversionAlgCfg(flags, name =
'FPGAConversionAlg_1st', stage =
'_1st', doActsTrk=
True, doSP=flags.Trigger.FPGATrackSim.spacePoints))
559 from FPGATrackSimPrototrackFitter.FPGATrackSimPrototrackFitterConfig
import FPGATruthDecorationCfg, FPGAProtoTrackFitCfg
561 acc.merge(
FPGATruthDecorationCfg(flags,FinalProtoTrackChainxAODTracksKey=FinalProtoTrackChainxAODTracksKey,stage=
'_1st'))
562 if not flags.Trigger.FPGATrackSim.wrapperFileName
and flags.Trigger.FPGATrackSim.runCKF:
563 from FPGATrackSimConfTools.FPGATrackExtensionConfig
import FPGATrackExtensionAlgCfg
564 acc.merge(
FPGATrackExtensionAlgCfg(flags, enableTrackStatePrinter=
False, name=
"FPGATrackExtension", ProtoTracksLocation=
"ActsProtoTracks_1stFromFPGATrack"))
566 if flags.Trigger.FPGATrackSim.writeToAOD: acc.merge(FPGATrackSimDataPrepConfig.WriteToAOD(flags,
568 finalTrackParticles=f
"{FinalProtoTrackChainxAODTracksKey}TrackParticles"))
569 if flags.Trigger.FPGATrackSim.Hough.secondStage : acc.merge(FPGATrackSimDataPrepConfig.FPGAConversionAlgCfg(flags, name =
'FPGAConversionAlg_2nd', stage =
'_2nd'))
570 if flags.Trigger.FPGATrackSim.convertUnmappedHits: acc.merge(FPGATrackSimDataPrepConfig.FPGAConversionAlgCfg(flags, name =
'FPGAConversionAlgUnmapped_1st', stage =
'Unmapped_1st', doClusters =
False))
571 if flags.Trigger.FPGATrackSim.Hough.hitFiltering : acc.merge(FPGATrackSimDataPrepConfig.FPGAConversionAlgCfg(flags, name =
'FPGAConversionAlgFiltered_1st', stage =
'Filtered_1st', doHits =
False))
574 from FPGATrackSimReporting.FPGATrackSimReportingConfig
import FPGATrackSimReportingCfg
576 perEventReports = (flags.Trigger.FPGATrackSim.sampleType !=
'skipTruth') ))
578 from InDetTrackPerfMon.InDetTrackPerfMonConfig
import InDetTrackPerfMonCfg
581 acc.store(
open(
'AnalysisConfig.pkl',
'wb'))
583 acc.foreach_component(
"FPGATrackSim*").OutputLevel=flags.Trigger.FPGATrackSim.loglevel
584 if flags.Trigger.FPGATrackSim.msgLimit!=-1:
585 acc.getService(
"MessageSvc").debugLimit = flags.Trigger.FPGATrackSim.msgLimit
586 acc.getService(
"MessageSvc").infoLimit = flags.Trigger.FPGATrackSim.msgLimit
588 statusCode = acc.run(flags.Exec.MaxEvents)
589 assert statusCode.isSuccess()
is True,
"Application execution did not succeed"