5 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
6 from AthenaConfiguration.ComponentFactory
import CompFactory
7 from AthenaConfiguration.Enums
import Format
11 Config for emulating jFex input data from LATOME readout
15 emulator = CompFactory.LVL1.jFexEmulatedTowers(name)
16 emulator.SCell = flags.Trigger.L1.L1CaloSuperCellContainerName
17 emulator.jTowersWriteKey = writeKey
18 emulator.isDATA =
not flags.Input.isMC
19 acc.addEventAlgo(emulator)
25 Config for emulating eFex input data from LATOME readout
29 emulator = CompFactory.LVL1.eFexTowerBuilder(name,ApplyMasking=
not flags.Input.isMC)
30 emulator.eFexContainerWriteKey = writeKey
31 acc.addEventAlgo(emulator)
36 if __name__ ==
'__main__':
37 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
38 from AthenaCommon.Logging
import logging
43 parser = argparse.ArgumentParser(prog=
'python -m L1CaloFEXAlgos.FexEmulatedTowersConfig',
44 description=
"""Emulator tools for FEX towers athena script.\n\n
45 Example: python -m L1CaloFEXAlgos.FexEmulatedTowersConfig --filesInput "data22*" --evtMax 10 --outputs jTowers """)
46 parser.add_argument(
'--evtMax',type=int,default=-1,help=
"number of events")
47 parser.add_argument(
'--filesInput',nargs=
'+',help=
"input files",required=
True)
48 parser.add_argument(
'--outputs',nargs=
'+',choices={
"jTowers",
"eTowers"},required=
True, help=
"What data to decode and emulate")
49 parser.add_argument(
'--outputLevel',default=
"WARNING",choices={
'INFO',
'WARNING',
'DEBUG',
'VERBOSE'})
50 args = parser.parse_args()
53 log = logging.getLogger(
'FexEmulatedTowersConfig')
54 log.setLevel(logging.DEBUG)
56 from AthenaCommon
import Constants
57 algLogLevel = getattr(Constants,args.outputLevel)
60 if any([
"data" in f
for f
in args.filesInput]):
61 flags.Trigger.triggerConfig=
'DB'
63 flags.Exec.OutputLevel = algLogLevel
64 flags.Exec.MaxEvents = args.evtMax
65 flags.Input.Files = [file
for x
in args.filesInput
for file
in glob.glob(x)]
66 flags.Concurrency.NumThreads = 1
67 flags.Concurrency.NumConcurrentEvents = 1
69 if not flags.Input.isMC:
70 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
71 flags.GeoModel.AtlasVersion = defaultGeometryTags.autoconfigure(flags)
73 if any([
"data" in f
for f
in args.filesInput]):
75 flags.Output.AODFileName =
"AOD."+(s.split(
"/")[-1]).
split(
'_SFO')[0]+
"pool.root"
77 flags.Output.AODFileName =
'AOD.pool.root'
79 flags.Trigger.EDMVersion = 3
80 flags.Trigger.doLVL1 =
True
81 flags.Trigger.enableL1CaloPhase1 =
True
84 from AthenaConfiguration.DetectorConfigFlags
import setupDetectorsFromList
91 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
95 from TriggerJobOpts.TriggerByteStreamConfig
import ByteStreamReadCfg
100 from TrigConfigSvc.TrigConfigSvcCfg
import L1ConfigSvcCfg
105 maybeMissingRobs = []
108 auxType = edmType.replace(
'Container',
'AuxContainer')
109 return [f
'{edmType}#{edmName}',
110 f
'{auxType}#{edmName}Aux.']
118 from L1CaloFEXSim.L1CaloFEXSimCfg
import ReadSCellFromByteStreamCfg,TriggerTowersInputCfg
128 if 'jTowers' in args.outputs:
130 outputEDM +=
addEDM(
'xAOD::jFexTowerContainer',
'L1_jFexEmulatedTowers')
133 from L1CaloFEXByteStream.L1CaloFEXByteStreamConfig
import jFexInputByteStreamToolCfg
135 for module_id
in inputjFexTool.ROBIDs:
136 maybeMissingRobs.append(module_id)
138 decoderTools += [inputjFexTool]
140 outputEDM +=
addEDM(
'xAOD::jFexTowerContainer', inputjFexTool.jTowersWriteKey.Path)
145 if 'eTowers' in args.outputs:
147 outputEDM +=
addEDM(
'xAOD::eFexTowerContainer',
'L1_eFexEmulatedTowers')
150 from L1CaloFEXByteStream.L1CaloFEXByteStreamConfig
import eFexByteStreamToolCfg
152 flags,
'eFexBSDecoder',TOBs=
False,xTOBs=
False,decodeInputs=
True))
153 for module_id
in inputeFexTool.ROBIDs:
154 maybeMissingRobs.append(module_id)
156 decoderTools += [inputeFexTool]
158 outputEDM +=
addEDM(
'xAOD::eFexTowerContainer',
'L1_eFexDataTowers')
161 decoderAlg = CompFactory.L1TriggerByteStreamDecoderAlg(name=
"L1TriggerByteStreamDecoder",
162 DecoderTools=decoderTools, OutputLevel=algLogLevel,
163 MaybeMissingROBs=maybeMissingRobs)
165 acc.addEventAlgo(decoderAlg, sequenceName=
'AthAlgSeq')
169 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
170 log.debug(
'Adding the following output EDM to ItemList: %s', outputEDM)
173 acc.getEventAlgo(
"EventInfoTagBuilder").PropagateInput = (flags.Input.Format != Format.BS)
175 if acc.run().isFailure():