76 def L1CaloFEXSimCfg(flags, eFexTowerInputs = ["L1_eFexDataTowers","L1_eFexEmulatedTowers"],deadMaterialCorrections=True, outputSuffix="", simulateAltTau=False):
77 from AthenaConfiguration.Enums
import Format
79 if not simulateAltTau
and flags.DQ.Environment ==
"tier0":
84 log = logging.getLogger(
'L1CaloFEXSimCfg')
88 sCellType = flags.Trigger.L1.L1CaloSuperCellContainerName
89 if flags.Input.Format
is Format.POOL:
91 if 'L1_eFexEmulatedTowers' in eFexTowerInputs
and "L1_eFexEmulatedTowers" not in flags.Input.Collections:
95 eFexTowerInputs = [l
for l
in eFexTowerInputs
if l !=
"L1_eFexDataTowers"]
97 from AthenaConfiguration.Enums
import LHCPeriod
98 if flags.GeoModel.Run
is LHCPeriod.Run2:
100 from TrigT1CaloFexPerf.EmulationConfig
import emulateSC_Cfg
104 if 'L1_eFexEmulatedTowers' in eFexTowerInputs
and "L1_eFexEmulatedTowers" not in flags.Input.Collections:
108 if "xAODTriggerTowers" not in flags.Input.Collections:
111 if 'L1_eFexEmulatedTowers' in eFexTowerInputs
and "L1_eFexEmulatedTowers" not in flags.Input.Collections:
112 acc.addEventAlgo( CompFactory.LVL1.eFexTowerBuilder(
"L1_eFexEmulatedTowers",CaloCellContainerReadKey=sCellType,ApplyMasking=
not flags.Input.isMC) )
114 if flags.Trigger.L1.doeFex:
115 if eFexTowerInputs==[]:
117 eFEXInputs = CompFactory.LVL1.eTowerMakerFromSuperCells(
'eTowerMakerFromSuperCells',
118 eSuperCellTowerMapperTool = CompFactory.LVL1.eSuperCellTowerMapper(
'eSuperCellTowerMapper', SCell=sCellType))
121 if (
not flags.Trigger.L1.doCaloInputs)
and eFexTowerInputs[0] ==
"L1_eFexDataTowers" and (
"L1_eFexDataTowers" not in flags.Input.Collections):
122 if len(eFexTowerInputs)==1:
123 log.fatal(
"Requested L1_eFexDataTowers but Trigger.L1.doCaloInputs is False, but not secondary collection given")
126 log.warning(
"Requested L1_eFexDataTowers but Trigger.L1.doCaloInputs is False, falling back to secondary")
127 eFexTowerInputs[0] = eFexTowerInputs[1]
128 eFexTowerInputs[1] =
""
129 eFEXInputs = CompFactory.LVL1.eTowerMakerFromEfexTowers(
'eTowerMakerFromEfexTowers')
130 eFEXInputs.InputTowers = eFexTowerInputs[0]
131 eFEXInputs.SecondaryInputTowers = eFexTowerInputs[1]
if len(eFexTowerInputs) > 1
else ""
133 eFEX = CompFactory.LVL1.eFEXDriver(
'eFEXDriver')
134 eFEX.eFEXSysSimTool = CompFactory.LVL1.eFEXSysSim(
'eFEXSysSimTool')
135 eFEX.eFEXSysSimTool.eFEXSimTool = CompFactory.LVL1.eFEXSim(
'eFEXSimTool')
136 eFEX.eFEXSysSimTool.eFEXSimTool.eFEXFPGATool = CompFactory.LVL1.eFEXFPGA(
'eFEXFPGATool')
139 from TrigConfigSvc.TriggerConfigAccess
import getL1MenuAccess
142 em_algoVersion = L1_menu.thresholdExtraInfo(
"eEM").
get(
"algoVersion", 0)
143 tau_algoVersion = L1_menu.thresholdExtraInfo(
"eTAU").
get(
"algoVersion", 0)
145 from PathResolver
import PathResolver
146 bdtConfigJsonPath =
PathResolver.FindCalibFile(
"Run3L1CaloSimulation/L1CaloFEXSim/eTAU/" + (
"bdt_config_v17.json" if tau_algoVersion==2
else "bdt_config_v16.json"))
148 eFEX.eFEXSysSimTool.eFEXSimTool.eFEXFPGATool.eFEXegAlgoTool = CompFactory.LVL1.eFEXegAlgo(
'eFEXegAlgoTool',algoVersion=em_algoVersion,dmCorr=deadMaterialCorrections)
149 eFEX.eFEXSysSimTool.eFEXSimTool.eFEXFPGATool.eFEXtauAlgoTool = CompFactory.LVL1.eFEXtauAlgo(
"eFEXtauAlgo")
150 eFEX.eFEXSysSimTool.eFEXSimTool.eFEXFPGATool.eFEXtauBDTAlgoTool = CompFactory.LVL1.eFEXtauBDTAlgo(
"eFEXtauBDTAlgo", BDTJsonConfigPath=bdtConfigJsonPath)
160 from IOVDbSvc.IOVDbSvcConfig
import addFolders
162 acc.merge(
addFolders(flags,
"/TRIGGER/L1Calo/V1/Calibration/EfexNoiseCuts",
"TRIGGER_OFL" if flags.Input.isMC
else "TRIGGER_ONL",className=
"CondAttrListCollection"))
163 eFEXInputs.NoiseCutsKey =
"/TRIGGER/L1Calo/V1/Calibration/EfexNoiseCuts"
164 acc.merge(
addFolders(flags,
"/TRIGGER/L1Calo/V1/Calibration/EfexEnergyCalib",
"TRIGGER_OFL" if flags.Input.isMC
else "TRIGGER_ONL",className=
"CondAttrListCollection"))
165 eFEX.eFEXSysSimTool.eFEXSimTool.eFEXFPGATool.eFEXegAlgoTool.DMCorrectionsKey =
"/TRIGGER/L1Calo/V1/Calibration/EfexEnergyCalib"
167 acc.addEventAlgo(eFEXInputs)
168 acc.addEventAlgo(eFEX)
171 eFEX.eFEXSysSimTool.Key_eFexAltTauOutputContainer=
"L1_eTauRoIAlt"
172 eFEX.eFEXSysSimTool.Key_eFexAltTauxTOBOutputContainer=
"L1_eTauxRoIAlt"
175 if flags.Trigger.L1.dojFex:
177 if flags.Input.Format
is not Format.POOL:
178 from L1CaloFEXByteStream.L1CaloFEXByteStreamConfig
import jFexInputByteStreamToolCfg
181 maybeMissingRobs = []
184 for module_id
in inputjFexTool.ROBIDs:
185 maybeMissingRobs.append(module_id)
187 decoderTools += [inputjFexTool]
188 decoderAlg = CompFactory.L1TriggerByteStreamDecoderAlg(name=
"L1TriggerByteStreamDecoder", DecoderTools=[inputjFexTool], MaybeMissingROBs=maybeMissingRobs)
189 acc.addEventAlgo(decoderAlg)
191 if "L1_jFexEmulatedTowers" not in flags.Input.Collections:
192 from L1CaloFEXAlgos.FexEmulatedTowersConfig
import jFexEmulatedTowersCfg
195 from L1CaloFEXCond.L1CaloFEXCondConfig
import jFexDBConfig
198 jFEXInputs = CompFactory.LVL1.jTowerMakerFromJfexTowers(
'jTowerMakerFromJfexTowers')
199 jFEXInputs.IsMC = flags.Input.isMC
200 jFEXInputs.jSuperCellTowerMapperTool = CompFactory.LVL1.jSuperCellTowerMapper(
'jSuperCellTowerMapper', SCell=sCellType)
201 jFEXInputs.jSuperCellTowerMapperTool.SCellMasking =
not flags.Input.isMC
203 jFEX = CompFactory.LVL1.jFEXDriver(
'jFEXDriver',jFEXSysSimTool=CompFactory.LVL1.jFEXSysSim(
204 'jFEXSysSimTool',jFEXSimTool=CompFactory.LVL1.jFEXSim(
205 'LVL1::jFEXSim',jFEXFPGATool=CompFactory.LVL1.jFEXFPGA(
206 'LVL1::jFEXFPGA',IjFEXFormTOBsTool=CompFactory.LVL1.jFEXFormTOBs(
207 'LVL1::jFEXFormTOBs',IsMC=flags.Input.isMC)))))
208 acc.addEventAlgo(jFEXInputs)
209 acc.addEventAlgo(jFEX)
212 if flags.Trigger.L1.dogFex:
214 if flags.Input.Format
is not Format.POOL:
215 from L1CaloFEXByteStream.L1CaloFEXByteStreamConfig
import gFexInputByteStreamToolCfg
218 maybeMissingRobs = []
221 for module_id
in inputgFexTool.ROBIDs:
222 maybeMissingRobs.append(module_id)
224 decoderTools += [inputgFexTool]
225 decoderAlg = CompFactory.L1TriggerByteStreamDecoderAlg(name=
"L1TriggerByteStreamDecoder", DecoderTools=[inputgFexTool], MaybeMissingROBs=maybeMissingRobs)
226 acc.addEventAlgo(decoderAlg)
228 gFEXInputs = CompFactory.LVL1.gTowerMakerFromGfexTowers(
'gTowerMakerFromGfexTowers')
229 gFEXInputs.IsMC = flags.Input.isMC
230 gFEXInputs.gSuperCellTowerMapperTool = CompFactory.LVL1.gSuperCellTowerMapper(
'gSuperCellTowerMapper', SCell=sCellType)
231 gFEXInputs.gSuperCellTowerMapperTool.SCellMasking =
not flags.Input.isMC
233 gFEXInputs50 = CompFactory.LVL1.gTowerMakerFromGfexTowers(
'gTowerMakerFromGfexTowers50')
234 gFEXInputs50.InputDataTowers =
"L1_gFexDataTowers50"
235 gFEXInputs50.MyGTowers =
"gTower50Container"
236 gFEXInputs50.IsMC = flags.Input.isMC
237 gFEXInputs50.gSuperCellTowerMapperTool = CompFactory.LVL1.gSuperCellTowerMapper(
'gSuperCellTowerMapper50', SCell=sCellType)
238 gFEXInputs50.gSuperCellTowerMapperTool.SCellMasking =
not flags.Input.isMC
240 from L1CaloFEXCond.L1CaloFEXCondConfig
import gFexDBConfig
243 gFEX = CompFactory.LVL1.gFEXDriver(
'gFEXDriver')
244 gFEX.gFEXSysSimTool = CompFactory.LVL1.gFEXSysSim(
'gFEXSysSimTool')
245 acc.addEventAlgo(gFEXInputs)
246 acc.addEventAlgo(gFEXInputs50)
247 acc.addEventAlgo(gFEX)
249 if flags.Trigger.doHLT:
253 from TrigEDMConfig.TriggerEDM
import recordable
255 assert key==
recordable(key), f
'recordable() check failed for {key}'
256 if flags.Trigger.L1.doeFex:
257 check(eFEX.eFEXSysSimTool.Key_eFexEMOutputContainer)
258 check(eFEX.eFEXSysSimTool.Key_eFexTauOutputContainer)
260 check(eFEX.eFEXSysSimTool.Key_eFexAltTauOutputContainer)
261 if flags.Trigger.L1.dojFex:
262 check(jFEX.jFEXSysSimTool.Key_jFexSRJetOutputContainer)
263 check(jFEX.jFEXSysSimTool.Key_jFexLRJetOutputContainer)
264 check(jFEX.jFEXSysSimTool.Key_jFexTauOutputContainer)
265 check(jFEX.jFEXSysSimTool.Key_jFexSumETOutputContainer)
266 check(jFEX.jFEXSysSimTool.Key_jFexMETOutputContainer)
267 check(jFEX.jFEXSysSimTool.Key_jFexFwdElOutputContainer)
268 if flags.Trigger.L1.dogFex:
269 check(gFEX.gFEXSysSimTool.Key_gFexSRJetOutputContainer)
270 check(gFEX.gFEXSysSimTool.Key_gFexLRJetOutputContainer)
271 check(gFEX.gFEXSysSimTool.Key_gFexRhoOutputContainer)
272 check(gFEX.gFEXSysSimTool.Key_gScalarEJwojOutputContainer)
273 check(gFEX.gFEXSysSimTool.Key_gMETComponentsJwojOutputContainer)
274 check(gFEX.gFEXSysSimTool.Key_gMHTComponentsJwojOutputContainer)
275 check(gFEX.gFEXSysSimTool.Key_gMSTComponentsJwojOutputContainer)
276 check(gFEX.gFEXSysSimTool.Key_gMETComponentsNoiseCutOutputContainer)
277 check(gFEX.gFEXSysSimTool.Key_gMETComponentsRmsOutputContainer)
278 check(gFEX.gFEXSysSimTool.Key_gScalarENoiseCutOutputContainer)
279 check(gFEX.gFEXSysSimTool.Key_gScalarERmsOutputContainer)
284 Add 'Sim' to the standard handle path and include user-specified suffix
287 if not key.endswith(
"Sim"): key +=
"Sim"
290 if flags.Trigger.L1.doeFex:
291 eFEX.eFEXSysSimTool.Key_eFexEMOutputContainer=
getSimHandle(
"L1_eEMRoI")
292 eFEX.eFEXSysSimTool.Key_eFexTauOutputContainer=
getSimHandle(
"L1_eTauRoI")
293 eFEX.eFEXSysSimTool.Key_eFexEMxTOBOutputContainer=
getSimHandle(
"L1_eEMxRoI")
294 eFEX.eFEXSysSimTool.Key_eFexTauxTOBOutputContainer=
getSimHandle(
"L1_eTauxRoI")
296 eFEX.eFEXSysSimTool.Key_eFexAltTauOutputContainer=
getSimHandle(
"L1_eTauRoIAlt")
297 eFEX.eFEXSysSimTool.Key_eFexAltTauxTOBOutputContainer=
getSimHandle(
"L1_eTauxRoIAlt")
299 if flags.Trigger.L1.dojFex:
300 jFEX.jFEXSysSimTool.Key_jFexSRJetOutputContainer=
getSimHandle(
"L1_jFexSRJetRoI")
301 jFEX.jFEXSysSimTool.Key_jFexLRJetOutputContainer=
getSimHandle(
"L1_jFexLRJetRoI")
302 jFEX.jFEXSysSimTool.Key_jFexTauOutputContainer=
getSimHandle(
"L1_jFexTauRoI")
303 jFEX.jFEXSysSimTool.Key_jFexSumETOutputContainer=
getSimHandle(
"L1_jFexSumETRoI")
304 jFEX.jFEXSysSimTool.Key_jFexMETOutputContainer=
getSimHandle(
"L1_jFexMETRoI")
305 jFEX.jFEXSysSimTool.Key_jFexFwdElOutputContainer=
getSimHandle(
"L1_jFexFwdElRoI")
306 jFEX.jFEXSysSimTool.Key_xTobOutKey_jJ=
getSimHandle(
"L1_jFexSRJetxRoI")
307 jFEX.jFEXSysSimTool.Key_xTobOutKey_jLJ=
getSimHandle(
"L1_jFexLRJetxRoI")
308 jFEX.jFEXSysSimTool.Key_xTobOutKey_jTau=
getSimHandle(
"L1_jFexTauxRoI")
309 jFEX.jFEXSysSimTool.Key_xTobOutKey_jEM=
getSimHandle(
"L1_jFexFwdElxRoI")
310 if flags.Trigger.L1.dogFex:
311 gFEX.gFEXSysSimTool.Key_gFexSRJetOutputContainer=
getSimHandle(
"L1_gFexSRJetRoI")
312 gFEX.gFEXSysSimTool.Key_gFexLRJetOutputContainer=
getSimHandle(
"L1_gFexLRJetRoI")
313 gFEX.gFEXSysSimTool.Key_gFexRhoOutputContainer=
getSimHandle(
"L1_gFexRhoRoI")
314 gFEX.gFEXSysSimTool.Key_gScalarEJwojOutputContainer=
getSimHandle(
"L1_gScalarEJwoj")
315 gFEX.gFEXSysSimTool.Key_gMETComponentsJwojOutputContainer=
getSimHandle(
"L1_gMETComponentsJwoj")
316 gFEX.gFEXSysSimTool.Key_gMHTComponentsJwojOutputContainer=
getSimHandle(
"L1_gMHTComponentsJwoj")
317 gFEX.gFEXSysSimTool.Key_gMSTComponentsJwojOutputContainer=
getSimHandle(
"L1_gMSTComponentsJwoj")
318 gFEX.gFEXSysSimTool.Key_gMETComponentsNoiseCutOutputContainer=
getSimHandle(
"L1_gMETComponentsNoiseCut")
319 gFEX.gFEXSysSimTool.Key_gMETComponentsRmsOutputContainer=
getSimHandle(
"L1_gMETComponentsRms")
320 gFEX.gFEXSysSimTool.Key_gScalarENoiseCutOutputContainer=
getSimHandle(
"L1_gScalarENoiseCut")
321 gFEX.gFEXSysSimTool.Key_gScalarERmsOutputContainer=
getSimHandle(
"L1_gScalarERms")