Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
L1CaloFEXSimCfg.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 #
4 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
5 from AthenaConfiguration.ComponentFactory import CompFactory
6 from AthenaCommon.Logging import logging
7 
8 def 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 
24 def ReadSCellFromByteStreamCfg(flags, key='SCell', SCmask=True):
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 
47 def eFEXTOBEtToolCfg(flags):
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 
76 def 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  if 'L1_eFexEmulatedTowers' in eFexTowerInputs and "L1_eFexEmulatedTowers" not in flags.Input.Collections:
112  doV6Mapping=False # latome fex input mapping if different between v5 and v6 ... for now only switching to v6 in data
113  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
114  from LArConditionsCommon.LArRunFormat import getLArDTInfoForRun
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) # 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
119  if doV6Mapping: builderAlg.MappingFile='' # need to regenerate mapping on-the-fly for v6
120  acc.addEventAlgo( builderAlg )
121 
122  if flags.Trigger.L1.doeFex:
123  if eFexTowerInputs==[]:
124  # no input specified, so use the old eTowerMaker
125  eFEXInputs = CompFactory.LVL1.eTowerMakerFromSuperCells('eTowerMakerFromSuperCells',
126  eSuperCellTowerMapperTool = CompFactory.LVL1.eSuperCellTowerMapper('eSuperCellTowerMapper', SCell=sCellType))
127  else:
128  # if primary is DataTowers, check that caloInputs are enabled (if data towers not already available). If it isn't then skip this
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")
132  import sys
133  sys.exit(1)
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 ""
140 
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')
145 
146  # read algoVersions from menu and configure the algo tools
147  from TrigConfigSvc.TriggerConfigAccess import getL1MenuAccess
148  L1_menu = getL1MenuAccess(flags)
149 
150  em_algoVersion = L1_menu.thresholdExtraInfo("eEM").get("algoVersion", 0)
151  tau_algoVersion = L1_menu.thresholdExtraInfo("eTAU").get("algoVersion", 0)
152 
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"))
155 
156  eFEX.eFEXSysSimTool.eFEXSimTool.eFEXFPGATool.eFEXegAlgoTool = CompFactory.LVL1.eFEXegAlgo('eFEXegAlgoTool',algoVersion=em_algoVersion,dmCorr=deadMaterialCorrections) # only dmCorrections in data for now
157  eFEX.eFEXSysSimTool.eFEXSimTool.eFEXFPGATool.eFEXtauAlgoTool = CompFactory.LVL1.eFEXtauAlgo("eFEXtauAlgo") # heuristic algorithm
158  eFEX.eFEXSysSimTool.eFEXSimTool.eFEXFPGATool.eFEXtauBDTAlgoTool = CompFactory.LVL1.eFEXtauBDTAlgo("eFEXtauBDTAlgo", BDTJsonConfigPath=bdtConfigJsonPath)
159  # To dump supercells as a decorator to the tau TOB, set
160  # eFEX.eFEXSysSimTool.eFEXSimTool.eFEXFPGATool.eFEXtauAlgoTool.DumpSuperCells = True
161  # and/or
162  # eFEX.eFEXSysSimTool.eFEXSimTool.eFEXFPGATool.eFEXtauBDTAlgoTool.DumpSuperCells = True
163 
164 
165 
166 
167  # load noise cuts and dm corrections when running on data
168  from IOVDbSvc.IOVDbSvcConfig import addFolders#, addFoldersSplitOnline
169 
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")) # dmCorr from DB!
173  eFEX.eFEXSysSimTool.eFEXSimTool.eFEXFPGATool.eFEXegAlgoTool.DMCorrectionsKey = "/TRIGGER/L1Calo/V1/Calibration/EfexEnergyCalib"
174 
175  acc.addEventAlgo(eFEXInputs)
176  acc.addEventAlgo(eFEX)
177 
178  if simulateAltTau:
179  eFEX.eFEXSysSimTool.Key_eFexAltTauOutputContainer="L1_eTauRoIAlt"
180  eFEX.eFEXSysSimTool.Key_eFexAltTauxTOBOutputContainer="L1_eTauxRoIAlt"
181 
182 
183  if flags.Trigger.L1.dojFex:
184 
185  if flags.Input.Format is not Format.POOL:
186  from L1CaloFEXByteStream.L1CaloFEXByteStreamConfig import jFexInputByteStreamToolCfg
187  inputjFexTool = acc.popToolsAndMerge(jFexInputByteStreamToolCfg(flags, 'jFexInputBSDecoderTool'))
188 
189  maybeMissingRobs = []
190  decoderTools = []
191 
192  for module_id in inputjFexTool.ROBIDs:
193  maybeMissingRobs.append(module_id)
194 
195  decoderTools += [inputjFexTool]
196  decoderAlg = CompFactory.L1TriggerByteStreamDecoderAlg(name="L1TriggerByteStreamDecoder", DecoderTools=[inputjFexTool], MaybeMissingROBs=maybeMissingRobs)
197  acc.addEventAlgo(decoderAlg)
198 
199  if "L1_jFexEmulatedTowers" not in flags.Input.Collections:
200  from L1CaloFEXAlgos.FexEmulatedTowersConfig import jFexEmulatedTowersCfg
201  acc.merge(jFexEmulatedTowersCfg(flags))
202 
203  from L1CaloFEXCond.L1CaloFEXCondConfig import jFexDBConfig
204  acc.merge(jFexDBConfig(flags))
205 
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
210  # need to set an IsMC property on a tool deep inside the toolstack:
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)
218 
219 
220  if flags.Trigger.L1.dogFex:
221 
222  if flags.Input.Format is not Format.POOL:
223  from L1CaloFEXByteStream.L1CaloFEXByteStreamConfig import gFexInputByteStreamToolCfg
224  inputgFexTool = acc.popToolsAndMerge(gFexInputByteStreamToolCfg(flags, 'gFexInputBSDecoderTool'))
225 
226  maybeMissingRobs = []
227  decoderTools = []
228 
229  for module_id in inputgFexTool.ROBIDs:
230  maybeMissingRobs.append(module_id)
231 
232  decoderTools += [inputgFexTool]
233  decoderAlg = CompFactory.L1TriggerByteStreamDecoderAlg(name="L1TriggerByteStreamDecoder", DecoderTools=[inputgFexTool], MaybeMissingROBs=maybeMissingRobs)
234  acc.addEventAlgo(decoderAlg)
235 
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 = True
240 
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 = True
247 
248  from L1CaloFEXCond.L1CaloFEXCondConfig import gFexDBConfig
249  acc.merge(gFexDBConfig(flags))
250 
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)
256 
257  if flags.Trigger.doHLT:
258  # This will be the case when the offline simulation is actually being run as part of MC
259  # as opposed to running another pass of the simulation on either an MC or data file (e.g in DAOD)
260  # Check the RoI EDM containers are registered in HLT outputs
261  from TrigEDMConfig.TriggerEDM import recordable
262  def check(key):
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)
267  if (simulateAltTau):
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)
288  else:
289  # Rename outputs for monitoring resimulation to avoid clash with standard SG keys
290  def getSimHandle(key):
291  """
292  Add 'Sim' to the standard handle path and include user-specified suffix
293  """
294  key += outputSuffix
295  if not key.endswith("Sim"): key += "Sim"
296  return key
297 
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")
303  if simulateAltTau:
304  eFEX.eFEXSysSimTool.Key_eFexAltTauOutputContainer=getSimHandle("L1_eTauRoIAlt")
305  eFEX.eFEXSysSimTool.Key_eFexAltTauxTOBOutputContainer=getSimHandle("L1_eTauxRoIAlt")
306 
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")
330 
331  return acc
332 
333 
334 if __name__ == '__main__':
335 
338  import argparse
339  p = argparse.ArgumentParser()
340  p.add_argument('-i', '--input',
341  metavar='KEY',
342  default='ttbar',
343  help='Key of the input from TrigValInputs to be used, default=%(default)s')
344  p.add_argument('-e', '--execute',
345  action='store_true',
346  help='After building the configuration, also process a few events')
347  p.add_argument('-n', '--nevents',
348  metavar='N',
349  type=int,
350  default=25,
351  help='Number of events to process if --execute is used, default=%(default)s')
352  p.add_argument('-d', '--efexdebug',
353  action='store_true',
354  help='Activate DEBUG mode for eFEX driver .. this option is required by a unit test')
355 
356  args = p.parse_args()
357 
358 
361  from AthenaConfiguration.AllConfigFlags import initConfigFlags
362  from TrigValTools.TrigValSteering import Input
363  import os
364 
365  flags = initConfigFlags()
366  flags.Common.isOnline = True
367  flags.Input.Files = [args.input] if os.path.isfile(args.input) else Input.get_input(args.input).paths
368  if not flags.Input.isMC:
369  from AthenaConfiguration.TestDefaults import defaultGeometryTags
370  flags.GeoModel.AtlasVersion = defaultGeometryTags.autoconfigure(flags)
371  from AthenaConfiguration.Enums import LHCPeriod
372  flags.IOVDb.GlobalTag = 'CONDBR2-HLTP-2023-01' if flags.GeoModel.Run is LHCPeriod.Run3 else 'CONDBR2-HLTP-2018-04'
373  else:
374  from AthenaConfiguration.TestDefaults import defaultConditionsTags
375  flags.IOVDb.GlobalTag = defaultConditionsTags.RUN3_MC
376  flags.Output.AODFileName = 'AOD.pool.root'
377  flags.Exec.MaxEvents = args.nevents
378  flags.Concurrency.NumThreads = 1
379  flags.Concurrency.NumConcurrentEvents = 1
380  flags.Scheduler.ShowDataDeps = True
381  flags.Scheduler.CheckDependencies = True
382  flags.Scheduler.ShowDataFlow = True
383  flags.Trigger.EDMVersion = 3
384  flags.Trigger.doLVL1 = True
385  flags.Trigger.enableL1CaloPhase1 = True
386  flags.Trigger.triggerConfig = 'FILE'
387 
388  # Enable only calo for this test
389  from AthenaConfiguration.DetectorConfigFlags import setupDetectorFlags
390  setupDetectorFlags(flags, ['LAr','Tile','MBTS'], toggle_geometry=True)
391 
392  flags.lock()
393 
394 
397  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
398  acc = MainServicesCfg(flags)
399 
400  from AthenaConfiguration.Enums import Format
401  if flags.Input.Format == Format.POOL:
402  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
403  acc.merge(PoolReadCfg(flags))
404  else:
405  from TriggerJobOpts.TriggerByteStreamConfig import ByteStreamReadCfg
406  acc.merge(ByteStreamReadCfg(flags))
407 
408  from TrigConfigSvc.TrigConfigSvcCfg import L1ConfigSvcCfg, generateL1Menu, createL1PrescalesFileFromMenu
409  generateL1Menu(flags)
411  acc.merge(L1ConfigSvcCfg(flags))
412 
413  from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
414  FexEDMList = [
415  'xAOD::eFexEMRoIContainer#L1_eEMRoI','xAOD::eFexEMRoIAuxContainer#L1_eEMRoIAux.',
416  'xAOD::eFexTauRoIContainer#L1_eTauRoI','xAOD::eFexTauRoIAuxContainer#L1_eTauRoIAux.',
417  'xAOD::jFexTauRoIContainer#L1_jFexTauRoI','xAOD::jFexTauRoIAuxContainer#L1_jFexTauRoIAux.',
418  'xAOD::jFexSRJetRoIContainer#L1_jFexSRJetRoI','xAOD::jFexSRJetRoIAuxContainer#L1_jFexSRJetRoIAux.',
419  'xAOD::jFexLRJetRoIContainer#L1_jFexLRJetRoI','xAOD::jFexLRJetRoIAuxContainer#L1_jFexLRJetRoIAux.',
420  'xAOD::jFexMETRoIContainer#L1_jFexMETRoI','xAOD::jFexMETRoIAuxContainer#L1_jFexMETRoIAux.',
421  'xAOD::jFexSumETRoIContainer#L1_jFexSumETRoI','xAOD::jFexSumETRoIAuxContainer#L1_jFexSumETRoIAux.',
422  'xAOD::gFexJetRoIContainer#L1_gFexSRJetRoI','xAOD::gFexJetRoIAuxContainer#L1_gFexSRJetRoIAux.',
423  'xAOD::gFexJetRoIContainer#L1_gFexLRJetRoI','xAOD::gFexJetRoIAuxContainer#L1_gFexLRJetRoIAux.',
424  'xAOD::gFexJetRoIContainer#L1_gFexRhoRoI','xAOD::gFexJetRoIAuxContainer#L1_gFexRhoRoIAux.',
425  'xAOD::gFexGlobalRoIContainer#L1_gScalarEJwoj','xAOD::gFexGlobalRoIAuxContainer#L1_gScalarEJwojAux.',
426  'xAOD::gFexGlobalRoIContainer#L1_gMETComponentsJwoj','xAOD::gFexGlobalRoIAuxContainer#L1_gMETComponentsJwojAux.',
427  'xAOD::gFexGlobalRoIContainer#L1_gMHTComponentsJwoj','xAOD::gFexGlobalRoIAuxContainer#L1_gMHTComponentsJwojAux.',
428  'xAOD::gFexGlobalRoIContainer#L1_gMSTComponentsJwoj','xAOD::gFexGlobalRoIAuxContainer#L1_gMSTComponentsJwojAux.',
429  'xAOD::gFexGlobalRoIContainer#L1_gMETComponentsNoiseCut','xAOD::gFexGlobalRoIAuxContainer#L1_gMETComponentsNoiseCutAux.',
430  'xAOD::gFexGlobalRoIContainer#L1_gMETComponentsRms','xAOD::gFexGlobalRoIAuxContainer#L1_gMETComponentsRmsAux.',
431  'xAOD::gFexGlobalRoIContainer#L1_gScalarENoiseCut','xAOD::gFexGlobalRoIAuxContainer#L1_gScalarENoiseCutAux.',
432  'xAOD::gFexGlobalRoIContainer#L1_gScalarERms','xAOD::gFexGlobalRoIAuxContainer#L1_gScalarERmsAux.',
433 
434  ]
435  acc.merge(OutputStreamCfg(flags, 'AOD', ItemList=FexEDMList))
436 
437 
440  acc.merge(L1CaloFEXSimCfg(flags))
441  if args.efexdebug:
442  from AthenaCommon.Constants import DEBUG
443  acc.getEventAlgo("eFEXDriver").OutputLevel = DEBUG
444 
445 
448  with open("L1Sim.pkl", "wb") as f:
449  acc.store(f)
450  f.close()
451 
452  if args.execute:
453  sc = acc.run()
454  if sc.isFailure():
455  exit(1)
L1CaloFEXSimCfg.ReadSCellFromByteStreamCfg
def ReadSCellFromByteStreamCfg(flags, key='SCell', SCmask=True)
Definition: L1CaloFEXSimCfg.py:24
L1CaloFEXCondConfig.jFexDBConfig
def jFexDBConfig(flags, name="jFEXCondAlgo")
Definition: L1CaloFEXCondConfig.py:8
PathResolver::FindCalibFile
static std::string FindCalibFile(const std::string &logical_file_name)
Definition: PathResolver.h:108
L1CaloFEXSimCfg.TriggerTowersInputCfg
def TriggerTowersInputCfg(flags)
Definition: L1CaloFEXSimCfg.py:64
LArCablingConfig.LArOnOffIdMappingSCCfg
def LArOnOffIdMappingSCCfg(configFlags)
Definition: LArCablingConfig.py:65
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
FEXReprocessingRun3.getSimHandle
def getSimHandle(key)
Definition: FEXReprocessingRun3.py:87
python.EmulationConfig.emulateSC_Cfg
def emulateSC_Cfg(flags, CellsIn="SeedLessFS", CellsOut="")
Definition: EmulationConfig.py:3
LArRAWtoSuperCellConfig.LArRAWtoSuperCellCfg
def LArRAWtoSuperCellCfg(flags, name="LArRAWtoSuperCell", mask=True, SCellContainerOut="", SCIn="", doReco=False, bcidShift=0)
Definition: LArRAWtoSuperCellConfig.py:8
python.OutputStreamConfig.OutputStreamCfg
def OutputStreamCfg(flags, streamName, ItemList=[], MetadataItemList=[], disableEventTag=False, trigNavThinningSvc=None, takeItemsFromInput=False, extendProvenanceRecord=True, keepProvenanceTagsRegEx=None, AcceptAlgs=[], HelperTools=[])
Definition: OutputStreamConfig.py:16
python.TrigConfigSvcCfg.generateL1Menu
def generateL1Menu(flags)
Definition: TrigConfigSvcCfg.py:189
L1CaloFEXSimCfg.L1CaloFEXSimCfg
def L1CaloFEXSimCfg(flags, eFexTowerInputs=["L1_eFexDataTowers","L1_eFexEmulatedTowers"], deadMaterialCorrections=True, outputSuffix="", simulateAltTau=False)
Definition: L1CaloFEXSimCfg.py:76
python.ByteStreamConfig.ByteStreamReadCfg
def ByteStreamReadCfg(flags, type_names=None)
Definition: Event/ByteStreamCnvSvc/python/ByteStreamConfig.py:25
LVL1CaloRun2ByteStreamConfig.LVL1CaloRun2ReadBSCfg
def LVL1CaloRun2ReadBSCfg(flags, forRoIBResultToxAOD=False)
Definition: LVL1CaloRun2ByteStreamConfig.py:121
L1CaloFEXByteStreamConfig.jFexInputByteStreamToolCfg
def jFexInputByteStreamToolCfg(flags, name, *writeBS=False)
Definition: L1CaloFEXByteStreamConfig.py:232
LArCablingConfig.LArLATOMEMappingCfg
def LArLATOMEMappingCfg(configFlags)
Definition: LArCablingConfig.py:95
python.TriggerConfigAccess.getL1MenuAccess
L1MenuAccess getL1MenuAccess(flags=None)
Definition: TriggerConfigAccess.py:129
python.LArRunFormat.getLArDTInfoForRun
def getLArDTInfoForRun(run, quiet=False, connstring="COOLONL_LAR/CONDBR2")
Definition: LArRunFormat.py:152
LArRunFormat
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
Constants
some useful constants -------------------------------------------------—
python.IOVDbSvcConfig.addFolders
def addFolders(flags, folderStrings, detDb=None, className=None, extensible=False, tag=None, db=None, modifiers='')
Definition: IOVDbSvcConfig.py:81
calibdata.exit
exit
Definition: calibdata.py:236
L1CaloFEXSimCfg.eFEXTOBEtToolCfg
def eFEXTOBEtToolCfg(flags)
Definition: L1CaloFEXSimCfg.py:47
LArGMConfig.LArGMCfg
def LArGMCfg(flags)
Definition: LArGMConfig.py:8
python.DetectorConfigFlags.setupDetectorFlags
def setupDetectorFlags(flags, custom_list=None, use_metadata=False, toggle_geometry=False, validate_only=False, keep_beampipe=False)
Definition: DetectorConfigFlags.py:291
L1CaloFEXSimCfg.ReadSCellFromPoolFileCfg
def ReadSCellFromPoolFileCfg(flags, key='SCell')
Definition: L1CaloFEXSimCfg.py:8
L1CaloFEXByteStreamConfig.gFexInputByteStreamToolCfg
def gFexInputByteStreamToolCfg(flags, name, *writeBS=False)
Definition: L1CaloFEXByteStreamConfig.py:275
LArNewCalib_Delay_OFC_Cali.check
check
Definition: LArNewCalib_Delay_OFC_Cali.py:289
python.TrigConfigSvcCfg.L1ConfigSvcCfg
def L1ConfigSvcCfg(flags)
Definition: TrigConfigSvcCfg.py:203
Trk::open
@ open
Definition: BinningType.h:40
python.TrigConfigSvcCfg.createL1PrescalesFileFromMenu
def createL1PrescalesFileFromMenu(flags, Optional[dict[str, float]] prescales=None)
Definition: TrigConfigSvcCfg.py:165
TrigT1CaloSimRun2Config.Run2TriggerTowerMakerCfg
def Run2TriggerTowerMakerCfg(flags, name='Run2TriggerTowerMaker25ns')
Definition: TrigT1CaloSimRun2Config.py:10
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition: hcg.cxx:127
FexEmulatedTowersConfig.jFexEmulatedTowersCfg
def jFexEmulatedTowersCfg(flags, name="jFexEmulatedTowerMaker", writeKey="L1_jFexEmulatedTowers")
Definition: FexEmulatedTowersConfig.py:9
L1CaloFEXCondConfig.gFexDBConfig
def gFexDBConfig(flags, name="gFEXCondAlgo")
Definition: L1CaloFEXCondConfig.py:34
python.TriggerEDM.recordable
def recordable(arg, runVersion=3)
Definition: TriggerEDM.py:34
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69
L1CaloFEXSimCfg
Definition: L1CaloFEXSimCfg.py:1
TileGMConfig.TileGMCfg
def TileGMCfg(flags)
Definition: TileGMConfig.py:7