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):
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 ) )
376
377 from MuonPatternRecognitionAlgs.MuonPatternRecognitionConfig import MuonPatternRecognitionCfg
378 acc.merge(MuonPatternRecognitionCfg(flags))
379
380 else:
381 acc.merge(MuonLayerHoughAlgCfg(flags, "TrigMuonLayerHoughAlg"))
382
383 # if NSW is excluded from reconstruction (during commissioning)
384 if flags.Muon.runCommissioningChain:
385 acc.merge(MuonSegmentFinderAlgCfg(flags, name="TrigMuonSegmentMaker_"+name,SegmentCollectionName="TrackMuonSegments_withNSW"))
386 acc.merge(MuonSegmentFilterAlgCfg(flags, name="TrigMuonSegmentFilter_"+name,SegmentCollectionName="TrackMuonSegments_withNSW",
387 FilteredCollectionName="TrackMuonSegments", TrashUnFiltered=False, ThinStations=()))
388 else:
389 acc.merge(MuonSegmentFinderAlgCfg(flags, "TrigMuonSegmentMaker_"+name))
390
391
392 from MuonSegmentTrackMaker.MuonTrackMakerAlgsMonitoring import MuPatTrackBuilderMonitoring
393 if flags.Muon.runCommissioningChain:
394 acc.merge(EMEO_MuPatTrackBuilderCfg(flags, name="TrigMuPatTrackBuilder_"+name ,MuonSegmentCollection = "TrackMuonSegments", MonTool = MuPatTrackBuilderMonitoring(flags, "MuPatTrackBuilderMonitoringSA_"+name), SpectrometerTrackOutputLocation="MuonSpectrometerTracks"))
395 else:
396 acc.merge(MuPatTrackBuilderCfg(flags, name="TrigMuPatTrackBuilder_"+name ,MuonSegmentCollection = "TrackMuonSegments", MonTool = MuPatTrackBuilderMonitoring(flags, "MuPatTrackBuilderMonitoringSA_"+name)))
397
398 acc.merge(MuonStandaloneTrackParticleCnvAlgCfg(flags, name = "TrigMuonStandaloneTrackParticleCnvAlg_"+name))
399 acc.merge(MuonCombinedMuonCandidateAlgCfg(flags, name="TrigMuonCandidateAlg_"+name))
400
401 msMuonName = muNames.EFSAName
402 if 'FS' in name:
403 msMuonName = muNamesFS.EFSAName
404
405 acc.merge(MuonCreatorAlgCfg(flags, name="TrigMuonCreatorAlg_"+name, CreateSAmuons=True, TagMaps=[], MuonContainerLocation=msMuonName,
406 ExtrapolatedLocation = "HLT_MSExtrapolatedMuons_"+name, MSOnlyExtrapolatedLocation = "HLT_MSOnlyExtrapolatedMuons_"+name,
407 MonTool = MuonCreatorAlgMonitoring(flags, "MuonCreatorAlgSA_"+name)))
408
409 sequenceOut = msMuonName
410
411 return acc, sequenceOut
412
413
414
415def VDVEFMuCBCfg(flags, RoIs, name, suffix):
416 acc = ComponentAccumulator()
417 dataObjects = [( 'Muon::MdtPrepDataContainer' , 'StoreGateSvc+MDT_DriftCircles' ),
418 ( 'Muon::TgcPrepDataContainer' , 'StoreGateSvc+TGC_Measurements' ),
419 ( 'Muon::RpcPrepDataContainer' , 'StoreGateSvc+RPC_Measurements' ),
420 ( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+%s' % RoIs ),
421 ( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' ),
422 ]
423 if "FS" in name:
424 dataObjects +=[( 'MuonCandidateCollection' , 'StoreGateSvc+MuonCandidates_FS' )]
425 else:
426 dataObjects +=[( 'MuonCandidateCollection' , 'StoreGateSvc+MuonCandidates')]
427
428 if flags.Detector.GeometryCSC:
429 dataObjects += [( 'Muon::CscStripPrepDataContainer' , 'StoreGateSvc+CSC_Measurements' )]
430 if flags.Detector.GeometrysTGC and flags.Detector.GeometryMM:
431 dataObjects += [( 'Muon::MMPrepDataContainer' , 'StoreGateSvc+MM_Measurements'),
432 ( 'Muon::sTgcPrepDataContainer' , 'StoreGateSvc+STGC_Measurements') ]
433 if flags.Muon.usePhaseIIGeoSetup:
434 dataObjects += [( 'MuonR4::SpacePointContainer' , 'StoreGateSvc+MuonSpacePoints' )]
435 if flags.Detector.GeometrysTGC or flags.Detector.GeometryMM:
436 dataObjects += [( 'MuonR4::SpacePointContainer' , 'StoreGateSvc+NswSpacePoints' )]
437
438 alg = CompFactory.AthViews.ViewDataVerifier( name = "VDVMuEFCB_"+name+suffix,
439 DataObjects = dataObjects)
440 acc.addEventAlgo(alg)
441 return acc
442
443
444
445def VDVPrecMuTrkCfg(flags, name, suffix):
446 acc = ComponentAccumulator()
447
448 vdvName = "VDVMuTrkLRT" if "LRT" in name else "VDVMuTrk"
449 trkname = "LRT" if "LRT" in name else ''
450 dataObjects = [( 'xAOD::IParticleContainer' , 'StoreGateSvc+'+ getIDTracks(flags, trkname) )]
451
452 if not flags.Muon.enableTrigIDtrackReuse and suffix == '':
453 dataObjects += [( 'xAOD::TrackParticleContainer' , 'StoreGateSvc+'+getIDTracks(flags, trkname, muonIDreuse=flags.Muon.enableTrigIDtrackReuse) )]
454 else:
455 if suffix != 'idReuse':
456 MuonL2CBContainer = muNames.L2CBName+suffix
457 else:
458 MuonL2CBContainer = muNames.L2CBName
459 dataObjects += [( 'xAOD::L2CombinedMuonContainer', 'StoreGateSvc+'+MuonL2CBContainer)]
460
461 if not flags.Input.isMC:
462 dataObjects += [( 'IDCInDetBSErrContainer' , 'StoreGateSvc+PixelByteStreamErrs' ),
463 ( 'IDCInDetBSErrContainer' , 'StoreGateSvc+SCT_ByteStreamErrs' )]
464
465 alg = CompFactory.AthViews.ViewDataVerifier( name = vdvName+suffix,
466 DataObjects = dataObjects)
467 acc.addEventAlgo(alg)
468 return acc
469
470
471def VDVidReuseITkCfg(flags, suffix):
472 acc = ComponentAccumulator()
473
474 vdvName = "VDVidReuseITk"
475 dataObjects = []
476
477 from TrigInDetConfig.TrigInDetConfig import InDetExtraDataObjectsFromDataPrep
478 InDetExtraDataObjectsFromDataPrep(flags, dataObjects)
479
480 alg = CompFactory.AthViews.ViewDataVerifier( name = vdvName+suffix,
481 DataObjects = dataObjects)
482 acc.addEventAlgo(alg)
483 return acc
484
485
486def muEFCBRecoSequenceCfg( flags, RoIs, name, suffix ):
487
488
489 from MuonCombinedAlgs.MuonCombinedAlgsMonitoring import MuonCreatorAlgMonitoring
490 from MuonCombinedConfig.MuonCombinedReconstructionConfig import MuonCreatorAlgCfg, MuonCombinedAlgCfg, MuonCombinedInDetCandidateAlgCfg
491 acc = ComponentAccumulator()
492
493 acc.merge(VDVEFMuCBCfg(flags, RoIs, name, suffix))
494
495 if "FS" in name:
496 #Need to run tracking for full scan chains
497 from TrigInDetConfig.TrigInDetConfig import trigInDetFastTrackingCfg
498 acc.merge(trigInDetFastTrackingCfg( flags, roisKey=RoIs, signatureName="muonFS" ))
499
500 else:
501 acc.merge(VDVPrecMuTrkCfg(flags, name, suffix))
502
503
504 #Precision Tracking
505 from TrigInDetConfig.TrigInDetConfig import trigInDetPrecisionTrackingCfg
506 #When run in a different view than FTF some data dependencies needs to be loaded through verifier
507 #Pass verifier as an argument and it will automatically append necessary DataObjects
508 #@NOTE: Don't provide any verifier if loaded in the same view as FTF
509 if isCosmic(flags) and 'LRT' not in name:
510 trackParticles=getIDTracks(flags, name, muonIDreuse=flags.Muon.enableTrigIDtrackReuse)
511 elif 'LRT' in name:
512 muLrtFlags = getFlagsForActiveConfig(flags, "muonLRT", log)
513 acc.merge(trigInDetPrecisionTrackingCfg(muLrtFlags, rois= RoIs, signatureName="muonLRT"))
514 trackParticles = getIDTracks(muLrtFlags, name, precision=True)
515 elif 'FS' in name:
516 muFsFlags = getFlagsForActiveConfig(flags, "muonFS", log)
517 acc.merge(trigInDetPrecisionTrackingCfg(muFsFlags, rois= RoIs, signatureName="muonFS", in_view=False))
518 trackParticles = getIDTracks(muFsFlags, precision=True)
519 else:
520 muFlags = getFlagsForActiveConfig(flags, "muon", log)
521 if not flags.Muon.enableTrigIDtrackReuse and suffix == '':
522 acc.merge(trigInDetPrecisionTrackingCfg(muFlags, rois= RoIs, signatureName="muon"))
523 trackParticles=getIDTracks(muFlags, name, muonIDreuse=flags.Muon.enableTrigIDtrackReuse, precision=True, suffix=suffix)
524
525 if flags.Muon.enableTrigIDtrackReuse or suffix != '':
526 if 'LRT' not in name or 'FS' not in name:
527 if flags.GeoModel.Run > LHCPeriod.Run3:
528 acc.merge(VDVidReuseITkCfg(flags, suffix))
529 if suffix != 'idReuse':
530 MuonL2CBInputContainer = muNames.L2CBName+suffix
531 else:
532 MuonL2CBInputContainer = muNames.L2CBName
533 from TrigMuonEF.TrigMuonEFConfig import GetL2CBmuonInDetTracksAlgCfg
534 acc.merge(GetL2CBmuonInDetTracksAlgCfg(flags, name="GetL2CBInDetTracks"+suffix,
535 MuonL2CBContainerLocation=MuonL2CBInputContainer,
536 IDtrackOutputLocation="HLT_IDTrack_MuonComb_FTF"+suffix))
537
538 #Make InDetCandidates
539 acc.merge(MuonCombinedInDetCandidateAlgCfg(flags, name="TrigMuonCombinedInDetCandidateAlg_"+name+suffix,TrackParticleLocation = [trackParticles], InDetCandidateLocation="InDetCandidates_"+name+suffix))
540
541
542 #MS ID combination
543 candidatesName = "MuonCandidates"
544 if 'FS' in name:
545 candidatesName = "MuonCandidates_FS"
546
547 acc.merge(MuonCombinedAlgCfg(flags,name="TrigMuonCombinedAlg_"+name+suffix, MuonCandidateLocation=candidatesName, InDetCandidateLocation="InDetCandidates_"+name+suffix))
548
549 cbMuonName = muNames.EFCBOutInName
550 if 'FS' in name:
551 cbMuonName = muNamesFS.EFCBOutInName
552 elif 'LRT' in name:
553 cbMuonName = muNamesLRT.EFCBName
554
555
556 acc.merge(MuonCreatorAlgCfg(flags, name="TrigMuonCreatorAlgCB_"+name+suffix, MuonCandidateLocation=[candidatesName], TagMaps=["muidcoTagMap"], InDetCandidateLocation="InDetCandidates_"+name+suffix,
557 MuonContainerLocation = cbMuonName+suffix, ExtrapolatedLocation = "CBExtrapolatedMuons"+suffix,
558 MSOnlyExtrapolatedLocation = "CBMSonlyExtrapolatedMuons"+suffix, CombinedLocation = "HLT_CBCombinedMuon_"+name+suffix,
559 MonTool = MuonCreatorAlgMonitoring(flags, "MuonCreatorAlgCB_"+name+suffix)))
560
561
562
563 return acc
564
565
566def VDVMuInsideOutCfg(flags, name, candidatesName, suffix):
567 acc = ComponentAccumulator()
568 dataObjects = [( 'Muon::RpcPrepDataContainer' , 'StoreGateSvc+RPC_Measurements' ),
569 ( 'Muon::TgcPrepDataContainer' , 'StoreGateSvc+TGC_Measurements' ),
570 ( 'MuonCandidateCollection' , 'StoreGateSvc+'+candidatesName ),
571 ('Trk::SegmentCollection' , 'StoreGateSvc+TrackMuonSegments')]
572 if not isCosmic(flags): dataObjects += [( 'Muon::HoughDataPerSectorVec' , 'StoreGateSvc+HoughDataPerSectorVec')]
573 if flags.Detector.GeometryCSC:
574 dataObjects += [( 'Muon::CscPrepDataContainer' , 'StoreGateSvc+CSC_Clusters' )]
575 if flags.Detector.GeometrysTGC and flags.Detector.GeometryMM:
576 dataObjects += [( 'Muon::MMPrepDataContainer' , 'StoreGateSvc+MM_Measurements'),
577 ( 'Muon::sTgcPrepDataContainer' , 'StoreGateSvc+STGC_Measurements') ]
578
579 alg = CompFactory.AthViews.ViewDataVerifier( name = "VDVMuInsideOut_"+name+suffix,
580 DataObjects = dataObjects)
581 acc.addEventAlgo(alg)
582 return acc
583
584
585def muEFInsideOutRecoSequenceCfg(flags, RoIs, name, suffix ):
586
587 from MuonConfig.MuonSegmentFindingConfig import MuonSegmentFinderAlgCfg, MuonLayerHoughAlgCfg, MuonSegmentFilterAlgCfg
588 from MuonCombinedAlgs.MuonCombinedAlgsMonitoring import MuonCreatorAlgMonitoring
589 from MuonCombinedConfig.MuonCombinedReconstructionConfig import MuonCreatorAlgCfg, MuGirlStauAlgCfg, StauCreatorAlgCfg, MuonInDetToMuonSystemExtensionAlgCfg, MuonInsideOutRecoAlgCfg, MuonCombinedInDetCandidateAlgCfg
590 from MuonCombinedConfig.MuonCombinedRecToolsConfig import MuonInsideOutRecoToolCfg
591
592 acc = ComponentAccumulator()
593
594 candidatesName = "MuonCandidates"
595 if 'FS' in name:
596 candidatesName = "MuonCandidates_FS"
597
598 if "Late" in name:
599
600 #Need to run hough transform at start of late muon chain
601 acc.merge(MuonLayerHoughAlgCfg(flags, "TrigMuonLayerHoughAlg_"+name,MuonPatternCombinationCollection="MuonLayerHoughCombis_"+name,
602 Key_MuonLayerHoughToolHoughDataPerSectorVec="HoughDataPerSectorVec_"+name))
603
604
605 # if NSW is excluded from reconstruction (during commissioning)
606 if flags.Muon.runCommissioningChain:
607 acc.merge(MuonSegmentFinderAlgCfg(flags, name="TrigMuonSegmentMaker_"+name,SegmentCollectionName="TrackMuonSegments_withNSW",MuonLayerHoughCombisKey="MuonLayerHoughCombis_"+name))
608 acc.merge(MuonSegmentFilterAlgCfg(flags, name="TrigMuonSegmentFilter_"+name,SegmentCollectionName="TrackMuonSegments_withNSW",
609 FilteredCollectionName="TrackMuonSegments", TrashUnFiltered=False, ThinStations=()))
610 else:
611 acc.merge(MuonSegmentFinderAlgCfg(flags, "TrigMuonSegmentMaker_"+name,MuonLayerHoughCombisKey="MuonLayerHoughCombis_"+name))
612
613
614 # need to run precisions tracking for late muons, since we don't run it anywhere else
615 from TrigInDetConfig.TrigInDetConfig import trigInDetPrecisionTrackingCfg
616 muLateFlags = getFlagsForActiveConfig(flags, "muonLate", log)
617 acc.merge(trigInDetPrecisionTrackingCfg(muLateFlags, rois= RoIs, signatureName="muonLate", in_view=False))
618 trackParticles = muLateFlags.Tracking.ActiveConfig.tracks_IDTrig
619
620 #Make InDetCandidates
621 acc.merge(MuonCombinedInDetCandidateAlgCfg(flags, name="TrigMuonCombinedInDetCandidateAlg_"+name,TrackParticleLocation=[trackParticles],ForwardParticleLocation=trackParticles,InDetCandidateLocation="InDetCandidates_"+name,ExtendBulk=True))
622
623 else:
624 # for non-latemu chains, the decoding/hough transform is run in an earlier step
625 #Need PRD containers for inside-out reco
626 acc.merge(VDVMuInsideOutCfg(flags, name, candidatesName, suffix))
627
628 #Inside-out reconstruction
629
630 cbMuonName = muNames.EFCBInOutName+suffix
631 if 'Late' in name:
632 cbMuonName = recordable(cbMuonName+"_Late")
633 acc.merge(MuGirlStauAlgCfg(flags, name="TrigMuonLateInsideOutRecoAlg_"+name,InDetCandidateLocation="InDetCandidates_"+name))
634 acc.merge(StauCreatorAlgCfg(flags, name="TrigLateMuonCreatorAlg_"+name, TagMaps=["stauTagMap"], SegmentContainerName="", InDetCandidateLocation="InDetCandidates_"+name,
635 MuonContainerLocation=cbMuonName, MonTool=MuonCreatorAlgMonitoring(flags, "LateMuonCreatorAlg_"+name)))
636 else:
637 acc.merge(MuonInDetToMuonSystemExtensionAlgCfg(flags, name="TrigInDetMuonExtensionAlg_"+name+suffix, InputInDetCandidates="InDetCandidates_"+name+suffix,
638 WriteInDetCandidates="InDetCandidatesSystemExtended_"+name+suffix))
639 if 'RoI' in name:
640 ioTool = MuonInsideOutRecoToolCfg(flags, MuonLayerSegmentFinderTool="", InputSegments="TrackMuonSegments")
641 else:
642 ioTool = MuonInsideOutRecoToolCfg(flags)
643 InsideOutRecoTool = acc.popToolsAndMerge(ioTool)
644
645 acc.merge(MuonInsideOutRecoAlgCfg(flags, name="TrigMuonInsideOutRecoAlg_"+name+suffix,InDetCandidateLocation="InDetCandidatesSystemExtended_"+name+suffix, MuonCombinedInDetExtensionTool=InsideOutRecoTool))
646
647 acc.merge(MuonCreatorAlgCfg(flags, name="TrigMuonCreatorAlgInsideOut_"+name+suffix, MuonCandidateLocation=[candidatesName], TagMaps=["muGirlTagMap"],InDetCandidateLocation="InDetCandidates_"+name+suffix,
648 MuonContainerLocation = cbMuonName, ExtrapolatedLocation = "InsideOutCBExtrapolatedMuons"+suffix,
649 MSOnlyExtrapolatedLocation = "InsideOutCBMSOnlyExtrapolatedMuons"+suffix, CombinedLocation = "InsideOutCBCombinedMuon"+suffix, MonTool = MuonCreatorAlgMonitoring(flags, "MuonCreatorAlgInsideOut_"+name+suffix)))
650
651
652
653 return acc
654
655
656def VDVMuIsoCfg(flags, name, RoIs):
657 acc = ComponentAccumulator()
658 dataObjects = [( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+'+RoIs ),
659 ( 'xAOD::MuonContainer' , 'StoreGateSvc+IsoViewMuons'+name )]
660
661 alg = CompFactory.AthViews.ViewDataVerifier( name = "efMuIsoVDV"+name,
662 DataObjects = dataObjects)
663 acc.addEventAlgo(alg)
664 return acc
665
666
667def efmuisoRecoSequenceCfg( flags, RoIs, Muons, doMSiso=False ):
668
669 name = ""
670 if doMSiso:
671 name = "MS"
672 acc = VDVMuIsoCfg(flags, name, RoIs)
673
674 acc.merge(muonIDFastTrackingSequenceCfg(flags, RoIs, "muonIso"+name ))
675
676 from TrigInDetConfig.TrigInDetConfig import trigInDetPrecisionTrackingCfg
677 muIsoFlags = getFlagsForActiveConfig(flags, "muonIso"+name, log)
678 acc.merge(trigInDetPrecisionTrackingCfg(muIsoFlags, rois= RoIs, signatureName="muonIso"+name, in_view=False))
679 trackParticles = muIsoFlags.Tracking.ActiveConfig.tracks_IDTrig
680
681 # Isolation alg
682 from TrigMuonEF.TrigMuonEFConfig import TrigMuonEFTrackIsolationAlgCfg
683 acc.merge(TrigMuonEFTrackIsolationAlgCfg(flags,name="TrigEFMuIso"+name, requireCombinedMuon = not doMSiso,
684 MuonEFContainer = Muons,IdTrackParticles = trackParticles, MuonContName = muNames.EFIsoMuonName+name,
685 ptcone02Name = muNames.EFIsoMuonName+name + ".ptcone02",
686 ptcone03Name = muNames.EFIsoMuonName+name + ".ptcone03"))
687
688 return acc
689
690def VDVLateMuCfg(flags):
691 acc = ComponentAccumulator()
692 dataObjects = [( 'xAOD::MuonRoIContainer', 'StoreGateSvc+LVL1MuonRoIsBCm2' ),
693 ( 'xAOD::MuonRoIContainer', 'StoreGateSvc+LVL1MuonRoIsBCm1' ),
694 ( 'xAOD::MuonRoIContainer', 'StoreGateSvc+LVL1MuonRoIsBCp1' ),
695 ( 'xAOD::MuonRoIContainer', 'StoreGateSvc+LVL1MuonRoIsBCp2' )]
696
697 alg = CompFactory.AthViews.ViewDataVerifier( name = "efLateMuRoIVDV",
698 DataObjects = dataObjects)
699 acc.addEventAlgo(alg)
700 return acc
701
702
704
705 acc = VDVLateMuCfg(flags)
706
707 from TrigmuRoI.TrigmuRoIConfig import TrigmuRoIConfig
708 sequenceOut = "LateMuRoIs"
709 acc.merge(TrigmuRoIConfig(flags, "TrigmuRoI", outputRoIs=sequenceOut))
710
711 return acc, sequenceOut
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)