ATLAS Offline Software
TrigL2MuonSAConfig.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 #
4 # This file configs the L2MuonSA reco alg in the newJO way,
5 # but now is located here temporarily until newJO migrations are done in all trigger signatures.
6 # This should be moved at somewhere in offline.
7 
8 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
9 from AthenaConfiguration.ComponentFactory import CompFactory
10 from AthenaConfiguration.AccumulatorCache import AccumulatorCache
11 
12 
13 # Get Rpc data decoder for MuFast data preparator
14 def RpcDataPreparatorCfg( flags ):
15 
16  acc = ComponentAccumulator()
17 
18  # Set Rpc data preparator for MuFast data preparator
19  from TrigT1MuonRecRoiTool.TrigT1MuonRecRoiToolConfig import RPCRecRoiToolCfg
20  from RegionSelector.RegSelToolConfig import regSelTool_RPC_Cfg
21 
22  recRoiTool = acc.popToolsAndMerge(RPCRecRoiToolCfg(flags, useRun3Config=flags.Trigger.enableL1MuonPhase1))
23  RpcDataPreparator = CompFactory.getComp("TrigL2MuonSA::RpcDataPreparator")(
24  TrigT1RPCRecRoiTool = recRoiTool,
25  RpcClusterPreparator = CompFactory.getComp("TrigL2MuonSA::RpcClusterPreparator")(
26  TrigT1RPCRecRoiTool = recRoiTool),
27  RegSel_RPC = acc.popToolsAndMerge( regSelTool_RPC_Cfg( flags ) )
28  )
29 
30  return acc, RpcDataPreparator
31 
32 # Get Tgc data decoder for MuFast data preparator
33 def TgcDataPreparatorCfg( flags ):
34 
35  acc = ComponentAccumulator()
36 
37  # Set Tgc data preparator for MuFast data preparator
38  TgcDataPreparator = CompFactory.getComp("TrigL2MuonSA::TgcDataPreparator")()
39 
40  return acc, TgcDataPreparator
41 
42 # Get Mdt data decoder for MuFast data preparator
43 def MdtDataPreparatorCfg( flags ):
44 
45  acc = ComponentAccumulator()
46 
47  # Set Mdt data preparator for MuFast data preparator
48  from RegionSelector.RegSelToolConfig import regSelTool_MDT_Cfg
49  MdtDataPreparator = CompFactory.getComp("TrigL2MuonSA::MdtDataPreparator")(
50  RegSel_MDT = acc.popToolsAndMerge( regSelTool_MDT_Cfg( flags ) )
51  )
52  return acc, MdtDataPreparator
53 
54 # Get Csc data decoder for MuFast data preparator
55 def CscDataPreparatorCfg( flags ):
56 
57  acc = ComponentAccumulator()
58 
59  # Set Csc data preparator for MuFast data preparator
60  CscDataPreparator = CompFactory.getComp("TrigL2MuonSA::CscDataPreparator")()
61 
62  return acc, CscDataPreparator
63 
64 def StgcDataPreparatorCfg( flags ):
65 
66  acc = ComponentAccumulator()
67 
68  # Set Stgc data preparator for MuFast data preparator
69  from RegionSelector.RegSelToolConfig import regSelTool_STGC_Cfg
70  StgcDataPreparator = CompFactory.getComp("TrigL2MuonSA::StgcDataPreparator")(
71  RegSel_STGC = acc.popToolsAndMerge( regSelTool_STGC_Cfg( flags ) )
72  )
73  return acc, StgcDataPreparator
74 
75 def MmDataPreparatorCfg( flags ):
76 
77  acc = ComponentAccumulator()
78 
79  # Set Mm data preparator for MuFast data preparator
80  TrigL2MuonSA__MmDataPreparator=CompFactory.getComp("TrigL2MuonSA::MmDataPreparator")
81  MmDataPreparator = TrigL2MuonSA__MmDataPreparator()
82  from RegionSelector.RegSelToolConfig import regSelTool_MM_Cfg
83  MmDataPreparator.RegSel_MM = acc.popToolsAndMerge( regSelTool_MM_Cfg( flags ) )
84 
85  return acc, MmDataPreparator
86 
87 def RpcRoadDefinerCfg( flags ):
88 
89  acc = ComponentAccumulator()
90 
91  # Set RPC road definer for MuFast data preparator
92  from RegionSelector.RegSelToolConfig import regSelTool_MDT_Cfg
93  RpcRoadDefiner = CompFactory.getComp("TrigL2MuonSA::RpcRoadDefiner")(
94  RegionSelectionTool = acc.popToolsAndMerge( regSelTool_MDT_Cfg( flags ) )
95  )
96  return acc, RpcRoadDefiner
97 
98 def TgcRoadDefinerCfg( flags ):
99 
100  acc = ComponentAccumulator()
101 
102  # Set TGC road definer for MuFast data preparator
103  from RegionSelector.RegSelToolConfig import regSelTool_MDT_Cfg
104  TgcRoadDefiner = CompFactory.getComp("TrigL2MuonSA::TgcRoadDefiner")(
105  RegionSelectionTool = acc.popToolsAndMerge( regSelTool_MDT_Cfg( flags ) )
106  )
107  return acc, TgcRoadDefiner
108 
110 
111  acc = ComponentAccumulator()
112 
113  from RegionSelector.RegSelToolConfig import regSelTool_MDT_Cfg
114  ClusterRoadDefiner = CompFactory.getComp("TrigL2MuonSA::ClusterRoadDefiner")(
115  RegionSelectionTool = acc.popToolsAndMerge(regSelTool_MDT_Cfg(flags))
116  )
117  return acc, ClusterRoadDefiner
118 
119 
120 def muFastSteeringCfg( flags, roisKey="", setup="", **kwargs ):
121  from MuonConfig.MuonCalibrationConfig import MdtCalibrationToolCfg
122 
123  acc = ComponentAccumulator()
124 
125  # Get RPC decoder
126  rpcAcc, RpcDataPreparator = RpcDataPreparatorCfg( flags )
127  acc.merge( rpcAcc )
128 
129  # Get TGC decoder
130  tgcAcc, TgcDataPreparator = TgcDataPreparatorCfg( flags )
131  acc.merge( tgcAcc )
132 
133  # Get MDT decoder
134  mdtAcc, MdtDataPreparator = MdtDataPreparatorCfg( flags )
135  acc.merge( mdtAcc )
136 
137  # Get CSC decoder
138  if flags.Detector.GeometryCSC:
139  cscAcc, CscDataPreparator = CscDataPreparatorCfg( flags )
140  acc.merge( cscAcc )
141  else:
142  CscDataPreparator = ""
143 
144  # Get sTGC decoder
145  if flags.Detector.GeometrysTGC:
146  stgcAcc, StgcDataPreparator = StgcDataPreparatorCfg( flags )
147  acc.merge( stgcAcc )
148  else:
149  StgcDataPreparator = ""
150 
151  # Get MM decoder
152  if flags.Detector.GeometryMM:
153  mmAcc, MmDataPreparator = MmDataPreparatorCfg( flags )
154  acc.merge( mmAcc )
155  else:
156  MmDataPreparator = ""
157 
158  # Get RPC road definer
159  rpcRDAcc, RpcRoadDefiner = RpcRoadDefinerCfg( flags )
160  acc.merge( rpcRDAcc )
161 
162  # Get TGC road definer
163  tgcRDAcc, TgcRoadDefiner = TgcRoadDefinerCfg( flags )
164  acc.merge( tgcRDAcc )
165 
166  # Get Cluster Road Definer
167  clusRDAcc, ClusterRoadDefiner = ClusterRoadDefinerCfg(flags)
168  acc.merge(clusRDAcc)
169 
170  # Set MuFast data preparator
171  TrigL2MuonSA__MuFastDataPreparator=CompFactory.getComp("TrigL2MuonSA::MuFastDataPreparator")
172 
173  from TrigT1MuonRecRoiTool.TrigT1MuonRecRoiToolConfig import RPCRecRoiToolCfg
174  MuFastDataPreparator = TrigL2MuonSA__MuFastDataPreparator( CSCDataPreparator = CscDataPreparator,
175  MDTDataPreparator = MdtDataPreparator,
176  RPCDataPreparator = RpcDataPreparator,
177  TGCDataPreparator = TgcDataPreparator,
178  STGCDataPreparator = StgcDataPreparator,
179  MMDataPreparator = MmDataPreparator,
180  RpcRoadDefiner = RpcRoadDefiner,
181  TgcRoadDefiner = TgcRoadDefiner,
182  ClusterRoadDefiner = ClusterRoadDefiner,
183  TrigT1RPCRecRoiTool = acc.popToolsAndMerge(RPCRecRoiToolCfg(flags, useRun3Config=flags.Trigger.enableL1MuonPhase1)) )
184 
185  # Setup the station fitter
186  TrigL2MuonSA__MuFastStationFitter,TrigL2MuonSA__PtFromAlphaBeta=CompFactory.getComps("TrigL2MuonSA::MuFastStationFitter","TrigL2MuonSA::PtFromAlphaBeta")
187  PtFromAlphaBeta = TrigL2MuonSA__PtFromAlphaBeta()
188  PtFromAlphaBeta.useCscPt = True
189  PtFromAlphaBeta.AvoidMisalignedCSCs = False
190 
191  MuFastStationFitter = TrigL2MuonSA__MuFastStationFitter( PtFromAlphaBeta = PtFromAlphaBeta )
192  TrigL2MuonSA__MuFastPatternFinder,TrigL2MuonSA__MuFastTrackFitter,TrigL2MuonSA__MuFastTrackExtrapolator,TrigL2MuonSA__MuCalStreamerTool,TrigL2MuonSA__CscSegmentMaker=CompFactory.getComps("TrigL2MuonSA::MuFastPatternFinder","TrigL2MuonSA::MuFastTrackFitter","TrigL2MuonSA::MuFastTrackExtrapolator","TrigL2MuonSA::MuCalStreamerTool","TrigL2MuonSA::CscSegmentMaker")
193  MuFastPatternFinder = TrigL2MuonSA__MuFastPatternFinder(CalibrationTool=acc.popToolsAndMerge( MdtCalibrationToolCfg(flags)))
194  MuFastTrackFitter = TrigL2MuonSA__MuFastTrackFitter()
195  MuFastTrackExtrapolator = TrigL2MuonSA__MuFastTrackExtrapolator()
196 
197  from RegionSelector.RegSelToolConfig import regSelTool_MDT_Cfg, regSelTool_TGC_Cfg
198  MuCalStreamerTool = TrigL2MuonSA__MuCalStreamerTool(
199  RegSel_MDT = acc.popToolsAndMerge(regSelTool_MDT_Cfg(flags)),
200  RegSel_TGC = acc.popToolsAndMerge(regSelTool_TGC_Cfg(flags)) )
201 
202 
203  CscSegmentMaker = TrigL2MuonSA__CscSegmentMaker()
204 
205  if not flags.Detector.GeometrysTGC and not flags.Detector.GeometryMM:
206  MuFastStationFitter.NswStationFitter=""
207 
208  # Set Reco alg of muFast step
209  useNSW = (( not flags.Muon.runCommissioningChain ) and ( not flags.Muon.disableNSWForL2SA ))
210  from TrigL2MuonSA.TrigL2MuonSAMonitoring import TrigL2MuonSAMonitoring
211  from TrkConfig.AtlasExtrapolatorConfig import AtlasExtrapolatorCfg
212  muFastAlg = CompFactory.MuFastSteering(
213  name = "MuFastSteering_Muon"+setup,
214  DataPreparator = MuFastDataPreparator,
215  StationFitter = MuFastStationFitter,
216  PatternFinder = MuFastPatternFinder,
217  TrackFitter = MuFastTrackFitter,
218  TrackExtrapolator = MuFastTrackExtrapolator,
219  FtfRoadDefiner = CompFactory.TrigL2MuonSA.FtfRoadDefiner(
220  IOExtrapolator=acc.popToolsAndMerge(AtlasExtrapolatorCfg(flags))),
221  CalibrationStreamer = MuCalStreamerTool,
222  MuonCalibrationStream = "MuonCalibrationStream"+setup,
223  CscSegmentMaker = CscSegmentMaker,
224  MuRoIs = roisKey,
225  R_WIDTH_TGC_FAILED = 200,
226  R_WIDTH_RPC_FAILED = 400,
227  DoCalibrationStream = False,
228  USE_ROIBASEDACCESS_CSC = True,
229  # NSW on/off
230  USE_STGC = useNSW,
231  USE_MM = useNSW,
232 
234  USE_ROIBASEDACCESS_STGC= False,
235  USE_ROIBASEDACCESS_MM = False,
236 
237  RpcErrToDebugStream = True,
238  topoRoad = True,
239  dEtasurrRoI = 0.14,
240  dPhisurrRoI = 0.14,
241  MonTool = TrigL2MuonSAMonitoring(flags),
242  UseRun3Config = flags.Trigger.enableL1MuonPhase1,
243  UseEndcapInnerFromBarrel = True,
244  **kwargs )
245 
246  # Default backextrapolator is for MC Misaligned Detector
247  TrigMuonBackExtrapolator=CompFactory.TrigMuonBackExtrapolator
248  muFastAlg.BackExtrapolator = TrigMuonBackExtrapolator( name = "MisalignedBackExtrapolator",
249  Aligned = False,
250  DataSet = False )
251 
252  if setup == '900GeV':
253  muFastAlg.WinPt = 4.0
254  muFastAlg.Scale_Road_BarrelInner = 3
255  muFastAlg.Scale_Road_BarrelMiddle = 3
256  muFastAlg.Scale_Road_BarrelOuter = 3
257  else:
258  muFastAlg.WinPt = 6.0
259  muFastAlg.Scale_Road_BarrelInner = 1
260  muFastAlg.Scale_Road_BarrelMiddle = 1
261  muFastAlg.Scale_Road_BarrelOuter = 1
262 
263  if setup == 'Calib':
264  muFastAlg.DoCalibrationStream = True
265  muFastAlg.MuonCalDataScouting = False
266  muFastAlg.MuonCalBufferSize = 1024*1024
267 
268  elif setup == 'MuonCalibDataScouting':
269  muFastAlg.DoCalibrationStream = True
270  muFastAlg.MuonCalDataScouting = True
271  muFastAlg.MuonCalBufferSize = 1024*1024
272 
273  elif setup == 'l2mtmode':
274  muFastAlg.multitrackMode = True
275  muFastAlg.doEndcapForl2mt = False
276 
277  elif setup == 'IOmode':
278  # Do not run topo road and inside-out mode at the same time
279  muFastAlg.topoRoad = False
280  muFastAlg.InsideOutMode = True
281 
282  return acc, muFastAlg
283 
284 def PtBarrelLUTSvcCfg( flags ):
285 
286  acc = ComponentAccumulator()
287  ptBarrelLUTSvc = CompFactory.getComp("TrigL2MuonSA::PtBarrelLUTSvc")(name = 'PtBarrelLUTSvc')
288  ptBarrelLUTSvc.LUTfile = "pt_barrel.lut"
289  ptBarrelLUTSvc.SP_LUTfile = "pt_barrelSP_new.lut"
290 
291  acc.addService( ptBarrelLUTSvc )
292 
293  return acc, ptBarrelLUTSvc
294 
295 def PtBarrelLUTSvcCfg_MC( flags ):
296 
297  acc = ComponentAccumulator()
298  ptBarrelLUTSvc_MC = CompFactory.getComp("TrigL2MuonSA::PtBarrelLUTSvc")(name = 'PtBarrelLUTSvc_MC')
299  ptBarrelLUTSvc_MC.LUTfile = "pt_barrel.mc10.lut"
300  acc.addService( ptBarrelLUTSvc_MC )
301 
302  return acc, ptBarrelLUTSvc_MC
303 
304 def PtEndcapLUTSvcCfg( flags ):
305 
306  acc = ComponentAccumulator()
307  ptEndcapLUTSvc = CompFactory.getComp("TrigL2MuonSA::PtEndcapLUTSvc")(name = 'PtEndcapLUTSvc')
308  ptEndcapLUTSvc.FileName = "pt_endcap.lut"
309  ptEndcapLUTSvc.EMeanLUT = "pt_comb_mean.lut"
310  ptEndcapLUTSvc.ESigmaLUT = "pt_comb_sigma.lut"
311  if flags.Detector.GeometrysTGC or flags.Detector.GeometryMM:
312  ptEndcapLUTSvc.UseRun3LUT = True
313  else:
314  ptEndcapLUTSvc.UseRun3LUT = False
315  acc.addService( ptEndcapLUTSvc )
316 
317  return acc, ptEndcapLUTSvc
318 
319 def PtEndcapLUTSvcCfg_MC( flags ):
320 
321  acc = ComponentAccumulator()
322  ptEndcapLUTSvc_MC = CompFactory.getComp("TrigL2MuonSA::PtEndcapLUTSvc")(name = 'PtEndcapLUTSvc_MC')
323  ptEndcapLUTSvc_MC.FileName = "pt_endcap.mc10.lut"
324  ptEndcapLUTSvc_MC.EMeanLUT = "pt_comb_mean.lut"
325  ptEndcapLUTSvc_MC.ESigmaLUT = "pt_comb_sigma.lut"
326  if flags.Detector.GeometrysTGC or flags.Detector.GeometryMM:
327  ptEndcapLUTSvc_MC.UseRun3LUT = True
328  else:
329  ptEndcapLUTSvc_MC.UseRun3LUT = False
330  acc.addService( ptEndcapLUTSvc_MC )
331 
332  return acc, ptEndcapLUTSvc_MC
333 
334 
336 
337  acc = ComponentAccumulator()
338  alignmentBarrelLUTSvc = CompFactory.getComp("TrigL2MuonSA::AlignmentBarrelLUTSvc")(name = 'AlignmentBarrelLUTSvc')
339  alignmentBarrelLUTSvc.LUTfile = "dZ_barrel.lut"
340  acc.addService( alignmentBarrelLUTSvc )
341 
342  return acc, alignmentBarrelLUTSvc
343 
344 
345 @AccumulatorCache
346 def l2MuFastAlgCfg( flags, roisKey, setup="", **kwargs ):
347 
348  acc = ComponentAccumulator()
349 
350  if not roisKey:
351  from HLTSeeding.HLTSeedingConfig import mapThresholdToL1RoICollection
352  roisKey = mapThresholdToL1RoICollection("MU")
353 
354  # Get Reco alg of muFast step
355  muFastAcc, muFastFex = muFastSteeringCfg( flags, roisKey, setup, **kwargs )
356  acc.merge( muFastAcc )
357 
358  # Get services of the Reco alg
359  acc.merge( PtBarrelLUTSvcCfg(flags)[0] )
360  acc.merge( PtBarrelLUTSvcCfg_MC(flags)[0] )
361  acc.merge( PtEndcapLUTSvcCfg(flags)[0] )
362  acc.merge( PtEndcapLUTSvcCfg_MC(flags)[0] )
363  acc.merge( AlignmentBarrelLUTSvcCfg(flags)[0] )
364  acc.addEventAlgo(muFastFex)
365 
366  return acc
367 
368 
369 
370 if __name__ == "__main__":
371  from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultGeometryTags
372  from AthenaConfiguration.AllConfigFlags import initConfigFlags
373  flags = initConfigFlags()
374  flags.Input.Files = defaultTestFiles.RAW_RUN2
375  flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
376  flags.lock()
377 
378  cfg = l2MuFastAlgCfg(flags, roisKey="MURoIs")
379  cfg.printConfig(withDetails=True, summariseProps=True)
380  cfg.wasMerged()
TrigT1MuonRecRoiToolConfig.RPCRecRoiToolCfg
def RPCRecRoiToolCfg(flags, name="RPCRecRoiTool", useRun3Config=True)
Definition: TrigT1MuonRecRoiToolConfig.py:8
RegSelToolConfig.regSelTool_MDT_Cfg
def regSelTool_MDT_Cfg(flags)
Definition: RegSelToolConfig.py:134
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
TrigL2MuonSAConfig.l2MuFastAlgCfg
def l2MuFastAlgCfg(flags, roisKey, setup="", **kwargs)
Definition: TrigL2MuonSAConfig.py:346
RegSelToolConfig.regSelTool_STGC_Cfg
def regSelTool_STGC_Cfg(flags)
Definition: RegSelToolConfig.py:185
TrigL2MuonSAConfig.muFastSteeringCfg
def muFastSteeringCfg(flags, roisKey="", setup="", **kwargs)
Definition: TrigL2MuonSAConfig.py:120
TrigMuonBackExtrapolator
Definition: TrigMuonBackExtrapolator.h:16
RegSelToolConfig.regSelTool_TGC_Cfg
def regSelTool_TGC_Cfg(flags)
Definition: RegSelToolConfig.py:161
TrigL2MuonSAMonitoring
Definition: TrigL2MuonSAMonitoring.py:1
TrigL2MuonSAConfig.AlignmentBarrelLUTSvcCfg
def AlignmentBarrelLUTSvcCfg(flags)
Definition: TrigL2MuonSAConfig.py:335
python.AtlasExtrapolatorConfig.AtlasExtrapolatorCfg
def AtlasExtrapolatorCfg(flags, name='AtlasExtrapolator')
Definition: AtlasExtrapolatorConfig.py:63
TrigL2MuonSAConfig.StgcDataPreparatorCfg
def StgcDataPreparatorCfg(flags)
Definition: TrigL2MuonSAConfig.py:64
TrigL2MuonSAConfig.PtBarrelLUTSvcCfg
def PtBarrelLUTSvcCfg(flags)
Definition: TrigL2MuonSAConfig.py:284
TrigL2MuonSAConfig.TgcDataPreparatorCfg
def TgcDataPreparatorCfg(flags)
Definition: TrigL2MuonSAConfig.py:33
TrigL2MuonSAConfig.PtEndcapLUTSvcCfg
def PtEndcapLUTSvcCfg(flags)
Definition: TrigL2MuonSAConfig.py:304
TrigL2MuonSAConfig.MmDataPreparatorCfg
def MmDataPreparatorCfg(flags)
Definition: TrigL2MuonSAConfig.py:75
python.MuonCalibrationConfig.MdtCalibrationToolCfg
def MdtCalibrationToolCfg(flags, name="MdtCalibrationTool", **kwargs)
Definition: MuonCalibrationConfig.py:82
TrigL2MuonSAConfig.MdtDataPreparatorCfg
def MdtDataPreparatorCfg(flags)
Definition: TrigL2MuonSAConfig.py:43
RegSelToolConfig.regSelTool_MM_Cfg
def regSelTool_MM_Cfg(flags)
Definition: RegSelToolConfig.py:191
TrigL2MuonSAConfig.ClusterRoadDefinerCfg
def ClusterRoadDefinerCfg(flags)
Definition: TrigL2MuonSAConfig.py:109
TrigL2MuonSAConfig.RpcDataPreparatorCfg
def RpcDataPreparatorCfg(flags)
Definition: TrigL2MuonSAConfig.py:14
TrigL2MuonSAConfig.TgcRoadDefinerCfg
def TgcRoadDefinerCfg(flags)
Definition: TrigL2MuonSAConfig.py:98
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
HLTSeedingConfig.mapThresholdToL1RoICollection
def mapThresholdToL1RoICollection(threshold)
Definition: HLTSeedingConfig.py:91
TrigL2MuonSAConfig.PtEndcapLUTSvcCfg_MC
def PtEndcapLUTSvcCfg_MC(flags)
Definition: TrigL2MuonSAConfig.py:319
TrigL2MuonSAConfig.PtBarrelLUTSvcCfg_MC
def PtBarrelLUTSvcCfg_MC(flags)
Definition: TrigL2MuonSAConfig.py:295
TrigL2MuonSAConfig.RpcRoadDefinerCfg
def RpcRoadDefinerCfg(flags)
Definition: TrigL2MuonSAConfig.py:87
RegSelToolConfig.regSelTool_RPC_Cfg
def regSelTool_RPC_Cfg(flags)
Definition: RegSelToolConfig.py:149
TrigL2MuonSAConfig.CscDataPreparatorCfg
def CscDataPreparatorCfg(flags)
Definition: TrigL2MuonSAConfig.py:55