ATLAS Offline Software
add_subsystems.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 from libpyeformat_helper import SourceIdentifier, SubDetector
4 from AthenaConfiguration.ComponentFactory import CompFactory
5 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
6 
7 
8 from AthenaCommon.Constants import DEBUG
9 from AthenaCommon.Logging import logging
10 logger = logging.getLogger('add_subsystems')
11 logger.setLevel(DEBUG)
12 
13 def add_subsystems(flags, subsystems, args, OutputLevel):
14 
15  acc = ComponentAccumulator()
16 
17  decoderTools = []
18  outputEDM = []
19  maybeMissingRobs = []
20 
21  from TrigT1ResultByteStream.TrigT1ResultByteStreamConfig import (
22  RoIBResultByteStreamToolCfg,)
23 
24  roibResultTool = acc.popToolsAndMerge(
26  name="RoIBResultBSDecoderTool",
27  writeBS=False))
28 
29  decoderTools += [roibResultTool]
30 
31 
32  for module_id in roibResultTool.L1TopoModuleIds:
33  maybeMissingRobs.append(
34  int(SourceIdentifier(SubDetector.TDAQ_CALO_TOPO_PROC, module_id)))
35 
36  for module_id in roibResultTool.JetModuleIds:
37  maybeMissingRobs.append(
38  int(SourceIdentifier(SubDetector.TDAQ_CALO_JET_PROC_ROI,
39  module_id)))
40 
41  for module_id in roibResultTool.EMModuleIds:
42  maybeMissingRobs.append(int(SourceIdentifier(
43  SubDetector.TDAQ_CALO_CLUSTER_PROC_ROI, module_id)))
44 
45 
46  def addEDM(edmType, edmName):
47  auxType = edmType.replace('Container','AuxContainer')
48  return [f'{edmType}#{edmName}', f'{auxType}#{edmName}Aux.']
49 
50  if 'jFex' in subsystems:
51  from L1CaloFEXByteStream.L1CaloFEXByteStreamConfig import (
52  jFexRoiByteStreamToolCfg,jFexInputByteStreamToolCfg)
53 
54 
55  jFexTool = acc.popToolsAndMerge(jFexRoiByteStreamToolCfg(
56  flags, 'jFexBSDecoder', writeBS=False))
57 
58  decoderTools += [jFexTool]
59  outputEDM += addEDM('xAOD::jFexSRJetRoIContainer',
60  jFexTool.jJRoIContainerWriteKey.Path)
61 
62  outputEDM += addEDM('xAOD::jFexLRJetRoIContainer',
63  jFexTool.jLJRoIContainerWriteKey.Path)
64 
65  outputEDM += addEDM('xAOD::jFexTauRoIContainer' ,
66  jFexTool.jTauRoIContainerWriteKey.Path)
67 
68  outputEDM += addEDM('xAOD::jFexFwdElRoIContainer',
69  jFexTool.jEMRoIContainerWriteKey.Path)
70 
71  outputEDM += addEDM('xAOD::jFexSumETRoIContainer',
72  jFexTool.jTERoIContainerWriteKey.Path)
73  outputEDM += addEDM('xAOD::jFexMETRoIContainer' ,
74  jFexTool.jXERoIContainerWriteKey.Path)
75  maybeMissingRobs += jFexTool.ROBIDs
76 
77  if args.doCaloInput:
78 
79  jFexInputByteStreamTool = acc.popToolsAndMerge(
81  'jFexInputBSDecoderTool',
82  writeBS=False))
83 
84  decoderTools += [jFexInputByteStreamTool]
85  outputEDM += addEDM('xAOD::jFexTowerContainer',
86  jFexInputByteStreamTool.jTowersWriteKey.Path)
87  maybeMissingRobs += jFexInputByteStreamTool.ROBIDs
88 
89  if 'eFex' in subsystems:
90  from L1CaloFEXByteStream.L1CaloFEXByteStreamConfig import (
91  eFexByteStreamToolCfg,)
92 
93  eFexTool = acc.popToolsAndMerge(
95  'eFexBSDecoder',
96  writeBS=False,
97  decodeInputs=args.doCaloInput))
98 
99  decoderTools += [eFexTool]
100  outputEDM += addEDM('xAOD::eFexEMRoIContainer',
101  eFexTool.eEMContainerWriteKey.Path)
102  outputEDM += addEDM('xAOD::eFexTauRoIContainer',
103  eFexTool.eTAUContainerWriteKey.Path)
104 
105  if args.doCaloInput:
106  outputEDM += addEDM('xAOD::eFexTowerContainer',
107  eFexTool.eTowerContainerWriteKey.Path)
108 
109  maybeMissingRobs += eFexTool.ROBIDs
110 
111  if 'gFex' in subsystems:
112  from L1CaloFEXByteStream.L1CaloFEXByteStreamConfig import (
113  gFexByteStreamToolCfg,gFexInputByteStreamToolCfg,)
114 
115  gFexTool = acc.popToolsAndMerge(gFexByteStreamToolCfg(
116  flags, 'gFexBSDecoder', writeBS=False))
117 
118  decoderTools += [gFexTool]
119  outputEDM += addEDM(
120  'xAOD::gFexJetRoIContainer',
121  gFexTool.gFexRhoOutputContainerWriteKey.Path)
122 
123  outputEDM += addEDM(
124  'xAOD::gFexJetRoIContainer',
125  gFexTool.gFexSRJetOutputContainerWriteKey.Path)
126 
127  outputEDM += addEDM(
128  'xAOD::gFexJetRoIContainer',
129  gFexTool.gFexLRJetOutputContainerWriteKey.Path)
130 
131  outputEDM += addEDM(
132  'xAOD::gFexGlobalRoIContainer',
133  gFexTool.gScalarEJwojOutputContainerWriteKey.Path)
134 
135  outputEDM += addEDM(
136  'xAOD::gFexGlobalRoIContainer',
137  gFexTool.gMETComponentsJwojOutputContainerWriteKey.Path)
138 
139  outputEDM += addEDM(
140  'xAOD::gFexGlobalRoIContainer',
141  gFexTool.gMHTComponentsJwojOutputContainerWriteKey.Path)
142 
143  outputEDM += addEDM(
144  'xAOD::gFexGlobalRoIContainer',
145  gFexTool.gMSTComponentsJwojOutputContainerWriteKey.Path)
146 
147  outputEDM += addEDM(
148  'xAOD::gFexGlobalRoIContainer',
149  gFexTool.gMETComponentsNoiseCutOutputContainerWriteKey.Path)
150 
151  outputEDM += addEDM(
152  'xAOD::gFexGlobalRoIContainer',
153  gFexTool.gMETComponentsRmsOutputContainerWriteKey.Path)
154 
155  outputEDM += addEDM(
156  'xAOD::gFexGlobalRoIContainer',
157  gFexTool.gScalarENoiseCutOutputContainerWriteKey.Path)
158 
159  outputEDM += addEDM(
160  'xAOD::gFexGlobalRoIContainer',
161  gFexTool.gScalarERmsOutputContainerWriteKey.Path)
162 
163  maybeMissingRobs += gFexTool.ROBIDs
164 
165  if args.doCaloInput:
166  gFexInputByteStreamTool = acc.popToolsAndMerge(
168  flags, 'gFexInputByteStreamTool', writeBS=False))
169 
170  decoderTools += [gFexInputByteStreamTool]
171  outputEDM += addEDM('xAOD::gFexTowerContainer',
172  gFexInputByteStreamTool.gTowersWriteKey.Path)
173 
174  maybeMissingRobs += gFexInputByteStreamTool.ROBIDs
175 
176  decoderAlg = CompFactory.L1TriggerByteStreamDecoderAlg(
177  name="L1TriggerByteStreamDecoder",
178  DecoderTools=decoderTools,
179  MaybeMissingROBs=maybeMissingRobs,
180  OutputLevel=OutputLevel)
181 
182  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
183  logger.debug('Adding the following output EDM to ItemList: %s', outputEDM)
184 
185  acc.addEventAlgo(decoderAlg, sequenceName='AthAlgSeq')
186 
187  acc.merge(OutputStreamCfg(flags, 'AOD', ItemList=outputEDM))
188 
189  return acc
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.OutputStreamConfig.OutputStreamCfg
def OutputStreamCfg(flags, streamName, ItemList=[], MetadataItemList=[], disableEventTag=False, trigNavThinningSvc=None, takeItemsFromInput=False, extendProvenanceRecord=True, AcceptAlgs=[], HelperTools=[])
Definition: OutputStreamConfig.py:12
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
L1CaloFEXByteStreamConfig.jFexInputByteStreamToolCfg
def jFexInputByteStreamToolCfg(flags, name, *writeBS=False)
Definition: L1CaloFEXByteStreamConfig.py:232
TrigT1ResultByteStreamConfig.RoIBResultByteStreamToolCfg
def RoIBResultByteStreamToolCfg(flags, name, writeBS=False)
Definition: TrigT1ResultByteStreamConfig.py:18
L1CaloFEXByteStreamConfig.gFexByteStreamToolCfg
def gFexByteStreamToolCfg(flags, name, *writeBS=False)
Definition: L1CaloFEXByteStreamConfig.py:148
Constants
some useful constants -------------------------------------------------—
add_subsystems.add_subsystems
def add_subsystems(flags, subsystems, args, OutputLevel)
Definition: add_subsystems.py:13
L1CaloFEXByteStreamConfig.gFexInputByteStreamToolCfg
def gFexInputByteStreamToolCfg(flags, name, *writeBS=False)
Definition: L1CaloFEXByteStreamConfig.py:275
FexEmulatedTowersConfig.addEDM
def addEDM(edmType, edmName)
Definition: FexEmulatedTowersConfig.py:107
L1CaloFEXByteStreamConfig.jFexRoiByteStreamToolCfg
def jFexRoiByteStreamToolCfg(flags, name, *writeBS=False, xTOBs=False)
Definition: L1CaloFEXByteStreamConfig.py:87
L1CaloFEXByteStreamConfig.eFexByteStreamToolCfg
def eFexByteStreamToolCfg(flags, name, *writeBS=False, TOBs=True, xTOBs=False, multiSlice=False, decodeInputs=False)
Definition: L1CaloFEXByteStreamConfig.py:8