ATLAS Offline Software
Loading...
Searching...
No Matches
L1CaloFEXSimCfg.py
Go to the documentation of this file.
2# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3#
4from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
5from AthenaConfiguration.ComponentFactory import CompFactory
6from AthenaCommon.Logging import logging
7
8def ReadSCellFromPoolFileCfg(flags, key='SCell'):
9 '''Configure reading SCell container from a Pool file like RDO or ESD'''
10 acc = ComponentAccumulator()
11
12 # Ensure SCell container is in the input file
13 # TODO this needs to be uncommented once all MC files used in tests contain SCells
14 # e.g. test_trig_mc_v1DevHI_build.py
15 # assert key in flags.Input.Collections or not flags.Input.Collections, 'MC input file is required to contain SCell container'
16
17 # Need geometry and conditions for the SCell converter from POOL
18 from LArGeoAlgsNV.LArGMConfig import LArGMCfg
19 acc.merge(LArGMCfg(flags))
20
21 return acc
22
23
24def ReadSCellFromByteStreamCfg(flags, key='SCell', SCmask=True):
25 acc=ComponentAccumulator()
26
27 # Geometry, conditions and cabling setup
28 from TileGeoModel.TileGMConfig import TileGMCfg
29 from LArGeoAlgsNV.LArGMConfig import LArGMCfg
30 from LArCabling.LArCablingConfig import LArLATOMEMappingCfg
31 from LArCabling.LArCablingConfig import LArOnOffIdMappingSCCfg
32 from LArCellRec.LArRAWtoSuperCellConfig import LArRAWtoSuperCellCfg
33 acc.merge(TileGMCfg(flags))
34 acc.merge(LArGMCfg(flags))
35 acc.merge(LArLATOMEMappingCfg(flags))
36 acc.merge(LArOnOffIdMappingSCCfg(flags))
37
38 # Conversion from ByteStream to LArRawSCContainer
39 decoderTool = CompFactory.LArLATOMEDecoder('LArLATOMEDecoder', ProtectSourceId = True)
40 decoderAlg = CompFactory.LArRawSCDataReadingAlg('LArRawSCDataReadingAlg', LATOMEDecoder=decoderTool)
41 acc.addEventAlgo(decoderAlg)
42
43 acc.merge(LArRAWtoSuperCellCfg(flags,mask=SCmask, SCellContainerOut=key) )
44
45 return acc
46
48 """
49 Configure the eFEX TOB Et Tool which recalculates isolation variables
50 The tool requires eTowers as inputs (add eTowerMaker algorithm)
51 """
52 acc = ComponentAccumulator()
53
54 # had to comment this out for now, because it causes a clash with the eTowerMakerFromEfexTowers algorithm
55 # if that gets scheduled
56 #eTowerMakerAlg = CompFactory.LVL1.eTowerMakerFromSuperCells('eTowerMakerFromSuperCells')
57 #acc.addEventAlgo(eTowerMakerAlg)
58
59 eFEXTOBEtTool = CompFactory.LVL1.eFEXTOBEtTool
60 acc.setPrivateTools(eFEXTOBEtTool())
61
62 return acc
63
65 '''Configuration to provide TriggerTowers as input to the Fex simulation'''
66 from AthenaConfiguration.Enums import Format
67 if flags.Input.Format is Format.POOL:
68 # For POOL files produce TT with R2TTMaker
69 from TrigT1CaloSim.TrigT1CaloSimRun2Config import Run2TriggerTowerMakerCfg
70 return Run2TriggerTowerMakerCfg(flags)
71 else:
72 # For RAW decode TT from ByteStream
73 from TrigT1CaloByteStream.LVL1CaloRun2ByteStreamConfig import LVL1CaloRun2ReadBSCfg
74 return LVL1CaloRun2ReadBSCfg(flags)
75
76def L1CaloFEXSimCfg(flags, eFexTowerInputs = ["L1_eFexDataTowers","L1_eFexEmulatedTowers"],deadMaterialCorrections=True, outputSuffix="", simulateAltTau=False):
77 from AthenaConfiguration.Enums import Format
78
79 if not simulateAltTau and flags.DQ.Environment == "tier0":
80 simulateAltTau = True # require alt RoI at tier0 while validating new BDT alg against heuristic
81
82 acc = ComponentAccumulator()
83
84 log = logging.getLogger('L1CaloFEXSimCfg')
85
86
87 # Configure SCell inputs
88 sCellType = flags.Trigger.L1.L1CaloSuperCellContainerName
89 if flags.Input.Format is Format.POOL:
90 # Read SCell directly from input RDO file unless not necessary
91 if 'L1_eFexEmulatedTowers' in eFexTowerInputs and "L1_eFexEmulatedTowers" not in flags.Input.Collections:
92 acc.merge(ReadSCellFromPoolFileCfg(flags,sCellType))
93 if flags.Input.isMC:
94 # wont have eFexDataTowers available so remove that if it appears in input list
95 eFexTowerInputs = [l for l in eFexTowerInputs if l != "L1_eFexDataTowers"]
96 else:
97 from AthenaConfiguration.Enums import LHCPeriod
98 if flags.GeoModel.Run is LHCPeriod.Run2:
99 # Run-2 data inputs, emulate SCells
100 from TrigT1CaloFexPerf.EmulationConfig import emulateSC_Cfg
101 acc.merge(emulateSC_Cfg(flags))
102 else:
103 # Run-3+ data inputs, decode SCells from ByteStream if needed
104 if 'L1_eFexEmulatedTowers' in eFexTowerInputs and "L1_eFexEmulatedTowers" not in flags.Input.Collections:
105 acc.merge(ReadSCellFromByteStreamCfg(flags,key=sCellType))
106
107 # Need also TriggerTowers as input .. so reconstruct if not in input collections already
108 if "xAODTriggerTowers" not in flags.Input.Collections:
109 acc.merge(TriggerTowersInputCfg(flags))
110
111 doV6Mapping=False # latome fex input mapping if different between v5 and v6 ... for now only switching to v6 in data
112 if not flags.Input.isMC and len(flags.Input.RunNumbers)>0: # in HLT reprocessing jobs, the runNumbers list will be empty ... have to default to v5 for now for these jobs
113 from LArConditionsCommon.LArRunFormat import getLArDTInfoForRun
114 runinfo = getLArDTInfoForRun(flags.Input.RunNumbers[0], connstring="COOLONL_LAR/CONDBR2")
115 doV6Mapping = (runinfo.FWversion()==6)
116
117 if doV6Mapping and len(flags.Input.RunNumbers)>0:
118 # add required dbOverride (don't do in athena HLT where we will rely on LAr/LATOME to have set it to the right thing)
119 from IOVDbSvc.IOVDbSvcConfig import addOverride
120 acc.merge( addOverride(flags,folder="/LAR/Identifier/LatomeMapping",tag="LARIdentifierLatomeMapping-fw6") )
121
122
123 if flags.Trigger.L1.doeFex:
124 if 'L1_eFexEmulatedTowers' in eFexTowerInputs and "L1_eFexEmulatedTowers" not in flags.Input.Collections:
125 builderAlg = CompFactory.LVL1.eFexTowerBuilder("L1_eFexEmulatedTowers",UseLATOMEv6Mapping=doV6Mapping,
126 CaloCellContainerReadKey=sCellType,ApplyMasking=not flags.Input.isMC) # builds the emulated towers to use as secondary input to eTowerMaker - name has to match what it gets called in other places to avoid conflict
127 if flags.Input.isMC: builderAlg.LArLatomeHeaderKey=""
128 elif doV6Mapping or len(flags.Input.RunNumbers)==0:
129 builderAlg.MappingFile='' # need to regenerate mapping on-the-fly for v6 or in athena hlt jobs
130 # if regenerating mapping file and this is data, we will need the LATOME headers, otherwise don't use them
131 from LArByteStream.LArRawSCDataReadingConfig import LArRawSCDataReadingCfg
132 acc.merge(LArRawSCDataReadingCfg(flags))
133
134
135 acc.addEventAlgo( builderAlg )
136
137 if eFexTowerInputs==[]:
138 # no input specified, so use the old eTowerMaker
139 eFEXInputs = CompFactory.LVL1.eTowerMakerFromSuperCells('eTowerMakerFromSuperCells',
140 eSuperCellTowerMapperTool = CompFactory.LVL1.eSuperCellTowerMapper('eSuperCellTowerMapper', SCell=sCellType))
141 else:
142 # if primary is DataTowers, check that caloInputs are enabled (if data towers not already available). If it isn't then skip this
143 if (not flags.Trigger.L1.doCaloInputs) and eFexTowerInputs[0] == "L1_eFexDataTowers" and ("L1_eFexDataTowers" not in flags.Input.Collections):
144 if len(eFexTowerInputs)==1:
145 log.fatal("Requested L1_eFexDataTowers but Trigger.L1.doCaloInputs is False, but not secondary collection given")
146 import sys
147 sys.exit(1)
148 log.warning("Requested L1_eFexDataTowers but Trigger.L1.doCaloInputs is False, falling back to secondary")
149 eFexTowerInputs[0] = eFexTowerInputs[1]
150 eFexTowerInputs[1] = ""
151 eFEXInputs = CompFactory.LVL1.eTowerMakerFromEfexTowers('eTowerMakerFromEfexTowers')
152 eFEXInputs.InputTowers = eFexTowerInputs[0]
153 eFEXInputs.SecondaryInputTowers = eFexTowerInputs[1] if len(eFexTowerInputs) > 1 else ""
154
155 eFEX = CompFactory.LVL1.eFEXDriver('eFEXDriver')
156 eFEX.eFEXSysSimTool = CompFactory.LVL1.eFEXSysSim('eFEXSysSimTool')
157 eFEX.eFEXSysSimTool.eFEXSimTool = CompFactory.LVL1.eFEXSim('eFEXSimTool')
158 eFEX.eFEXSysSimTool.eFEXSimTool.eFEXFPGATool = CompFactory.LVL1.eFEXFPGA('eFEXFPGATool')
159
160 # read algoVersions from menu and configure the algo tools
161 from TrigConfigSvc.TriggerConfigAccess import getL1MenuAccess
162 L1_menu = getL1MenuAccess(flags)
163
164 em_algoVersion = L1_menu.thresholdExtraInfo("eEM").get("algoVersion", 0)
165 tau_algoVersion = L1_menu.thresholdExtraInfo("eTAU").get("algoVersion", 0)
166
167 from PathResolver import PathResolver
168 bdtConfigJsonPath = PathResolver.FindCalibFile("Run3L1CaloSimulation/L1CaloFEXSim/eTAU/" + ("bdt_config_v17.json" if tau_algoVersion==2 else "bdt_config_v16.json"))
169
170 eFEX.eFEXSysSimTool.eFEXSimTool.eFEXFPGATool.eFEXegAlgoTool = CompFactory.LVL1.eFEXegAlgo('eFEXegAlgoTool',algoVersion=em_algoVersion,dmCorr=deadMaterialCorrections) # only dmCorrections in data for now
171 eFEX.eFEXSysSimTool.eFEXSimTool.eFEXFPGATool.eFEXtauAlgoTool = CompFactory.LVL1.eFEXtauAlgo("eFEXtauAlgo") # heuristic algorithm
172 eFEX.eFEXSysSimTool.eFEXSimTool.eFEXFPGATool.eFEXtauBDTAlgoTool = CompFactory.LVL1.eFEXtauBDTAlgo("eFEXtauBDTAlgo", BDTJsonConfigPath=bdtConfigJsonPath)
173 # To dump supercells as a decorator to the tau TOB, set
174 # eFEX.eFEXSysSimTool.eFEXSimTool.eFEXFPGATool.eFEXtauAlgoTool.DumpSuperCells = True
175 # and/or
176 # eFEX.eFEXSysSimTool.eFEXSimTool.eFEXFPGATool.eFEXtauBDTAlgoTool.DumpSuperCells = True
177
178
179
180
181 # load noise cuts and dm corrections when running on data
182 from IOVDbSvc.IOVDbSvcConfig import addFolders#, addFoldersSplitOnline
183
184 acc.merge(addFolders(flags,"/TRIGGER/L1Calo/V1/Calibration/EfexNoiseCuts","TRIGGER_OFL" if flags.Input.isMC else "TRIGGER_ONL",className="CondAttrListCollection"))
185 eFEXInputs.NoiseCutsKey = "/TRIGGER/L1Calo/V1/Calibration/EfexNoiseCuts"
186 acc.merge(addFolders(flags,"/TRIGGER/L1Calo/V1/Calibration/EfexEnergyCalib","TRIGGER_OFL" if flags.Input.isMC else "TRIGGER_ONL",className="CondAttrListCollection")) # dmCorr from DB!
187 eFEX.eFEXSysSimTool.eFEXSimTool.eFEXFPGATool.eFEXegAlgoTool.DMCorrectionsKey = "/TRIGGER/L1Calo/V1/Calibration/EfexEnergyCalib"
188
189 acc.addEventAlgo(eFEXInputs)
190 acc.addEventAlgo(eFEX)
191
192 if simulateAltTau:
193 eFEX.eFEXSysSimTool.Key_eFexAltTauOutputContainer="L1_eTauRoIAlt"
194 eFEX.eFEXSysSimTool.Key_eFexAltTauxTOBOutputContainer="L1_eTauxRoIAlt"
195
196
197 if flags.Trigger.L1.dojFex:
198
199 if flags.Input.Format is not Format.POOL:
200 from L1CaloFEXByteStream.L1CaloFEXByteStreamConfig import jFexInputByteStreamToolCfg
201 inputjFexTool = acc.popToolsAndMerge(jFexInputByteStreamToolCfg(flags, 'jFexInputBSDecoderTool'))
202
203 maybeMissingRobs = []
204 decoderTools = []
205
206 for module_id in inputjFexTool.ROBIDs:
207 maybeMissingRobs.append(module_id)
208
209 decoderTools += [inputjFexTool]
210 decoderAlg = CompFactory.L1TriggerByteStreamDecoderAlg(name="L1TriggerByteStreamDecoder", DecoderTools=[inputjFexTool], MaybeMissingROBs=maybeMissingRobs)
211 acc.addEventAlgo(decoderAlg)
212
213 if "L1_jFexEmulatedTowers" not in flags.Input.Collections:
214 from L1CaloFEXAlgos.FexEmulatedTowersConfig import jFexEmulatedTowersCfg
215 acc.merge(jFexEmulatedTowersCfg(flags))
216
217 from L1CaloFEXCond.L1CaloFEXCondConfig import jFexDBConfig
218 acc.merge(jFexDBConfig(flags))
219
220 jFEXInputs = CompFactory.LVL1.jTowerMakerFromJfexTowers('jTowerMakerFromJfexTowers')
221 jFEXInputs.IsMC = flags.Input.isMC
222 jFEXInputs.jSuperCellTowerMapperTool = CompFactory.LVL1.jSuperCellTowerMapper('jSuperCellTowerMapper', SCell=sCellType)
223 jFEXInputs.jSuperCellTowerMapperTool.SCellMasking = not flags.Input.isMC
224 # need to set an IsMC property on a tool deep inside the toolstack:
225 jFEX = CompFactory.LVL1.jFEXDriver('jFEXDriver',jFEXSysSimTool=CompFactory.LVL1.jFEXSysSim(
226 'jFEXSysSimTool',jFEXSimTool=CompFactory.LVL1.jFEXSim(
227 'LVL1::jFEXSim',jFEXFPGATool=CompFactory.LVL1.jFEXFPGA(
228 'LVL1::jFEXFPGA',jFEXLargeRJetAlgoTool="", # disables jLJ algorithm - will produce empty container
229 IjFEXFormTOBsTool=CompFactory.LVL1.jFEXFormTOBs(
230 'LVL1::jFEXFormTOBs',IsMC=flags.Input.isMC)))))
231 acc.addEventAlgo(jFEXInputs)
232 acc.addEventAlgo(jFEX)
233
234
235 if flags.Trigger.L1.dogFex:
236
237 if flags.Input.Format is not Format.POOL:
238 from L1CaloFEXByteStream.L1CaloFEXByteStreamConfig import gFexInputByteStreamToolCfg
239 inputgFexTool = acc.popToolsAndMerge(gFexInputByteStreamToolCfg(flags, 'gFexInputBSDecoderTool'))
240
241 maybeMissingRobs = []
242 decoderTools = []
243
244 for module_id in inputgFexTool.ROBIDs:
245 maybeMissingRobs.append(module_id)
246
247 decoderTools += [inputgFexTool]
248 decoderAlg = CompFactory.L1TriggerByteStreamDecoderAlg(name="L1TriggerByteStreamDecoder", DecoderTools=[inputgFexTool], MaybeMissingROBs=maybeMissingRobs)
249 acc.addEventAlgo(decoderAlg)
250
251 # only create emulated towers if not a POOL file or not EmulatedTowers collection
252 if not Format.POOL or ("L1_gFexEmulatedTowers" not in flags.Input.Collections and sCellType in flags.Input.Collections):
253 from L1CaloFEXAlgos.FexEmulatedTowersConfig import gFexEmulatedTowersCfg
254 acc.merge(gFexEmulatedTowersCfg(flags,name="L1_gFexEmulatedTowers"))
255
256 gFEXTowerSummer = CompFactory.LVL1.gFexTowerSummer('gFexTowerSummer')
257 gFEXTowerSummer.gFexDataTowers = "L1_gFexEmulatedTowers" if flags.Input.isMC else "L1_gFexDataTowers"
258 gFEXTowerSummer.gTowers200WriteKey = "L1_gFexEmulatedTowers200" if flags.Input.isMC else "L1_gFexDataTowers200"
259 gFEXTowerSummer.gTowers50WriteKey = "L1_gFexEmulatedTowers50" if flags.Input.isMC else "L1_gFexDataTowers50"
260 gFEXTowerSummer.gTowersEMWriteKey = ""
261 gFEXTowerSummer.gTowersHADWriteKey = ""
262 acc.addEventAlgo(gFEXTowerSummer)
263
264 gFEXInputs = CompFactory.LVL1.gTowerMakerFromGfexTowers('gTowerMakerFromGfexTowers')
265 gFEXInputs.InputDataTowers = "L1_gFexEmulatedTowers200" if flags.Input.isMC else "L1_gFexDataTowers200"
266 gFEXInputs.MyGTowers = "gTowerContainer"
267
268 gFEXInputs50 = CompFactory.LVL1.gTowerMakerFromGfexTowers('gTowerMakerFromGfexTowers50')
269 gFEXInputs50.InputDataTowers = "L1_gFexEmulatedTowers50" if flags.Input.isMC else "L1_gFexDataTowers50"
270 gFEXInputs50.MyGTowers = "gTower50Container"
271
272 from L1CaloFEXCond.L1CaloFEXCondConfig import gFexDBConfig
273 acc.merge(gFexDBConfig(flags))
274
275 gFEX = CompFactory.LVL1.gFEXDriver('gFEXDriver')
276 gFEX.gFEXSysSimTool = CompFactory.LVL1.gFEXSysSim('gFEXSysSimTool')
277 acc.addEventAlgo(gFEXInputs)
278 acc.addEventAlgo(gFEXInputs50)
279 acc.addEventAlgo(gFEX)
280
281 if flags.Trigger.doHLT:
282 # This will be the case when the offline simulation is actually being run as part of MC
283 # as opposed to running another pass of the simulation on either an MC or data file (e.g in DAOD)
284 # Check the RoI EDM containers are registered in HLT outputs
285 from TrigEDMConfig.TriggerEDM import recordable
286 def check(key):
287 assert key==recordable(key), f'recordable() check failed for {key}'
288 if flags.Trigger.L1.doeFex:
289 check(eFEX.eFEXSysSimTool.Key_eFexEMOutputContainer)
290 check(eFEX.eFEXSysSimTool.Key_eFexTauOutputContainer)
291 if (simulateAltTau):
292 check(eFEX.eFEXSysSimTool.Key_eFexAltTauOutputContainer)
293 if flags.Trigger.L1.dojFex:
294 check(jFEX.jFEXSysSimTool.Key_jFexSRJetOutputContainer)
295 check(jFEX.jFEXSysSimTool.Key_jFexLRJetOutputContainer)
296 check(jFEX.jFEXSysSimTool.Key_jFexTauOutputContainer)
297 check(jFEX.jFEXSysSimTool.Key_jFexSumETOutputContainer)
298 check(jFEX.jFEXSysSimTool.Key_jFexMETOutputContainer)
299 check(jFEX.jFEXSysSimTool.Key_jFexFwdElOutputContainer)
300 if flags.Trigger.L1.dogFex:
301 check(gFEX.gFEXSysSimTool.Key_gFexSRJetOutputContainer)
302 check(gFEX.gFEXSysSimTool.Key_gFexLRJetOutputContainer)
303 check(gFEX.gFEXSysSimTool.Key_gFexRhoOutputContainer)
304 check(gFEX.gFEXSysSimTool.Key_gScalarEJwojOutputContainer)
305 check(gFEX.gFEXSysSimTool.Key_gMETComponentsJwojOutputContainer)
306 check(gFEX.gFEXSysSimTool.Key_gMHTComponentsJwojOutputContainer)
307 check(gFEX.gFEXSysSimTool.Key_gMSTComponentsJwojOutputContainer)
308 check(gFEX.gFEXSysSimTool.Key_gMETComponentsNoiseCutOutputContainer)
309 check(gFEX.gFEXSysSimTool.Key_gMETComponentsRmsOutputContainer)
310 check(gFEX.gFEXSysSimTool.Key_gScalarENoiseCutOutputContainer)
311 check(gFEX.gFEXSysSimTool.Key_gScalarERmsOutputContainer)
312 else:
313 # Rename outputs for monitoring resimulation to avoid clash with standard SG keys
314 def getSimHandle(key):
315 """
316 Add 'Sim' to the standard handle path and include user-specified suffix
317 """
318 key += outputSuffix
319 if not key.endswith("Sim"): key += "Sim"
320 return key
321
322 if flags.Trigger.L1.doeFex:
323 eFEX.eFEXSysSimTool.Key_eFexEMOutputContainer=getSimHandle("L1_eEMRoI")
324 eFEX.eFEXSysSimTool.Key_eFexTauOutputContainer=getSimHandle("L1_eTauRoI")
325 eFEX.eFEXSysSimTool.Key_eFexEMxTOBOutputContainer=getSimHandle("L1_eEMxRoI")
326 eFEX.eFEXSysSimTool.Key_eFexTauxTOBOutputContainer=getSimHandle("L1_eTauxRoI")
327 if simulateAltTau:
328 eFEX.eFEXSysSimTool.Key_eFexAltTauOutputContainer=getSimHandle("L1_eTauRoIAlt")
329 eFEX.eFEXSysSimTool.Key_eFexAltTauxTOBOutputContainer=getSimHandle("L1_eTauxRoIAlt")
330
331 if flags.Trigger.L1.dojFex:
332 jFEX.jFEXSysSimTool.Key_jFexSRJetOutputContainer=getSimHandle("L1_jFexSRJetRoI")
333 jFEX.jFEXSysSimTool.Key_jFexLRJetOutputContainer=getSimHandle("L1_jFexLRJetRoI")
334 jFEX.jFEXSysSimTool.Key_jFexTauOutputContainer=getSimHandle("L1_jFexTauRoI")
335 jFEX.jFEXSysSimTool.Key_jFexSumETOutputContainer=getSimHandle("L1_jFexSumETRoI")
336 jFEX.jFEXSysSimTool.Key_jFexMETOutputContainer=getSimHandle("L1_jFexMETRoI")
337 jFEX.jFEXSysSimTool.Key_jFexFwdElOutputContainer=getSimHandle("L1_jFexFwdElRoI")
338 jFEX.jFEXSysSimTool.Key_xTobOutKey_jJ=getSimHandle("L1_jFexSRJetxRoI")
339 jFEX.jFEXSysSimTool.Key_xTobOutKey_jLJ=getSimHandle("L1_jFexLRJetxRoI")
340 jFEX.jFEXSysSimTool.Key_xTobOutKey_jTau=getSimHandle("L1_jFexTauxRoI")
341 jFEX.jFEXSysSimTool.Key_xTobOutKey_jEM=getSimHandle("L1_jFexFwdElxRoI")
342 if flags.Trigger.L1.dogFex:
343 gFEX.gFEXSysSimTool.Key_gFexSRJetOutputContainer=getSimHandle("L1_gFexSRJetRoI")
344 gFEX.gFEXSysSimTool.Key_gFexLRJetOutputContainer=getSimHandle("L1_gFexLRJetRoI")
345 gFEX.gFEXSysSimTool.Key_gFexRhoOutputContainer=getSimHandle("L1_gFexRhoRoI")
346 gFEX.gFEXSysSimTool.Key_gScalarEJwojOutputContainer=getSimHandle("L1_gScalarEJwoj")
347 gFEX.gFEXSysSimTool.Key_gMETComponentsJwojOutputContainer=getSimHandle("L1_gMETComponentsJwoj")
348 gFEX.gFEXSysSimTool.Key_gMHTComponentsJwojOutputContainer=getSimHandle("L1_gMHTComponentsJwoj")
349 gFEX.gFEXSysSimTool.Key_gMSTComponentsJwojOutputContainer=getSimHandle("L1_gMSTComponentsJwoj")
350 gFEX.gFEXSysSimTool.Key_gMETComponentsNoiseCutOutputContainer=getSimHandle("L1_gMETComponentsNoiseCut")
351 gFEX.gFEXSysSimTool.Key_gMETComponentsRmsOutputContainer=getSimHandle("L1_gMETComponentsRms")
352 gFEX.gFEXSysSimTool.Key_gScalarENoiseCutOutputContainer=getSimHandle("L1_gScalarENoiseCut")
353 gFEX.gFEXSysSimTool.Key_gScalarERmsOutputContainer=getSimHandle("L1_gScalarERms")
354
355 return acc
356
357
358if __name__ == '__main__':
359
362 import argparse
363 p = argparse.ArgumentParser()
364 p.add_argument('-i', '--input',
365 metavar='KEY',
366 default='ttbar',
367 help='Key of the input from TrigValInputs to be used, default=%(default)s')
368 p.add_argument('-e', '--execute',
369 action='store_true',
370 help='After building the configuration, also process a few events')
371 p.add_argument('-n', '--nevents',
372 metavar='N',
373 type=int,
374 default=25,
375 help='Number of events to process if --execute is used, default=%(default)s')
376 p.add_argument('-d', '--efexdebug',
377 action='store_true',
378 help='Activate DEBUG mode for eFEX driver .. this option is required by a unit test')
379
380 args = p.parse_args()
381
382
385 from AthenaConfiguration.AllConfigFlags import initConfigFlags
386 from TrigValTools.TrigValSteering import Input
387 import os
388
389 flags = initConfigFlags()
390 flags.Common.isOnline = True
391 flags.Input.Files = [args.input] if os.path.isfile(args.input) else Input.get_input(args.input).paths
392 if not flags.Input.isMC:
393 from AthenaConfiguration.TestDefaults import defaultGeometryTags
394 flags.GeoModel.AtlasVersion = defaultGeometryTags.autoconfigure(flags)
395 from AthenaConfiguration.Enums import LHCPeriod
396 flags.IOVDb.GlobalTag = 'CONDBR2-HLTP-2023-01' if flags.GeoModel.Run is LHCPeriod.Run3 else 'CONDBR2-HLTP-2018-04'
397 else:
398 from AthenaConfiguration.TestDefaults import defaultConditionsTags
399 flags.IOVDb.GlobalTag = defaultConditionsTags.RUN3_MC
400 flags.Output.AODFileName = 'AOD.pool.root'
401 flags.Exec.MaxEvents = args.nevents
402 flags.Concurrency.NumThreads = 1
403 flags.Concurrency.NumConcurrentEvents = 1
404 flags.Scheduler.ShowDataDeps = True
405 flags.Scheduler.CheckDependencies = True
406 flags.Scheduler.ShowDataFlow = True
407 flags.Trigger.EDMVersion = 3
408 flags.Trigger.doLVL1 = True
409 flags.Trigger.enableL1CaloPhase1 = True
410 flags.Trigger.triggerConfig = 'FILE'
411
412 # Enable only calo for this test
413 from AthenaConfiguration.DetectorConfigFlags import setupDetectorFlags
414 setupDetectorFlags(flags, ['LAr','Tile','MBTS'], toggle_geometry=True)
415
416 flags.lock()
417
418
421 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
422 acc = MainServicesCfg(flags)
423
424 from AthenaConfiguration.Enums import Format
425 if flags.Input.Format == Format.POOL:
426 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
427 acc.merge(PoolReadCfg(flags))
428 else:
429 from TriggerJobOpts.TriggerByteStreamConfig import ByteStreamReadCfg
430 acc.merge(ByteStreamReadCfg(flags))
431
432 from TrigConfigSvc.TrigConfigSvcCfg import L1ConfigSvcCfg, generateL1Menu, createL1PrescalesFileFromMenu
433 generateL1Menu(flags)
434 createL1PrescalesFileFromMenu(flags)
435 acc.merge(L1ConfigSvcCfg(flags))
436
437 from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
438 FexEDMList = [
439 'xAOD::eFexEMRoIContainer#L1_eEMRoI','xAOD::eFexEMRoIAuxContainer#L1_eEMRoIAux.',
440 'xAOD::eFexTauRoIContainer#L1_eTauRoI','xAOD::eFexTauRoIAuxContainer#L1_eTauRoIAux.',
441 'xAOD::jFexTauRoIContainer#L1_jFexTauRoI','xAOD::jFexTauRoIAuxContainer#L1_jFexTauRoIAux.',
442 'xAOD::jFexSRJetRoIContainer#L1_jFexSRJetRoI','xAOD::jFexSRJetRoIAuxContainer#L1_jFexSRJetRoIAux.',
443 'xAOD::jFexLRJetRoIContainer#L1_jFexLRJetRoI','xAOD::jFexLRJetRoIAuxContainer#L1_jFexLRJetRoIAux.',
444 'xAOD::jFexMETRoIContainer#L1_jFexMETRoI','xAOD::jFexMETRoIAuxContainer#L1_jFexMETRoIAux.',
445 'xAOD::jFexSumETRoIContainer#L1_jFexSumETRoI','xAOD::jFexSumETRoIAuxContainer#L1_jFexSumETRoIAux.',
446 'xAOD::gFexJetRoIContainer#L1_gFexSRJetRoI','xAOD::gFexJetRoIAuxContainer#L1_gFexSRJetRoIAux.',
447 'xAOD::gFexJetRoIContainer#L1_gFexLRJetRoI','xAOD::gFexJetRoIAuxContainer#L1_gFexLRJetRoIAux.',
448 'xAOD::gFexJetRoIContainer#L1_gFexRhoRoI','xAOD::gFexJetRoIAuxContainer#L1_gFexRhoRoIAux.',
449 'xAOD::gFexGlobalRoIContainer#L1_gScalarEJwoj','xAOD::gFexGlobalRoIAuxContainer#L1_gScalarEJwojAux.',
450 'xAOD::gFexGlobalRoIContainer#L1_gMETComponentsJwoj','xAOD::gFexGlobalRoIAuxContainer#L1_gMETComponentsJwojAux.',
451 'xAOD::gFexGlobalRoIContainer#L1_gMHTComponentsJwoj','xAOD::gFexGlobalRoIAuxContainer#L1_gMHTComponentsJwojAux.',
452 'xAOD::gFexGlobalRoIContainer#L1_gMSTComponentsJwoj','xAOD::gFexGlobalRoIAuxContainer#L1_gMSTComponentsJwojAux.',
453 'xAOD::gFexGlobalRoIContainer#L1_gMETComponentsNoiseCut','xAOD::gFexGlobalRoIAuxContainer#L1_gMETComponentsNoiseCutAux.',
454 'xAOD::gFexGlobalRoIContainer#L1_gMETComponentsRms','xAOD::gFexGlobalRoIAuxContainer#L1_gMETComponentsRmsAux.',
455 'xAOD::gFexGlobalRoIContainer#L1_gScalarENoiseCut','xAOD::gFexGlobalRoIAuxContainer#L1_gScalarENoiseCutAux.',
456 'xAOD::gFexGlobalRoIContainer#L1_gScalarERms','xAOD::gFexGlobalRoIAuxContainer#L1_gScalarERmsAux.',
457
458 ]
459 acc.merge(OutputStreamCfg(flags, 'AOD', ItemList=FexEDMList))
460
461
464 acc.merge(L1CaloFEXSimCfg(flags))
465 if args.efexdebug:
466 from AthenaCommon.Constants import DEBUG
467 acc.getEventAlgo("eFEXDriver").OutputLevel = DEBUG
468
469
472 with open("L1Sim.pkl", "wb") as f:
473 acc.store(f)
474 f.close()
475
476 if args.execute:
477 sc = acc.run()
478 if sc.isFailure():
479 exit(1)
static std::string FindCalibFile(const std::string &logical_file_name)
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:132
TriggerTowersInputCfg(flags)
ReadSCellFromByteStreamCfg(flags, key='SCell', SCmask=True)
ReadSCellFromPoolFileCfg(flags, key='SCell')