77 def L1CaloFEXSimCfg(flags, eFexTowerInputs = ["L1_eFexDataTowers","L1_eFexEmulatedTowers"],deadMaterialCorrections=True, outputSuffix="", simulateAltTau=False):
78 from AthenaConfiguration.Enums
import Format
80 if not simulateAltTau
and flags.DQ.Environment ==
"tier0":
85 log = logging.getLogger(
'L1CaloFEXSimCfg')
89 sCellType = flags.Trigger.L1.L1CaloSuperCellContainerName
90 if flags.Input.Format
is Format.POOL:
92 if 'L1_eFexEmulatedTowers' in eFexTowerInputs
and "L1_eFexEmulatedTowers" not in flags.Input.Collections:
96 eFexTowerInputs = [l
for l
in eFexTowerInputs
if l !=
"L1_eFexDataTowers"]
98 from AthenaConfiguration.Enums
import LHCPeriod
99 if flags.GeoModel.Run
is LHCPeriod.Run2:
101 from TrigT1CaloFexPerf.EmulationConfig
import emulateSC_Cfg
105 if 'L1_eFexEmulatedTowers' in eFexTowerInputs
and "L1_eFexEmulatedTowers" not in flags.Input.Collections:
109 if "xAODTriggerTowers" not in flags.Input.Collections:
112 if 'L1_eFexEmulatedTowers' in eFexTowerInputs
and "L1_eFexEmulatedTowers" not in flags.Input.Collections:
113 acc.addEventAlgo( CompFactory.LVL1.eFexTowerBuilder(
"L1_eFexEmulatedTowers",CaloCellContainerReadKey=sCellType,ApplyMasking=
not flags.Input.isMC) )
115 if flags.Trigger.L1.doeFex:
116 if eFexTowerInputs==[]:
118 eFEXInputs = CompFactory.LVL1.eTowerMakerFromSuperCells(
'eTowerMakerFromSuperCells',
119 eSuperCellTowerMapperTool = CompFactory.LVL1.eSuperCellTowerMapper(
'eSuperCellTowerMapper', SCell=sCellType))
122 if (
not flags.Trigger.L1.doCaloInputs)
and eFexTowerInputs[0] ==
"L1_eFexDataTowers" and (
"L1_eFexDataTowers" not in flags.Input.Collections):
123 if len(eFexTowerInputs)==1:
124 log.fatal(
"Requested L1_eFexDataTowers but Trigger.L1.doCaloInputs is False, but not secondary collection given")
127 log.warning(
"Requested L1_eFexDataTowers but Trigger.L1.doCaloInputs is False, falling back to secondary")
128 eFexTowerInputs[0] = eFexTowerInputs[1]
129 eFexTowerInputs[1] =
""
130 eFEXInputs = CompFactory.LVL1.eTowerMakerFromEfexTowers(
'eTowerMakerFromEfexTowers')
131 eFEXInputs.InputTowers = eFexTowerInputs[0]
132 eFEXInputs.SecondaryInputTowers = eFexTowerInputs[1]
if len(eFexTowerInputs) > 1
else ""
134 eFEX = CompFactory.LVL1.eFEXDriver(
'eFEXDriver')
135 eFEX.eFEXSysSimTool = CompFactory.LVL1.eFEXSysSim(
'eFEXSysSimTool')
136 eFEX.eFEXSysSimTool.eFEXSimTool = CompFactory.LVL1.eFEXSim(
'eFEXSimTool')
137 eFEX.eFEXSysSimTool.eFEXSimTool.eFEXFPGATool = CompFactory.LVL1.eFEXFPGA(
'eFEXFPGATool')
138 eFEX.eFEXSysSimTool.eFEXSimTool.eFEXFPGATool.eFEXegAlgoTool = CompFactory.LVL1.eFEXegAlgo(
'eFEXegAlgoTool',dmCorr=deadMaterialCorrections)
139 eFEX.eFEXSysSimTool.eFEXSimTool.eFEXFPGATool.eFEXtauAlgoTool = CompFactory.LVL1.eFEXtauAlgo(
"eFEXtauAlgo")
144 eFEX.eFEXSysSimTool.eFEXSimTool.eFEXFPGATool.eFEXtauBDTAlgoTool = CompFactory.LVL1.eFEXtauBDTAlgo(
"eFEXtauBDTAlgo", BDTJsonConfigPath=
"bdt_config_v16.json")
146 from IOVDbSvc.IOVDbSvcConfig
import addFolders
148 acc.merge(
addFolders(flags,
"/TRIGGER/L1Calo/V1/Calibration/EfexNoiseCuts",
"TRIGGER_OFL" if flags.Input.isMC
else "TRIGGER_ONL",className=
"CondAttrListCollection"))
149 eFEXInputs.NoiseCutsKey =
"/TRIGGER/L1Calo/V1/Calibration/EfexNoiseCuts"
150 acc.merge(
addFolders(flags,
"/TRIGGER/L1Calo/V1/Calibration/EfexEnergyCalib",
"TRIGGER_OFL" if flags.Input.isMC
else "TRIGGER_ONL",className=
"CondAttrListCollection"))
151 eFEX.eFEXSysSimTool.eFEXSimTool.eFEXFPGATool.eFEXegAlgoTool.DMCorrectionsKey =
"/TRIGGER/L1Calo/V1/Calibration/EfexEnergyCalib"
153 acc.addEventAlgo(eFEXInputs)
154 acc.addEventAlgo(eFEX)
157 eFEX.eFEXSysSimTool.Key_eFexAltTauOutputContainer=
"L1_eTauRoIAlt"
158 eFEX.eFEXSysSimTool.Key_eFexAltTauxTOBOutputContainer=
"L1_eTauxRoIAlt"
161 if flags.Trigger.L1.dojFex:
163 if flags.Input.Format
is not Format.POOL:
164 from L1CaloFEXByteStream.L1CaloFEXByteStreamConfig
import jFexInputByteStreamToolCfg
167 maybeMissingRobs = []
170 for module_id
in inputjFexTool.ROBIDs:
171 maybeMissingRobs.append(module_id)
173 decoderTools += [inputjFexTool]
174 decoderAlg = CompFactory.L1TriggerByteStreamDecoderAlg(name=
"L1TriggerByteStreamDecoder", DecoderTools=[inputjFexTool], MaybeMissingROBs=maybeMissingRobs)
175 acc.addEventAlgo(decoderAlg)
177 if "L1_jFexEmulatedTowers" not in flags.Input.Collections:
178 from L1CaloFEXAlgos.FexEmulatedTowersConfig
import jFexEmulatedTowersCfg
181 from L1CaloFEXCond.L1CaloFEXCondConfig
import jFexDBConfig
184 jFEXInputs = CompFactory.LVL1.jTowerMakerFromJfexTowers(
'jTowerMakerFromJfexTowers')
185 jFEXInputs.IsMC = flags.Input.isMC
186 jFEXInputs.jSuperCellTowerMapperTool = CompFactory.LVL1.jSuperCellTowerMapper(
'jSuperCellTowerMapper', SCell=sCellType)
187 jFEXInputs.jSuperCellTowerMapperTool.SCellMasking =
not flags.Input.isMC
188 jFEX = CompFactory.LVL1.jFEXDriver(
'jFEXDriver')
189 jFEX.jFEXSysSimTool = CompFactory.LVL1.jFEXSysSim(
'jFEXSysSimTool')
190 acc.addEventAlgo(jFEXInputs)
191 acc.addEventAlgo(jFEX)
194 jFEXCondAlg = acc.getCondAlgo(
"jFEXCondAlgo")
195 jFEXCondAlg.IsMC = flags.Input.isMC
196 jFEXFormTOBsTool = CompFactory.LVL1.jFEXFormTOBs(
'jFEXFormTOBs')
197 jFEXFormTOBsTool.IsMC = flags.Input.isMC
199 if flags.Trigger.L1.dogFex:
201 if flags.Input.Format
is not Format.POOL:
202 from L1CaloFEXByteStream.L1CaloFEXByteStreamConfig
import gFexInputByteStreamToolCfg
205 maybeMissingRobs = []
208 for module_id
in inputgFexTool.ROBIDs:
209 maybeMissingRobs.append(module_id)
211 decoderTools += [inputgFexTool]
212 decoderAlg = CompFactory.L1TriggerByteStreamDecoderAlg(name=
"L1TriggerByteStreamDecoder", DecoderTools=[inputgFexTool], MaybeMissingROBs=maybeMissingRobs)
213 acc.addEventAlgo(decoderAlg)
215 gFEXInputs = CompFactory.LVL1.gTowerMakerFromGfexTowers(
'gTowerMakerFromGfexTowers')
216 gFEXInputs.IsMC = flags.Input.isMC
217 gFEXInputs.gSuperCellTowerMapperTool = CompFactory.LVL1.gSuperCellTowerMapper(
'gSuperCellTowerMapper', SCell=sCellType)
218 gFEXInputs.gSuperCellTowerMapperTool.SCellMasking =
not flags.Input.isMC
220 gFEXInputs50 = CompFactory.LVL1.gTowerMakerFromGfexTowers(
'gTowerMakerFromGfexTowers50')
221 gFEXInputs50.InputDataTowers =
"L1_gFexDataTowers50"
222 gFEXInputs50.MyGTowers =
"gTower50Container"
223 gFEXInputs50.IsMC = flags.Input.isMC
224 gFEXInputs50.gSuperCellTowerMapperTool = CompFactory.LVL1.gSuperCellTowerMapper(
'gSuperCellTowerMapper50', SCell=sCellType)
225 gFEXInputs50.gSuperCellTowerMapperTool.SCellMasking =
not flags.Input.isMC
227 gFEX = CompFactory.LVL1.gFEXDriver(
'gFEXDriver')
228 gFEX.gFEXSysSimTool = CompFactory.LVL1.gFEXSysSim(
'gFEXSysSimTool')
229 acc.addEventAlgo(gFEXInputs)
230 acc.addEventAlgo(gFEXInputs50)
231 acc.addEventAlgo(gFEX)
233 if flags.Trigger.doHLT:
237 from TrigEDMConfig.TriggerEDM
import recordable
239 assert key==
recordable(key), f
'recordable() check failed for {key}'
240 if flags.Trigger.L1.doeFex:
241 check(eFEX.eFEXSysSimTool.Key_eFexEMOutputContainer)
242 check(eFEX.eFEXSysSimTool.Key_eFexTauOutputContainer)
244 check(eFEX.eFEXSysSimTool.Key_eFexAltTauOutputContainer)
245 if flags.Trigger.L1.dojFex:
246 check(jFEX.jFEXSysSimTool.Key_jFexSRJetOutputContainer)
247 check(jFEX.jFEXSysSimTool.Key_jFexLRJetOutputContainer)
248 check(jFEX.jFEXSysSimTool.Key_jFexTauOutputContainer)
249 check(jFEX.jFEXSysSimTool.Key_jFexSumETOutputContainer)
250 check(jFEX.jFEXSysSimTool.Key_jFexMETOutputContainer)
251 check(jFEX.jFEXSysSimTool.Key_jFexFwdElOutputContainer)
252 if flags.Trigger.L1.dogFex:
253 check(gFEX.gFEXSysSimTool.Key_gFexSRJetOutputContainer)
254 check(gFEX.gFEXSysSimTool.Key_gFexLRJetOutputContainer)
255 check(gFEX.gFEXSysSimTool.Key_gFexRhoOutputContainer)
256 check(gFEX.gFEXSysSimTool.Key_gScalarEJwojOutputContainer)
257 check(gFEX.gFEXSysSimTool.Key_gMETComponentsJwojOutputContainer)
258 check(gFEX.gFEXSysSimTool.Key_gMHTComponentsJwojOutputContainer)
259 check(gFEX.gFEXSysSimTool.Key_gMSTComponentsJwojOutputContainer)
260 check(gFEX.gFEXSysSimTool.Key_gMETComponentsNoiseCutOutputContainer)
261 check(gFEX.gFEXSysSimTool.Key_gMETComponentsRmsOutputContainer)
262 check(gFEX.gFEXSysSimTool.Key_gScalarENoiseCutOutputContainer)
263 check(gFEX.gFEXSysSimTool.Key_gScalarERmsOutputContainer)
268 Add 'Sim' to the standard handle path and include user-specified suffix
271 if not key.endswith(
"Sim"): key +=
"Sim"
274 if flags.Trigger.L1.doeFex:
275 eFEX.eFEXSysSimTool.Key_eFexEMOutputContainer=
getSimHandle(
"L1_eEMRoI")
276 eFEX.eFEXSysSimTool.Key_eFexTauOutputContainer=
getSimHandle(
"L1_eTauRoI")
277 eFEX.eFEXSysSimTool.Key_eFexEMxTOBOutputContainer=
getSimHandle(
"L1_eEMxRoI")
278 eFEX.eFEXSysSimTool.Key_eFexTauxTOBOutputContainer=
getSimHandle(
"L1_eTauxRoI")
280 eFEX.eFEXSysSimTool.Key_eFexAltTauOutputContainer=
getSimHandle(
"L1_eTauRoIAlt")
281 eFEX.eFEXSysSimTool.Key_eFexAltTauxTOBOutputContainer=
getSimHandle(
"L1_eTauxRoIAlt")
283 if flags.Trigger.L1.dojFex:
284 jFEX.jFEXSysSimTool.Key_jFexSRJetOutputContainer=
getSimHandle(
"L1_jFexSRJetRoI")
285 jFEX.jFEXSysSimTool.Key_jFexLRJetOutputContainer=
getSimHandle(
"L1_jFexLRJetRoI")
286 jFEX.jFEXSysSimTool.Key_jFexTauOutputContainer=
getSimHandle(
"L1_jFexTauRoI")
287 jFEX.jFEXSysSimTool.Key_jFexSumETOutputContainer=
getSimHandle(
"L1_jFexSumETRoI")
288 jFEX.jFEXSysSimTool.Key_jFexMETOutputContainer=
getSimHandle(
"L1_jFexMETRoI")
289 jFEX.jFEXSysSimTool.Key_jFexFwdElOutputContainer=
getSimHandle(
"L1_jFexFwdElRoI")
290 jFEX.jFEXSysSimTool.Key_xTobOutKey_jJ=
getSimHandle(
"L1_jFexSRJetxRoI")
291 jFEX.jFEXSysSimTool.Key_xTobOutKey_jLJ=
getSimHandle(
"L1_jFexLRJetxRoI")
292 jFEX.jFEXSysSimTool.Key_xTobOutKey_jTau=
getSimHandle(
"L1_jFexTauxRoI")
293 jFEX.jFEXSysSimTool.Key_xTobOutKey_jEM=
getSimHandle(
"L1_jFexFwdElxRoI")
294 if flags.Trigger.L1.dogFex:
295 gFEX.gFEXSysSimTool.Key_gFexSRJetOutputContainer=
getSimHandle(
"L1_gFexSRJetRoI")
296 gFEX.gFEXSysSimTool.Key_gFexLRJetOutputContainer=
getSimHandle(
"L1_gFexLRJetRoI")
297 gFEX.gFEXSysSimTool.Key_gFexRhoOutputContainer=
getSimHandle(
"L1_gFexRhoRoI")
298 gFEX.gFEXSysSimTool.Key_gScalarEJwojOutputContainer=
getSimHandle(
"L1_gScalarEJwoj")
299 gFEX.gFEXSysSimTool.Key_gMETComponentsJwojOutputContainer=
getSimHandle(
"L1_gMETComponentsJwoj")
300 gFEX.gFEXSysSimTool.Key_gMHTComponentsJwojOutputContainer=
getSimHandle(
"L1_gMHTComponentsJwoj")
301 gFEX.gFEXSysSimTool.Key_gMSTComponentsJwojOutputContainer=
getSimHandle(
"L1_gMSTComponentsJwoj")
302 gFEX.gFEXSysSimTool.Key_gMETComponentsNoiseCutOutputContainer=
getSimHandle(
"L1_gMETComponentsNoiseCut")
303 gFEX.gFEXSysSimTool.Key_gMETComponentsRmsOutputContainer=
getSimHandle(
"L1_gMETComponentsRms")
304 gFEX.gFEXSysSimTool.Key_gScalarENoiseCutOutputContainer=
getSimHandle(
"L1_gScalarENoiseCut")
305 gFEX.gFEXSysSimTool.Key_gScalarERmsOutputContainer=
getSimHandle(
"L1_gScalarERms")