ATLAS Offline Software
Loading...
Searching...
No Matches
MuonRecoSequences.py
Go to the documentation of this file.
2# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3#
4
5from AthenaCommon.Logging import logging
6log = logging.getLogger(__name__)
7
8
9from TrigEDMConfig.TriggerEDM import recordable
10from MuonConfig.MuonBytestreamDecodeConfig import RpcBytestreamDecodeCfg, NrpcBytestreamDecodeCfg, TgcBytestreamDecodeCfg, MdtBytestreamDecodeCfg, CscBytestreamDecodeCfg, sTgcBytestreamDecodeCfg, MmBytestreamDecodeCfg
11from MuonConfig.MuonRdoDecodeConfig import RpcRDODecodeCfg, TgcRDODecodeCfg, MdtRDODecodeCfg, CscRDODecodeCfg, CscClusterBuildCfg, StgcRDODecodeCfg, MMRDODecodeCfg
12from MuonConfig.MuonRdoDecodeConfig import MuonPrdCacheNames
13from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
14from AthenaConfiguration.ComponentFactory import CompFactory
15from TrigInDetConfig.utils import getFlagsForActiveConfig
16
17CBTPname = recordable("HLT_CBCombinedMuon_RoITrackParticles")
18CBTPnameFS = recordable("HLT_CBCombinedMuon_FSTrackParticles")
19CBTPnameLRT = recordable("HLT_CBCombinedMuon_LRTTrackParticles")
20ExtrpTPname = recordable("HLT_MSExtrapolatedMuons_RoITrackParticles")
21ExtrpTPnameFS = recordable("HLT_MSExtrapolatedMuons_FSTrackParticles")
22MSextrpTPname = recordable("HLT_MSOnlyExtrapolatedMuons_FSTrackParticles")
23
24
25from AthenaConfiguration.Enums import BeamType, LHCPeriod
26
28 def __init__(self):
29 #EFSA and EFCB containers have different names
30 #for RoI and FS running. Other containers are
31 #produced in RoIs only.
32
33 self.L2SAName = recordable("HLT_MuonL2SAInfo")
34 self.L2CBName = recordable("HLT_MuonL2CBInfo")
35 self.EFSAName = "Muons"
36 self.EFCBName = "MuonsCB"
37 self.EFCBOutInName = "MuonsCBOutsideIn"
38 self.EFCBInOutName = "HLT_MuonsCBInsideOut"
39 self.EFIsoMuonName = recordable("HLT_MuonsIso")
40 self.L2forIDName = "RoIs_fromL2SAViews"
41
42 def getNames(self, name):
43
44 if "FS" in name:
45 self.EFSAName = recordable("HLT_Muons_FS")
46 self.EFCBName = recordable("HLT_MuonsCB_FS")
47 self.EFCBOutInName = "MuonsCBOutsideIn_FS"
48 if "RoI" in name:
49 self.EFSAName = recordable("HLT_Muons_RoI")
50 self.EFCBName = recordable("HLT_MuonsCB_RoI")
51 if "LRT" in name:
52 self.L2CBName = recordable("HLT_MuonL2CBInfoLRT")
53 self.EFSAName = recordable("HLT_Muons_RoI")
54 self.EFCBName = recordable("HLT_MuonsCB_LRT")
55 return self
56
57muNames = muonNames().getNames('RoI')
58muNamesFS = muonNames().getNames('FS')
59muNamesLRT = muonNames().getNames('LRT')
60
61def isCosmic(flags):
62 #FIXME: this might not be ideal criteria to determine if this is cosmic chain but used to work in Run2 and will do for now, ATR-22758
63 return (flags.Beam.Type == BeamType.Cosmics)
64
65def isLRT(name):
66 return "LRT" in name
67
68#Returns relevant track collection name
69def getIDTracks(flags, name='', muonIDreuse=False, precision=False, suffix=''):
70
71 if muonIDreuse or suffix != '':
72 if isLRT(name):
73 return 'HLT_IDTrack_MuonComb_FTF_LRT'
74 elif isCosmic(flags):
75 return 'HLT_IDTrack_MuonComb_FTF'
76 else:
77 return 'HLT_IDTrack_MuonComb_FTF'+suffix
78
79 else:
80 if precision:
81 return flags.Tracking.ActiveConfig.tracks_IDTrig
82 else:
83 if isLRT(name):
84 return flags.Trigger.InDetTracking.muonLRT.tracks_FTF
85 elif isCosmic(flags):
86 return flags.Trigger.InDetTracking.cosmics.tracks_IDTrig
87 else:
88 return flags.Trigger.InDetTracking.muon.tracks_FTF
89
90
92 result = ComponentAccumulator()
93
94 # Cache
95 dataObjects=[( 'RpcPrepDataCollection_Cache' , 'StoreGateSvc+RpcPrdCache' ),
96 ( 'TgcRdo_Cache' , 'StoreGateSvc+TgcRdoCache' ),
97 ( 'MdtCsm_Cache' , 'StoreGateSvc+MdtCsmRdoCache' ),
98 ( 'RpcPad_Cache' , 'StoreGateSvc+RpcRdoCache' ),
99 ( 'RpcCoinDataCollection_Cache' , 'StoreGateSvc+RpcCoinCache' ),
100 ( 'TgcPrepDataCollection_Cache' , 'StoreGateSvc+' + MuonPrdCacheNames.TgcCache + 'PriorBC' ),
101 ( 'TgcPrepDataCollection_Cache' , 'StoreGateSvc+' + MuonPrdCacheNames.TgcCache + 'NextBC' ),
102 ( 'TgcPrepDataCollection_Cache' , 'StoreGateSvc+' + MuonPrdCacheNames.TgcCache + 'AllBCs' ),
103 ( 'TgcPrepDataCollection_Cache' , 'StoreGateSvc+' + MuonPrdCacheNames.TgcCache ),
104 ( 'TgcCoinDataCollection_Cache' , 'StoreGateSvc+' + MuonPrdCacheNames.TgcCoinCache + 'PriorBC' ),
105 ( 'TgcCoinDataCollection_Cache' , 'StoreGateSvc+' + MuonPrdCacheNames.TgcCoinCache + 'NextBC' ),
106 ( 'TgcCoinDataCollection_Cache' , 'StoreGateSvc+' + MuonPrdCacheNames.TgcCoinCache + 'NextNextBC' ),
107 ( 'TgcCoinDataCollection_Cache' , 'StoreGateSvc+' + MuonPrdCacheNames.TgcCoinCache )
108 ]
109
110 if flags.Detector.GeometrysTGC:
111 dataObjects += [( 'sTgcPrepDataCollection_Cache' , 'StoreGateSvc+' + MuonPrdCacheNames.sTgcCache)]
112 if flags.Input.isMC:
113 dataObjects += [( 'Muon::STGC_RawDataContainer' , 'StoreGateSvc+sTGCRDO' )]
114
115 if flags.Detector.GeometryMM:
116 dataObjects += [( 'MMPrepDataCollection_Cache' , 'StoreGateSvc+' + MuonPrdCacheNames.MmCache)]
117 if flags.Input.isMC:
118 dataObjects += [( 'Muon::MM_RawDataContainer' , 'StoreGateSvc+MMRDO' )]
119
120 if flags.Detector.GeometryCSC:
121 dataObjects+=[( 'CscRawDataCollection_Cache' , 'StoreGateSvc+CscRdoCache' )]
122 if flags.Input.isMC:
123 dataObjects += [( 'CscRawDataContainer' , 'StoreGateSvc+CSCRDO' ),
124 ( 'CscRawDataCollection_Cache' , 'StoreGateSvc+CscRdoCache' )]
125
126 if flags.Input.isMC:
127 dataObjects += [( 'MdtCsmContainer' , 'StoreGateSvc+MDTCSM' ),
128 *( [( 'RpcPadContainer' , 'StoreGateSvc+RPCPAD' )] if "RPCPAD" in flags.Input.Collections else [] ),
129 *( [( 'xAOD::NRPCRDOContainer' , 'StoreGateSvc+NRPCRDO' )] if flags.Muon.enableNRPC else [] ),
130 ('TgcRdoContainer' , 'StoreGateSvc+TGCRDO' )]
131
132 if flags.Muon.usePhaseIIGeoSetup:
133 dataObjects += [('ActsTrk::GeometryContext' , 'StoreGateSvc+ActsAlignment' )]
134
135 alg = CompFactory.AthViews.ViewDataVerifier( name = "VDVMuDataPrep",
136 DataObjects = dataObjects)
137 result.addEventAlgo(alg)
138 return result
139
140
141def muonDecodeCfg(flags, RoIs):
142 acc = ComponentAccumulator()
143
144 doSeededDecoding =True
145 if 'FSRoI' in RoIs:
146 doSeededDecoding = False
147 acc.merge(MuDataPrepViewDataVerifierCfg(flags))
148
149 # Get RPC BS decoder
150 if not flags.Input.isMC:
151 rpcAcc = RpcBytestreamDecodeCfg( flags, name = "RpcRawDataProvider_"+RoIs, RoIs = RoIs, DoSeededDecoding = doSeededDecoding )
152 acc.merge( rpcAcc )
153 if flags.Muon.enableNRPC:
154 acc.merge(NrpcBytestreamDecodeCfg( flags, name="NRpcRawDataProvider_"+RoIs ))
155 # Get RPC RDO convertor
156 rpcAcc = RpcRDODecodeCfg( flags, name= "RpcRdoToRpcPrepData_"+RoIs, RoIs = RoIs, DoSeededDecoding = doSeededDecoding )
157 acc.merge( rpcAcc )
158 # Get TGC BS decoder
159 if not flags.Input.isMC:
160 tgcAcc = TgcBytestreamDecodeCfg( flags, name="TgcRawDataProvider_"+RoIs, RoIs = RoIs, DoSeededDecoding = doSeededDecoding )
161 acc.merge( tgcAcc )
162 # Get TGC RDO convertor
163 tgcAcc = TgcRDODecodeCfg( flags, name="TgcRdoToTgcPrepData_"+RoIs, RoIs = RoIs, DoSeededDecoding = doSeededDecoding )
164 acc.merge( tgcAcc )
165 # Get MDT BS decoder
166 if not flags.Input.isMC:
167 mdtAcc = MdtBytestreamDecodeCfg( flags, name="MdtRawDataProvider_"+RoIs, RoIs = RoIs, DoSeededDecoding = doSeededDecoding )
168 acc.merge( mdtAcc )
169 # Get MDT RDO convertor
170 mdtAcc = MdtRDODecodeCfg( flags, name="MdtRdoToMdtPrepData_"+RoIs, RoIs = RoIs, DoSeededDecoding = doSeededDecoding )
171 acc.merge( mdtAcc )
172 # Get CSC BS decoder
173 if flags.Detector.GeometryCSC:
174 if not flags.Input.isMC:
175 cscAcc = CscBytestreamDecodeCfg( flags, name="CscRawDataProvider_"+RoIs, RoIs = RoIs, DoSeededDecoding = doSeededDecoding )
176 acc.merge( cscAcc )
177 # Get CSC RDO convertor
178 cscAcc = CscRDODecodeCfg( flags, name="CscRdoToCscPrepData_"+RoIs, RoIs = RoIs, DoSeededDecoding = doSeededDecoding )
179 acc.merge( cscAcc )
180 # Get CSC cluster builder
181 cscAcc = CscClusterBuildCfg( flags, name="CscThresholdClusterBuilder_"+RoIs )
182 acc.merge( cscAcc )
183 #sTGC and MM BS decoder
184 if flags.Detector.GeometrysTGC and flags.Detector.GeometryMM:
185 if not flags.Input.isMC:
186 stgcAcc = sTgcBytestreamDecodeCfg(flags, name="sTgcRawDataProvider_"+RoIs, RoIs = RoIs, DoSeededDecoding = doSeededDecoding)
187 acc.merge( stgcAcc )
188 mmAcc = MmBytestreamDecodeCfg(flags, name="MMRawDataProvider_"+RoIs, RoIs = RoIs, DoSeededDecoding = doSeededDecoding)
189 acc.merge( mmAcc )
190 #sTGC and MM RDO converter
191 stgcAcc = StgcRDODecodeCfg( flags, name="StgcRdoToStgcPrepData_"+RoIs, RoIs = RoIs, DoSeededDecoding = doSeededDecoding )
192 acc.merge( stgcAcc )
193
194 mmAcc = MMRDODecodeCfg( flags, name="MMRdoToMMPrepData_"+RoIs, RoIs = RoIs, DoSeededDecoding = doSeededDecoding)
195 acc.merge( mmAcc )
196
197 return acc
198
199def muFastVDVCfg(flags, RoIs, postFix, InsideOutMode, extraLoads):
200 result=ComponentAccumulator()
201 # In insideout mode, need to inherit muon decoding objects for TGC, RPC, MDT, CSC
202 dataObjects=[]
203 if InsideOutMode:
204 dataObjects = [('Muon::TgcPrepDataContainer','StoreGateSvc+TGC_Measurements'),
205 ('TgcRdoContainer' , 'StoreGateSvc+TGCRDO'),
206 ('Muon::RpcPrepDataContainer','StoreGateSvc+RPC_Measurements'),
207 ('Muon::MdtPrepDataContainer','StoreGateSvc+MDT_DriftCircles'),
208 *( [( 'RpcPadContainer' , 'StoreGateSvc+RPCPAD' )] if "RPCPAD" in flags.Input.Collections else [] )]
209 if flags.Detector.GeometryCSC:
210 dataObjects += [('Muon::CscPrepDataContainer','StoreGateSvc+CSC_Clusters')]
211 if flags.Detector.GeometrysTGC:
212 dataObjects += [('Muon::sTgcPrepDataContainer','StoreGateSvc+STGC_Measurements')]
213 if flags.Detector.GeometryMM:
214 dataObjects += [('Muon::MMPrepDataContainer','StoreGateSvc+MM_Measurements')]
215
216 if flags.Muon.usePhaseIIGeoSetup:
217 dataObjects += [('ActsTrk::GeometryContext' , 'StoreGateSvc+ActsAlignment' )]
218
219 else:
220 dataObjects += [( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+%s' % RoIs )]
221 dataObjects += [( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' )]
222 if flags.Trigger.enableL1MuonPhase1:
223 dataObjects += [( 'xAOD::MuonRoIContainer' , 'StoreGateSvc+LVL1MuonRoIs' )]
224 else:
225 dataObjects += [( 'DataVector< LVL1::RecMuonRoI >' , 'StoreGateSvc+HLT_RecMURoIs' )]
226
227 #For L2 multi-track SA mode
228 if extraLoads:
229 dataObjects += extraLoads
230 ViewVerify = CompFactory.AthViews.ViewDataVerifier("muFastRecoVDV"+postFix, DataObjects = dataObjects)
231
232 result.addEventAlgo(ViewVerify)
233 return result
234
235def muFastRecoSequenceCfg( flags, RoIs, doFullScanID = False, InsideOutMode=False, extraLoads=None, l2mtmode=False, calib=False ):
236
237 acc = ComponentAccumulator()
238 postFix = ""
239 if InsideOutMode:
240 postFix = "IOmode"
241 elif l2mtmode:
242 postFix = "l2mtmode"
243 elif calib:
244 postFix = "Calib"
245
246 acc.merge(muFastVDVCfg(flags, RoIs, postFix, InsideOutMode, extraLoads))
247
248
249
250 from TrigL2MuonSA.TrigL2MuonSAConfig import l2MuFastAlgCfg
251 acc.merge(l2MuFastAlgCfg(flags,
252 roisKey = RoIs,
253 setup = postFix,
254 FILL_FSIDRoI = doFullScanID,
255 MuonL2SAInfo = muNames.L2SAName+postFix,
256 L2IOCB = muNames.L2CBName+postFix,
257 forID = muNames.L2forIDName+postFix,
258 forMS = "forMS"+postFix,
259 TrackParticlesContainerName = getIDTracks(flags)))
260
261
262 return acc
263
264def muonIDtrackVDVCfg( flags, name, RoIs, extraLoads=None, extraLoadsForl2mtmode=None ):
265 result=ComponentAccumulator()
266 dataObjects=[( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+%s' % RoIs )]
267 if extraLoads:
268 dataObjects += extraLoads
269 if extraLoadsForl2mtmode:
270 dataObjects += extraLoadsForl2mtmode
271 ViewVerify = CompFactory.AthViews.ViewDataVerifier("muCombVDV"+name, DataObjects = dataObjects)
272
273 result.addEventAlgo(ViewVerify)
274 return result
275
276def muonIDFastTrackingSequenceCfg( flags, RoIs, name, extraLoads=None, extraLoadsForl2mtmode=None, doLRT=False, trackingMode="FTF" ):
277
278 acc = ComponentAccumulator()
279 from TrigInDetConfig.TrigInDetConfig import trigInDetFastTrackingCfg
280 acc.merge(trigInDetFastTrackingCfg( flags, roisKey=RoIs, signatureName=name, patternMode=trackingMode ))
281
282 acc.merge(muonIDtrackVDVCfg(flags, name, RoIs, extraLoads, extraLoadsForl2mtmode))
283
284 return acc
285
286def muonIDCosmicTrackingSequenceCfg( flags, RoIs, name, extraLoads=None, extraLoadsForl2mtmode=None ):
287
288 acc = ComponentAccumulator()
289
290 acc.merge(muonIDtrackVDVCfg(flags, 'cosmics', RoIs, extraLoads, extraLoadsForl2mtmode))
291
292 flagsWithTrk = getFlagsForActiveConfig(flags, "cosmics", log)
293
294 from TrigInDetConfig.InnerTrackingTrigSequence import InnerTrackingTrigSequence
295 seq = InnerTrackingTrigSequence.create(flagsWithTrk,
296 flagsWithTrk.Tracking.ActiveConfig.input_name,
297 rois = RoIs,
298 inView = "muCombVDVcosmics")
299 acc.merge(seq.sequence("Offline"))
300
301
302 return acc
303
304def muCombVDVCfg( flags, postFix):
305 result=ComponentAccumulator()
306 dataObjects=[('xAOD::L2StandAloneMuonContainer','StoreGateSvc+%s' % muNames.L2SAName+postFix)]
307 ViewVerify = CompFactory.AthViews.ViewDataVerifier("muCombAlgVDV"+postFix, DataObjects = dataObjects)
308 result.addEventAlgo(ViewVerify)
309 return result
310
311
312def muCombRecoSequenceCfg( flags, RoIs, name, l2mtmode=False, l2CBname="" ):
313
314 acc = ComponentAccumulator()
315 postFix = ""
316 if l2mtmode:
317 postFix = "l2mtmode"
318
319 acc.merge(muCombVDVCfg(flags, postFix))
320 from TrigmuComb.TrigmuCombConfig import muCombCfg
321 l2trackname = getIDTracks(flags) if l2mtmode else getIDTracks(flags, name)
322 acc.merge(muCombCfg(flags, f'{postFix}_{name}', useBackExtrp=True,
323 L2StandAloneMuonContainerName = muNames.L2SAName+postFix,
324 L2CombinedMuonContainerName = l2CBname, TrackParticleContainerName = l2trackname ))
325
326 return acc
327
328def EFMuSADataPrepViewDataVerifierCfg(flags, RoIs, roiName):
329 result=ComponentAccumulator()
330 dataObjects=[( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' ),
331 ( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+%s' % RoIs )]
332
333 if flags.Muon.usePhaseIIGeoSetup:
334 dataObjects += [( 'ActsGeometryContext' , 'StoreGateSvc+ActsAlignment' )]
335
336 if flags.Input.isMC and flags.Muon.scheduleActsReco:
337 dataObjects += [( 'xAOD::MuonSimHitContainer' , 'StoreGateSvc+MDT_SDO' ),
338 ( 'xAOD::MuonSimHitContainer' , 'StoreGateSvc+MM_SDO' ),
339 ( 'xAOD::MuonSimHitContainer' , 'StoreGateSvc+RPC_SDO' ),
340 ( 'xAOD::MuonSimHitContainer' , 'StoreGateSvc+TGC_SDO' ),
341 ( 'xAOD::MuonSimHitContainer' , 'StoreGateSvc+sTGC_SDO' ),
342 ( 'McEventCollection' , 'StoreGateSvc+TruthEvent' )]
343
344 alg = CompFactory.AthViews.ViewDataVerifier( name = "VDVMuEFSA_"+roiName,
345 DataObjects = dataObjects)
346 result.addEventAlgo(alg)
347 return result
348
349
350def muEFSARecoSequenceCfg( flags, RoIs, name, useBucketFilter=False):
351
352 from MuonCombinedAlgs.MuonCombinedAlgsMonitoring import MuonCreatorAlgMonitoring
353 from MuonConfig.MuonSegmentFindingConfig import MuonSegmentFinderAlgCfg, MuonLayerHoughAlgCfg, MuonSegmentFilterAlgCfg
354 from MuonConfig.MuonTrackBuildingConfig import MuPatTrackBuilderCfg, EMEO_MuPatTrackBuilderCfg
355 from xAODTrackingCnv.xAODTrackingCnvConfig import MuonStandaloneTrackParticleCnvAlgCfg
356 from MuonCombinedConfig.MuonCombinedReconstructionConfig import MuonCombinedMuonCandidateAlgCfg, MuonCreatorAlgCfg
357
358 acc = ComponentAccumulator()
359
360 acc.merge(EFMuSADataPrepViewDataVerifierCfg(flags, RoIs, name))
361
362 if flags.Muon.usePhaseIIGeoSetup and flags.Muon.scheduleActsReco:
363
364 # Schedule truth segment maker and truth hit association.
365 if flags.Input.isMC:
366 from xAODTruthCnv.xAODTruthCnvConfig import GEN_AOD2xAODCfg
367 acc.merge(GEN_AOD2xAODCfg(flags))
368 from MuonTruthAlgsR4.MuonTruthAlgsConfig import MuonTruthAlgsCfg
369 acc.merge(MuonTruthAlgsCfg(flags))
370 from MuonObjectMarker.ObjectMarkerConfig import TruthMeasMarkerAlgCfg
371 acc.merge(TruthMeasMarkerAlgCfg(flags))
372
373 # Schedule muon EF reco
374 from MuonSpacePointFormation.SpacePointFormationConfig import MuonSpacePointFormationCfg
375 acc.merge( MuonSpacePointFormationCfg( flags, suffix =f'_{name}' ) )
376
377
378 if useBucketFilter:
379 from MuonInference.InferenceConfig import GraphBucketFilterToolCfg, GraphInferenceAlgCfg
380 bucketTool = acc.popToolsAndMerge( GraphBucketFilterToolCfg(flags, name=f"GraphBucketFilterTool_{name}",
381 ReadSpacePoints=f"MuonSpacePoints_{name}",
382 WriteSpacePointKey=f"FilteredMlBuckets_{name}"))
383 acc.merge(GraphInferenceAlgCfg(flags, name=f"GraphInferenceAlg_{name}", InferenceTools=[bucketTool]))
384
385
386 from MuonPatternRecognitionAlgs.MuonPatternRecognitionConfig import MuonPatternRecognitionCfg
387 acc.merge(MuonPatternRecognitionCfg(flags, suffix = f'_{name}'))
388
389 if useBucketFilter:
390 # Change the input container to use filtered buckets
391 acc.getEventAlgo(f"MuonEtaHoughTransformAlg_{name}").SpacePointContainer = f"FilteredMlBuckets_{name}"
392
393 else:
394 acc.merge(MuonLayerHoughAlgCfg(flags, "TrigMuonLayerHoughAlg"))
395
396 # if NSW is excluded from reconstruction (during commissioning)
397 if flags.Muon.runCommissioningChain:
398 acc.merge(MuonSegmentFinderAlgCfg(flags, name="TrigMuonSegmentMaker_"+name,SegmentCollectionName="TrackMuonSegments_withNSW"))
399 acc.merge(MuonSegmentFilterAlgCfg(flags, name="TrigMuonSegmentFilter_"+name,SegmentCollectionName="TrackMuonSegments_withNSW",
400 FilteredCollectionName="TrackMuonSegments", TrashUnFiltered=False, ThinStations=()))
401 else:
402 acc.merge(MuonSegmentFinderAlgCfg(flags, "TrigMuonSegmentMaker_"+name))
403
404
405 from MuonSegmentTrackMaker.MuonTrackMakerAlgsMonitoring import MuPatTrackBuilderMonitoring
406 if flags.Muon.runCommissioningChain:
407 acc.merge(EMEO_MuPatTrackBuilderCfg(flags, name="TrigMuPatTrackBuilder_"+name ,MuonSegmentCollection = "TrackMuonSegments", MonTool = MuPatTrackBuilderMonitoring(flags, "MuPatTrackBuilderMonitoringSA_"+name), SpectrometerTrackOutputLocation="MuonSpectrometerTracks"))
408 else:
409 acc.merge(MuPatTrackBuilderCfg(flags, name="TrigMuPatTrackBuilder_"+name ,MuonSegmentCollection = "TrackMuonSegments", MonTool = MuPatTrackBuilderMonitoring(flags, "MuPatTrackBuilderMonitoringSA_"+name)))
410
411 acc.merge(MuonStandaloneTrackParticleCnvAlgCfg(flags, name = "TrigMuonStandaloneTrackParticleCnvAlg_"+name))
412 acc.merge(MuonCombinedMuonCandidateAlgCfg(flags, name="TrigMuonCandidateAlg_"+name))
413
414 msMuonName = muNames.EFSAName
415 if 'FS' in name:
416 msMuonName = muNamesFS.EFSAName
417
418 acc.merge(MuonCreatorAlgCfg(flags, name="TrigMuonCreatorAlg_"+name, CreateSAmuons=True, TagMaps=[], MuonContainerLocation=msMuonName,
419 ExtrapolatedLocation = "HLT_MSExtrapolatedMuons_"+name, MSOnlyExtrapolatedLocation = "HLT_MSOnlyExtrapolatedMuons_"+name,
420 MonTool = MuonCreatorAlgMonitoring(flags, "MuonCreatorAlgSA_"+name)))
421
422 sequenceOut = msMuonName
423
424 return acc, sequenceOut
425
426
427
428def VDVEFMuCBCfg(flags, RoIs, name, suffix):
429 acc = ComponentAccumulator()
430 dataObjects = [( 'Muon::MdtPrepDataContainer' , 'StoreGateSvc+MDT_DriftCircles' ),
431 ( 'Muon::TgcPrepDataContainer' , 'StoreGateSvc+TGC_Measurements' ),
432 ( 'Muon::RpcPrepDataContainer' , 'StoreGateSvc+RPC_Measurements' ),
433 ( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+%s' % RoIs ),
434 ( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' ),
435 ]
436 if "FS" in name:
437 dataObjects +=[( 'MuonCandidateCollection' , 'StoreGateSvc+MuonCandidates_FS' )]
438 else:
439 dataObjects +=[( 'MuonCandidateCollection' , 'StoreGateSvc+MuonCandidates')]
440
441 if flags.Detector.GeometryCSC:
442 dataObjects += [( 'Muon::CscStripPrepDataContainer' , 'StoreGateSvc+CSC_Measurements' )]
443 if flags.Detector.GeometrysTGC and flags.Detector.GeometryMM:
444 dataObjects += [( 'Muon::MMPrepDataContainer' , 'StoreGateSvc+MM_Measurements'),
445 ( 'Muon::sTgcPrepDataContainer' , 'StoreGateSvc+STGC_Measurements') ]
446 if flags.Muon.usePhaseIIGeoSetup:
447 dataObjects += [( 'MuonR4::SpacePointContainer' , 'StoreGateSvc+MuonSpacePoints' )]
448 if flags.Detector.GeometrysTGC or flags.Detector.GeometryMM:
449 dataObjects += [( 'MuonR4::SpacePointContainer' , 'StoreGateSvc+NswSpacePoints' )]
450
451 alg = CompFactory.AthViews.ViewDataVerifier( name = "VDVMuEFCB_"+name+suffix,
452 DataObjects = dataObjects)
453 acc.addEventAlgo(alg)
454 return acc
455
456
457
458def VDVPrecMuTrkCfg(flags, name, suffix):
459 acc = ComponentAccumulator()
460
461 vdvName = "VDVMuTrkLRT" if "LRT" in name else "VDVMuTrk"
462 trkname = "LRT" if "LRT" in name else ''
463 dataObjects = [( 'xAOD::IParticleContainer' , 'StoreGateSvc+'+ getIDTracks(flags, trkname) )]
464
465 if not flags.Muon.enableTrigIDtrackReuse and suffix == '':
466 dataObjects += [( 'xAOD::TrackParticleContainer' , 'StoreGateSvc+'+getIDTracks(flags, trkname, muonIDreuse=flags.Muon.enableTrigIDtrackReuse) )]
467 else:
468 if suffix != 'idReuse':
469 MuonL2CBContainer = muNames.L2CBName+suffix
470 else:
471 MuonL2CBContainer = muNames.L2CBName
472 dataObjects += [( 'xAOD::L2CombinedMuonContainer', 'StoreGateSvc+'+MuonL2CBContainer)]
473
474 if not flags.Input.isMC:
475 dataObjects += [( 'IDCInDetBSErrContainer' , 'StoreGateSvc+PixelByteStreamErrs' ),
476 ( 'IDCInDetBSErrContainer' , 'StoreGateSvc+SCT_ByteStreamErrs' )]
477
478 alg = CompFactory.AthViews.ViewDataVerifier( name = vdvName+suffix,
479 DataObjects = dataObjects)
480 acc.addEventAlgo(alg)
481 return acc
482
483
484def VDVidReuseITkCfg(flags, suffix):
485 acc = ComponentAccumulator()
486
487 vdvName = "VDVidReuseITk"
488 dataObjects = []
489
490 from TrigInDetConfig.TrigInDetConfig import InDetExtraDataObjectsFromDataPrep
491 InDetExtraDataObjectsFromDataPrep(flags, dataObjects)
492
493 alg = CompFactory.AthViews.ViewDataVerifier( name = vdvName+suffix,
494 DataObjects = dataObjects)
495 acc.addEventAlgo(alg)
496 return acc
497
498
499def muEFCBRecoSequenceCfg( flags, RoIs, name, suffix ):
500
501
502 from MuonCombinedAlgs.MuonCombinedAlgsMonitoring import MuonCreatorAlgMonitoring
503 from MuonCombinedConfig.MuonCombinedReconstructionConfig import MuonCreatorAlgCfg, MuonCombinedAlgCfg, MuonCombinedInDetCandidateAlgCfg
504 acc = ComponentAccumulator()
505
506 acc.merge(VDVEFMuCBCfg(flags, RoIs, name, suffix))
507
508 if "FS" in name:
509 #Need to run tracking for full scan chains
510 from TrigInDetConfig.TrigInDetConfig import trigInDetFastTrackingCfg
511 acc.merge(trigInDetFastTrackingCfg( flags, roisKey=RoIs, signatureName="muonFS" ))
512
513 else:
514 acc.merge(VDVPrecMuTrkCfg(flags, name, suffix))
515
516
517 #Precision Tracking
518 from TrigInDetConfig.TrigInDetConfig import trigInDetPrecisionTrackingCfg
519 #When run in a different view than FTF some data dependencies needs to be loaded through verifier
520 #Pass verifier as an argument and it will automatically append necessary DataObjects
521 #@NOTE: Don't provide any verifier if loaded in the same view as FTF
522 if isCosmic(flags) and 'LRT' not in name:
523 trackParticles=getIDTracks(flags, name, muonIDreuse=flags.Muon.enableTrigIDtrackReuse)
524 elif 'LRT' in name:
525 muLrtFlags = getFlagsForActiveConfig(flags, "muonLRT", log)
526 acc.merge(trigInDetPrecisionTrackingCfg(muLrtFlags, rois= RoIs, signatureName="muonLRT"))
527 trackParticles = getIDTracks(muLrtFlags, name, precision=True)
528 elif 'FS' in name:
529 muFsFlags = getFlagsForActiveConfig(flags, "muonFS", log)
530 acc.merge(trigInDetPrecisionTrackingCfg(muFsFlags, rois= RoIs, signatureName="muonFS", in_view=False))
531 trackParticles = getIDTracks(muFsFlags, precision=True)
532 else:
533 muFlags = getFlagsForActiveConfig(flags, "muon", log)
534 if not flags.Muon.enableTrigIDtrackReuse and suffix == '':
535 acc.merge(trigInDetPrecisionTrackingCfg(muFlags, rois= RoIs, signatureName="muon"))
536 trackParticles=getIDTracks(muFlags, name, muonIDreuse=flags.Muon.enableTrigIDtrackReuse, precision=True, suffix=suffix)
537
538 if flags.Muon.enableTrigIDtrackReuse or suffix != '':
539 if 'LRT' not in name or 'FS' not in name:
540 if flags.GeoModel.Run > LHCPeriod.Run3:
541 acc.merge(VDVidReuseITkCfg(flags, suffix))
542 if suffix != 'idReuse':
543 MuonL2CBInputContainer = muNames.L2CBName+suffix
544 else:
545 MuonL2CBInputContainer = muNames.L2CBName
546 from TrigMuonEF.TrigMuonEFConfig import GetL2CBmuonInDetTracksAlgCfg
547 acc.merge(GetL2CBmuonInDetTracksAlgCfg(flags, name="GetL2CBInDetTracks"+suffix,
548 MuonL2CBContainerLocation=MuonL2CBInputContainer,
549 IDtrackOutputLocation="HLT_IDTrack_MuonComb_FTF"+suffix))
550
551 #Make InDetCandidates
552 acc.merge(MuonCombinedInDetCandidateAlgCfg(flags, name="TrigMuonCombinedInDetCandidateAlg_"+name+suffix,TrackParticleLocation = [trackParticles], InDetCandidateLocation="InDetCandidates_"+name+suffix))
553
554
555 #MS ID combination
556 candidatesName = "MuonCandidates"
557 if 'FS' in name:
558 candidatesName = "MuonCandidates_FS"
559
560 acc.merge(MuonCombinedAlgCfg(flags,name="TrigMuonCombinedAlg_"+name+suffix, MuonCandidateLocation=candidatesName, InDetCandidateLocation="InDetCandidates_"+name+suffix))
561
562 cbMuonName = muNames.EFCBOutInName
563 if 'FS' in name:
564 cbMuonName = muNamesFS.EFCBOutInName
565 elif 'LRT' in name:
566 cbMuonName = muNamesLRT.EFCBName
567
568
569 acc.merge(MuonCreatorAlgCfg(flags, name="TrigMuonCreatorAlgCB_"+name+suffix, MuonCandidateLocation=[candidatesName], TagMaps=["muidcoTagMap"], InDetCandidateLocation="InDetCandidates_"+name+suffix,
570 MuonContainerLocation = cbMuonName+suffix, ExtrapolatedLocation = "CBExtrapolatedMuons"+suffix,
571 MSOnlyExtrapolatedLocation = "CBMSonlyExtrapolatedMuons"+suffix, CombinedLocation = "HLT_CBCombinedMuon_"+name+suffix,
572 MonTool = MuonCreatorAlgMonitoring(flags, "MuonCreatorAlgCB_"+name+suffix)))
573
574
575
576 return acc
577
578
579def VDVMuInsideOutCfg(flags, name, candidatesName, suffix):
580 acc = ComponentAccumulator()
581 dataObjects = [( 'Muon::RpcPrepDataContainer' , 'StoreGateSvc+RPC_Measurements' ),
582 ( 'Muon::TgcPrepDataContainer' , 'StoreGateSvc+TGC_Measurements' ),
583 ( 'MuonCandidateCollection' , 'StoreGateSvc+'+candidatesName ),
584 ('Trk::SegmentCollection' , 'StoreGateSvc+TrackMuonSegments')]
585 if not isCosmic(flags): dataObjects += [( 'Muon::HoughDataPerSectorVec' , 'StoreGateSvc+HoughDataPerSectorVec')]
586 if flags.Detector.GeometryCSC:
587 dataObjects += [( 'Muon::CscPrepDataContainer' , 'StoreGateSvc+CSC_Clusters' )]
588 if flags.Detector.GeometrysTGC and flags.Detector.GeometryMM:
589 dataObjects += [( 'Muon::MMPrepDataContainer' , 'StoreGateSvc+MM_Measurements'),
590 ( 'Muon::sTgcPrepDataContainer' , 'StoreGateSvc+STGC_Measurements') ]
591
592 alg = CompFactory.AthViews.ViewDataVerifier( name = "VDVMuInsideOut_"+name+suffix,
593 DataObjects = dataObjects)
594 acc.addEventAlgo(alg)
595 return acc
596
597
598def muEFInsideOutRecoSequenceCfg(flags, RoIs, name, suffix ):
599
600 from MuonConfig.MuonSegmentFindingConfig import MuonSegmentFinderAlgCfg, MuonLayerHoughAlgCfg, MuonSegmentFilterAlgCfg
601 from MuonCombinedAlgs.MuonCombinedAlgsMonitoring import MuonCreatorAlgMonitoring
602 from MuonCombinedConfig.MuonCombinedReconstructionConfig import MuonCreatorAlgCfg, MuGirlStauAlgCfg, StauCreatorAlgCfg, MuonInDetToMuonSystemExtensionAlgCfg, MuonInsideOutRecoAlgCfg, MuonCombinedInDetCandidateAlgCfg
603 from MuonCombinedConfig.MuonCombinedRecToolsConfig import MuonInsideOutRecoToolCfg
604
605 acc = ComponentAccumulator()
606
607 candidatesName = "MuonCandidates"
608 if 'FS' in name:
609 candidatesName = "MuonCandidates_FS"
610
611 if "Late" in name:
612
613 #Need to run hough transform at start of late muon chain
614 acc.merge(MuonLayerHoughAlgCfg(flags, "TrigMuonLayerHoughAlg_"+name,MuonPatternCombinationCollection="MuonLayerHoughCombis_"+name,
615 Key_MuonLayerHoughToolHoughDataPerSectorVec="HoughDataPerSectorVec_"+name))
616
617
618 # if NSW is excluded from reconstruction (during commissioning)
619 if flags.Muon.runCommissioningChain:
620 acc.merge(MuonSegmentFinderAlgCfg(flags, name="TrigMuonSegmentMaker_"+name,SegmentCollectionName="TrackMuonSegments_withNSW",MuonLayerHoughCombisKey="MuonLayerHoughCombis_"+name))
621 acc.merge(MuonSegmentFilterAlgCfg(flags, name="TrigMuonSegmentFilter_"+name,SegmentCollectionName="TrackMuonSegments_withNSW",
622 FilteredCollectionName="TrackMuonSegments", TrashUnFiltered=False, ThinStations=()))
623 else:
624 acc.merge(MuonSegmentFinderAlgCfg(flags, "TrigMuonSegmentMaker_"+name,MuonLayerHoughCombisKey="MuonLayerHoughCombis_"+name))
625
626
627 # need to run precisions tracking for late muons, since we don't run it anywhere else
628 from TrigInDetConfig.TrigInDetConfig import trigInDetPrecisionTrackingCfg
629 muLateFlags = getFlagsForActiveConfig(flags, "muonLate", log)
630 acc.merge(trigInDetPrecisionTrackingCfg(muLateFlags, rois= RoIs, signatureName="muonLate", in_view=False))
631 trackParticles = muLateFlags.Tracking.ActiveConfig.tracks_IDTrig
632
633 #Make InDetCandidates
634 acc.merge(MuonCombinedInDetCandidateAlgCfg(flags, name="TrigMuonCombinedInDetCandidateAlg_"+name,TrackParticleLocation=[trackParticles],ForwardParticleLocation=trackParticles,InDetCandidateLocation="InDetCandidates_"+name,ExtendBulk=True))
635
636 else:
637 # for non-latemu chains, the decoding/hough transform is run in an earlier step
638 #Need PRD containers for inside-out reco
639 acc.merge(VDVMuInsideOutCfg(flags, name, candidatesName, suffix))
640
641 #Inside-out reconstruction
642
643 cbMuonName = muNames.EFCBInOutName+suffix
644 if 'Late' in name:
645 cbMuonName = recordable(cbMuonName+"_Late")
646 acc.merge(MuGirlStauAlgCfg(flags, name="TrigMuonLateInsideOutRecoAlg_"+name,InDetCandidateLocation="InDetCandidates_"+name))
647 acc.merge(StauCreatorAlgCfg(flags, name="TrigLateMuonCreatorAlg_"+name, TagMaps=["stauTagMap"], SegmentContainerName="", InDetCandidateLocation="InDetCandidates_"+name,
648 MuonContainerLocation=cbMuonName, MonTool=MuonCreatorAlgMonitoring(flags, "LateMuonCreatorAlg_"+name)))
649 else:
650 acc.merge(MuonInDetToMuonSystemExtensionAlgCfg(flags, name="TrigInDetMuonExtensionAlg_"+name+suffix, InputInDetCandidates="InDetCandidates_"+name+suffix,
651 WriteInDetCandidates="InDetCandidatesSystemExtended_"+name+suffix))
652 if 'RoI' in name:
653 ioTool = MuonInsideOutRecoToolCfg(flags, MuonLayerSegmentFinderTool="", InputSegments="TrackMuonSegments")
654 else:
655 ioTool = MuonInsideOutRecoToolCfg(flags)
656 InsideOutRecoTool = acc.popToolsAndMerge(ioTool)
657
658 acc.merge(MuonInsideOutRecoAlgCfg(flags, name="TrigMuonInsideOutRecoAlg_"+name+suffix,InDetCandidateLocation="InDetCandidatesSystemExtended_"+name+suffix, MuonCombinedInDetExtensionTool=InsideOutRecoTool))
659
660 acc.merge(MuonCreatorAlgCfg(flags, name="TrigMuonCreatorAlgInsideOut_"+name+suffix, MuonCandidateLocation=[candidatesName], TagMaps=["muGirlTagMap"],InDetCandidateLocation="InDetCandidates_"+name+suffix,
661 MuonContainerLocation = cbMuonName, ExtrapolatedLocation = "InsideOutCBExtrapolatedMuons"+suffix,
662 MSOnlyExtrapolatedLocation = "InsideOutCBMSOnlyExtrapolatedMuons"+suffix, CombinedLocation = "InsideOutCBCombinedMuon"+suffix, MonTool = MuonCreatorAlgMonitoring(flags, "MuonCreatorAlgInsideOut_"+name+suffix)))
663
664 return acc
665
666
667def VDVMuIsoCfg(flags, name, RoIs):
668 acc = ComponentAccumulator()
669 dataObjects = [( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+'+RoIs ),
670 ( 'xAOD::MuonContainer' , 'StoreGateSvc+IsoViewMuons'+name )]
671
672 alg = CompFactory.AthViews.ViewDataVerifier( name = "efMuIsoVDV"+name,
673 DataObjects = dataObjects)
674 acc.addEventAlgo(alg)
675 return acc
676
677
678def efmuisoRecoSequenceCfg( flags, RoIs, Muons, doMSiso=False ):
679
680 name = ""
681 if doMSiso:
682 name = "MS"
683 acc = VDVMuIsoCfg(flags, name, RoIs)
684
685 acc.merge(muonIDFastTrackingSequenceCfg(flags, RoIs, "muonIso"+name ))
686
687 from TrigInDetConfig.TrigInDetConfig import trigInDetPrecisionTrackingCfg
688 muIsoFlags = getFlagsForActiveConfig(flags, "muonIso"+name, log)
689 acc.merge(trigInDetPrecisionTrackingCfg(muIsoFlags, rois= RoIs, signatureName="muonIso"+name, in_view=False))
690 trackParticles = muIsoFlags.Tracking.ActiveConfig.tracks_IDTrig
691
692 # Isolation alg
693 from TrigMuonEF.TrigMuonEFConfig import TrigMuonEFTrackIsolationAlgCfg
694 acc.merge(TrigMuonEFTrackIsolationAlgCfg(flags,name="TrigEFMuIso"+name, requireCombinedMuon = not doMSiso,
695 MuonEFContainer = Muons,IdTrackParticles = trackParticles, MuonContName = muNames.EFIsoMuonName+name,
696 ptcone02Name = muNames.EFIsoMuonName+name + ".ptcone02",
697 ptcone03Name = muNames.EFIsoMuonName+name + ".ptcone03"))
698
699 return acc
700
701def VDVLateMuCfg(flags):
702 acc = ComponentAccumulator()
703 dataObjects = [( 'xAOD::MuonRoIContainer', 'StoreGateSvc+LVL1MuonRoIsBCm2' ),
704 ( 'xAOD::MuonRoIContainer', 'StoreGateSvc+LVL1MuonRoIsBCm1' ),
705 ( 'xAOD::MuonRoIContainer', 'StoreGateSvc+LVL1MuonRoIsBCp1' ),
706 ( 'xAOD::MuonRoIContainer', 'StoreGateSvc+LVL1MuonRoIsBCp2' )]
707
708 alg = CompFactory.AthViews.ViewDataVerifier( name = "efLateMuRoIVDV",
709 DataObjects = dataObjects)
710 acc.addEventAlgo(alg)
711 return acc
712
713
715
716 acc = VDVLateMuCfg(flags)
717
718 from TrigmuRoI.TrigmuRoIConfig import TrigmuRoIConfig
719 sequenceOut = "LateMuRoIs"
720 acc.merge(TrigmuRoIConfig(flags, "TrigmuRoI", outputRoIs=sequenceOut))
721
722 return acc, sequenceOut
muEFSARecoSequenceCfg(flags, RoIs, name, useBucketFilter=False)
EFMuSADataPrepViewDataVerifierCfg(flags, RoIs, roiName)
muonIDFastTrackingSequenceCfg(flags, RoIs, name, extraLoads=None, extraLoadsForl2mtmode=None, doLRT=False, trackingMode="FTF")
muonIDCosmicTrackingSequenceCfg(flags, RoIs, name, extraLoads=None, extraLoadsForl2mtmode=None)
muonIDtrackVDVCfg(flags, name, RoIs, extraLoads=None, extraLoadsForl2mtmode=None)
muEFInsideOutRecoSequenceCfg(flags, RoIs, name, suffix)
getIDTracks(flags, name='', muonIDreuse=False, precision=False, suffix='')
muCombRecoSequenceCfg(flags, RoIs, name, l2mtmode=False, l2CBname="")
VDVMuInsideOutCfg(flags, name, candidatesName, suffix)
muFastVDVCfg(flags, RoIs, postFix, InsideOutMode, extraLoads)
muEFCBRecoSequenceCfg(flags, RoIs, name, suffix)
VDVEFMuCBCfg(flags, RoIs, name, suffix)
muFastRecoSequenceCfg(flags, RoIs, doFullScanID=False, InsideOutMode=False, extraLoads=None, l2mtmode=False, calib=False)
efmuisoRecoSequenceCfg(flags, RoIs, Muons, doMSiso=False)