ATLAS Offline Software
Loading...
Searching...
No Matches
TrigInDetConfig.py
Go to the documentation of this file.
2# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3#
4
5from AthenaConfiguration.AccumulatorCache import AccumulatorCache
6from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
7from AthenaConfiguration.ComponentFactory import CompFactory
8from AthenaCommon.Logging import logging
9
10def InDetExtraDataObjectsFromDataPrep(flags, dataObjects) :
11 if flags.Detector.GeometryITk:
12 if flags.Detector.EnableITkPixel:
13 dataObjects.append( ('InDet::SiDetectorElementStatus' , 'StoreGateSvc+ITkPixelDetectorElementStatus' ))
14 if flags.Detector.EnableITkStrip:
15 dataObjects.append( ('InDet::SiDetectorElementStatus' , 'StoreGateSvc+ITkStripDetectorElementStatus' ))
16
17
19 #Create IdentifiableCaches
20 acc = ComponentAccumulator()
21 InDet__CacheCreator=CompFactory.getComp("InDet::CacheCreator")
22 InDetCacheCreatorTrig = InDet__CacheCreator(name = "InDetCacheCreatorTrig",
23 TRT_DriftCircleKey = flags.Trigger.InDetTracking.TRT_DriftCircleCacheKey,
24 Pixel_ClusterKey = flags.Trigger.InDetTracking.PixelClusterCacheKey,
25 SCT_ClusterKey = flags.Trigger.InDetTracking.SCTClusterCacheKey,
26 SpacePointCachePix = flags.Trigger.InDetTracking.SpacePointCachePix,
27 SpacePointCacheSCT = flags.Trigger.InDetTracking.SpacePointCacheSCT,
28 SCTRDOCacheKey = flags.Trigger.InDetTracking.SCTRDOCacheKey,
29 SCTBSErrCacheKey = flags.Trigger.InDetTracking.SCTBSErrCacheKey,
30 SCTFlaggedCondCacheKey = flags.Trigger.InDetTracking.SCTFlaggedCondCacheKey,
31 PixRDOCacheKey = flags.Trigger.InDetTracking.PixRDOCacheKey,
32 PixBSErrCacheKey = flags.Trigger.InDetTracking.PixBSErrCacheKey,
33 TRTRDOCacheKey = flags.Trigger.InDetTracking.TRTRDOCacheKey)
34
35 if not flags.Detector.GeometryTRT:
36 InDetCacheCreatorTrig.disableTRT = True
37
38 acc.addEventAlgo( InDetCacheCreatorTrig )
39 return acc
40
42 #Create IdentifiableCaches
43 acc = ComponentAccumulator()
44
45 creator = CompFactory.ActsTrk.Cache.CreatorAlg(name="ActsCacheCreatorTrig",
46 PixelClustersCacheKey="ActsPixelClusterCache_Back",
47 StripClustersCacheKey="ActsStripClusterCache_Back",
48 PixelSpacePointCacheKey="ActsPixelSpacePointCache_Back",
49 StripSpacePointCacheKey="ActsStripSpacePointCache_Back",
50 StripOverlapSpacePointCacheKey="ActsStripOverlapSpacePointCache_Back")
51
52 acc.addEventAlgo(creator)
53
54 return acc
55
56
57
58
61@AccumulatorCache
62def trigInDetSPFormationCfg(inflags, roisKey: str, signatureName: str, in_view: bool | str = True) -> ComponentAccumulator:
63 log = logging.getLogger('trigInDetSPFormationCfg')
64 from TrigInDetConfig.utils import getFlagsForActiveConfig
65 flags = getFlagsForActiveConfig(inflags, signatureName, log)
66
67 if in_view:
68 if isinstance(in_view, bool):
69 in_view = 'VDVInDetFTF'
70 else:
71 in_view = None
72
73 from TrigInDetConfig.InnerTrackingTrigSequence import InnerTrackingTrigSequence
74 seq = InnerTrackingTrigSequence.create(flags,
75 flags.Tracking.ActiveConfig.input_name,
76 rois = roisKey,
77 inView = in_view)
78
79 return seq.sequence('spacePointFormation')
80
81
82
83
86@AccumulatorCache
87def trigInDetFastTrackingCfg( inflags, roisKey="EMRoIs", signatureName='', patternMode='FTF', in_view=True ):
88
89 log = logging.getLogger("trigInDetFastTrackingCfg")
90 from TrigInDetConfig.utils import getFlagsForActiveConfig
91 flags = getFlagsForActiveConfig(inflags, signatureName, log)
92
93 """ Generates fast tracking config, it is a primary config function """
94
95 from TrigInDetConfig.InnerTrackingTrigSequence import InnerTrackingTrigSequence
96
97 seq = InnerTrackingTrigSequence.create(flags,
98 flags.Tracking.ActiveConfig.input_name,
99 rois = roisKey,
100 inView = "VDVInDetFTF" if in_view else None)
101 if patternMode=='FTF':
102 acc = seq.sequence("FastTrackFinder")
103 elif patternMode=="fastTracking":
104 acc = seq.sequence("offlinePattern")
105
106 return acc
107
108
109
110
111
112@AccumulatorCache
113def trigInDetLRTCfg(flags, LRTInputCollection, roisKey, in_view, extra_view_inputs=tuple()):
114 from TrigInDetConfig.InnerTrackingTrigSequence import InnerTrackingTrigSequence
115 viewname = "VDVInDetLRT" if in_view else None
116 seq = InnerTrackingTrigSequence.create(flags,
117 flags.Tracking.ActiveConfig.input_name,
118 rois = roisKey,
119 inView = viewname)
120 acc = ComponentAccumulator()
121 if in_view:
122 acc.addEventAlgo( CompFactory.AthViews.ViewDataVerifier(
123 name = "LRTInputVDV_"+viewname + "_" + flags.Tracking.ActiveConfig.input_name,
124 DataObjects = { ( 'TrigRoiDescriptorCollection' , f'StoreGateSvc+{roisKey}' ),
125 ( 'TrackCollection' , 'StoreGateSvc+HLT_IDTrkTrack_FS_FTF' ),
126 } | set(extra_view_inputs) ) )
127
128 #need to make sure the cache containers are available
129 acc.merge(seq.viewDataVerifier(viewname))
130 acc.merge(seq.dataPreparation())
131 acc.merge(seq.spacePointFormation())
132
133 acc.merge(seq.fastTrackFinder(inputTracksName = LRTInputCollection))
134
135 return acc
136
137
138
139
140
141
144
145@AccumulatorCache
146def trigInDetPrecisionTrackingCfg( inflags, rois, signatureName, in_view=True ):
147
148 """ Generates precision tracking config, it is a primary config function """
149
150 acc = ComponentAccumulator()
151 log = logging.getLogger("trigInDetPrecisionTrackingCfg")
152 from TrigInDetConfig.utils import getFlagsForActiveConfig
153 flags = getFlagsForActiveConfig(inflags, signatureName, log)
154
155 if in_view:
156
157 verifier = CompFactory.AthViews.ViewDataVerifier( name = 'VDVInDetPrecision'+flags.Tracking.ActiveConfig.input_name,
158 DataObjects= {( 'xAOD::EventInfo', 'StoreGateSvc+EventInfo'),
159 ( 'SG::AuxElement' , 'StoreGateSvc+EventInfo.averageInteractionsPerCrossing'),
160 ( 'TrigRoiDescriptorCollection' , f'StoreGateSvc+{rois}' ),
161 ( 'TagInfo', 'DetectorStore+ProcessingTags' ),
162 ( ('ActsTrk::TrackContainer' if "Acts" in flags.Tracking.ActiveConfig.trkTracks_FTF else 'TrackCollection'), flags.Tracking.ActiveConfig.trkTracks_FTF )} )
163
164 acc.addEventAlgo(verifier)
165
166 from TrigInDetConfig.InnerTrackingTrigSequence import InnerTrackingTrigSequence
167
168 seq = InnerTrackingTrigSequence.create(flags,
169 flags.Tracking.ActiveConfig.input_name,
170 rois = flags.Tracking.ActiveConfig.roi,
171 inView = verifier.getName() if in_view else '')
172
173 acc.merge(seq.sequenceAfterPattern(rois = rois))
174
175 return acc
176
177
178
179
180
181def trigInDetVertexingCfg(flags, inputTracks, outputVtx):
182
183 acc = ComponentAccumulator()
184
185 acc.addEventAlgo( CompFactory.AthViews.ViewDataVerifier(
186 name = "VtxVDV_" + flags.Tracking.ActiveConfig.input_name,
187 DataObjects = {
188 ('ActsTrk::GeometryContext' , 'StoreGateSvc+ActsAlignment' )
189 }
190 ))
191
192 from InDetConfig.InDetPriVxFinderConfig import InDetTrigPriVxFinderCfg
193 acc.merge(InDetTrigPriVxFinderCfg(flags, inputTracks = inputTracks, outputVtx =outputVtx))
194
195 return acc
196
197
198
199
200if __name__ == "__main__":
201 from AthenaConfiguration.AllConfigFlags import initConfigFlags
202 from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags
203 ComponentAccumulator.debugMode = "trackCA trackPublicTool trackEventAlgo trackCondAlgo trackPrivateTool"
204 flags = initConfigFlags()
205 flags.Input.Files = defaultTestFiles.RAW_RUN2
206 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
207 flags.lock()
208 # this configuration is not runable, the test checks if there is no mistake in python scripts above
209 # output can be used by experts to check actual configuration (e.g. here we configure to run on RAW and it should be reflected in settings)
210 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
211 acc = MainServicesCfg( flags )
212 roisKey = "ElectronRoIs"
213
214 flags = flags.cloneAndReplace("Tracking.ActiveConfig", "Trigger.InDetTracking.electron")
215 acc.merge( trigInDetFastTrackingCfg( flags, roisKey=roisKey, signatureName="electron" ) )
216 acc.merge( trigInDetPrecisionTrackingCfg( flags, rois=roisKey, signatureName="electron", in_view=True) )
217 acc.merge( trigInDetVertexingCfg( flags, inputTracks=flags.Tracking.ActiveConfig.tracks_FTF, outputVtx="testVtx") )
218
219
220 acc.printConfig(withDetails=True, summariseProps=True)
221 acc.store( open("test.pkl", "wb") )
STL class.
trigInDetPrecisionTrackingCfg(inflags, rois, signatureName, in_view=True)
precision tracking
trigInDetFastTrackingCfg(inflags, roisKey="EMRoIs", signatureName='', patternMode='FTF', in_view=True)
Fast tracking.
ComponentAccumulator trigInDetSPFormationCfg(inflags, str roisKey, str signatureName, bool|str in_view=True)
Standalone Space-Point finding.
InDetExtraDataObjectsFromDataPrep(flags, dataObjects)
trigInDetVertexingCfg(flags, inputTracks, outputVtx)
trigInDetLRTCfg(flags, LRTInputCollection, roisKey, in_view, extra_view_inputs=tuple())