ATLAS Offline Software
TrigT1ResultByteStreamConfig.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 #
4 from AthenaCommon.Logging import logging
5 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6 from AthenaConfiguration.ComponentFactory import CompFactory
7 from AthenaConfiguration.Enums import Format
8 from TrigEDMConfig.TriggerEDM import recordable
9 from TrigEDMConfig.Utils import getEDMListFromWriteHandles
10 from libpyeformat_helper import SourceIdentifier, SubDetector
11 
12 from L1CaloFEXByteStream.L1CaloFEXByteStreamConfig import eFexByteStreamToolCfg, jFexRoiByteStreamToolCfg, jFexInputByteStreamToolCfg, gFexByteStreamToolCfg, gFexInputByteStreamToolCfg
13 from L1TopoByteStream.L1TopoByteStreamConfig import L1TopoPhase1ByteStreamToolCfg
14 from TrigT1MuonRecRoiTool.TrigT1MuonRecRoiToolConfig import RPCRecRoiToolCfg, TGCRecRoiToolCfg
15 from TrigT1MuctpiPhase1.TrigT1MuctpiPhase1Config import TrigThresholdDecisionToolCfg
16 
17 _log = logging.getLogger('TrigT1ResultByteStreamConfig')
18 
19 def RoIBResultByteStreamToolCfg(flags, name, writeBS=False):
20  acc = ComponentAccumulator()
21  tool = CompFactory.RoIBResultByteStreamTool(name)
22 
23  if not flags.Trigger.L1.doCTP:
24  # disable CTP ByteStream decoding/encoding as part of RoIBResult
25  tool.CTPModuleId = 0xFF
26 
27  if flags.Trigger.enableL1MuonPhase1 or not flags.Trigger.L1.doMuon:
28  # disable legacy MUCTPI ByteStream decoding/encoding as part of RoIBResult
29  tool.MUCTPIModuleId = 0xFF
30 
31  if not flags.Trigger.enableL1CaloLegacy or not flags.Trigger.L1.doCalo:
32  # disable legacy L1Calo ByteStream decoding/encoding as part of RoIBResult
33  tool.JetModuleIds = []
34  tool.EMModuleIds = []
35 
36  if flags.Trigger.EDMVersion == 1 or not flags.Trigger.L1.doTopo:
37  # disable legacy L1Topo ByteStream decoding/encoding as part of RoIBResult
38  tool.L1TopoModuleIds = []
39 
40  if writeBS:
41  # write BS == read RDO
42  tool.RoIBResultReadKey="RoIBResult"
43  tool.RoIBResultWriteKey=""
44  else:
45  # read BS == write RDO
46  tool.RoIBResultReadKey=""
47  tool.RoIBResultWriteKey="RoIBResult"
48 
49  acc.setPrivateTools(tool)
50  return acc
51 
52 def ExampleL1TriggerByteStreamToolCfg(flags, name, writeBS=False):
53  acc = ComponentAccumulator()
54  tool = CompFactory.ExampleL1TriggerByteStreamTool(name)
55  muctpi_moduleid = 0
56  muctpi_robid = int(SourceIdentifier(SubDetector.TDAQ_MUON_CTP_INTERFACE, muctpi_moduleid))
57  tool.ROBIDs = [muctpi_robid]
58  if writeBS:
59  # write BS == read xAOD
60  tool.MuonRoIContainerReadKey="LVL1MuonRoIs"
61  tool.MuonRoIContainerWriteKey=""
62  tool.L1TopoOutputLocID=""
63  else:
64  # read BS == write xAOD
65  tool.MuonRoIContainerReadKey=""
66  tool.MuonRoIContainerWriteKey=recordable("LVL1MuonRoIs")
67  acc.setPrivateTools(tool)
68  return acc
69 
70 def MuonRoIByteStreamToolCfg(flags, name, writeBS=False):
71  acc = ComponentAccumulator()
72  tool = CompFactory.MuonRoIByteStreamTool(name)
73  muctpi_moduleid = 0 # No RoIB in Run 3, we always read the DAQ ROB
74  muctpi_robid = int(SourceIdentifier(SubDetector.TDAQ_MUON_CTP_INTERFACE, muctpi_moduleid)) # 0x760000
75  tool.ROBIDs = [muctpi_robid]
76  tool.DoTopo = flags.Trigger.L1.doMuonTopoInputs
77 
78  from TrigT1ResultByteStream.TrigT1ResultByteStreamMonitoringConfig import L1MuonBSConverterMonitoringCfg
79  tool.MonTool = acc.popToolsAndMerge(L1MuonBSConverterMonitoringCfg(flags, name, writeBS))
80 
81  # Build container names for each bunch crossing in the maximum readout window (size 5)
82  containerBaseName = "LVL1MuonRoIs"
83  containerNames = [
84  containerBaseName + "BCm2",
85  containerBaseName + "BCm1",
86  containerBaseName,
87  containerBaseName + "BCp1",
88  containerBaseName + "BCp2",
89  ]
90  topocontainerBaseName = "L1MuCTPItoL1TopoLocationFromMuonRoI"
91  topocontainerNames = [
92  topocontainerBaseName + "-2",
93  topocontainerBaseName + "-1",
94  topocontainerBaseName,
95  topocontainerBaseName + "1",
96  topocontainerBaseName + "2",
97  ]
98  if writeBS:
99  # write BS == read xAOD
100  tool.MuonRoIContainerReadKeys += containerNames
101  else:
102  # read BS == write xAOD
103  tool.MuonRoIContainerWriteKeys += [recordable(c) for c in containerNames]
104  tool.L1TopoOutputLocID += topocontainerNames
105 
106  tool.RPCRecRoiTool = acc.popToolsAndMerge(RPCRecRoiToolCfg(flags))
107  tool.TGCRecRoiTool = acc.popToolsAndMerge(TGCRecRoiToolCfg(flags))
108  tool.TrigThresholdDecisionTool = acc.popToolsAndMerge(TrigThresholdDecisionToolCfg(flags))
109 
110  acc.setPrivateTools(tool)
111  return acc
112 
113 def doRoIBResult(flags):
114  '''
115  Helper function returning a logic combination of flags deciding
116  whether the RoIBResult decoding/encoding is required in the job
117  '''
118  if flags.Trigger.L1.doCalo and flags.Trigger.enableL1CaloLegacy:
119  # Only needed for legacy (Run-2) L1Calo system
120  return True
121  if flags.Trigger.L1.doMuon and not flags.Trigger.enableL1MuonPhase1:
122  # Only needed for legacy (Run-2) MUCTPI data
123  return True
124  if flags.Trigger.L1.doTopo:
125  # Currently only RoIBResult path implemented for L1Topo
126  return True
127  if flags.Trigger.L1.doCTP:
128  # Currently only RoIBResult path implemented for CTP
129  return True
130  # Otherwise don't need RoIBResult
131  return False
132 
133 def L1TriggerByteStreamDecoderCfg(flags, returnEDM=False):
134  acc = ComponentAccumulator()
135  decoderTools = []
136  maybeMissingRobs = []
137 
138 
141  if not flags.Trigger.doLVL1: #if we rerun L1, don't decode the original RoIBResult
142  if doRoIBResult(flags):
143  roibResultTool = acc.popToolsAndMerge(RoIBResultByteStreamToolCfg(
144  flags, name="RoIBResultBSDecoderTool", writeBS=False))
145  decoderTools += [roibResultTool]
146  # Always treat L1Topo as "maybe missing" as it was under commissioning in Run 2 and had readout issues in Run 3
147  for module_id in roibResultTool.L1TopoModuleIds:
148  maybeMissingRobs.append(int(SourceIdentifier(SubDetector.TDAQ_CALO_TOPO_PROC, module_id)))
149  if flags.Trigger.EDMVersion == 2 and not flags.Trigger.doHLT:
150  # L1Calo occasional readout errors weren't caught by HLT in 2015 - ignore these in offline reco, see ATR-24493
151  for module_id in roibResultTool.JetModuleIds:
152  maybeMissingRobs.append(int(SourceIdentifier(SubDetector.TDAQ_CALO_JET_PROC_ROI, module_id)))
153  for module_id in roibResultTool.EMModuleIds:
154  maybeMissingRobs.append(int(SourceIdentifier(SubDetector.TDAQ_CALO_CLUSTER_PROC_ROI, module_id)))
155 
156 
159  if flags.Trigger.L1.doMuon and flags.Trigger.enableL1MuonPhase1 and flags.Trigger.doHLT:
160  muonRoiTool = acc.popToolsAndMerge(MuonRoIByteStreamToolCfg(
161  flags, name="L1MuonBSDecoderTool", writeBS=False))
162  decoderTools += [muonRoiTool]
163 
164 
167  if flags.Trigger.L1.doCalo and flags.Trigger.enableL1CaloPhase1:
168  #--------------------
169  # eFex
170  #--------------------
171  if flags.Trigger.L1.doeFex:
172  # Online case in HLT with TOB decoding only
173  if flags.Trigger.doHLT:
174  eFexByteStreamTool = acc.popToolsAndMerge(eFexByteStreamToolCfg(
175  flags,
176  'eFexBSDecoderTool',
177  writeBS=False,
178  TOBs=True,
179  xTOBs=False,
180  multiSlice=False
181  ))
182  # Reco/monitoring case (either online but downstream from HLT, or at Tier-0) with xTOB, input tower and multi-slice decoding
183  else:
184  eFexByteStreamTool = acc.popToolsAndMerge(eFexByteStreamToolCfg(
185  flags,
186  'eFexBSDecoderTool',
187  writeBS=False,
188  TOBs=False,
189  xTOBs=True,
190  multiSlice=True,
191  decodeInputs=flags.Trigger.L1.doCaloInputs
192  ))
193  decoderTools += [eFexByteStreamTool]
194  # Allow the data to be missing at T0, due to the commissioning of the phase-1 L1Calo in RAW data from 2022
195  # Forbit the data to be missing at Point 1 (2023+)
196  if not flags.Trigger.doHLT:
197  maybeMissingRobs += eFexByteStreamTool.ROBIDs
198 
199  #--------------------
200  # jFex
201  #--------------------
202  if flags.Trigger.L1.dojFex:
203  # Online case in HLT with TOB decoding only
204  if flags.Trigger.doHLT:
205  jFexRoiByteStreamTool = acc.popToolsAndMerge(jFexRoiByteStreamToolCfg(
206  flags,
207  'jFexBSDecoderTool',
208  writeBS=False
209  ))
210  # Reco/monitoring case (either online but downstream from HLT, or at Tier-0) with xTOB decoding only
211  else:
212  jFexRoiByteStreamTool = acc.popToolsAndMerge(jFexRoiByteStreamToolCfg(
213  flags,
214  'jFexBSDecoderTool',
215  writeBS=False,
216  xTOBs=True
217  ))
218  decoderTools += [jFexRoiByteStreamTool]
219  maybeMissingRobs += jFexRoiByteStreamTool.ROBIDs # Allow the data to be missing during commissioning of the phase-1 L1Calo (2022)
220 
221  # Input towers decoding
222  if flags.Trigger.L1.doCaloInputs:
223  jFexInputByteStreamTool = acc.popToolsAndMerge(jFexInputByteStreamToolCfg(
224  flags,
225  'jFexInputBSDecoderTool',
226  writeBS=False
227  ))
228  decoderTools += [jFexInputByteStreamTool]
229  maybeMissingRobs += jFexInputByteStreamTool.ROBIDs # Allow the data to be missing during commissioning of the phase-1 L1Calo (2022)
230 
231 
232  #--------------------
233  # gFex
234  #--------------------
235  if flags.Trigger.L1.dogFex:
236  # Online case in HLT with TOB decoding (no 'else' case because gFex doesn't have xTOBs to decode offline)
237  if flags.Trigger.doHLT:
238  gFexByteStreamTool = acc.popToolsAndMerge(gFexByteStreamToolCfg(
239  flags,
240  'gFexBSDecoderTool',
241  writeBS=False
242  ))
243  decoderTools += [gFexByteStreamTool]
244  maybeMissingRobs += gFexByteStreamTool.ROBIDs # Allow the data to be missing during commissioning of the phase-1 L1Calo (2022)
245 
246  # Input towers decoding
247  if flags.Trigger.L1.doCaloInputs:
248  gFexInputByteStreamTool = acc.popToolsAndMerge(gFexInputByteStreamToolCfg(
249  flags,
250  'gFexInputBSDecoderTool',
251  writeBS=False
252  ))
253  decoderTools += [gFexInputByteStreamTool]
254  maybeMissingRobs += gFexInputByteStreamTool.ROBIDs # Allow the data to be missing during commissioning of the phase-1 L1Calo (2022)
255 
256 
259  if flags.Trigger.L1.doTopo and flags.Trigger.enableL1CaloPhase1 and flags.Trigger.L1.doTopoPhase1:
260  topoByteStreamTool = acc.popToolsAndMerge(L1TopoPhase1ByteStreamToolCfg(
261  flags,
262  "L1TopoBSDecoderTool",
263  writeBS=False
264  ))
265  decoderTools += [topoByteStreamTool]
266  maybeMissingRobs += topoByteStreamTool.ROBIDs # Allow the data to be missing during commissioning of the phase-1 L1Topo (2022)
267 
268  decoderAlg = CompFactory.L1TriggerByteStreamDecoderAlg(name="L1TriggerByteStreamDecoder",
269  DecoderTools=decoderTools,
270  MaybeMissingROBs=list(set(maybeMissingRobs)))
271 
272  if flags.Trigger.doHLT or flags.DQ.Steering.doHLTMon:
273  from TrigT1ResultByteStream.TrigT1ResultByteStreamMonitoringConfig import L1TriggerByteStreamDecoderMonitoringCfg
274  decoderAlg.MonTool = acc.popToolsAndMerge(L1TriggerByteStreamDecoderMonitoringCfg(flags, decoderAlg.getName(), decoderTools))
275 
276  acc.addEventAlgo(decoderAlg, primary=True)
277 
278  # The decoderAlg needs to load ByteStreamMetadata for the detector mask
279  from TriggerJobOpts.TriggerByteStreamConfig import ByteStreamReadCfg
280  readBSAcc = ByteStreamReadCfg(flags)
281  readBSAcc.getEventAlgo('SGInputLoader').Load.add(
282  ('ByteStreamMetadataContainer', 'InputMetaDataStore+ByteStreamMetadata'))
283  acc.merge(readBSAcc)
284 
285  # In reconstruction/monitoring jobs add the decoders' output EDM to the output file
286  if not flags.Trigger.doHLT:
287  from OutputStreamAthenaPool.OutputStreamConfig import addToESD, addToAOD
288  outputEDM = getEDMListFromWriteHandles([tool for tool in decoderAlg.DecoderTools if 'RoIBResult' not in tool.getName()])
289  _log.info('Adding the following output EDM to ItemList: %s', outputEDM)
290  acc.merge(addToESD(flags, outputEDM))
291  acc.merge(addToAOD(flags, outputEDM))
292 
293  # Return outputEDM as a second object to be used for compatibility with RecExCommon output configuration,
294  # because the above calls to addToESD/addtoAOD are no-op when this fragment is wrapped in RecExCommon.
295  # See discussions in https://gitlab.cern.ch/atlas/athena/-/merge_requests/55891#note_5912844
296  if returnEDM:
297  return acc, outputEDM
298  return acc
299 
301  acc = ComponentAccumulator()
302 
303  # Legacy encoding via RoIBResult
304  if doRoIBResult(flags):
305  roibResultTool = acc.popToolsAndMerge(RoIBResultByteStreamToolCfg(
306  flags, name="RoIBResultBSEncoderTool", writeBS=True))
307  acc.addPublicTool(roibResultTool)
308 
309  # Run-3 L1Muon encoding
310  if flags.Trigger.L1.doMuon and flags.Trigger.enableL1MuonPhase1:
311  muonRoiTool = acc.popToolsAndMerge(MuonRoIByteStreamToolCfg(
312  flags, name="L1MuonBSEncoderTool", writeBS=True))
313  acc.addPublicTool(muonRoiTool)
314 
315  # TODO: Run-3 L1Calo, L1Topo, CTP
316 
317  return acc
318 
320  #print("MUCTPI DQ DEBUG python include algo")
321  acc = ComponentAccumulator()
322  alg = CompFactory.MuCTPIPhase1ByteStreamAlgo()
323  acc.addEventAlgo(alg)
324  return acc
325 
326 if __name__ == '__main__':
327  from AthenaConfiguration.AllConfigFlags import initConfigFlags
328  flags = initConfigFlags()
329  import glob
330  import sys
331 
332  import argparse
333  parser = argparse.ArgumentParser(prog='python -m TrigT1ResultByteStream.TrigT1ResultByteStreamConfig',
334  description="""Bytestream decoder athena script.\n\n
335  Example: python -m TrigT1ResultByteStream.TrigT1ResultByteStreamConfig --filesInput "data22*" --evtMax 10 --outputs eTOBs exTOBs """)
336  parser.add_argument('--evtMax',type=int,default=-1,help="number of events to process (-1 = til end of files)")
337  parser.add_argument('--skipEvents',type=int,default=0,help="number of events to skip")
338  parser.add_argument('--filesInput',nargs='+',help="input files",required=True)
339  parser.add_argument('--userAlgs',nargs='+',help="names of user algorithms to add, can specify as Type/Name or just Type",default=[])
340  parser.add_argument('--outputLevel',default="WARNING",choices={ 'INFO','WARNING','DEBUG','VERBOSE'})
341  parser.add_argument('--outputHISTFile',default="",help="if specified, will activate monitoring")
342  parser.add_argument('--outputs',nargs='+',choices={"eTOBs","exTOBs","seTOBs","eDataTowers","jTOBs","jxTOBS","jTowers","gTOBs","gCaloTowers","Topo","legacy","tTowers","sCells","eEmulatedTowers"},required=True,
343  help="What data to decode and output.")
344  args = parser.parse_args()
345 
346  _log.setLevel(logging.DEBUG)
347 
348  from AthenaCommon import Constants
349  algLogLevel = getattr(Constants,args.outputLevel)
350 
351 
352  if any(["data23" in f for f in args.filesInput]):
353  flags.IOVDb.GlobalTag = "CONDBR2-HLTP-2022-02"
354  flags.Trigger.triggerConfig='DB'
355 
356  elif any(["data22" in f for f in args.filesInput]):
357  flags.IOVDb.GlobalTag = "CONDBR2-ES1PA-2022-07"
358  flags.Trigger.triggerConfig='DB'
359 
360  flags.Input.Files = [file for x in args.filesInput for file in glob.glob(x)]
361 
362  from AthenaConfiguration.TestDefaults import defaultGeometryTags
363  flags.GeoModel.AtlasVersion = defaultGeometryTags.autoconfigure(flags)
364 
365  flags.Exec.OutputLevel = algLogLevel
366  flags.Exec.MaxEvents = args.evtMax
367  flags.Exec.SkipEvents = args.skipEvents
368  flags.Concurrency.NumThreads = 1
369  flags.Concurrency.NumConcurrentEvents = 1
370  flags.Output.HISTFileName = args.outputHISTFile
371 
372  if any(["data" in f for f in args.filesInput]):
373  s=args.filesInput[0].replace('*','').replace('.data','')
374  flags.Output.AODFileName = "AOD."+(s.split("/")[-1]).split('_SFO')[0]+"pool.root"
375  else:
376  flags.Output.AODFileName = 'AOD.pool.root'
377 
378  flags.DQ.useTrigger = False # don't do TrigDecisionTool in MonitorCfg helper methods
379  flags.DQ.enableLumiAccess = False
380 
381  flags.Trigger.enableL1CaloLegacy = 'legacy' in args.outputs
382  flags.lock()
383 
384  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
385  from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg
386  acc = MainServicesCfg(flags)
387  acc.merge(ByteStreamReadCfg(flags)) # configure reading bytestream
388 
389 
390  # Generate run3 L1 menu
391  from TrigConfigSvc.TrigConfigSvcCfg import L1ConfigSvcCfg,generateL1Menu
392  acc.merge(L1ConfigSvcCfg(flags))
393 
394  if not any(["data22" in f for f in args.filesInput]) and not any(["data23" in f for f in args.filesInput]):
395  generateL1Menu(flags)
396 
397 
398  decoderTools = []
399  outputEDM = []
400  maybeMissingRobs = []
401 
402 
403  def addEDM(edmType, edmName):
404  auxType = edmType.replace('Container','AuxContainer')
405  return [f'{edmType}#{edmName}',
406  f'{auxType}#{edmName}Aux.']
407 
408  if "eEmulatedTowers" in args.outputs:
409  # building eTowers from supercells and trigger towers
410  args.outputs += ["sCells","tTowers"] # need both of these
411 
412  # next few lines are attempt to include masked channels
413  from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg # should this be LArOnOffIdMappingSCCfg?
414  acc.merge( LArOnOffIdMappingCfg(flags) )
415  from IOVDbSvc.IOVDbSvcConfig import addFolders
416  acc.merge(addFolders(flags,"/LAR/BadChannels/BadChannelsSC","LAR",tag="LARBadChannelsBadChannelsSC-RUN3-UPD1-00",className="CondAttrListCollection"))
417  acc.addCondAlgo(CompFactory.LArBadChannelCondAlg(ReadKey="/LAR/BadChannels/BadChannelsSC",isSC=True,CablingKey="LArOnOffIdMapSC"))
418 
419  acc.addEventAlgo( CompFactory.LVL1.eFexTowerBuilder("eFexTowerBuilder"), sequenceName='AthAlgSeq' )
420  outputEDM += addEDM('xAOD::eFexTowerContainer', acc.getEventAlgo("eFexTowerBuilder").eFexContainerWriteKey)
421 
422  if "sCells" in args.outputs:
423  from L1CaloFEXSim.L1CaloFEXSimCfg import ReadSCellFromByteStreamCfg
424  acc.merge( ReadSCellFromByteStreamCfg(flags,"SCell") )
425  outputEDM += ["CaloCellContainer#SCell"]
426 
427  if "tTowers" in args.outputs:
428  from TriggerJobOpts.TriggerByteStreamConfig import ByteStreamReadCfg
429  acc.merge(ByteStreamReadCfg(flags, type_names=['xAOD::TriggerTowerContainer/xAODTriggerTowers',
430  'xAOD::TriggerTowerAuxContainer/xAODTriggerTowersAux.']))
431 
432 
433 
434 
435 
436 
439  if 'legacy' in args.outputs:
440  # Produce xAOD L1 RoIs from RoIBResult. RoIB readout only
441  from AnalysisTriggerAlgs.AnalysisTriggerAlgsConfig import RoIBResultToxAODCfg
442  xRoIBResultAcc, xRoIBResultOutputs = RoIBResultToxAODCfg(flags)
443  acc.merge(xRoIBResultAcc)
444 
445  roibResultTool = acc.popToolsAndMerge(RoIBResultByteStreamToolCfg(
446  flags, name="RoIBResultBSDecoderTool", writeBS=False))
447  decoderTools += [roibResultTool]
448 
449  # Always treat L1Topo as "maybe missing" as it was under commissioning in Run 2 and had readout issues in Run 3
450  for module_id in roibResultTool.L1TopoModuleIds:
451  maybeMissingRobs.append(int(SourceIdentifier(SubDetector.TDAQ_CALO_TOPO_PROC, module_id)))
452  if flags.Trigger.EDMVersion == 2 and not flags.Trigger.doHLT:
453  # L1Calo occasional readout errors weren't caught by HLT in 2015 - ignore these in offline reco, see ATR-24493
454  for module_id in roibResultTool.JetModuleIds:
455  maybeMissingRobs.append(int(SourceIdentifier(SubDetector.TDAQ_CALO_JET_PROC_ROI, module_id)))
456  for module_id in roibResultTool.EMModuleIds:
457  maybeMissingRobs.append(int(SourceIdentifier(SubDetector.TDAQ_CALO_CLUSTER_PROC_ROI, module_id)))
458 
459 
460  outputEDM += addEDM('xAOD::JetEtRoI' , 'LVL1JetEtRoI')
461  outputEDM += addEDM('xAOD::JetRoIContainer' , 'LVL1JetRoIs')
462  outputEDM += addEDM('xAOD::EmTauRoIContainer', 'LVL1EmTauRoIs')
463  outputEDM += addEDM('xAOD::EnergySumRoI' , 'LVL1EnergySumRoI')
464 
465  # CPM and JEM RoIs (independent from above). Both readouts
466  from TriggerJobOpts.TriggerByteStreamConfig import ByteStreamReadCfg
467  type_names = [
468  # ===== CPM ================================================================
469  "xAOD::CPMTowerContainer/CPMTowers",
470  "xAOD::CPMTowerAuxContainer/CPMTowersAux.",
471  "xAOD::CPMTowerContainer/CPMTowersOverlap",
472  "xAOD::CPMTowerAuxContainer/CPMTowersOverlapAux.",
473  # ===== CPMTOBROIS =========================================================
474  "xAOD::CPMTobRoIContainer/CPMTobRoIs",
475  "xAOD::CPMTobRoIAuxContainer/CPMTobRoIsAux.",
476  "xAOD::CPMTobRoIContainer/CPMTobRoIsRoIB",
477  "xAOD::CPMTobRoIAuxContainer/CPMTobRoIsRoIBAux.",
478  # ===== JEMTOBROIS =========================================================
479  "xAOD::JEMTobRoIContainer/JEMTobRoIs",
480  "xAOD::JEMTobRoIAuxContainer/JEMTobRoIsAux.",
481  "xAOD::JEMTobRoIContainer/JEMTobRoIsRoIB",
482  "xAOD::JEMTobRoIAuxContainer/JEMTobRoIsRoIBAux.",
483  ]
484  acc.merge(ByteStreamReadCfg(flags, type_names=type_names))
485 
486  outputEDM += [item.replace('/','#') for item in type_names]
487 
488 
491  if 'jTOBs' in args.outputs:
492  jFexTool = acc.popToolsAndMerge(jFexRoiByteStreamToolCfg(
493  flags, 'jFexBSDecoder_TOB'))
494  for module_id in jFexTool.ROBIDs:
495  maybeMissingRobs.append(module_id)
496 
497  decoderTools += [jFexTool]
498 
499 
502  if 'jxTOBs' in args.outputs:
503  jFexTool = acc.popToolsAndMerge(jFexRoiByteStreamToolCfg(
504  flags, 'jFexBSDecoder_xTOB', xTOBs=True))
505  for module_id in jFexTool.ROBIDs:
506  maybeMissingRobs.append(module_id)
507 
508  decoderTools += [jFexTool]
509 
510 
513  if 'jTowers' in args.outputs:
514  inputjFexTool = acc.popToolsAndMerge(jFexInputByteStreamToolCfg(
515  flags, 'jFexInputBSDecoder'))
516  for module_id in inputjFexTool.ROBIDs:
517  maybeMissingRobs.append(module_id)
518 
519  decoderTools += [inputjFexTool]
520 
521 
524  if any( [x in args.outputs for x in ['eTOBs','exTOBs','eDataTowers']] ):
525  eFexTool = acc.popToolsAndMerge(eFexByteStreamToolCfg(
526  flags,
527  'eFexBSDecoder',
528  TOBs='eTOBs' in args.outputs,
529  xTOBs='exTOBs' in args.outputs,
530  decodeInputs='eDataTowers' in args.outputs
531  ))
532  # eFexTool_xTOBs = eFexByteStreamToolCfg('eFexBSDecoder_xTOBs', flags,xTOBs=True)
533  decoderTools += [eFexTool]
534 
535  # allow for missing ROBs for eFEX decoding:
536  maybeMissingRobs += eFexTool.ROBIDs
537 
538 
541  if 'gTOBs' in args.outputs:
542  gFexTool = acc.popToolsAndMerge(gFexByteStreamToolCfg(
543  flags, 'gFexBSDecoder'))
544  decoderTools += [gFexTool]
545 
546 
549  if 'gCaloTowers' in args.outputs:
550  inputgFexTool = acc.popToolsAndMerge(gFexInputByteStreamToolCfg(
551  flags, 'gFexInputBSDecoder'))
552  decoderTools += [inputgFexTool]
553 
554 
557  if 'Topo' in args.outputs:
558  l1topoBSTool = acc.popToolsAndMerge(L1TopoPhase1ByteStreamToolCfg(
559  flags, "L1TopoBSDecoderTool"))
560  decoderTools += [l1topoBSTool]
561  # allow for missing Topo ROBs:
562  maybeMissingRobs += l1topoBSTool.ROBIDs
563 
564  if 'seTOBs' in args.outputs:
565  # efex simulation
566  acc.addEventAlgo(CompFactory.LVL1.eTowerMakerFromSuperCells('eTowerMakerFromSuperCells'),sequenceName='AthAlgSeq') # builds eTowers from sCells
567  acc.addEventAlgo(CompFactory.LVL1.eFEXDriver('eFEXDriver',
568  eFEXSysSimTool = CompFactory.LVL1.eFEXSysSim('eFEXSysSimTool') # have to do this so that property settings below take effect
569  ),sequenceName='AthAlgSeq') # creates L1_eEMRoI etc
570  acc.getEventAlgo('eFEXDriver').eFEXSysSimTool.Key_eFexEMOutputContainer = "L1_eEMRoISim" # changes key of output
571  acc.getEventAlgo('eFEXDriver').eFEXSysSimTool.Key_eFexEMxTOBOutputContainer = "L1_eEMxRoISim"
572  acc.getEventAlgo('eFEXDriver').eFEXSysSimTool.Key_eFexTauOutputContainer = "L1_eTauRoISim"
573  acc.getEventAlgo('eFEXDriver').eFEXSysSimTool.Key_eFexTauxTOBOutputContainer = "L1_eTauxRoISim"
574 
575  decoderAlg = CompFactory.L1TriggerByteStreamDecoderAlg(name="L1TriggerByteStreamDecoder",
576  DecoderTools=decoderTools, OutputLevel=algLogLevel, MaybeMissingROBs=list(set(maybeMissingRobs)))
577 
578  acc.addEventAlgo(decoderAlg, sequenceName='AthAlgSeq')
579 
580  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
581  outputEDM += getEDMListFromWriteHandles([tool for tool in decoderAlg.DecoderTools if 'RoIBResult' not in tool.getName()])
582  _log.debug('Adding the following output EDM to ItemList: %s', outputEDM)
583  acc.merge(OutputStreamCfg(flags, 'AOD', ItemList=outputEDM))
584 
585  # get rid of warning about propagating input attribute list ... since there is none
586  acc.getEventAlgo("EventInfoTagBuilder").PropagateInput = (flags.Input.Format != Format.BS)
587 
588 
589  if flags.Exec.MaxEvents==1: # if doing 1 event, will dump storegate too
590  acc.getService("StoreGateSvc").Dump=True
591  acc.getService("StoreGateSvc").OutputLevel=Constants.INFO
592 
593  # schedule user algs, if any
594  for alg in args.userAlgs: acc.addEventAlgo(CompFactory.getComp(alg.split('/')[0])(name=alg.split('/')[-1]),sequenceName='AthEndSeq')
595 
596 
597 
598  if args.outputHISTFile != "":
599  from AthenaMonitoring.AthMonitorCfgHelper import getDQTHistSvc
600  acc.merge(getDQTHistSvc(flags))
601  if "seTOBs" in args.outputs and "eTOBs" in args.outputs and "exTOBs" in args.outputs:
602  from TrigT1CaloMonitoring.EfexSimMonitorAlgorithm import EfexSimMonitoringConfig
603  acc.merge(EfexSimMonitoringConfig(flags))
604 
605 
606  acc.printConfig()
607  flags.dump()
608 
609  if acc.run().isFailure():
610  sys.exit(1)
L1TopoByteStreamConfig.L1TopoPhase1ByteStreamToolCfg
def L1TopoPhase1ByteStreamToolCfg(flags, name, writeBS=False)
Definition: L1TopoByteStreamConfig.py:9
replace
std::string replace(std::string s, const std::string &s2, const std::string &s3)
Definition: hcg.cxx:307
L1CaloFEXSimCfg.ReadSCellFromByteStreamCfg
def ReadSCellFromByteStreamCfg(flags, key='SCell', SCmask=True)
Definition: L1CaloFEXSimCfg.py:24
TrigT1MuonRecRoiToolConfig.RPCRecRoiToolCfg
def RPCRecRoiToolCfg(flags, name="RPCRecRoiTool", useRun3Config=True)
Definition: TrigT1MuonRecRoiToolConfig.py:8
python.TrigT1MuctpiPhase1Config.TrigThresholdDecisionToolCfg
def TrigThresholdDecisionToolCfg(flags, name="TrigThresholdDecisionTool")
Definition: TrigT1MuctpiPhase1Config.py:9
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
TrigT1ResultByteStreamConfig.ExampleL1TriggerByteStreamToolCfg
def ExampleL1TriggerByteStreamToolCfg(flags, name, writeBS=False)
Definition: TrigT1ResultByteStreamConfig.py:52
python.OutputStreamConfig.OutputStreamCfg
def OutputStreamCfg(flags, streamName, ItemList=[], MetadataItemList=[], disableEventTag=False, trigNavThinningSvc=None, takeItemsFromInput=False, extendProvenanceRecord=True, AcceptAlgs=[], HelperTools=[])
Definition: OutputStreamConfig.py:12
EfexSimMonitorAlgorithm.EfexSimMonitoringConfig
def EfexSimMonitoringConfig(flags)
Definition: EfexSimMonitorAlgorithm.py:4
python.TrigConfigSvcCfg.generateL1Menu
def generateL1Menu(flags)
Definition: TrigConfigSvcCfg.py:184
TrigT1ResultByteStreamConfig.addEDM
def addEDM(edmType, edmName)
Definition: TrigT1ResultByteStreamConfig.py:403
python.ByteStreamConfig.ByteStreamReadCfg
def ByteStreamReadCfg(flags, type_names=None)
Definition: Event/ByteStreamCnvSvc/python/ByteStreamConfig.py:25
AnalysisTriggerAlgsConfig.RoIBResultToxAODCfg
def RoIBResultToxAODCfg(flags)
Definition: AnalysisTriggerAlgsConfig.py:9
TrigT1ResultByteStreamConfig.doRoIBResult
def doRoIBResult(flags)
Definition: TrigT1ResultByteStreamConfig.py:113
L1CaloFEXByteStreamConfig.jFexInputByteStreamToolCfg
def jFexInputByteStreamToolCfg(flags, name, *writeBS=False)
Definition: L1CaloFEXByteStreamConfig.py:232
python.Utils.getEDMListFromWriteHandles
def getEDMListFromWriteHandles(configurables)
Definition: Trigger/TriggerCommon/TrigEDMConfig/python/Utils.py:92
TrigT1ResultByteStreamConfig.int
int
Definition: TrigT1ResultByteStreamConfig.py:336
TrigT1ResultByteStreamConfig.RoIBResultByteStreamToolCfg
def RoIBResultByteStreamToolCfg(flags, name, writeBS=False)
Definition: TrigT1ResultByteStreamConfig.py:19
TrigT1ResultByteStreamConfig.MuCTPIPhase1ByteStreamAlgoCfg
def MuCTPIPhase1ByteStreamAlgoCfg(flags)
Definition: TrigT1ResultByteStreamConfig.py:319
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:256
L1CaloFEXByteStreamConfig.gFexByteStreamToolCfg
def gFexByteStreamToolCfg(flags, name, *writeBS=False)
Definition: L1CaloFEXByteStreamConfig.py:148
TrigT1ResultByteStreamMonitoringConfig.L1TriggerByteStreamDecoderMonitoringCfg
def L1TriggerByteStreamDecoderMonitoringCfg(flags, name, decoderTools)
Definition: TrigT1ResultByteStreamMonitoringConfig.py:75
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
python.IOVDbSvcConfig.addFolders
def addFolders(flags, folderStrings, detDb=None, className=None, extensible=False, tag=None, db=None, modifiers='')
Definition: IOVDbSvcConfig.py:72
LArCablingConfig.LArOnOffIdMappingCfg
def LArOnOffIdMappingCfg(configFlags)
Definition: LArCablingConfig.py:62
TrigT1ResultByteStreamConfig.L1TriggerByteStreamEncoderCfg
def L1TriggerByteStreamEncoderCfg(flags)
Definition: TrigT1ResultByteStreamConfig.py:300
TrigT1ResultByteStreamMonitoringConfig.L1MuonBSConverterMonitoringCfg
def L1MuonBSConverterMonitoringCfg(flags, name, encoder=False)
Definition: TrigT1ResultByteStreamMonitoringConfig.py:8
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:224
TrigT1ResultByteStreamConfig.MuonRoIByteStreamToolCfg
def MuonRoIByteStreamToolCfg(flags, name, writeBS=False)
Definition: TrigT1ResultByteStreamConfig.py:70
python.OutputStreamConfig.addToESD
def addToESD(flags, itemOrList, **kwargs)
Definition: OutputStreamConfig.py:127
L1CaloFEXByteStreamConfig.gFexInputByteStreamToolCfg
def gFexInputByteStreamToolCfg(flags, name, *writeBS=False)
Definition: L1CaloFEXByteStreamConfig.py:275
python.AthMonitorCfgHelper.getDQTHistSvc
def getDQTHistSvc(flags)
Definition: AthMonitorCfgHelper.py:169
python.TrigConfigSvcCfg.L1ConfigSvcCfg
def L1ConfigSvcCfg(flags)
Definition: TrigConfigSvcCfg.py:198
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
L1CaloFEXByteStreamConfig.jFexRoiByteStreamToolCfg
def jFexRoiByteStreamToolCfg(flags, name, *writeBS=False, xTOBs=False)
Definition: L1CaloFEXByteStreamConfig.py:87
python.OutputStreamConfig.addToAOD
def addToAOD(flags, itemOrList, **kwargs)
Definition: OutputStreamConfig.py:142
python.TriggerEDM.recordable
def recordable(arg, runVersion=3)
Definition: TriggerEDM.py:30
TrigT1MuonRecRoiToolConfig.TGCRecRoiToolCfg
def TGCRecRoiToolCfg(flags, name="TGCRecRoiTool", useRun3Config=True)
Definition: TrigT1MuonRecRoiToolConfig.py:20
L1CaloFEXByteStreamConfig.eFexByteStreamToolCfg
def eFexByteStreamToolCfg(flags, name, *writeBS=False, TOBs=True, xTOBs=False, multiSlice=False, decodeInputs=False)
Definition: L1CaloFEXByteStreamConfig.py:8
TrigT1ResultByteStreamConfig.L1TriggerByteStreamDecoderCfg
def L1TriggerByteStreamDecoderCfg(flags, returnEDM=False)
Definition: TrigT1ResultByteStreamConfig.py:133
Trk::split
@ split
Definition: LayerMaterialProperties.h:38