11from AthenaCommon.Logging
import logging
12from AthenaCommon.Logging
import log
as topLog
13topLog.setLevel(logging.WARNING)
14log = logging.getLogger(
'l1calo-ath-mon')
15log.setLevel(logging.INFO)
17from TrigT1CaloMonitoring.LVL1CaloMonitoringConfig
import L1CaloMonitorCfgHelper
18L1CaloMonitorCfgHelper.embargoed = [
"Expert/Efficiency/gFEX/MuonReferenceTrigger/SRpt_L1_gJ400p0ETA25"]
22from AthenaConfiguration.ComponentFactory
import CompFactory
23from AthenaConfiguration.AllConfigFlags
import initConfigFlags
24from AthenaConfiguration.Enums
import LHCPeriod,Format
25from AthenaCommon
import Constants
29partition = ispy.IPCPartition(os.getenv(
"TDAQ_PARTITION",
"ATLAS"))
31flags = initConfigFlags()
33neededCats = [
"GeoModel",
"DQ",
"Trigger",
"PerfMon",
"Detector",
"Muon",
"Overlay",
"LAr",
"Reco",
"Calo",
"Tile"]
34for cat
in list(flags._dynaflags.keys()):
35 if cat
not in neededCats: del flags._dynaflags[cat]
42flags.Exec.OutputLevel = Constants.WARNING
43flags.Exec.InfoMessageComponents = [
"AthenaEventLoopMgr",
"AthenaHiveEventLoopMgr",
"THistSvc",
"PerfMonMTSvc",
"ApplicationMgr",
"AvalancheSchedulerSvc"]
44flags.Exec.PrintAlgsSequence =
True
48flags.GeoModel.Run = LHCPeriod.Run3
49flags.Common.useOnlineLumi =
True
50flags.DQ.doMonitoring =
True
51flags.DQ.enableLumiAccess =
False
52flags.DQ.FileKey =
"" if partition.isValid()
else "EXPERT"
53flags.Output.HISTFileName = os.getenv(
"L1CALO_ATHENA_JOB_NAME",
"") +
"monitoring.root"
54flags.DQ.useTrigger =
False
55flags.Trigger.L1.doCaloInputs = partition.isValid()
56flags.Trigger.enableL1CaloPhase1 =
True
58flags.Trigger.L1.doCalo = partition.isValid()
59flags.Trigger.L1.doeFex = partition.isValid()
60flags.Trigger.L1.dojFex = partition.isValid()
61flags.Trigger.L1.dogFex = partition.isValid()
62flags.Trigger.L1.doTopo = partition.isValid()
65if partition.isValid():
68 flags.Trigger.doLVL1 =
False
69 flags.Trigger.doHLT =
False
70 from AthenaConfiguration.AutoConfigOnlineRecoFlags
import autoConfigOnlineRecoFlags
71 autoConfigOnlineRecoFlags(flags, partition.name())
73 flags.Trigger.doLVL1 =
True
78parser = flags.getArgumentParser(epilog=
"""
79Extra flags are specified after a " -- " and the following are most relevant flags for this script:
81 Trigger.enableL1CaloPhase1 : turn on/off the offline simulation [default: True]
82 DQ.doMonitoring : turn on/off the monitoring [default: True]
83 Trigger.L1.doCaloInputs : controls input readout decoding and monitoring [default: False*]
84 Trigger.L1.doCalo : controls trex (legacy syst) monitoring [default: False]
85 Trigger.L1.doeFex : controls efex simulation and monitoring [default: False*]
86 Trigger.L1.dojFex : controls jfex simulation and monitoring [default: False*]
87 Trigger.L1.dogFex : controls gfex simulation and monitoring [default: False*]
88 Trigger.L1.doTopo : controls topo simulation and monitoring [default: False*] (from 2023 Onwards)
89 Trigger.L1.doGlobal : controls global simulation and monitoring [default: False]
90 DQ.useTrigger : controls if JetEfficiency monitoring alg is run or not [default: False]
91 PerfMon.doFullMonMT : print info about execution time of algorithms and memory use etc [default: False]
92 Trigger.triggerConfig : if you specifying this as "FILE:<filename>" the script will use that L1 json menu. [default: "DB" (takes menu from DB for data)]
94Note: If you do not specify any flags, then all the flags that are marked with a * will automatically become True
96E.g. to run just the jFex monitoring, without offline simulation, you can do:
98athena TrigT1CaloMonitoring/L1CalPhase1Monitoring.py .... -- Trigger.enableL1CaloPhase1=False Trigger.L1.doCaloInputs=False Trigger.L1.doeFex=False Trigger.L1.dogFex=False
100Further notes: Run with "--evtMax 0" to print flags and ca config, and generate a hanConfig file.
101 Run with "--evtMax 1" to dump StoreGate contents after the first event
106parser.formatter_class = argparse.RawDescriptionHelpFormatter
107parser.add_argument(
'--runNumber',default=
None,help=
"specify to select a run number")
108parser.add_argument(
'--lumiBlock',default=
None,help=
"specify to select a lumiBlock")
109parser.add_argument(
'--evtNumber',default=
None,nargs=
"+",type=int,help=
"specify to select an evtNumber")
110parser.add_argument(
'--stream',default=
"*",help=
"stream to lookup files in")
111parser.add_argument(
'--fexReadoutFilter',action=
'store_true',help=
"If specified, will skip events without fexReadout")
112parser.add_argument(
'--dbOverrides',default=
None,nargs=
"+",type=str,help=
"specify overrides of COOL database folders in form <folder>=<dbPath> or <folder>:<tag>[=<dbPath>] to override a tag, example: /TRIGGER/L1Calo/V1/Calibration/EfexEnergyCalib=mytest.db ")
113parser.add_argument(
'--postConfig',default=[],nargs=
"+",type=str,help=
"specify component properties to apply at the end of the config. Can also specify in the flags section if start with 'cfg.' Use '--postHelp' option to explore the configurables and their properties")
114parser.add_argument(
'--postInclude',default=[],nargs=
"+",type=str,help=
"specify python files to call before configuration completes")
115parser.add_argument(
'--postHelp',default=
None,nargs=
"*",help=
"Displays configurables and their properties")
116args,unknown_args = flags.fillFromArgs(parser=parser,return_unknown=
True)
117args.postConfig += [x[4:]
for x
in unknown_args
if x.startswith(
"cfg.")]
118if any([
not x.startswith(
"cfg.")
for x
in unknown_args]):
119 raise KeyError(
"Unknown flags: " +
" ".join([x
for x
in unknown_args
if not x.startswith(
"cfg.")]))
120if not any([flags.Trigger.L1.doCalo,flags.Trigger.L1.doCaloInputs,flags.Trigger.L1.doeFex,flags.Trigger.L1.dojFex,flags.Trigger.L1.dogFex,flags.Trigger.L1.doTopo,flags.DQ.useTrigger]):
121 log.info(
"No steering flags specified, turning on all phase 1 systems (trex,efex,jfex,gfex,topo)")
122 flags.Trigger.L1.doCaloInputs =
True
123 flags.Trigger.L1.doCalo =
True
124 flags.Trigger.L1.doeFex =
True
125 flags.Trigger.L1.dojFex =
True
126 flags.Trigger.L1.dogFex =
True
127 flags.Trigger.L1.doTopo =
True
130if len(flags.Input.Files)>0:
132 from AthenaConfiguration.TestDefaults
import defaultTestFiles
133 flags.Input.Files = [getattr(defaultTestFiles,f,f)
for f
in flags.Input.Files]
134 flags.Input.Files = [item
for x
in flags.Input.Files
for item
in (x
if isinstance(x,list)
else [x])]
136 for f
in flags.Input.Files:
137 if not os.path.exists(f):
138 log.fatal(f
"file '{f}' does not exist")
141if args.runNumber
is not None:
147 from glob
import glob
148 if args.lumiBlock
is None: args.lumiBlock=
"*"
149 log.info(
" ".join((
"Looking up files in atlastier0 for run",args.runNumber,
"lb =",args.lumiBlock)))
150 flags.Input.Files = []
151 for lb
in args.lumiBlock.split(
","):
153 tryStr = f
"/eos/atlas/atlastier0/rucio/data*/{args.stream}/*{args.runNumber}/*RAW/*lb*.*"
155 tryStr = f
"/eos/atlas/atlastier0/rucio/data*/{args.stream}/*{args.runNumber}/*RAW/*lb{int(lb):04}.*"
156 log.info(
" ".join((
"Trying",tryStr)))
157 flags.Input.Files += glob(tryStr)
158 log.info(
" ".join((
"Found",
str(len(flags.Input.Files)),
"files")))
161if type(flags.Trigger.triggerConfig)==str
and flags.Trigger.triggerConfig.startswith(
"FILE:"):
162 customMenuFile = flags.Trigger.triggerConfig.split(
":",1)[-1]
163 flags.Trigger.triggerConfig=
"FILE"
167if not flags.Common.isOnline
and len(flags.Input.Files)==0:
168 if flags.Exec.MaxEvents==0:
170 flags.Input.Files = [
"/eos/atlas/atlascerngroupdisk/det-l1calo/OfflineSoftware/TestFiles/data24_13p6TeV/data24_13p6TeV.00477048.physics_Main.daq.RAW._lb0821._SFO-20._0001.data"]
172 log.fatal(
"Running in offline mode but no input files provided. Please specify with: --filesInput <file>")
173 from AthenaConfiguration.TestDefaults
import defaultTestFiles
174 log.fatal(
"You can specify one of the default test files:" +
",".join([f
for f
in dir(defaultTestFiles)
if f[0].isupper()]))
176elif flags.Common.isOnline:
177 log.info(
"Running Online with Partition: "+partition.name())
180 if flags.Trigger.Online.partitionName ==
'':
183 flags.Trigger.doLVL1 =
False
184 flags.Trigger.doHLT =
False
185 from AthenaConfiguration.AutoConfigOnlineRecoFlags
import autoConfigOnlineRecoFlags
186 autoConfigOnlineRecoFlags(flags, partition.name())
187 standalone = (partition.name()!=
"ATLAS")
188 if standalone : log.info(
"Using local menu because partition is not ATLAS")
189 elif len(flags.Input.Files)==0
and partition.isValid():
192 log.info(
"Waiting 2 minutes for LATOME to get their databases in order")
196if len(flags.Input.Files)>0:
197 flags.DQ.Environment =
"user"
200 standalone = ((flags.Input.ProjectName ==
"data_test")
or (re.match(
r"data\d\d_calib", flags.Input.ProjectName)))
201 if standalone :
print(
"Using local menu because project_name=",flags.Input.ProjectName)
202 if flags.Input.isMC : flags.Trigger.triggerConfig=
'FILE'
203 elif flags.Trigger.triggerConfig==
'INFILE':
205 flags.Trigger.triggerConfig=
"DB"
207 if flags.Input.isMC
and flags.Trigger.L1.doCalo:
208 log.info(
"Disabling legacy monitoring because it doesn't work with MC")
209 flags.Trigger.L1.doCalo=
False
212 flags.Trigger.triggerConfig=
'FILE'
215if flags.Exec.MaxEvents == 0:
217 flags.DQ.doMonitoring=
True
218 flags.Trigger.L1.doCalo=
True
219 flags.Trigger.L1.doCaloInputs=
True
220 flags.Trigger.L1.doeFex=
True
221 flags.Trigger.L1.dojFex=
True
222 flags.Trigger.L1.dogFex=
True
223 flags.Trigger.L1.doTopo=
True
224 flags.DQ.useTrigger=
True
225 flags.Exec.OutputLevel = Constants.INFO
228if flags.GeoModel.AtlasVersion
is None:
229 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
230 flags.GeoModel.AtlasVersion = defaultGeometryTags.autoconfigure(flags)
232if flags.Trigger.triggerConfig==
"FILE" and flags.Trigger.L1.doCalo:
235 log.warning(
"Cannot run Legacy sim/mon when using json l1 menu. Disabling")
236 flags.Trigger.L1.doCalo=
False
238if (flags.Input.Format == Format.POOL): flags.Trigger.L1.doTopo =
False
239if not flags.Trigger.L1.doTopo: flags.Trigger.L1.doMuon =
False
241if flags.Trigger.enableL1CaloPhase1:
244 from AthenaConfiguration.DetectorConfigFlags
import setupDetectorsFromList
245 setupDetectorsFromList(flags,[
'LAr',
'Tile',
'MBTS'] + ([
'RPC',
'TGC',
'MDT']
if flags.Trigger.L1.doMuon
else []),
True)
247from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
248cfg = MainServicesCfg(flags)
250log.setLevel(logging.INFO)
253if flags.Exec.MaxEvents == 0: flags.dump(evaluate=
True)
256if not any([flags.Trigger.L1.doCaloInputs,flags.Trigger.L1.doCalo,flags.Trigger.L1.doeFex,flags.Trigger.L1.dojFex,flags.Trigger.L1.dogFex,flags.Trigger.L1.doTopo]):
257 log.fatal(
"You did not set any flags to specify what to run. ")
258 log.fatal(
"Please set at least one of the flags in Trigger.L1.(doCaloInputs, doCalo, doeFex, dojFex, dogFex, doTopo) ")
259 log.fatal(
"or use '--all' option to turn on everything (but that is slow)")
260 log.fatal(
"See --help for more info about the flags")
263if flags.Common.isOnline
and len(flags.Input.Files)==0:
264 flags.dump(evaluate=
True)
265 from ByteStreamEmonSvc.EmonByteStreamConfig
import EmonByteStreamCfg
266 cfg.merge(EmonByteStreamCfg(flags))
267 bsSvc = cfg.getService(
"ByteStreamInputSvc")
268 bsSvc.Partition = partition.name()
269 bsSvc.Key = os.environ.get(
"L1CALO_PTIO_KEY",
"REB" if partition.name()==
"L1CaloStandalone" else "dcm")
270 if partition.name()==
"L1CaloSTF": bsSvc.Key =
"SWROD"
271 bsSvc.KeyCount = int(os.environ.get(
"L1CALO_PTIO_KEY_COUNT",
"25"))
272 bsSvc.ISServer =
"Histogramming"
273 bsSvc.BufferSize = 10
274 bsSvc.UpdatePeriod = 30
275 bsSvc.Timeout = 240000
276 bsSvc.PublishName = os.getenv(
"L1CALO_ATHENA_JOB_NAME",
"testing")
277 bsSvc.StreamType = os.getenv(
"L1CALO_PTIO_STREAM_TYPE",
"physics")
278 bsSvc.ExitOnPartitionShutdown =
False
279 bsSvc.ClearHistograms =
True
280 bsSvc.GroupName =
"RecExOnline"
282 bsSvc.StreamNames = os.getenv(
"L1CALO_PTIO_STREAM_NAME",
"L1Calo:Main:MinBias:MinBiasOverlay:UPC:EnhancedBias:ZeroBias:HardProbes:Standby:ALFACalib").
split(
":")
283 bsSvc.StreamLogic = os.getenv(
"L1CALO_PTIO_STREAM_LOGIC",
"Or")
if partition.name() !=
"L1CaloStandalone" else "Ignore"
285 bsSvc.LVL1Logic =
"Ignore"
286elif flags.Input.Format == Format.POOL:
287 log.info(f
"Running Offline on {len(flags.Input.Files)} POOL files: {flags.Input.Files[0]} ...")
288 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
289 cfg.merge(PoolReadCfg(flags))
291 log.info(f
"Running Offline on {len(flags.Input.Files)} bytestream files: {flags.Input.Files[0]} ...")
294 from TriggerJobOpts.TriggerByteStreamConfig
import ByteStreamReadCfg
295 cfg.merge(ByteStreamReadCfg(flags))
298from AthenaMonitoring.AthMonitorCfgHelper
import getDQTHistSvc
299cfg.merge(getDQTHistSvc(flags))
302from TrigConfigSvc.TrigConfigSvcCfg
import L1ConfigSvcCfg,generateL1Menu, createL1PrescalesFileFromMenu,getL1MenuFileName
303if flags.Trigger.triggerConfig==
"FILE":
305 menuFilename = getL1MenuFileName(flags)
306 if customMenuFile ==
"":
307 if os.path.exists(menuFilename): os.remove(menuFilename)
308 generateL1Menu(flags)
313 os.symlink(customMenuFile, menuFilename)
315 if e.errno == errno.EEXIST:
316 os.remove(menuFilename)
317 os.symlink(customMenuFile, menuFilename)
320 menuFilename = customMenuFile
321 if os.path.exists(menuFilename):
322 log.info(f
"Using L1Menu: {menuFilename}")
324 log.fatal(f
"L1Menu file does not exist: {menuFilename}")
326 createL1PrescalesFileFromMenu(flags)
327cfg.merge(L1ConfigSvcCfg(flags))
334if flags.Common.isOnline
or (flags.Input.Format != Format.POOL
and not flags.Input.isMC):
335 from L1CaloFEXByteStream.L1CaloFEXByteStreamConfig
import eFexByteStreamToolCfg, jFexRoiByteStreamToolCfg, jFexInputByteStreamToolCfg, gFexByteStreamToolCfg, gFexInputByteStreamToolCfg
336 if flags.Trigger.L1.doeFex: decoderTools += [cfg.popToolsAndMerge(eFexByteStreamToolCfg(flags=flags,name=
'eFexBSDecoderTool',TOBs=flags.Trigger.L1.doeFex,xTOBs=flags.Trigger.L1.doeFex,decodeInputs=flags.Trigger.L1.doCaloInputs,multiSlice=
True))]
337 if flags.Trigger.L1.dojFex: decoderTools += [cfg.popToolsAndMerge(jFexRoiByteStreamToolCfg(flags=flags,name=
"jFexBSDecoderTool",writeBS=
False))]
338 if flags.Trigger.L1.dogFex: decoderTools += [cfg.popToolsAndMerge(gFexByteStreamToolCfg(flags=flags,name=
"gFexBSDecoderTool",writeBS=
False))]
339 if flags.Trigger.L1.doTopo:
340 from L1TopoByteStream.L1TopoByteStreamConfig
import L1TopoPhase1ByteStreamToolCfg
341 decoderTools += [cfg.popToolsAndMerge(L1TopoPhase1ByteStreamToolCfg(flags=flags,name=
"L1TopoBSDecoderTool",writeBS=
False))]
343 if flags.Trigger.L1.doMuon:
344 from MuonConfig.MuonBytestreamDecodeConfig
import RpcBytestreamDecodeCfg,TgcBytestreamDecodeCfg
345 cfg.merge(RpcBytestreamDecodeCfg(flags))
346 cfg.merge(TgcBytestreamDecodeCfg(flags))
347 from TrigT1ResultByteStream.TrigT1ResultByteStreamConfig
import MuonRoIByteStreamToolCfg
348 decoderTools += [cfg.popToolsAndMerge(MuonRoIByteStreamToolCfg(flags, name=
"L1MuonBSDecoderTool", writeBS=
False))]
351 if flags.Trigger.L1.doCaloInputs:
352 if flags.Trigger.L1.dojFex: decoderTools += [cfg.popToolsAndMerge(jFexInputByteStreamToolCfg(flags=flags,name=
'jFexInputBSDecoderTool',writeBS=
False))]
353 if flags.Trigger.L1.dogFex: decoderTools += [cfg.popToolsAndMerge(gFexInputByteStreamToolCfg(flags=flags,name=
'gFexInputBSDecoderTool',writeBS=
False))]
355 if len(decoderTools) > 0:
356 from TrigT1ResultByteStream.TrigT1ResultByteStreamMonitoringConfig
import L1TriggerByteStreamDecoderMonitoringCfg
357 cfg.addEventAlgo(CompFactory.L1TriggerByteStreamDecoderAlg(
358 name=
"L1TriggerByteStreamDecoder",
359 OutputLevel=Constants.ERROR,
360 DecoderTools=decoderTools,
361 ByteStreamMetadataRHKey =
'',
362 MaybeMissingROBs= [id
for tool
in decoderTools
for id
in tool.ROBIDs ]
if partition.name()!=
"ATLAS" or not flags.Common.isOnline
else [],
363 MonTool= cfg.popToolsAndMerge(L1TriggerByteStreamDecoderMonitoringCfg(flags,
"L1TriggerByteStreamDecoder", decoderTools))
364 ),sequenceName=
'AthAlgSeq'
368if flags.Trigger.enableL1CaloPhase1:
369 from L1CaloFEXSim.L1CaloFEXSimCfg
import L1CaloFEXSimCfg
371 cfg.addSequence(CompFactory.AthSequencer(
"L1Sim",StopOverride=
True),parentName=
"AthAlgSeq")
376 cfg.merge(
L1CaloFEXSimCfg(flags,outputSuffix=
"_ReSim" if flags.Input.Format == Format.POOL
else ""),sequenceName=
"L1Sim")
378 if flags.Trigger.L1.doTopo:
379 from L1TopoSimulation.L1TopoSimulationConfig
import L1TopoSimulationCfg
380 cfg.merge(L1TopoSimulationCfg(flags,readMuCTPI=
True,doMonitoring=
False),sequenceName=
"L1Sim")
383 if "doGlobal" in flags.Trigger.L1
and flags.Trigger.L1.doGlobal:
385 cfg.addSequence(CompFactory.AthSequencer(
"L1GlobalSim",StopOverride=
True),parentName=
"AthAlgSeq")
386 from GlobalSimulation.GlobalSimulationConfig
import GlobalSimulationCfg
387 cfg.merge(GlobalSimulationCfg(flags),sequenceName=
"L1GlobalSim")
389 if flags.Trigger.L1.doeFex:
391 from TrigConfigSvc.TriggerConfigAccess
import getL1MenuAccess
392 L1_menu = getL1MenuAccess(flags)
393 L1_menu.printSummary()
394 em_algoVersion = L1_menu.thresholdExtraInfo(
"eEM").
get(
"algoVersion", 0)
395 tau_algoVersion = L1_menu.thresholdExtraInfo(
"eTAU").
get(
"algoVersion", 0)
396 log.info(f
"algoVersions: eEM: {em_algoVersion}, eTAU: {tau_algoVersion}")
413if flags.DQ.doMonitoring:
415 cfg.addSequence(CompFactory.AthSequencer(
"L1Mon",StopOverride=
True),parentName=
"AthAlgSeq")
416 if flags.Trigger.L1.doCalo:
417 from TrigT1CaloMonitoring.PprMonitorAlgorithm
import PprMonitoringConfig
418 cfg.merge(PprMonitoringConfig(flags),sequenceName=
"L1Mon")
419 from TrigT1CaloMonitoring.PPMSimBSMonitorAlgorithm
import PPMSimBSMonitoringConfig
420 cfg.merge(PPMSimBSMonitoringConfig(flags),sequenceName=
"L1Mon")
421 from TrigT1CaloMonitoring.OverviewMonitorAlgorithm
import OverviewMonitoringConfig
422 cfg.merge(OverviewMonitoringConfig(flags),sequenceName=
"L1Mon")
425 OverviewMonAlg = cfg.getEventAlgo(
"OverviewMonAlg")
426 OverviewMonAlg.CPMErrorLocation =
""
427 OverviewMonAlg.CPMMismatchLocation =
""
429 if flags.Trigger.L1.doeFex:
430 from TrigT1CaloMonitoring.EfexMonitorAlgorithm
import EfexMonitoringConfig
431 cfg.merge(EfexMonitoringConfig(flags),sequenceName=
"L1Mon")
432 EfexMonAlg = cfg.getEventAlgo(
'EfexMonAlg')
434 EfexMonAlg.eFexEMTobKeyList = [
'L1_eEMRoI',
'L1_eEMxRoI']
435 EfexMonAlg.eFexTauTobKeyList = [
'L1_eTauRoI',
'L1_eTauxRoI']
437 if flags.Input.Format == Format.POOL
or flags.Trigger.enableL1CaloPhase1:
438 for l
in [EfexMonAlg.eFexEMTobKeyList,EfexMonAlg.eFexTauTobKeyList]: l += [x + (
"_ReSim" if flags.Input.Format == Format.POOL
and flags.Trigger.enableL1CaloPhase1
else "Sim")
for x
in l ]
440 if not flags.Input.isMC
and flags.Trigger.enableL1CaloPhase1:
441 from TrigT1CaloMonitoring.EfexSimMonitorAlgorithm
import EfexSimMonitoringConfig
442 cfg.merge(EfexSimMonitoringConfig(flags),sequenceName=
"L1Mon")
445 from TrigT1CaloMonitoring.EfexMonitorAlgorithm
import EfexMonitoringHistConfig
446 cfg.merge(EfexMonitoringHistConfig(flags,EfexMonAlg),sequenceName=
"L1Mon")
448 if flags.Trigger.L1.dojFex:
449 from TrigT1CaloMonitoring.JfexMonitorAlgorithm
import JfexMonitoringConfig
450 cfg.merge(JfexMonitoringConfig(flags),sequenceName=
"L1Mon")
451 if not flags.Input.isMC
and flags.Trigger.enableL1CaloPhase1:
452 from TrigT1CaloMonitoring.JfexSimMonitorAlgorithm
import JfexSimMonitoringConfig
453 cfg.merge(JfexSimMonitoringConfig(flags),sequenceName=
"L1Mon")
454 if flags.Trigger.L1.dogFex:
455 from TrigT1CaloMonitoring.GfexMonitorAlgorithm
import GfexMonitoringConfig
456 cfg.merge(GfexMonitoringConfig(flags),sequenceName=
"L1Mon")
457 if not flags.Input.isMC
and flags.Trigger.enableL1CaloPhase1:
458 from TrigT1CaloMonitoring.GfexSimMonitorAlgorithm
import GfexSimMonitoringConfig
459 cfg.merge(GfexSimMonitoringConfig(flags),sequenceName=
"L1Mon")
462 if flags.DQ.useTrigger:
463 from TrigT1CaloMonitoring.JetEfficiencyMonitorAlgorithm
import JetEfficiencyMonitoringConfig
464 cfg.merge(JetEfficiencyMonitoringConfig(flags),sequenceName=
"L1Mon")
466 if flags.Trigger.L1.doTopo:
467 from L1TopoOnlineMonitoring.L1TopoOnlineMonitoringConfig
import Phase1TopoMonitoringCfg
468 cfg.merge(Phase1TopoMonitoringCfg(flags))
471 if flags.Trigger.L1.doCaloInputs
and not flags.Input.isMC:
472 from TrigT1CaloMonitoring.EfexInputMonitorAlgorithm
import EfexInputMonitoringConfig
473 if flags.Trigger.L1.doeFex: cfg.merge(EfexInputMonitoringConfig(flags),sequenceName=
"L1Mon")
474 from TrigT1CaloMonitoring.JfexInputMonitorAlgorithm
import JfexInputMonitoringConfig
475 if flags.Trigger.L1.dojFex: cfg.merge(JfexInputMonitoringConfig(flags),sequenceName=
"L1Mon")
476 from TrigT1CaloMonitoring.GfexInputMonitorAlgorithm
import GfexInputMonitoringConfig
477 if flags.Trigger.L1.dogFex: cfg.merge(GfexInputMonitoringConfig(flags),sequenceName=
"L1Mon")
479mainSeq =
"AthAllAlgSeq"
480if args.fexReadoutFilter:
482 topSeq = cfg.getSequence(
"AthAlgEvtSeq")
483 algSeq = cfg.getSequence(mainSeq)
484 mainSeq =
"New" + mainSeq
486 topSeq.Members = [topSeq.Members[0],CompFactory.AthSequencer(mainSeq),topSeq.Members[-1]]
487 cfg.addEventAlgo(CompFactory.L1IDFilterAlgorithm(),sequenceName=mainSeq)
488 cfg.getSequence(mainSeq).Members += [algSeq]
490if args.evtNumber
is not None:
491 print(
"filtering events",args.evtNumber)
493 topSeq = cfg.getSequence(
"AthAlgEvtSeq")
494 algSeq = cfg.getSequence(mainSeq)
495 mainSeq =
"New" + mainSeq
497 topSeq.Members = [topSeq.Members[0],CompFactory.AthSequencer(mainSeq),topSeq.Members[-1]]
498 cfg.addEventAlgo(CompFactory.EventNumberFilterAlgorithm(
"EvtNumberFilter",EventNumbers=args.evtNumber),sequenceName=mainSeq)
499 cfg.getSequence(mainSeq).Members += [algSeq]
501from PerfMonComps.PerfMonCompsConfig
import PerfMonMTSvcCfg
502cfg.merge( PerfMonMTSvcCfg(flags) )
504from AthenaConfiguration.Utils
import setupLoggingLevels
505setupLoggingLevels(flags,cfg)
507if any([s.name==
"AthenaEventLoopMgr" for s
in cfg.getServices()]): cfg.getService(
"AthenaEventLoopMgr").IntervalInSeconds = 30
508if any([s.name==
"AthenaHiveEventLoopMgr" for s
in cfg.getServices()]): cfg.getService(
"AthenaHiveEventLoopMgr").EventPrintoutInterval = 100
509if any([s.name==
"AvalancheSchedulerSvc" for s
in cfg.getServices()]): cfg.getService(
"AvalancheSchedulerSvc").ShowDataDependencies=
True
512if not flags.Input.isMC:
514 runinfo = getLArDTInfoForRun(flags.Input.RunNumbers[0], connstring=
"COOLONL_LAR/CONDBR2")
515 if runinfo.FWversion()==6:
517 if args.dbOverrides
is None: args.dbOverrides = []
518 args.dbOverrides += [
"/LAR/Identifier/LatomeMapping:LARIdentifierLatomeMapping-fw6"]
522if type(args.dbOverrides)==list:
523 from IOVDbSvc.IOVDbSvcConfig
import addOverride
527 for override
in args.dbOverrides:
528 folderName,dbPath = override.split(
"=",1)
if "=" in override
else (override,
"")
529 if folderName ==
"":
raise ValueError(
"Cannot parse dbOverride: " + override)
532 if ";dbname=" not in dbPath: dbPath +=
";dbname=CONDBR2"
533 dbPath,dbInst = dbPath.split(
";dbname=")
534 if not os.path.exists(dbPath):
raise ValueError(
"dbOverride file doesn't exist: " + dbPath)
535 db = f
"sqlite://;schema={dbPath};dbname={dbInst}"
537 if ":" in folderName:
538 folderName,tag = folderName.split(
":",1)
539 if folderName[0] !=
"/": folderName =
"/TRIGGER/L1Calo/V1/Calibration/" + folderName
540 log.info(
" ".join((
"Overriding COOL folder=",folderName,
"db=",db,
"tag=",tag)))
542 cfg.merge( addOverride(flags,folder=folderName,tag=tag))
544 cfg.merge( addOverride(flags,folder=folderName,db=db,tag=tag))
548if flags.Output.AODFileName !=
"":
550 if edmName.endswith(
"Sim")
and flags.Input.Format == Format.POOL: edmName = edmName.replace(
"Sim",
"_ReSim")
551 auxType = edmType.replace(
'Container',
'AuxContainer')
552 return [f
'{edmType}#{edmName}', f
'{auxType}#{edmName}Aux.']
556 if flags.Trigger.L1.doeFex:
557 outputEDM +=
addEDM(
'xAOD::eFexEMRoIContainer' ,
"L1_eEMRoI")
558 outputEDM +=
addEDM(
'xAOD::eFexEMRoIContainer' ,
"L1_eEMRoISim")
559 outputEDM +=
addEDM(
'xAOD::eFexEMRoIContainer' ,
"L1_eEMxRoI")
560 outputEDM +=
addEDM(
'xAOD::eFexEMRoIContainer' ,
"L1_eEMxRoISim")
562 outputEDM +=
addEDM(
'xAOD::eFexTauRoIContainer' ,
"L1_eTauRoI")
563 outputEDM +=
addEDM(
'xAOD::eFexTauRoIContainer' ,
"L1_eTauRoISim")
564 outputEDM +=
addEDM(
'xAOD::eFexTauRoIContainer' ,
"L1_eTauxRoI")
565 outputEDM +=
addEDM(
'xAOD::eFexTauRoIContainer' ,
"L1_eTauxRoISim")
567 if flags.Trigger.L1.dojFex:
568 outputEDM +=
addEDM(
'xAOD::jFexTowerContainer' ,
"L1_jFexDataTowers")
569 outputEDM +=
addEDM(
'xAOD::jFexTowerContainer' ,
"L1_jFexEmulatedTowers")
570 outputEDM +=
addEDM(
'xAOD::jFexSRJetRoIContainer',
'L1_jFexSRJetRoISim')
571 outputEDM +=
addEDM(
'xAOD::jFexLRJetRoIContainer',
'L1_jFexLRJetRoISim')
572 outputEDM +=
addEDM(
'xAOD::jFexTauRoIContainer' ,
'L1_jFexTauRoISim' )
573 outputEDM +=
addEDM(
'xAOD::jFexFwdElRoIContainer',
'L1_jFexFwdElRoISim')
574 outputEDM +=
addEDM(
'xAOD::jFexSumETRoIContainer',
'L1_jFexSumETRoISim')
575 outputEDM +=
addEDM(
'xAOD::jFexMETRoIContainer' ,
'L1_jFexMETRoISim' )
576 outputEDM +=
addEDM(
'xAOD::jFexSRJetRoIContainer',
'L1_jFexSRJetRoI')
577 outputEDM +=
addEDM(
'xAOD::jFexLRJetRoIContainer',
'L1_jFexLRJetRoI')
578 outputEDM +=
addEDM(
'xAOD::jFexTauRoIContainer' ,
'L1_jFexTauRoI' )
579 outputEDM +=
addEDM(
'xAOD::jFexFwdElRoIContainer',
'L1_jFexFwdElRoI')
580 outputEDM +=
addEDM(
'xAOD::jFexSumETRoIContainer',
'L1_jFexSumETRoI')
581 outputEDM +=
addEDM(
'xAOD::jFexMETRoIContainer' ,
'L1_jFexMETRoI' )
583 outputEDM +=
addEDM(
'xAOD::jFexSRJetRoIContainer',
'L1_jFexSRJetxRoI')
584 outputEDM +=
addEDM(
'xAOD::jFexLRJetRoIContainer',
'L1_jFexLRJetxRoI')
585 outputEDM +=
addEDM(
'xAOD::jFexTauRoIContainer' ,
'L1_jFexTauxRoI' )
586 outputEDM +=
addEDM(
'xAOD::jFexFwdElRoIContainer',
'L1_jFexFwdElxRoI')
587 outputEDM +=
addEDM(
'xAOD::jFexSumETRoIContainer',
'L1_jFexSumETxRoI')
588 outputEDM +=
addEDM(
'xAOD::jFexMETRoIContainer' ,
'L1_jFexMETxRoI' )
590 if flags.Trigger.L1.dogFex:
591 outputEDM +=
addEDM(
'xAOD::gFexGlobalRoIContainer',
'L1_gMETComponentsJwoj')
592 outputEDM +=
addEDM(
'xAOD::gFexGlobalRoIContainer',
'L1_gMETComponentsJwojSim')
593 outputEDM +=
addEDM(
'xAOD::gFexGlobalRoIContainer',
'L1_gMHTComponentsJwoj')
594 outputEDM +=
addEDM(
'xAOD::gFexGlobalRoIContainer',
'L1_gMHTComponentsJwojSim')
595 outputEDM +=
addEDM(
'xAOD::gFexGlobalRoIContainer',
'L1_gMSTComponentsJwoj')
596 outputEDM +=
addEDM(
'xAOD::gFexGlobalRoIContainer',
'L1_gMSTComponentsJwojSim')
597 outputEDM +=
addEDM(
'xAOD::gFexGlobalRoIContainer',
'L1_gScalarEJwoj')
598 outputEDM +=
addEDM(
'xAOD::gFexGlobalRoIContainer',
'L1_gScalarEJwojSim')
599 outputEDM +=
addEDM(
'xAOD::gFexGlobalRoIContainer',
'L1_gScalarENoiseCutSim')
600 outputEDM +=
addEDM(
'xAOD::gFexGlobalRoIContainer',
'L1_gScalarERmsSim')
602 outputEDM +=
addEDM(
'xAOD::gFexJetRoIContainer',
'L1_gFexLRJetRoI')
603 outputEDM +=
addEDM(
'xAOD::gFexJetRoIContainer',
'L1_gFexLRJetRoISim')
604 outputEDM +=
addEDM(
'xAOD::gFexJetRoIContainer',
'L1_gFexSRJetRoI')
605 outputEDM +=
addEDM(
'xAOD::gFexJetRoIContainer',
'L1_gFexSRJetRoISim')
606 outputEDM +=
addEDM(
'xAOD::gFexJetRoIContainer',
'L1_gFexRhoRoI')
607 outputEDM +=
addEDM(
'xAOD::gFexJetRoIContainer',
'L1_gFexRhoRoISim')
611 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
612 cfg.merge(OutputStreamCfg(flags,
'AOD', ItemList=outputEDM, takeItemsFromInput=
True))
613 from xAODMetaDataCnv.InfileMetaDataConfig
import SetupMetaDataForStreamCfg
614 cfg.merge(SetupMetaDataForStreamCfg(flags,
'AOD'))
617if flags.Output.BSFileName !=
"":
618 from TrigT1ResultByteStream.TrigT1ResultByteStreamConfig
import L1TriggerByteStreamEncoderCfg
619 cfg.merge(L1TriggerByteStreamEncoderCfg(flags))
622 algo = CompFactory.L1TriggerResultMaker(
"OutputBSTCCMaker",
624 eFexEMRoIKeys=[], eFexTauRoIKeys=[],
625 jFexFwdElRoIKeys=[], jFexTauRoIKeys = [],
626 jFexSRJetRoIKeys = [], jFexLRJetRoIKeys = [],
627 gFexSRJetRoIKeys = [], gFexLRJetRoIKeys = [],
628 cTauRoIKey =
"", cjTauLinkKey =
"", ThresholdPatternTools= [],
629 L1TriggerResultWHKey =
"OutputBSTCC")
630 if flags.Trigger.L1.doeFex:
631 algo.eFexEMRoIKeys = [
"L1_eEMRoI",
"L1_eEMxRoI"]
632 algo.eFexTauRoIKeys = [
"L1_eTauRoI",
"L1_eTauxRoI"]
634 cfg.addEventAlgo(algo)
635 from ByteStreamCnvSvc.ByteStreamConfig
import ByteStreamWriteCfg
636 write = ByteStreamWriteCfg(flags, [
"xAOD::TrigCompositeContainer#OutputBSTCC"])
639if "MuonAlignmentCondAlg" in [a.name
for a
in cfg.getCondAlgos()]: cfg.getCondAlgo(
"MuonAlignmentCondAlg").OutputLevel=Constants.ERROR
642if flags.Trigger.L1.doeFex
and (args.evtNumber
is not None):
644 cfg.addEventAlgo(CompFactory.LVL1.eFexEventDumper(TowersKey=
"L1_eFexDataTowers",EMRoIKey=
"L1_eEMRoI",TauRoIKey=
"L1_eTauRoI"))
649from AthenaCommon.Include
import include
651with ConfigurableCABehavior():
652 for inc
in args.postInclude: include(inc)
654for conf
in args.postConfig:
655 compName,propNameAndVal=conf.split(
".",1)
656 propName,propVal=propNameAndVal.split(
"=",1)
658 from collections
import defaultdict
659 availableComps = defaultdict(list)
660 for comp
in [c
for c
in cfg._allComponents()]+cfg.getServices():
661 availableComps[comp.getType()] += [comp.getName()]
662 if comp.getName()==compName
or comp.getType()==compName
or comp.toStringProperty()==compName:
665 log.info(
"Setting "+compName+
" property: "+propNameAndVal)
666 exec(f
"comp.{propNameAndVal}")
667 except AttributeError
as e:
668 log.fatal(
"Unknown property of " + compName +
" : " + propNameAndVal)
669 log.fatal(
"See next line for available properties:")
674 print(
"Available comps:")
675 for k,v
in availableComps.items():
677 raise ValueError(f
"postConfig {conf} had no effect ... typo? See list above of available components")
679if args.postHelp
is not None:
680 from collections
import defaultdict
681 availableComps = defaultdict(list)
682 for comp
in [c
for c
in cfg._allComponents()]+cfg.getServices():
683 availableComps[comp.getType()] += [comp.getName()]
684 print(
"Available comps:")
685 for k,v
in availableComps.items():
686 print(
"",k,
":",
", ".join(v))
691if flags.Exec.MaxEvents==0: cfg.printConfig(withDetails =
True, summariseProps =
True, printDefaults =
True)
692log.info(
" ".join((
"Configured Services:",*[svc.name
for svc
in cfg.getServices()])) )
696if flags.Exec.MaxEvents==1:
698 cfg.getService(
"StoreGateSvc").Dump=
True
699 cfg.getService(
"DetectorStore").Dump=
True
702if cfg.getService(
"StoreGateSvc").Dump:
703 cfg.getService(
"StoreGateSvc").OutputLevel=3
704if cfg.getService(
"DetectorStore").Dump:
705 cfg.getService(
"DetectorStore").OutputLevel=3
708 from AthenaConfiguration.ComponentAccumulator
import startInteractive
709 oldLevel = int(cfg._msg.getEffectiveLevel())
710 cfg._msg.setLevel(logging.INFO)
711 print(
"\n\nEntering interactive configuration mode. You can explore and edit the cfg object. Ctrl+D to configure application and move to pre-initialize step")
712 startInteractive(locals()|{
"self":cfg})
713 cfg._msg.setLevel(oldLevel)
716 readline.write_history_file(os.path.expanduser(
'~/.athena.history' ))
718if flags.Exec.MaxEvents==0:
722 from TrigT1CaloMonitoring.LVL1CaloMonitoringConfig
import L1CaloMonitorCfgHelper
723 L1CaloMonitorCfgHelper.printHanConfig()
724 cfg._wasMerged =
True
727if cfg.run().isFailure():
void print(char *figname, TCanvas *c1)
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
std::vector< std::string > split(const std::string &s, const std::string &t=":")