3 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory
import CompFactory
5 from AthenaCommon.Logging
import AthenaLogger
6 from PathResolver
import PathResolver
8 log = AthenaLogger(__name__)
11 from FPGATrackSimConfTools
import FPGATrackSimDataPrepConfig
12 from FPGATrackSimConfTools
import FPGATrackSimSecondStageConfig
17 assert(fields.startswith(
'towers'))
26 FPGATrackSimWriteOutput = CompFactory.FPGATrackSimOutputHeaderTool(
"FPGATrackSimWriteOutput")
27 FPGATrackSimWriteOutput.InFileName = [
"test.root"]
30 FPGATrackSimWriteOutput.RWstatus =
"HEADER"
31 FPGATrackSimWriteOutput.THistSvc = CompFactory.THistSvc()
32 result.addPublicTool(FPGATrackSimWriteOutput, primary=
True)
39 FPGATrackSimBankSvc = CompFactory.FPGATrackSimBankSvc()
40 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 FPGATrackSimBankSvc.constants_1st = f
'{pathBankSvc}corrgen_raw_9L_reg{flags.Trigger.FPGATrackSim.region}_checkGood1.gcon'
60 FPGATrackSimBankSvc.constants_2nd = f
'{pathBankSvc}corrgen_raw_13L_reg{flags.Trigger.FPGATrackSim.region}_checkGood1.gcon'
61 FPGATrackSimBankSvc.sectorBank_1st = f
'{pathBankSvc}sectorsHW_raw_9L_reg{flags.Trigger.FPGATrackSim.region}_checkGood1.patt'
62 FPGATrackSimBankSvc.sectorBank_2nd = f
'{pathBankSvc}sectorsHW_raw_13L_reg{flags.Trigger.FPGATrackSim.region}_checkGood1.patt'
63 FPGATrackSimBankSvc.sectorSlices = f
'{pathBankSvc}slices_9L_reg{flags.Trigger.FPGATrackSim.region}.root'
66 import FPGATrackSimConfTools.FPGATrackSimTagConfig
as FPGATrackSimTagConfig
67 bank_tag = FPGATrackSimTagConfig.getTags(stage=
'bank')[
'bank']
68 FPGATrackSimBankSvc.sectorQPtBins = bank_tag[
'sectorQPtBins']
69 FPGATrackSimBankSvc.qptAbsBinning = bank_tag[
'qptAbsBinning']
71 result.addService(FPGATrackSimBankSvc, create=
True, primary=
True)
77 RF = CompFactory.FPGATrackSimRoadUnionTool()
79 xBins = flags.Trigger.FPGATrackSim.ActiveConfig.xBins
80 xBufferBins = flags.Trigger.FPGATrackSim.ActiveConfig.xBufferBins
81 yBins = flags.Trigger.FPGATrackSim.ActiveConfig.yBins
82 yBufferBins = flags.Trigger.FPGATrackSim.ActiveConfig.yBufferBins
83 xMin = flags.Trigger.FPGATrackSim.ActiveConfig.phiMin
84 xMax = flags.Trigger.FPGATrackSim.ActiveConfig.phiMax
85 xBuffer = (xMax - xMin) / xBins * xBufferBins
88 yMin = flags.Trigger.FPGATrackSim.ActiveConfig.qptMin
89 yMax = flags.Trigger.FPGATrackSim.ActiveConfig.qptMax
90 yBuffer = (yMax - yMin) / yBins * yBufferBins
95 FPGATrackSimMapping = result.getPrimaryAndMerge(FPGATrackSimDataPrepConfig.FPGATrackSimMappingCfg(flags))
97 HoughTransform = CompFactory.FPGATrackSimHoughTransformTool(
"HoughTransform_0_" +
str(number))
98 HoughTransform.FPGATrackSimEventSelectionSvc = result.getPrimaryAndMerge(FPGATrackSimDataPrepConfig.FPGATrackSimEventSelectionCfg(flags))
100 HoughTransform.FPGATrackSimMappingSvc = FPGATrackSimMapping
101 HoughTransform.combine_layers = flags.Trigger.FPGATrackSim.ActiveConfig.combineLayers
102 HoughTransform.convSize_x = flags.Trigger.FPGATrackSim.ActiveConfig.convSizeX
103 HoughTransform.convSize_y = flags.Trigger.FPGATrackSim.ActiveConfig.convSizeY
104 HoughTransform.convolution = flags.Trigger.FPGATrackSim.ActiveConfig.convolution
105 HoughTransform.d0_max = 0
106 HoughTransform.d0_min = 0
107 HoughTransform.fieldCorrection = flags.Trigger.FPGATrackSim.ActiveConfig.fieldCorrection
108 HoughTransform.hitExtend_x = flags.Trigger.FPGATrackSim.ActiveConfig.hitExtendX
109 HoughTransform.localMaxWindowSize = flags.Trigger.FPGATrackSim.ActiveConfig.localMaxWindowSize
110 HoughTransform.nBins_x = xBins + 2 * xBufferBins
111 HoughTransform.nBins_y = yBins + 2 * yBufferBins
112 HoughTransform.phi_max = xMax
113 HoughTransform.phi_min = xMin
114 HoughTransform.qpT_max = yMax
115 HoughTransform.qpT_min = yMin
116 HoughTransform.scale = flags.Trigger.FPGATrackSim.ActiveConfig.scale
117 HoughTransform.subRegion = number
118 HoughTransform.threshold = flags.Trigger.FPGATrackSim.ActiveConfig.threshold
119 HoughTransform.traceHits =
True
120 HoughTransform.IdealGeoRoads = (flags.Trigger.FPGATrackSim.ActiveConfig.IdealGeoRoads
and flags.Trigger.FPGATrackSim.tracking)
121 HoughTransform.useSpacePoints = flags.Trigger.FPGATrackSim.spacePoints
123 tools.append(HoughTransform)
126 result.addPublicTool(RF, primary=
True)
132 RF = CompFactory.FPGATrackSimRoadUnionTool()
133 splitpt=flags.Trigger.FPGATrackSim.Hough1D.splitpt
134 FPGATrackSimMapping = result.getPrimaryAndMerge(FPGATrackSimDataPrepConfig.FPGATrackSimMappingCfg(flags))
135 for ptstep
in range(splitpt):
136 qpt_min = flags.Trigger.FPGATrackSim.Hough1D.qptMin
137 qpt_max = flags.Trigger.FPGATrackSim.Hough1D.qptMax
138 lowpt = qpt_min + (qpt_max-qpt_min)/splitpt*ptstep
139 highpt = qpt_min + (qpt_max-qpt_min)/splitpt*(ptstep+1)
141 for iSlice
in range(nSlice):
142 tool = CompFactory.FPGATrackSimHough1DShiftTool(
"Hough1DShift" +
str(iSlice)+((
"_pt{}".
format(ptstep))
if splitpt>1
else ""))
143 tool.subRegion = iSlice
if nSlice > 1
else -1
144 tool.phiMin = flags.Trigger.FPGATrackSim.Hough1D.phiMin
145 tool.phiMax = flags.Trigger.FPGATrackSim.Hough1D.phiMax
148 tool.nBins = flags.Trigger.FPGATrackSim.Hough1D.xBins
150 tool.variableExtend =
True
151 tool.drawHitMasks =
False
152 tool.phiRangeCut = flags.Trigger.FPGATrackSim.Hough1D.phiRangeCut
156 tool.threshold = flags.Trigger.FPGATrackSim.Hough1D.threshold[0]
157 tool.hitExtend = flags.Trigger.FPGATrackSim.Hough1D.hitExtendX
158 tool.FPGATrackSimEventSelectionSvc = result.getPrimaryAndMerge(FPGATrackSimDataPrepConfig.FPGATrackSimEventSelectionCfg(flags))
160 tool.FPGATrackSimMappingSvc = FPGATrackSimMapping
161 tool.IdealGeoRoads = (flags.Trigger.FPGATrackSim.ActiveConfig.IdealGeoRoads
and flags.Trigger.FPGATrackSim.tracking)
162 tool.useSpacePoints = flags.Trigger.FPGATrackSim.spacePoints
167 result.addPublicTool(RF, primary=
True)
172 DataFlowTool = CompFactory.FPGATrackSimDataFlowTool()
173 DataFlowTool.FPGATrackSimEventSelectionSvc = result.getPrimaryAndMerge(FPGATrackSimDataPrepConfig.FPGATrackSimEventSelectionCfg(flags))
174 DataFlowTool.FPGATrackSimMappingSvc = result.getPrimaryAndMerge(FPGATrackSimDataPrepConfig.FPGATrackSimMappingCfg(flags))
175 DataFlowTool.Chi2ndofCut = flags.Trigger.FPGATrackSim.ActiveConfig.chi2cut
176 DataFlowTool.THistSvc = CompFactory.THistSvc()
177 result.setPrivateTools(DataFlowTool)
182 HoughRootOutputTool = CompFactory.FPGATrackSimHoughRootOutputTool()
183 HoughRootOutputTool.FPGATrackSimEventSelectionSvc = result.getPrimaryAndMerge(FPGATrackSimDataPrepConfig.FPGATrackSimEventSelectionCfg(flags))
184 HoughRootOutputTool.FPGATrackSimMappingSvc = result.getPrimaryAndMerge(FPGATrackSimDataPrepConfig.FPGATrackSimMappingCfg(flags))
185 HoughRootOutputTool.THistSvc = CompFactory.THistSvc()
186 result.setPrivateTools(HoughRootOutputTool)
191 LRTRoadFinder =CompFactory.FPGATrackSimHoughTransform_d0phi0_Tool()
193 LRTRoadFinder.FPGATrackSimMappingSvc = result.getPrimaryAndMerge(FPGATrackSimDataPrepConfig.FPGATrackSimMappingCfg(flags))
194 LRTRoadFinder.combine_layers = flags.Trigger.FPGATrackSim.ActiveConfig.lrtStraighttrackCombineLayers
195 LRTRoadFinder.convolution = flags.Trigger.FPGATrackSim.ActiveConfig.lrtStraighttrackConvolution
196 LRTRoadFinder.hitExtend_x = flags.Trigger.FPGATrackSim.ActiveConfig.lrtStraighttrackHitExtendX
197 LRTRoadFinder.scale = flags.Trigger.FPGATrackSim.ActiveConfig.scale
198 LRTRoadFinder.threshold = flags.Trigger.FPGATrackSim.ActiveConfig.lrtStraighttrackThreshold
199 result.setPrivateTools(LRTRoadFinder)
204 NNTrackTool = CompFactory.FPGATrackSimNNTrackTool()
205 NNTrackTool.THistSvc = CompFactory.THistSvc()
206 NNTrackTool.FPGATrackSimMappingSvc = result.getPrimaryAndMerge(FPGATrackSimDataPrepConfig.FPGATrackSimMappingCfg(flags))
207 result.setPrivateTools(NNTrackTool)
212 TF_1st = CompFactory.FPGATrackSimTrackFitterTool(
"FPGATrackSimTrackFitterTool_1st")
213 TF_1st.GuessHits = flags.Trigger.FPGATrackSim.ActiveConfig.guessHits
214 TF_1st.IdealCoordFitType = flags.Trigger.FPGATrackSim.ActiveConfig.idealCoordFitType
216 TF_1st.FPGATrackSimMappingSvc = result.getPrimaryAndMerge(FPGATrackSimDataPrepConfig.FPGATrackSimMappingCfg(flags))
217 TF_1st.chi2DofRecoveryMax = flags.Trigger.FPGATrackSim.ActiveConfig.chi2DoFRecoveryMax
218 TF_1st.chi2DofRecoveryMin = flags.Trigger.FPGATrackSim.ActiveConfig.chi2DoFRecoveryMin
219 TF_1st.doMajority = flags.Trigger.FPGATrackSim.ActiveConfig.doMajority
220 TF_1st.nHits_noRecovery = flags.Trigger.FPGATrackSim.ActiveConfig.nHitsNoRecovery
221 TF_1st.DoDeltaGPhis = flags.Trigger.FPGATrackSim.ActiveConfig.doDeltaGPhis
222 TF_1st.DoMissingHitsChecks = flags.Trigger.FPGATrackSim.ActiveConfig.doMissingHitsChecks
223 result.addPublicTool(TF_1st, primary=
True)
228 OR_1st = CompFactory.FPGATrackSimOverlapRemovalTool(
"FPGATrackSimOverlapRemovalTool_1st")
229 OR_1st.ORAlgo =
"Normal"
230 OR_1st.doFastOR =flags.Trigger.FPGATrackSim.ActiveConfig.doFastOR
231 OR_1st.NumOfHitPerGrouping = 5
232 OR_1st.FPGATrackSimMappingSvc = result.getPrimaryAndMerge(FPGATrackSimDataPrepConfig.FPGATrackSimMappingCfg(flags))
233 OR_1st.MinChi2 = flags.Trigger.FPGATrackSim.ActiveConfig.chi2cut
234 if flags.Trigger.FPGATrackSim.ActiveConfig.hough:
235 OR_1st.nBins_x = flags.Trigger.FPGATrackSim.ActiveConfig.xBins + 2 * flags.Trigger.FPGATrackSim.ActiveConfig.xBufferBins
236 OR_1st.nBins_y = flags.Trigger.FPGATrackSim.ActiveConfig.yBins + 2 * flags.Trigger.FPGATrackSim.ActiveConfig.yBufferBins
237 OR_1st.localMaxWindowSize = flags.Trigger.FPGATrackSim.ActiveConfig.localMaxWindowSize
238 OR_1st.roadSliceOR = flags.Trigger.FPGATrackSim.ActiveConfig.roadSliceOR
240 result.addPublicTool(OR_1st, primary=
True)
244 newFlags = flags.cloneAndReplace(
"Trigger.FPGATrackSim.ActiveConfig",
"Trigger.FPGATrackSim." + flags.Trigger.FPGATrackSim.algoTag)
252 if not flags.Trigger.FPGATrackSim.wrapperFileName:
253 from InDetConfig.InDetPrepRawDataFormationConfig
import AthenaTrkClusterizationCfg
256 theFPGATrackSimLogicalHitsProcessAlg=CompFactory.FPGATrackSimLogicalHitsProcessAlg()
257 theFPGATrackSimLogicalHitsProcessAlg.writeOutputData = flags.Trigger.FPGATrackSim.ActiveConfig.writeOutputData
258 theFPGATrackSimLogicalHitsProcessAlg.tracking = flags.Trigger.FPGATrackSim.tracking
259 theFPGATrackSimLogicalHitsProcessAlg.DoMissingHitsChecks = flags.Trigger.FPGATrackSim.ActiveConfig.doMissingHitsChecks
260 theFPGATrackSimLogicalHitsProcessAlg.DoHoughRootOutput = flags.Trigger.FPGATrackSim.ActiveConfig.houghRootoutput
261 theFPGATrackSimLogicalHitsProcessAlg.DoNNTrack =
False
262 theFPGATrackSimLogicalHitsProcessAlg.runOnRDO =
not flags.Trigger.FPGATrackSim.wrapperFileName
263 theFPGATrackSimLogicalHitsProcessAlg.eventSelector = result.getPrimaryAndMerge(FPGATrackSimDataPrepConfig.FPGATrackSimEventSelectionCfg(flags))
264 theFPGATrackSimLogicalHitsProcessAlg.TrackScoreCut = flags.Trigger.FPGATrackSim.ActiveConfig.chi2cut
266 FPGATrackSimMaping = result.getPrimaryAndMerge(FPGATrackSimDataPrepConfig.FPGATrackSimMappingCfg(flags))
267 theFPGATrackSimLogicalHitsProcessAlg.FPGATrackSimMapping = FPGATrackSimMaping
270 if flags.Trigger.FPGATrackSim.tracking:
273 if (flags.Trigger.FPGATrackSim.ActiveConfig.hough1D):
278 if flags.Trigger.FPGATrackSim.ActiveConfig.etaPatternFilter:
279 EtaPatternFilter = CompFactory.FPGATrackSimEtaPatternFilterTool()
280 EtaPatternFilter.FPGATrackSimMappingSvc = FPGATrackSimMaping
281 EtaPatternFilter.threshold = flags.Trigger.FPGATrackSim.Hough1D.threshold[0]
282 EtaPatternFilter.EtaPatterns = flags.Trigger.FPGATrackSim.mapsDir+
"/"+FPGATrackSimDataPrepConfig.getBaseName(flags)+
".patt"
283 theFPGATrackSimLogicalHitsProcessAlg.RoadFilter = EtaPatternFilter
284 theFPGATrackSimLogicalHitsProcessAlg.FilterRoads =
True
286 if (flags.Trigger.FPGATrackSim.ActiveConfig.phiRoadFilter):
287 RoadFilter2 = CompFactory.FPGATrackSimPhiRoadFilterTool()
288 RoadFilter2.FPGATrackSimMappingSvc = FPGATrackSimMaping
289 RoadFilter2.threshold = flags.Trigger.FPGATrackSim.Hough1D.threshold[0]
290 RoadFilter2.fieldCorrection = flags.Trigger.FPGATrackSim.ActiveConfig.fieldCorrection
292 windows = [flags.Trigger.FPGATrackSim.Hough1D.phifilterwindow
for i
in range(len(flags.Trigger.FPGATrackSim.ActiveConfig.hitExtendX))]
293 RoadFilter2.window = windows
295 theFPGATrackSimLogicalHitsProcessAlg.RoadFilter2 = RoadFilter2
296 theFPGATrackSimLogicalHitsProcessAlg.FilterRoads2 =
True
301 LRTRoadFilter = CompFactory.FPGATrackSimLLPRoadFilterTool()
302 result.addPublicTool(LRTRoadFilter)
303 theFPGATrackSimLogicalHitsProcessAlg.LRTRoadFilter = LRTRoadFilter
305 theFPGATrackSimLogicalHitsProcessAlg.LRTRoadFinder = result.getPrimaryAndMerge(
LRTRoadFinderCfg(flags))
306 theFPGATrackSimLogicalHitsProcessAlg.NNTrackTool = result.getPrimaryAndMerge(
NNTrackToolCfg(flags))
313 if flags.Trigger.FPGATrackSim.spacePoints:
314 SPRoadFilter = CompFactory.FPGATrackSimSpacepointRoadFilterTool(
"FPGATrackSimSpacepointRoadFilterTool_1st")
315 SPRoadFilter.filtering = flags.Trigger.FPGATrackSim.ActiveConfig.spacePointFiltering
316 SPRoadFilter.minSpacePlusPixel = flags.Trigger.FPGATrackSim.minSpacePlusPixel
318 if (flags.Trigger.FPGATrackSim.ActiveConfig.hough1D):
319 SPRoadFilter.threshold = flags.Trigger.FPGATrackSim.Hough1D.threshold[0]
321 SPRoadFilter.threshold = flags.Trigger.FPGATrackSim.ActiveConfig.threshold[0]
322 SPRoadFilter.setSectors = (flags.Trigger.FPGATrackSim.ActiveConfig.IdealGeoRoads
and flags.Trigger.FPGATrackSim.tracking)
324 theFPGATrackSimLogicalHitsProcessAlg.SPRoadFilterTool = SPRoadFilter
325 theFPGATrackSimLogicalHitsProcessAlg.Spacepoints =
True
328 if flags.Trigger.FPGATrackSim.ActiveConfig.lrt:
329 assert flags.Trigger.FPGATrackSim.ActiveConfig.lrtUseBasicHitFilter != flags.Trigger.FPGATrackSim.ActiveConfig.lrtUseMlHitFilter,
'Inconsistent LRT hit filtering setup, need either ML of Basic filtering enabled'
330 assert flags.Trigger.FPGATrackSim.ActiveConfig.lrtUseStraightTrackHT != flags.Trigger.FPGATrackSim.ActiveConfig.lrtUseDoubletHT,
'Inconsistent LRT HT setup, need either double or strightTrack enabled'
331 theFPGATrackSimLogicalHitsProcessAlg.doLRT =
True
332 theFPGATrackSimLogicalHitsProcessAlg.LRTHitFiltering = (
not flags.Trigger.FPGATrackSim.ActiveConfig.lrtSkipHitFiltering)
334 from FPGATrackSimAlgorithms.FPGATrackSimAlgorithmConfig
import FPGATrackSimLogicalHitsProcessAlgMonitoringCfg
337 result.addEventAlgo(theFPGATrackSimLogicalHitsProcessAlg)
344 if __name__ ==
"__main__":
345 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
346 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
351 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
352 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN4
356 FinalProtoTrackChainxAODTracksKey=
"xAODFPGAProtoTracks"
357 flags.Detector.EnableCalo =
False
360 flags.Tracking.ITkMainPass.doAthenaToActsSpacePoint=
True
361 flags.Tracking.ITkMainPass.doAthenaToActsCluster=
True
362 from TrkConfig.TrkConfigFlags
import TrackingComponent
363 flags.Tracking.recoChain = [TrackingComponent.ActsChain]
364 flags.Acts.doRotCorrection =
False
367 from InDetTrackPerfMon.InDetTrackPerfMonFlags
import initializeIDTPMConfigFlags, initializeIDTPMTrkAnaConfigFlags
370 flags.PhysVal.IDTPM.outputFilePrefix =
"myIDTPM_CA"
371 flags.PhysVal.IDTPM.plotsDefFileList =
"InDetTrackPerfMon/PlotsDefFileList_default.txt"
372 flags.PhysVal.IDTPM.plotsCommonValuesFile =
"InDetTrackPerfMon/PlotsDefCommonValues.json"
373 flags.PhysVal.OutputFileName = flags.PhysVal.IDTPM.outputFilePrefix +
'.HIST.root'
374 flags.Output.doWriteAOD_IDTPM =
True
375 flags.Output.AOD_IDTPMFileName = flags.PhysVal.IDTPM.outputFilePrefix +
'.AOD_IDTPM.pool.root'
376 flags.PhysVal.IDTPM.trkAnaCfgFile =
"InDetTrackPerfMon/EFTrkAnaConfig_example.json"
380 flags.PhysVal.IDTPM.TrkAnaEF.TrigTrkKey = f
"{FinalProtoTrackChainxAODTracksKey}TrackParticles"
381 flags.PhysVal.IDTPM.TrkAnaDoubleRatio.TrigTrkKey = f
"{FinalProtoTrackChainxAODTracksKey}TrackParticles"
383 flags.PhysVal.doExample =
False
385 flags.Concurrency.NumThreads=1
387 flags.Scheduler.ShowDataDeps=
True
388 flags.Scheduler.CheckDependencies=
True
393 assert not flags.Trigger.FPGATrackSim.pipeline.startswith(
'F-4'),
"ERROR You are trying to run an F-4* pipeline! This is not yet supported!"
394 assert not flags.Trigger.FPGATrackSim.pipeline.startswith(
'F-5'),
"ERROR You are trying to run an F-5* pipeline! This is not yet supported!"
396 if (flags.Trigger.FPGATrackSim.pipeline.startswith(
'F-1')):
397 print(
"You are trying to run an F-!* pipeline! I am going to run the Data Prep chain for you and nothing else!")
398 FPGATrackSimDataPrepConfig.runDataPrepChain()
399 elif (flags.Trigger.FPGATrackSim.pipeline.startswith(
'F-2')):
400 print(
"You are trying to run an F-2* pipeline! I am auto-configuring the 1D bitshift for you, iuncluding eta pattern filters and phi road filters")
401 flags.Trigger.FPGATrackSim.Hough.etaPatternFilter =
True
402 flags.Trigger.FPGATrackSim.Hough.phiRoadFilter =
True
403 flags.Trigger.FPGATrackSim.Hough.hough1D =
True
404 flags.Trigger.FPGATrackSim.Hough.hough =
False
405 elif (flags.Trigger.FPGATrackSim.pipeline.startswith(
'F-3')):
406 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")
407 flags.Trigger.FPGATrackSim.Hough.etaPatternFilter =
False
408 flags.Trigger.FPGATrackSim.Hough.phiRoadFilter =
False
409 flags.Trigger.FPGATrackSim.Hough.hough1D =
False
410 flags.Trigger.FPGATrackSim.Hough.hough =
True
411 elif (flags.Trigger.FPGATrackSim.pipeline !=
""):
412 raise AssertionError(
"ERROR You are trying to run the pipeline " + flags.Trigger.FPGATrackSim.pipeline +
" which is not yet supported!")
414 if (
not flags.Trigger.FPGATrackSim.pipeline.startswith(
'F-1')):
416 splitPipeline=flags.Trigger.FPGATrackSim.pipeline.split(
'-')
417 trackingOption=9999999
418 if (len(splitPipeline) > 1): trackingOption=
int(splitPipeline[1])
419 if (trackingOption < 9999999):
420 trackingOptionMod = (trackingOption % 100)
421 if (trackingOptionMod == 0):
422 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")
423 flags.Trigger.FPGATrackSim.tracking =
True
424 elif (trackingOptionMod == 1):
425 raise AssertionError(
"ERROR You are trying to run the NN fake removal as part of a pipeline! This is not yet supported!")
427 raise AssertionError(
"ERROR Your tracking option for the pipeline = " +
str(trackingOption) +
" is not yet supported!")
430 if isinstance(flags.Trigger.FPGATrackSim.wrapperFileName, str):
431 log.info(
"wrapperFile is string, converting to list")
432 flags.Trigger.FPGATrackSim.wrapperFileName = [flags.Trigger.FPGATrackSim.wrapperFileName]
433 flags.Input.Files =
lambda f: [f.Trigger.FPGATrackSim.wrapperFileName]
436 flags = flags.cloneAndReplace(
"Tracking.ActiveConfig",
"Tracking.MainPass")
439 acc.addService(CompFactory.THistSvc(Output = [
"EXPERT DATAFILE='monitoring.root', OPT='RECREATE'"]))
441 if (flags.Trigger.FPGATrackSim.Hough.houghRootoutput):
442 acc.addService(CompFactory.THistSvc(Output = [
"TRIGFPGATrackSimHOUGHOUTPUT DATAFILE='HoughRootOutput.root', OPT='RECREATE'"]))
444 acc.addService(CompFactory.THistSvc(Output = [
"FPGATRACKSIMOUTPUT DATAFILE='test.root', OPT='RECREATE'"]))
447 if not flags.Trigger.FPGATrackSim.wrapperFileName:
448 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
452 from xAODTruthCnv.xAODTruthCnvConfig
import GEN_AOD2xAODCfg
455 from JetRecConfig.JetRecoSteering
import addTruthPileupJetsToOutputCfg
458 if flags.Detector.EnableCalo:
459 from CaloRec.CaloRecoConfig
import CaloRecoCfg
462 if flags.Tracking.recoChain:
463 from InDetConfig.TrackRecoConfig
import InDetTrackRecoCfg
467 acc.merge(FPGATrackSimDataPrepConfig.FPGATrackSimDataPrepAlgCfg(flags))
471 if flags.Trigger.FPGATrackSim.Hough.secondStage:
472 acc.merge(FPGATrackSimSecondStageConfig.FPGATrackSimSecondStageAlgCfg(flags))
474 if flags.Trigger.FPGATrackSim.doEDMConversion:
475 acc.merge(FPGATrackSimDataPrepConfig.FPGAConversionAlgCfg(flags, name =
'FPGAConversionAlg_1st', stage =
'_1st', doActsTrk=
True, doSP=flags.Trigger.FPGATrackSim.spacePoints))
476 from FPGATrackSimPrototrackFitter.FPGATrackSimPrototrackFitterConfig
import FPGATruthDecorationCfg, FPGAProtoTrackFitCfg
478 acc.merge(
FPGATruthDecorationCfg(flags,FinalProtoTrackChainxAODTracksKey=FinalProtoTrackChainxAODTracksKey,stage=
'_1st'))
479 if not flags.Trigger.FPGATrackSim.wrapperFileName:
480 from FPGATrackSimConfTools.FPGATrackExtensionConfig
import FPGATrackExtensionAlgCfg
481 acc.merge(
FPGATrackExtensionAlgCfg(flags, enableTrackStatePrinter=
False, name=
"FPGATrackExtension", ProtoTracksLocation=
"ActsProtoTracks_1stFromFPGATrack"))
483 if flags.Trigger.FPGATrackSim.writeToAOD: acc.merge(FPGATrackSimDataPrepConfig.WriteToAOD(flags,
485 finalTrackParticles=f
"{FinalProtoTrackChainxAODTracksKey}TrackParticles"))
486 if flags.Trigger.FPGATrackSim.Hough.secondStage : acc.merge(FPGATrackSimDataPrepConfig.FPGAConversionAlgCfg(flags, name =
'FPGAConversionAlg_2nd', stage =
'_2nd'))
487 if flags.Trigger.FPGATrackSim.convertUnmappedHits: acc.merge(FPGATrackSimDataPrepConfig.FPGAConversionAlgCfg(flags, name =
'FPGAConversionAlgUnmapped_1st', stage =
'Unmapped_1st', doClusters =
False))
488 if flags.Trigger.FPGATrackSim.Hough.hitFiltering : acc.merge(FPGATrackSimDataPrepConfig.FPGAConversionAlgCfg(flags, name =
'FPGAConversionAlgFiltered_1st', stage =
'Filtered_1st', doHits =
False))
491 from FPGATrackSimReporting.FPGATrackSimReportingConfig
import FPGATrackSimReportingCfg
495 from InDetTrackPerfMon.InDetTrackPerfMonConfig
import InDetTrackPerfMonCfg
498 acc.store(
open(
'AnalysisConfig.pkl',
'wb'))
500 statusCode = acc.run(flags.Exec.MaxEvents)
501 assert statusCode.isSuccess()
is True,
"Application execution did not succeed"