ATLAS Offline Software
Loading...
Searching...
No Matches
FPGATrackSimBankGenConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2'''
3@file FPGATrackSimBankGenConfig.py
4@author Riley Xu - rixu@cern.ch
5@date Sept 22, 2020
6@brief This file declares functions to configure components in FPGATrackSimBankGen
7'''
8
9from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
10from AthenaConfiguration.ComponentFactory import CompFactory
11from FPGATrackSimConfTools.FPGATrackSimAnalysisConfig import FPGATrackSimRoadUnionToolCfg,FPGATrackSimRoadUnionTool1DCfg,FPGATrackSimRoadUnionToolGenScanCfg
12from FPGATrackSimConfTools.FPGATrackSimDataPrepConfig import FPGATrackSimRawLogicCfg, FPGATrackSimMappingCfg, FPGATrackSimEventSelectionSvcCfg
13from AthenaCommon.SystemOfUnits import GeV
14
15
17 result=ComponentAccumulator()
18 SpacePointTool = CompFactory.FPGATrackSimSpacePointsTool()
19 SpacePointTool.Filtering = flags.Trigger.FPGATrackSim.ActiveConfig.spacePointFiltering
20 SpacePointTool.FilteringClosePoints = False
21 SpacePointTool.PhiWindow = 0.004
22 SpacePointTool.Duplication = True
23 result.setPrivateTools(SpacePointTool)
24 return result
25
27 newFlags = flags.cloneAndReplace("Trigger.FPGATrackSim.ActiveConfig", "Trigger.FPGATrackSim." + flags.Trigger.FPGATrackSim.algoTag)
28 return newFlags
29
31 result=ComponentAccumulator()
32
33 from TrkConfig.AtlasExtrapolatorConfig import AtlasExtrapolatorCfg
34 MyExtrapolator = result.popToolsAndMerge(AtlasExtrapolatorCfg(flags))
35
36 from TrkConfig.TrkTruthCreatorToolsConfig import TruthToTrackToolCfg
37 MyTruthToTrack = result.popToolsAndMerge(TruthToTrackToolCfg(flags))
38
39 FPGATrackSimSGInputTool = CompFactory.FPGATrackSimSGToRawHitsTool(maxEta=5.0, minPt=0.8 * GeV,
40 dumpHitsOnTracks=False,
41 dumpTruthIntersections=False,
42 ReadOfflineClusters=False,
43 ReadTruthTracks=True,
44 ReadOfflineTracks=False,
45 UseNominalOrigin = True,
46 Extrapolator = MyExtrapolator,
47 TruthToTrackTool = MyTruthToTrack )
48 result.setPrivateTools(FPGATrackSimSGInputTool)
49 return result
50
51def FPGATrackSimBankGenCfg(flags, **kwargs):
52
53 acc = ComponentAccumulator()
54
55 theFPGATrackSimMatrixGenAlg = CompFactory.FPGATrackSimMatrixGenAlgo()
56 theFPGATrackSimMatrixGenAlg.Clustering = True
57 theFPGATrackSimMatrixGenAlg.IdealiseGeometry = 2
58 theFPGATrackSimMatrixGenAlg.SingleSector = False
59 theFPGATrackSimMatrixGenAlg.HoughConstants = True
60 theFPGATrackSimMatrixGenAlg.DeltaPhiConstants = False
61 theFPGATrackSimMatrixGenAlg.PT_THRESHOLD = 1.0 # GeV
62 theFPGATrackSimMatrixGenAlg.D0_THRESHOLD = 2.0 # mm
63 theFPGATrackSimMatrixGenAlg.TRAIN_PDG = 13
64 theFPGATrackSimMatrixGenAlg.NBanks = 1
65
66 theFPGATrackSimMatrixGenAlg.SpacePoints = flags.Trigger.FPGATrackSim.spacePoints
67 if flags.Trigger.FPGATrackSim.spacePoints:
68 theFPGATrackSimMatrixGenAlg.SpacePointTool = acc.getPrimaryAndMerge(FPGATrackSimSpacePointsToolCfg(flags))
69 theFPGATrackSimMatrixGenAlg.minSpacePlusPixel = flags.Trigger.FPGATrackSim.minSpacePlusPixel
70
71 theFPGATrackSimMatrixGenAlg.FPGATrackSimEventSelectionSvc = acc.getPrimaryAndMerge(FPGATrackSimEventSelectionSvcCfg(flags))
72 theFPGATrackSimMatrixGenAlg.FPGATrackSimMappingSvc = acc.getPrimaryAndMerge(FPGATrackSimMappingCfg(flags))
73
74 if (flags.Trigger.FPGATrackSim.ActiveConfig.secondStage):
75 from FPGATrackSimConfTools.FPGATrackSimAnalysisConfig import FPGATrackSimTrackFitterToolCfg,FPGATrackSimOverlapRemovalToolCfg
76 from FPGATrackSimConfTools.FPGATrackSimSecondStageConfig import FPGATrackSimWindowExtensionToolCfg
77 theFPGATrackSimMatrixGenAlg.TrackFitter_1st = acc.getPrimaryAndMerge(FPGATrackSimTrackFitterToolCfg(flags))
78 theFPGATrackSimMatrixGenAlg.OverlapRemoval_1st = acc.getPrimaryAndMerge(FPGATrackSimOverlapRemovalToolCfg(flags))
79 theFPGATrackSimMatrixGenAlg.TrackExtensionTool = acc.getPrimaryAndMerge(FPGATrackSimWindowExtensionToolCfg(flags))
80 theFPGATrackSimMatrixGenAlg.SecondStage = True
81 else:
82 theFPGATrackSimMatrixGenAlg.SecondStage = False
83
84
85 # Override this. It gets set somewhere from bank_tag.
86 theFPGATrackSimMatrixGenAlg.WCmax = 2
87 theFPGATrackSimMatrixGenAlg.dropHitsAndFill = flags.dropHitsAndFill
88
89 theFPGATrackSimMatrixGenAlg.FPGATrackSimRawToLogicalHitsTool = acc.getPrimaryAndMerge(FPGATrackSimRawLogicCfg(flags))
90 if (flags.Trigger.FPGATrackSim.ActiveConfig.genScan):
91 theFPGATrackSimMatrixGenAlg.RoadFinder = acc.getPrimaryAndMerge(FPGATrackSimRoadUnionToolGenScanCfg(flags))
92 elif (flags.Trigger.FPGATrackSim.ActiveConfig.hough1D):
93 theFPGATrackSimMatrixGenAlg.RoadFinder = acc.getPrimaryAndMerge(FPGATrackSimRoadUnionTool1DCfg(flags))
94 else:
95 theFPGATrackSimMatrixGenAlg.RoadFinder = acc.getPrimaryAndMerge(FPGATrackSimRoadUnionToolCfg(flags))
96
97 from BeamSpotConditions.BeamSpotConditionsConfig import BeamSpotCondAlgCfg
98 acc.merge(BeamSpotCondAlgCfg(flags))
99
100 theFPGATrackSimMatrixGenAlg.FPGATrackSimSGToRawHitsTool = acc.popToolsAndMerge(FPGATrackSimSGToRawHitsToolCfg(flags))
101 theFPGATrackSimMatrixGenAlg.FPGATrackSimClusteringFTKTool = CompFactory.FPGATrackSimClusteringTool()
102
103 theFPGATrackSimMatrixGenAlg.sectorQPtBins = [-0.001, -0.0005, 0, 0.0005, 0.001]
104 theFPGATrackSimMatrixGenAlg.qptAbsBinning = False
105
106 acc.addEventAlgo(theFPGATrackSimMatrixGenAlg)
107
108 return acc
109
110
111if __name__ == "__main__":
112 from AthenaConfiguration.AllConfigFlags import initConfigFlags
113 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
114 flags = initConfigFlags()
115 flags.addFlag('dropHitsAndFill', False)
116
117 from AthenaCommon.Logging import logging
118 log = logging.getLogger(__name__)
119
120 flags.fillFromArgs()
121 flags.Trigger.FPGATrackSim.Hough.IdealGeoRoads = False
123
124
125
126 flags.lock()
127
128 acc=MainServicesCfg(flags)
129
130 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
131 acc.merge(PoolReadCfg(flags))
132
133 acc.merge(FPGATrackSimBankGenCfg(flags))
134 acc.store(open('FPGATrackSimMapMakerConfig.pkl','wb'))
135
136 from AthenaConfiguration.Utils import setupLoggingLevels
137 setupLoggingLevels(flags, acc)
138
139 acc.foreach_component("FPGATrackSim*").OutputLevel=flags.Trigger.FPGATrackSim.loglevel
140 if flags.Trigger.FPGATrackSim.msgLimit!=-1:
141 acc.getService("MessageSvc").debugLimit = flags.Trigger.FPGATrackSim.msgLimit
142 acc.getService("MessageSvc").infoLimit = flags.Trigger.FPGATrackSim.msgLimit
143
144 MatrixFileName="matrix.root"
145 acc.addService(CompFactory.THistSvc(Output = ["TRIGFPGATrackSimMATRIXOUT DATAFILE='"+MatrixFileName+"', OPT='RECREATE'"]))
146
147 statusCode = acc.run()
148 assert statusCode.isSuccess() is True, "Application execution did not succeed"
149