5 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
6 from AthenaConfiguration.ComponentFactory
import CompFactory
7 from AthenaConfiguration.Enums
import Format
11 Config for emulating gFex input data from LATOME readout
15 acc.addEventAlgo( CompFactory.LVL1.gFexTowerBuilder(name=name,
16 SCell=flags.Trigger.L1.L1CaloSuperCellContainerName,
17 gTowersWriteKey = writeKey,
18 isDATA =
not flags.Input.isMC,
19 gFEX2SCmapping =
"Run3L1CaloSimulation/L1CaloFEXAlgos/gFEX/gCaloTowers_to_scells_v1.txt",
20 gFEX2Tilemapping =
"Run3L1CaloSimulation/L1CaloFEXAlgos/gFEX/gCaloTowers_to_tile_v1.txt",
21 gFexFiberTowerMapping =
"Run3L1CaloSimulation/L1CaloFEXAlgos/gFEX/gFex_gCaloTowerMap_weighted_v1.txt") )
26 Config for emulating jFex input data from LATOME readout
30 emulator = CompFactory.LVL1.jFexEmulatedTowers(name)
31 emulator.SCell = flags.Trigger.L1.L1CaloSuperCellContainerName
32 emulator.jTowersWriteKey = writeKey
33 emulator.isDATA =
not flags.Input.isMC
34 acc.addEventAlgo(emulator)
40 Config for emulating eFex input data from LATOME readout
44 emulator = CompFactory.LVL1.eFexTowerBuilder(name,ApplyMasking=
not flags.Input.isMC)
45 emulator.eFexContainerWriteKey = writeKey
46 acc.addEventAlgo(emulator)
51 if __name__ ==
'__main__':
52 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
53 from AthenaCommon.Logging
import logging
58 parser = argparse.ArgumentParser(prog=
'python -m L1CaloFEXAlgos.FexEmulatedTowersConfig',
59 description=
"""Emulator tools for FEX towers athena script.\n\n
60 Example: python -m L1CaloFEXAlgos.FexEmulatedTowersConfig --filesInput "data22*" --evtMax 10 --outputs jTowers """)
61 parser.add_argument(
'--evtMax',type=int,default=-1,help=
"number of events")
62 parser.add_argument(
'--filesInput',nargs=
'+',help=
"input files",required=
True)
63 parser.add_argument(
'--outputs',nargs=
'+',choices={
"jTowers",
"eTowers"},required=
True, help=
"What data to decode and emulate")
64 parser.add_argument(
'--outputLevel',default=
"WARNING",choices={
'INFO',
'WARNING',
'DEBUG',
'VERBOSE'})
65 args = parser.parse_args()
68 log = logging.getLogger(
'FexEmulatedTowersConfig')
69 log.setLevel(logging.DEBUG)
71 from AthenaCommon
import Constants
72 algLogLevel = getattr(Constants,args.outputLevel)
75 if any([
"data" in f
for f
in args.filesInput]):
76 flags.Trigger.triggerConfig=
'DB'
78 flags.Exec.OutputLevel = algLogLevel
79 flags.Exec.MaxEvents = args.evtMax
80 flags.Input.Files = [file
for x
in args.filesInput
for file
in glob.glob(x)]
81 flags.Concurrency.NumThreads = 1
82 flags.Concurrency.NumConcurrentEvents = 1
84 if not flags.Input.isMC:
85 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
86 flags.GeoModel.AtlasVersion = defaultGeometryTags.autoconfigure(flags)
88 if any([
"data" in f
for f
in args.filesInput]):
90 flags.Output.AODFileName =
"AOD."+(s.split(
"/")[-1]).
split(
'_SFO')[0]+
"pool.root"
92 flags.Output.AODFileName =
'AOD.pool.root'
94 flags.Trigger.EDMVersion = 3
95 flags.Trigger.doLVL1 =
True
96 flags.Trigger.enableL1CaloPhase1 =
True
99 from AthenaConfiguration.DetectorConfigFlags
import setupDetectorsFromList
106 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
110 from TriggerJobOpts.TriggerByteStreamConfig
import ByteStreamReadCfg
115 from TrigConfigSvc.TrigConfigSvcCfg
import L1ConfigSvcCfg
120 maybeMissingRobs = []
123 auxType = edmType.replace(
'Container',
'AuxContainer')
124 return [f
'{edmType}#{edmName}',
125 f
'{auxType}#{edmName}Aux.']
133 from L1CaloFEXSim.L1CaloFEXSimCfg
import ReadSCellFromByteStreamCfg,TriggerTowersInputCfg
143 if 'jTowers' in args.outputs:
145 outputEDM +=
addEDM(
'xAOD::jFexTowerContainer',
'L1_jFexEmulatedTowers')
148 from L1CaloFEXByteStream.L1CaloFEXByteStreamConfig
import jFexInputByteStreamToolCfg
150 for module_id
in inputjFexTool.ROBIDs:
151 maybeMissingRobs.append(module_id)
153 decoderTools += [inputjFexTool]
155 outputEDM +=
addEDM(
'xAOD::jFexTowerContainer', inputjFexTool.jTowersWriteKey.Path)
160 if 'eTowers' in args.outputs:
162 outputEDM +=
addEDM(
'xAOD::eFexTowerContainer',
'L1_eFexEmulatedTowers')
165 from L1CaloFEXByteStream.L1CaloFEXByteStreamConfig
import eFexByteStreamToolCfg
167 flags,
'eFexBSDecoder',TOBs=
False,xTOBs=
False,decodeInputs=
True))
168 for module_id
in inputeFexTool.ROBIDs:
169 maybeMissingRobs.append(module_id)
171 decoderTools += [inputeFexTool]
173 outputEDM +=
addEDM(
'xAOD::eFexTowerContainer',
'L1_eFexDataTowers')
176 decoderAlg = CompFactory.L1TriggerByteStreamDecoderAlg(name=
"L1TriggerByteStreamDecoder",
177 DecoderTools=decoderTools, OutputLevel=algLogLevel,
178 MaybeMissingROBs=maybeMissingRobs)
180 acc.addEventAlgo(decoderAlg, sequenceName=
'AthAlgSeq')
184 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
185 log.debug(
'Adding the following output EDM to ItemList: %s', outputEDM)
188 acc.getEventAlgo(
"EventInfoTagBuilder").PropagateInput = (flags.Input.Format != Format.BS)
190 if acc.run().isFailure():