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:
113 if not flags.Input.isMC
and len(flags.Input.RunNumbers)>0:
115 runinfo =
getLArDTInfoForRun(flags.Input.RunNumbers[0], connstring=
"COOLONL_LAR/CONDBR2")
116 doV6Mapping = (runinfo.FWversion()==6)
117 builderAlg = CompFactory.LVL1.eFexTowerBuilder(
"L1_eFexEmulatedTowers",UseLATOMEv6Mapping=doV6Mapping,
118 CaloCellContainerReadKey=sCellType,ApplyMasking=
not flags.Input.isMC)
119 if doV6Mapping: builderAlg.MappingFile=
''
120 acc.addEventAlgo( builderAlg )
122 if flags.Trigger.L1.doeFex:
123 if eFexTowerInputs==[]:
125 eFEXInputs = CompFactory.LVL1.eTowerMakerFromSuperCells(
'eTowerMakerFromSuperCells',
126 eSuperCellTowerMapperTool = CompFactory.LVL1.eSuperCellTowerMapper(
'eSuperCellTowerMapper', SCell=sCellType))
129 if (
not flags.Trigger.L1.doCaloInputs)
and eFexTowerInputs[0] ==
"L1_eFexDataTowers" and (
"L1_eFexDataTowers" not in flags.Input.Collections):
130 if len(eFexTowerInputs)==1:
131 log.fatal(
"Requested L1_eFexDataTowers but Trigger.L1.doCaloInputs is False, but not secondary collection given")
134 log.warning(
"Requested L1_eFexDataTowers but Trigger.L1.doCaloInputs is False, falling back to secondary")
135 eFexTowerInputs[0] = eFexTowerInputs[1]
136 eFexTowerInputs[1] =
""
137 eFEXInputs = CompFactory.LVL1.eTowerMakerFromEfexTowers(
'eTowerMakerFromEfexTowers')
138 eFEXInputs.InputTowers = eFexTowerInputs[0]
139 eFEXInputs.SecondaryInputTowers = eFexTowerInputs[1]
if len(eFexTowerInputs) > 1
else ""
141 eFEX = CompFactory.LVL1.eFEXDriver(
'eFEXDriver')
142 eFEX.eFEXSysSimTool = CompFactory.LVL1.eFEXSysSim(
'eFEXSysSimTool')
143 eFEX.eFEXSysSimTool.eFEXSimTool = CompFactory.LVL1.eFEXSim(
'eFEXSimTool')
144 eFEX.eFEXSysSimTool.eFEXSimTool.eFEXFPGATool = CompFactory.LVL1.eFEXFPGA(
'eFEXFPGATool')
147 from TrigConfigSvc.TriggerConfigAccess
import getL1MenuAccess
150 em_algoVersion = L1_menu.thresholdExtraInfo(
"eEM").
get(
"algoVersion", 0)
151 tau_algoVersion = L1_menu.thresholdExtraInfo(
"eTAU").
get(
"algoVersion", 0)
153 from PathResolver
import PathResolver
154 bdtConfigJsonPath =
PathResolver.FindCalibFile(
"Run3L1CaloSimulation/L1CaloFEXSim/eTAU/" + (
"bdt_config_v17.json" if tau_algoVersion==2
else "bdt_config_v16.json"))
156 eFEX.eFEXSysSimTool.eFEXSimTool.eFEXFPGATool.eFEXegAlgoTool = CompFactory.LVL1.eFEXegAlgo(
'eFEXegAlgoTool',algoVersion=em_algoVersion,dmCorr=deadMaterialCorrections)
157 eFEX.eFEXSysSimTool.eFEXSimTool.eFEXFPGATool.eFEXtauAlgoTool = CompFactory.LVL1.eFEXtauAlgo(
"eFEXtauAlgo")
158 eFEX.eFEXSysSimTool.eFEXSimTool.eFEXFPGATool.eFEXtauBDTAlgoTool = CompFactory.LVL1.eFEXtauBDTAlgo(
"eFEXtauBDTAlgo", BDTJsonConfigPath=bdtConfigJsonPath)
168 from IOVDbSvc.IOVDbSvcConfig
import addFolders
170 acc.merge(
addFolders(flags,
"/TRIGGER/L1Calo/V1/Calibration/EfexNoiseCuts",
"TRIGGER_OFL" if flags.Input.isMC
else "TRIGGER_ONL",className=
"CondAttrListCollection"))
171 eFEXInputs.NoiseCutsKey =
"/TRIGGER/L1Calo/V1/Calibration/EfexNoiseCuts"
172 acc.merge(
addFolders(flags,
"/TRIGGER/L1Calo/V1/Calibration/EfexEnergyCalib",
"TRIGGER_OFL" if flags.Input.isMC
else "TRIGGER_ONL",className=
"CondAttrListCollection"))
173 eFEX.eFEXSysSimTool.eFEXSimTool.eFEXFPGATool.eFEXegAlgoTool.DMCorrectionsKey =
"/TRIGGER/L1Calo/V1/Calibration/EfexEnergyCalib"
175 acc.addEventAlgo(eFEXInputs)
176 acc.addEventAlgo(eFEX)
179 eFEX.eFEXSysSimTool.Key_eFexAltTauOutputContainer=
"L1_eTauRoIAlt"
180 eFEX.eFEXSysSimTool.Key_eFexAltTauxTOBOutputContainer=
"L1_eTauxRoIAlt"
183 if flags.Trigger.L1.dojFex:
185 if flags.Input.Format
is not Format.POOL:
186 from L1CaloFEXByteStream.L1CaloFEXByteStreamConfig
import jFexInputByteStreamToolCfg
189 maybeMissingRobs = []
192 for module_id
in inputjFexTool.ROBIDs:
193 maybeMissingRobs.append(module_id)
195 decoderTools += [inputjFexTool]
196 decoderAlg = CompFactory.L1TriggerByteStreamDecoderAlg(name=
"L1TriggerByteStreamDecoder", DecoderTools=[inputjFexTool], MaybeMissingROBs=maybeMissingRobs)
197 acc.addEventAlgo(decoderAlg)
199 if "L1_jFexEmulatedTowers" not in flags.Input.Collections:
200 from L1CaloFEXAlgos.FexEmulatedTowersConfig
import jFexEmulatedTowersCfg
203 from L1CaloFEXCond.L1CaloFEXCondConfig
import jFexDBConfig
206 jFEXInputs = CompFactory.LVL1.jTowerMakerFromJfexTowers(
'jTowerMakerFromJfexTowers')
207 jFEXInputs.IsMC = flags.Input.isMC
208 jFEXInputs.jSuperCellTowerMapperTool = CompFactory.LVL1.jSuperCellTowerMapper(
'jSuperCellTowerMapper', SCell=sCellType)
209 jFEXInputs.jSuperCellTowerMapperTool.SCellMasking =
not flags.Input.isMC
211 jFEX = CompFactory.LVL1.jFEXDriver(
'jFEXDriver',jFEXSysSimTool=CompFactory.LVL1.jFEXSysSim(
212 'jFEXSysSimTool',jFEXSimTool=CompFactory.LVL1.jFEXSim(
213 'LVL1::jFEXSim',jFEXFPGATool=CompFactory.LVL1.jFEXFPGA(
214 'LVL1::jFEXFPGA',IjFEXFormTOBsTool=CompFactory.LVL1.jFEXFormTOBs(
215 'LVL1::jFEXFormTOBs',IsMC=flags.Input.isMC)))))
216 acc.addEventAlgo(jFEXInputs)
217 acc.addEventAlgo(jFEX)
220 if flags.Trigger.L1.dogFex:
222 if flags.Input.Format
is not Format.POOL:
223 from L1CaloFEXByteStream.L1CaloFEXByteStreamConfig
import gFexInputByteStreamToolCfg
226 maybeMissingRobs = []
229 for module_id
in inputgFexTool.ROBIDs:
230 maybeMissingRobs.append(module_id)
232 decoderTools += [inputgFexTool]
233 decoderAlg = CompFactory.L1TriggerByteStreamDecoderAlg(name=
"L1TriggerByteStreamDecoder", DecoderTools=[inputgFexTool], MaybeMissingROBs=maybeMissingRobs)
234 acc.addEventAlgo(decoderAlg)
236 gFEXInputs = CompFactory.LVL1.gTowerMakerFromGfexTowers(
'gTowerMakerFromGfexTowers')
237 gFEXInputs.IsMC = flags.Input.isMC
238 gFEXInputs.gSuperCellTowerMapperTool = CompFactory.LVL1.gSuperCellTowerMapper(
'gSuperCellTowerMapper', SCell=sCellType)
239 gFEXInputs.gSuperCellTowerMapperTool.SCellMasking =
not flags.Input.isMC
241 gFEXInputs50 = CompFactory.LVL1.gTowerMakerFromGfexTowers(
'gTowerMakerFromGfexTowers50')
242 gFEXInputs50.InputDataTowers =
"L1_gFexDataTowers50"
243 gFEXInputs50.MyGTowers =
"gTower50Container"
244 gFEXInputs50.IsMC = flags.Input.isMC
245 gFEXInputs50.gSuperCellTowerMapperTool = CompFactory.LVL1.gSuperCellTowerMapper(
'gSuperCellTowerMapper50', SCell=sCellType)
246 gFEXInputs50.gSuperCellTowerMapperTool.SCellMasking =
not flags.Input.isMC
248 from L1CaloFEXCond.L1CaloFEXCondConfig
import gFexDBConfig
251 gFEX = CompFactory.LVL1.gFEXDriver(
'gFEXDriver')
252 gFEX.gFEXSysSimTool = CompFactory.LVL1.gFEXSysSim(
'gFEXSysSimTool')
253 acc.addEventAlgo(gFEXInputs)
254 acc.addEventAlgo(gFEXInputs50)
255 acc.addEventAlgo(gFEX)
257 if flags.Trigger.doHLT:
261 from TrigEDMConfig.TriggerEDM
import recordable
263 assert key==
recordable(key), f
'recordable() check failed for {key}'
264 if flags.Trigger.L1.doeFex:
265 check(eFEX.eFEXSysSimTool.Key_eFexEMOutputContainer)
266 check(eFEX.eFEXSysSimTool.Key_eFexTauOutputContainer)
268 check(eFEX.eFEXSysSimTool.Key_eFexAltTauOutputContainer)
269 if flags.Trigger.L1.dojFex:
270 check(jFEX.jFEXSysSimTool.Key_jFexSRJetOutputContainer)
271 check(jFEX.jFEXSysSimTool.Key_jFexLRJetOutputContainer)
272 check(jFEX.jFEXSysSimTool.Key_jFexTauOutputContainer)
273 check(jFEX.jFEXSysSimTool.Key_jFexSumETOutputContainer)
274 check(jFEX.jFEXSysSimTool.Key_jFexMETOutputContainer)
275 check(jFEX.jFEXSysSimTool.Key_jFexFwdElOutputContainer)
276 if flags.Trigger.L1.dogFex:
277 check(gFEX.gFEXSysSimTool.Key_gFexSRJetOutputContainer)
278 check(gFEX.gFEXSysSimTool.Key_gFexLRJetOutputContainer)
279 check(gFEX.gFEXSysSimTool.Key_gFexRhoOutputContainer)
280 check(gFEX.gFEXSysSimTool.Key_gScalarEJwojOutputContainer)
281 check(gFEX.gFEXSysSimTool.Key_gMETComponentsJwojOutputContainer)
282 check(gFEX.gFEXSysSimTool.Key_gMHTComponentsJwojOutputContainer)
283 check(gFEX.gFEXSysSimTool.Key_gMSTComponentsJwojOutputContainer)
284 check(gFEX.gFEXSysSimTool.Key_gMETComponentsNoiseCutOutputContainer)
285 check(gFEX.gFEXSysSimTool.Key_gMETComponentsRmsOutputContainer)
286 check(gFEX.gFEXSysSimTool.Key_gScalarENoiseCutOutputContainer)
287 check(gFEX.gFEXSysSimTool.Key_gScalarERmsOutputContainer)
292 Add 'Sim' to the standard handle path and include user-specified suffix
295 if not key.endswith(
"Sim"): key +=
"Sim"
298 if flags.Trigger.L1.doeFex:
299 eFEX.eFEXSysSimTool.Key_eFexEMOutputContainer=
getSimHandle(
"L1_eEMRoI")
300 eFEX.eFEXSysSimTool.Key_eFexTauOutputContainer=
getSimHandle(
"L1_eTauRoI")
301 eFEX.eFEXSysSimTool.Key_eFexEMxTOBOutputContainer=
getSimHandle(
"L1_eEMxRoI")
302 eFEX.eFEXSysSimTool.Key_eFexTauxTOBOutputContainer=
getSimHandle(
"L1_eTauxRoI")
304 eFEX.eFEXSysSimTool.Key_eFexAltTauOutputContainer=
getSimHandle(
"L1_eTauRoIAlt")
305 eFEX.eFEXSysSimTool.Key_eFexAltTauxTOBOutputContainer=
getSimHandle(
"L1_eTauxRoIAlt")
307 if flags.Trigger.L1.dojFex:
308 jFEX.jFEXSysSimTool.Key_jFexSRJetOutputContainer=
getSimHandle(
"L1_jFexSRJetRoI")
309 jFEX.jFEXSysSimTool.Key_jFexLRJetOutputContainer=
getSimHandle(
"L1_jFexLRJetRoI")
310 jFEX.jFEXSysSimTool.Key_jFexTauOutputContainer=
getSimHandle(
"L1_jFexTauRoI")
311 jFEX.jFEXSysSimTool.Key_jFexSumETOutputContainer=
getSimHandle(
"L1_jFexSumETRoI")
312 jFEX.jFEXSysSimTool.Key_jFexMETOutputContainer=
getSimHandle(
"L1_jFexMETRoI")
313 jFEX.jFEXSysSimTool.Key_jFexFwdElOutputContainer=
getSimHandle(
"L1_jFexFwdElRoI")
314 jFEX.jFEXSysSimTool.Key_xTobOutKey_jJ=
getSimHandle(
"L1_jFexSRJetxRoI")
315 jFEX.jFEXSysSimTool.Key_xTobOutKey_jLJ=
getSimHandle(
"L1_jFexLRJetxRoI")
316 jFEX.jFEXSysSimTool.Key_xTobOutKey_jTau=
getSimHandle(
"L1_jFexTauxRoI")
317 jFEX.jFEXSysSimTool.Key_xTobOutKey_jEM=
getSimHandle(
"L1_jFexFwdElxRoI")
318 if flags.Trigger.L1.dogFex:
319 gFEX.gFEXSysSimTool.Key_gFexSRJetOutputContainer=
getSimHandle(
"L1_gFexSRJetRoI")
320 gFEX.gFEXSysSimTool.Key_gFexLRJetOutputContainer=
getSimHandle(
"L1_gFexLRJetRoI")
321 gFEX.gFEXSysSimTool.Key_gFexRhoOutputContainer=
getSimHandle(
"L1_gFexRhoRoI")
322 gFEX.gFEXSysSimTool.Key_gScalarEJwojOutputContainer=
getSimHandle(
"L1_gScalarEJwoj")
323 gFEX.gFEXSysSimTool.Key_gMETComponentsJwojOutputContainer=
getSimHandle(
"L1_gMETComponentsJwoj")
324 gFEX.gFEXSysSimTool.Key_gMHTComponentsJwojOutputContainer=
getSimHandle(
"L1_gMHTComponentsJwoj")
325 gFEX.gFEXSysSimTool.Key_gMSTComponentsJwojOutputContainer=
getSimHandle(
"L1_gMSTComponentsJwoj")
326 gFEX.gFEXSysSimTool.Key_gMETComponentsNoiseCutOutputContainer=
getSimHandle(
"L1_gMETComponentsNoiseCut")
327 gFEX.gFEXSysSimTool.Key_gMETComponentsRmsOutputContainer=
getSimHandle(
"L1_gMETComponentsRms")
328 gFEX.gFEXSysSimTool.Key_gScalarENoiseCutOutputContainer=
getSimHandle(
"L1_gScalarENoiseCut")
329 gFEX.gFEXSysSimTool.Key_gScalarERmsOutputContainer=
getSimHandle(
"L1_gScalarERms")