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:
112 if not flags.Input.isMC
and len(flags.Input.RunNumbers)>0:
114 runinfo =
getLArDTInfoForRun(flags.Input.RunNumbers[0], connstring=
"COOLONL_LAR/CONDBR2")
115 doV6Mapping = (runinfo.FWversion()==6)
117 if doV6Mapping
and len(flags.Input.RunNumbers)>0:
119 from IOVDbSvc.IOVDbSvcConfig
import addOverride
120 acc.merge(
addOverride(flags,folder=
"/LAR/Identifier/LatomeMapping",tag=
"LARIdentifierLatomeMapping-fw6") )
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)
127 if flags.Input.isMC: builderAlg.LArLatomeHeaderKey=
""
128 elif doV6Mapping
or len(flags.Input.RunNumbers)==0:
129 builderAlg.MappingFile=
''
131 from LArByteStream.LArRawSCDataReadingConfig
import LArRawSCDataReadingCfg
134 acc.addEventAlgo( builderAlg )
136 if eFexTowerInputs==[]:
138 eFEXInputs = CompFactory.LVL1.eTowerMakerFromSuperCells(
'eTowerMakerFromSuperCells',
139 eSuperCellTowerMapperTool = CompFactory.LVL1.eSuperCellTowerMapper(
'eSuperCellTowerMapper', SCell=sCellType))
142 if (
not flags.Trigger.L1.doCaloInputs)
and eFexTowerInputs[0] ==
"L1_eFexDataTowers" and (
"L1_eFexDataTowers" not in flags.Input.Collections):
143 if len(eFexTowerInputs)==1:
144 log.fatal(
"Requested L1_eFexDataTowers but Trigger.L1.doCaloInputs is False, but not secondary collection given")
147 log.warning(
"Requested L1_eFexDataTowers but Trigger.L1.doCaloInputs is False, falling back to secondary")
148 eFexTowerInputs[0] = eFexTowerInputs[1]
149 eFexTowerInputs[1] =
""
150 eFEXInputs = CompFactory.LVL1.eTowerMakerFromEfexTowers(
'eTowerMakerFromEfexTowers')
151 eFEXInputs.InputTowers = eFexTowerInputs[0]
152 eFEXInputs.SecondaryInputTowers = eFexTowerInputs[1]
if len(eFexTowerInputs) > 1
else ""
154 eFEX = CompFactory.LVL1.eFEXDriver(
'eFEXDriver')
155 eFEX.eFEXSysSimTool = CompFactory.LVL1.eFEXSysSim(
'eFEXSysSimTool')
156 eFEX.eFEXSysSimTool.eFEXSimTool = CompFactory.LVL1.eFEXSim(
'eFEXSimTool')
157 eFEX.eFEXSysSimTool.eFEXSimTool.eFEXFPGATool = CompFactory.LVL1.eFEXFPGA(
'eFEXFPGATool')
160 from TrigConfigSvc.TriggerConfigAccess
import getL1MenuAccess
163 em_algoVersion = L1_menu.thresholdExtraInfo(
"eEM").
get(
"algoVersion", 0)
164 tau_algoVersion = L1_menu.thresholdExtraInfo(
"eTAU").
get(
"algoVersion", 0)
166 from PathResolver
import PathResolver
167 bdtConfigJsonPath =
PathResolver.FindCalibFile(
"Run3L1CaloSimulation/L1CaloFEXSim/eTAU/" + (
"bdt_config_v17.json" if tau_algoVersion==2
else "bdt_config_v16.json"))
169 eFEX.eFEXSysSimTool.eFEXSimTool.eFEXFPGATool.eFEXegAlgoTool = CompFactory.LVL1.eFEXegAlgo(
'eFEXegAlgoTool',algoVersion=em_algoVersion,dmCorr=deadMaterialCorrections)
170 eFEX.eFEXSysSimTool.eFEXSimTool.eFEXFPGATool.eFEXtauAlgoTool = CompFactory.LVL1.eFEXtauAlgo(
"eFEXtauAlgo")
171 eFEX.eFEXSysSimTool.eFEXSimTool.eFEXFPGATool.eFEXtauBDTAlgoTool = CompFactory.LVL1.eFEXtauBDTAlgo(
"eFEXtauBDTAlgo", BDTJsonConfigPath=bdtConfigJsonPath)
181 from IOVDbSvc.IOVDbSvcConfig
import addFolders
183 acc.merge(
addFolders(flags,
"/TRIGGER/L1Calo/V1/Calibration/EfexNoiseCuts",
"TRIGGER_OFL" if flags.Input.isMC
else "TRIGGER_ONL",className=
"CondAttrListCollection"))
184 eFEXInputs.NoiseCutsKey =
"/TRIGGER/L1Calo/V1/Calibration/EfexNoiseCuts"
185 acc.merge(
addFolders(flags,
"/TRIGGER/L1Calo/V1/Calibration/EfexEnergyCalib",
"TRIGGER_OFL" if flags.Input.isMC
else "TRIGGER_ONL",className=
"CondAttrListCollection"))
186 eFEX.eFEXSysSimTool.eFEXSimTool.eFEXFPGATool.eFEXegAlgoTool.DMCorrectionsKey =
"/TRIGGER/L1Calo/V1/Calibration/EfexEnergyCalib"
188 acc.addEventAlgo(eFEXInputs)
189 acc.addEventAlgo(eFEX)
192 eFEX.eFEXSysSimTool.Key_eFexAltTauOutputContainer=
"L1_eTauRoIAlt"
193 eFEX.eFEXSysSimTool.Key_eFexAltTauxTOBOutputContainer=
"L1_eTauxRoIAlt"
196 if flags.Trigger.L1.dojFex:
198 if flags.Input.Format
is not Format.POOL:
199 from L1CaloFEXByteStream.L1CaloFEXByteStreamConfig
import jFexInputByteStreamToolCfg
202 maybeMissingRobs = []
205 for module_id
in inputjFexTool.ROBIDs:
206 maybeMissingRobs.append(module_id)
208 decoderTools += [inputjFexTool]
209 decoderAlg = CompFactory.L1TriggerByteStreamDecoderAlg(name=
"L1TriggerByteStreamDecoder", DecoderTools=[inputjFexTool], MaybeMissingROBs=maybeMissingRobs)
210 acc.addEventAlgo(decoderAlg)
212 if "L1_jFexEmulatedTowers" not in flags.Input.Collections:
213 from L1CaloFEXAlgos.FexEmulatedTowersConfig
import jFexEmulatedTowersCfg
216 from L1CaloFEXCond.L1CaloFEXCondConfig
import jFexDBConfig
219 jFEXInputs = CompFactory.LVL1.jTowerMakerFromJfexTowers(
'jTowerMakerFromJfexTowers')
220 jFEXInputs.IsMC = flags.Input.isMC
221 jFEXInputs.jSuperCellTowerMapperTool = CompFactory.LVL1.jSuperCellTowerMapper(
'jSuperCellTowerMapper', SCell=sCellType)
222 jFEXInputs.jSuperCellTowerMapperTool.SCellMasking =
not flags.Input.isMC
224 jFEX = CompFactory.LVL1.jFEXDriver(
'jFEXDriver',jFEXSysSimTool=CompFactory.LVL1.jFEXSysSim(
225 'jFEXSysSimTool',jFEXSimTool=CompFactory.LVL1.jFEXSim(
226 'LVL1::jFEXSim',jFEXFPGATool=CompFactory.LVL1.jFEXFPGA(
227 'LVL1::jFEXFPGA',jFEXLargeRJetAlgoTool=
"",
228 IjFEXFormTOBsTool=CompFactory.LVL1.jFEXFormTOBs(
229 'LVL1::jFEXFormTOBs',IsMC=flags.Input.isMC)))))
230 acc.addEventAlgo(jFEXInputs)
231 acc.addEventAlgo(jFEX)
234 if flags.Trigger.L1.dogFex:
236 if flags.Input.Format
is not Format.POOL:
237 from L1CaloFEXByteStream.L1CaloFEXByteStreamConfig
import gFexInputByteStreamToolCfg
240 maybeMissingRobs = []
243 for module_id
in inputgFexTool.ROBIDs:
244 maybeMissingRobs.append(module_id)
246 decoderTools += [inputgFexTool]
247 decoderAlg = CompFactory.L1TriggerByteStreamDecoderAlg(name=
"L1TriggerByteStreamDecoder", DecoderTools=[inputgFexTool], MaybeMissingROBs=maybeMissingRobs)
248 acc.addEventAlgo(decoderAlg)
250 from L1CaloFEXAlgos.FexEmulatedTowersConfig
import gFexEmulatedTowersCfg
253 gFEXTowerSummer = CompFactory.LVL1.gFexTowerSummer(
'gFexTowerSummer')
254 gFEXTowerSummer.gFexDataTowers =
"L1_gFexEmulatedTowers" if flags.Input.isMC
else "L1_gFexDataTowers"
255 gFEXTowerSummer.gTowers200WriteKey =
"L1_gFexEmulatedTowers200" if flags.Input.isMC
else "L1_gFexDataTowers200"
256 gFEXTowerSummer.gTowers50WriteKey =
"L1_gFexEmulatedTowers50" if flags.Input.isMC
else "L1_gFexDataTowers50"
257 gFEXTowerSummer.gTowersEMWriteKey =
""
258 gFEXTowerSummer.gTowersHADWriteKey =
""
259 acc.addEventAlgo(gFEXTowerSummer)
261 gFEXInputs = CompFactory.LVL1.gTowerMakerFromGfexTowers(
'gTowerMakerFromGfexTowers')
262 gFEXInputs.InputDataTowers =
"L1_gFexEmulatedTowers200" if flags.Input.isMC
else "L1_gFexDataTowers200"
263 gFEXInputs.MyGTowers =
"gTowerContainer"
265 gFEXInputs50 = CompFactory.LVL1.gTowerMakerFromGfexTowers(
'gTowerMakerFromGfexTowers50')
266 gFEXInputs50.InputDataTowers =
"L1_gFexEmulatedTowers50" if flags.Input.isMC
else "L1_gFexDataTowers50"
267 gFEXInputs50.MyGTowers =
"gTower50Container"
269 from L1CaloFEXCond.L1CaloFEXCondConfig
import gFexDBConfig
272 gFEX = CompFactory.LVL1.gFEXDriver(
'gFEXDriver')
273 gFEX.gFEXSysSimTool = CompFactory.LVL1.gFEXSysSim(
'gFEXSysSimTool')
274 acc.addEventAlgo(gFEXInputs)
275 acc.addEventAlgo(gFEXInputs50)
276 acc.addEventAlgo(gFEX)
278 if flags.Trigger.doHLT:
282 from TrigEDMConfig.TriggerEDM
import recordable
284 assert key==
recordable(key), f
'recordable() check failed for {key}'
285 if flags.Trigger.L1.doeFex:
286 check(eFEX.eFEXSysSimTool.Key_eFexEMOutputContainer)
287 check(eFEX.eFEXSysSimTool.Key_eFexTauOutputContainer)
289 check(eFEX.eFEXSysSimTool.Key_eFexAltTauOutputContainer)
290 if flags.Trigger.L1.dojFex:
291 check(jFEX.jFEXSysSimTool.Key_jFexSRJetOutputContainer)
292 check(jFEX.jFEXSysSimTool.Key_jFexLRJetOutputContainer)
293 check(jFEX.jFEXSysSimTool.Key_jFexTauOutputContainer)
294 check(jFEX.jFEXSysSimTool.Key_jFexSumETOutputContainer)
295 check(jFEX.jFEXSysSimTool.Key_jFexMETOutputContainer)
296 check(jFEX.jFEXSysSimTool.Key_jFexFwdElOutputContainer)
297 if flags.Trigger.L1.dogFex:
298 check(gFEX.gFEXSysSimTool.Key_gFexSRJetOutputContainer)
299 check(gFEX.gFEXSysSimTool.Key_gFexLRJetOutputContainer)
300 check(gFEX.gFEXSysSimTool.Key_gFexRhoOutputContainer)
301 check(gFEX.gFEXSysSimTool.Key_gScalarEJwojOutputContainer)
302 check(gFEX.gFEXSysSimTool.Key_gMETComponentsJwojOutputContainer)
303 check(gFEX.gFEXSysSimTool.Key_gMHTComponentsJwojOutputContainer)
304 check(gFEX.gFEXSysSimTool.Key_gMSTComponentsJwojOutputContainer)
305 check(gFEX.gFEXSysSimTool.Key_gMETComponentsNoiseCutOutputContainer)
306 check(gFEX.gFEXSysSimTool.Key_gMETComponentsRmsOutputContainer)
307 check(gFEX.gFEXSysSimTool.Key_gScalarENoiseCutOutputContainer)
308 check(gFEX.gFEXSysSimTool.Key_gScalarERmsOutputContainer)
313 Add 'Sim' to the standard handle path and include user-specified suffix
316 if not key.endswith(
"Sim"): key +=
"Sim"
319 if flags.Trigger.L1.doeFex:
320 eFEX.eFEXSysSimTool.Key_eFexEMOutputContainer=
getSimHandle(
"L1_eEMRoI")
321 eFEX.eFEXSysSimTool.Key_eFexTauOutputContainer=
getSimHandle(
"L1_eTauRoI")
322 eFEX.eFEXSysSimTool.Key_eFexEMxTOBOutputContainer=
getSimHandle(
"L1_eEMxRoI")
323 eFEX.eFEXSysSimTool.Key_eFexTauxTOBOutputContainer=
getSimHandle(
"L1_eTauxRoI")
325 eFEX.eFEXSysSimTool.Key_eFexAltTauOutputContainer=
getSimHandle(
"L1_eTauRoIAlt")
326 eFEX.eFEXSysSimTool.Key_eFexAltTauxTOBOutputContainer=
getSimHandle(
"L1_eTauxRoIAlt")
328 if flags.Trigger.L1.dojFex:
329 jFEX.jFEXSysSimTool.Key_jFexSRJetOutputContainer=
getSimHandle(
"L1_jFexSRJetRoI")
330 jFEX.jFEXSysSimTool.Key_jFexLRJetOutputContainer=
getSimHandle(
"L1_jFexLRJetRoI")
331 jFEX.jFEXSysSimTool.Key_jFexTauOutputContainer=
getSimHandle(
"L1_jFexTauRoI")
332 jFEX.jFEXSysSimTool.Key_jFexSumETOutputContainer=
getSimHandle(
"L1_jFexSumETRoI")
333 jFEX.jFEXSysSimTool.Key_jFexMETOutputContainer=
getSimHandle(
"L1_jFexMETRoI")
334 jFEX.jFEXSysSimTool.Key_jFexFwdElOutputContainer=
getSimHandle(
"L1_jFexFwdElRoI")
335 jFEX.jFEXSysSimTool.Key_xTobOutKey_jJ=
getSimHandle(
"L1_jFexSRJetxRoI")
336 jFEX.jFEXSysSimTool.Key_xTobOutKey_jLJ=
getSimHandle(
"L1_jFexLRJetxRoI")
337 jFEX.jFEXSysSimTool.Key_xTobOutKey_jTau=
getSimHandle(
"L1_jFexTauxRoI")
338 jFEX.jFEXSysSimTool.Key_xTobOutKey_jEM=
getSimHandle(
"L1_jFexFwdElxRoI")
339 if flags.Trigger.L1.dogFex:
340 gFEX.gFEXSysSimTool.Key_gFexSRJetOutputContainer=
getSimHandle(
"L1_gFexSRJetRoI")
341 gFEX.gFEXSysSimTool.Key_gFexLRJetOutputContainer=
getSimHandle(
"L1_gFexLRJetRoI")
342 gFEX.gFEXSysSimTool.Key_gFexRhoOutputContainer=
getSimHandle(
"L1_gFexRhoRoI")
343 gFEX.gFEXSysSimTool.Key_gScalarEJwojOutputContainer=
getSimHandle(
"L1_gScalarEJwoj")
344 gFEX.gFEXSysSimTool.Key_gMETComponentsJwojOutputContainer=
getSimHandle(
"L1_gMETComponentsJwoj")
345 gFEX.gFEXSysSimTool.Key_gMHTComponentsJwojOutputContainer=
getSimHandle(
"L1_gMHTComponentsJwoj")
346 gFEX.gFEXSysSimTool.Key_gMSTComponentsJwojOutputContainer=
getSimHandle(
"L1_gMSTComponentsJwoj")
347 gFEX.gFEXSysSimTool.Key_gMETComponentsNoiseCutOutputContainer=
getSimHandle(
"L1_gMETComponentsNoiseCut")
348 gFEX.gFEXSysSimTool.Key_gMETComponentsRmsOutputContainer=
getSimHandle(
"L1_gMETComponentsRms")
349 gFEX.gFEXSysSimTool.Key_gScalarENoiseCutOutputContainer=
getSimHandle(
"L1_gScalarENoiseCut")
350 gFEX.gFEXSysSimTool.Key_gScalarERmsOutputContainer=
getSimHandle(
"L1_gScalarERms")