11from AthenaCommon.Logging
import logging
12from AthenaCommon.Logging
import log
as topLog
13topLog.setLevel(logging.WARNING)
14log = logging.getLogger(
'L1CaloPhase1Monitoring.py')
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()
38flags.Exec.OutputLevel = Constants.WARNING
39flags.Exec.InfoMessageComponents = [
"AthenaEventLoopMgr",
"THistSvc",
"PerfMonMTSvc",
"ApplicationMgr",
"AvalancheSchedulerSvc"]
40flags.Exec.PrintAlgsSequence =
True
44flags.GeoModel.Run = LHCPeriod.Run3
45flags.Common.useOnlineLumi =
True
46flags.DQ.doMonitoring =
True
47flags.DQ.enableLumiAccess =
False
48flags.DQ.FileKey =
"" if partition.isValid()
else "EXPERT"
49flags.Output.HISTFileName = os.getenv(
"L1CALO_ATHENA_JOB_NAME",
"") +
"monitoring.root"
50flags.DQ.useTrigger =
False
51flags.Trigger.L1.doCaloInputs = partition.isValid()
52flags.Trigger.enableL1CaloPhase1 =
True
54flags.Trigger.L1.doCalo = partition.isValid()
55flags.Trigger.L1.doeFex = partition.isValid()
56flags.Trigger.L1.dojFex = partition.isValid()
57flags.Trigger.L1.dogFex = partition.isValid()
58flags.Trigger.L1.doTopo = partition.isValid()
61if partition.isValid():
64 flags.Trigger.doLVL1 =
False
65 flags.Trigger.doHLT =
False
66 from AthenaConfiguration.AutoConfigOnlineRecoFlags
import autoConfigOnlineRecoFlags
67 autoConfigOnlineRecoFlags(flags, partition.name())
69 flags.Trigger.doLVL1 =
True
74parser = flags.getArgumentParser(epilog=
"""
75Extra flags are specified after a " -- " and the following are most relevant flags for this script:
77 Trigger.enableL1CaloPhase1 : turn on/off the offline simulation [default: True]
78 DQ.doMonitoring : turn on/off the monitoring [default: True]
79 Trigger.L1.doCaloInputs : controls input readout decoding and monitoring [default: False*]
80 Trigger.L1.doCalo : controls trex (legacy syst) monitoring [default: False]
81 Trigger.L1.doeFex : controls efex simulation and monitoring [default: False*]
82 Trigger.L1.dojFex : controls jfex simulation and monitoring [default: False*]
83 Trigger.L1.dogFex : controls gfex simulation and monitoring [default: False*]
84 Trigger.L1.doTopo : controls topo simulation and monitoring [default: False*] (from 2023 Onwards)
85 DQ.useTrigger : controls if JetEfficiency monitoring alg is run or not [default: False]
86 PerfMon.doFullMonMT : print info about execution time of algorithms and memory use etc [default: False]
87 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)]
89Note: If you do not specify any flags, then all the flags that are marked with a * will automatically become True
91E.g. to run just the jFex monitoring, without offline simulation, you can do:
93athena TrigT1CaloMonitoring/L1CalPhase1Monitoring.py .... -- Trigger.enableL1CaloPhase1=False Trigger.L1.doCaloInputs=False Trigger.L1.doeFex=False Trigger.L1.dogFex=False
95Further notes: Run with "--evtMax 0" to print flags and ca config, and generate a hanConfig file.
96 Run with "--evtMax 1" to dump StoreGate contents after the first event
101parser.formatter_class = argparse.RawDescriptionHelpFormatter
102parser.add_argument(
'--runNumber',default=
None,help=
"specify to select a run number")
103parser.add_argument(
'--lumiBlock',default=
None,help=
"specify to select a lumiBlock")
104parser.add_argument(
'--evtNumber',default=
None,nargs=
"+",type=int,help=
"specify to select an evtNumber")
105parser.add_argument(
'--stream',default=
"*",help=
"stream to lookup files in")
106parser.add_argument(
'--fexReadoutFilter',action=
'store_true',help=
"If specified, will skip events without fexReadout")
107parser.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 ")
108parser.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.'")
109args,unknown_args = flags.fillFromArgs(parser=parser,return_unknown=
True)
110args.postConfig += [x[4:]
for x
in unknown_args
if x.startswith(
"cfg.")]
111if any([
not x.startswith(
"cfg.")
for x
in unknown_args]):
112 raise KeyError(
"Unknown flags: " +
" ".join([x
for x
in unknown_args
if not x.startswith(
"cfg.")]))
113if 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]):
114 log.info(
"No steering flags specified, turning on phase 1 sim+monitoring (trex,efex,jfex,gfex,topo)")
115 flags.Trigger.L1.doCaloInputs =
True
116 flags.Trigger.L1.doCalo =
True
117 flags.Trigger.L1.doeFex =
True
118 flags.Trigger.L1.dojFex =
True
119 flags.Trigger.L1.dogFex =
True
120 flags.Trigger.L1.doTopo =
True
121if args.runNumber
is not None:
127 from glob
import glob
128 if args.lumiBlock
is None: args.lumiBlock=
"*"
129 log.info(
" ".join((
"Looking up files in atlastier0 for run",args.runNumber,
"lb =",args.lumiBlock)))
130 flags.Input.Files = []
131 for lb
in args.lumiBlock.split(
","):
133 tryStr = f
"/eos/atlas/atlastier0/rucio/data*/{args.stream}/*{args.runNumber}/*RAW/*lb*.*"
135 tryStr = f
"/eos/atlas/atlastier0/rucio/data*/{args.stream}/*{args.runNumber}/*RAW/*lb{int(lb):04}.*"
136 log.info(
" ".join((
"Trying",tryStr)))
137 flags.Input.Files += glob(tryStr)
138 log.info(
" ".join((
"Found",str(len(flags.Input.Files)),
"files")))
141if flags.Trigger.triggerConfig.startswith(
"FILE:"):
142 customMenuFile = flags.Trigger.triggerConfig.split(
":",1)[-1]
143 flags.Trigger.triggerConfig=
"FILE"
147if not flags.Common.isOnline
and len(flags.Input.Files)==0:
148 if flags.Exec.MaxEvents==0:
150 flags.Input.Files = [
"/eos/atlas/atlascerngroupdisk/det-l1calo/OfflineSoftware/TestFiles/data24_13p6TeV/data24_13p6TeV.00477048.physics_Main.daq.RAW._lb0821._SFO-20._0001.data"]
152 log.fatal(
"Running in offline mode but no input files provided")
154elif flags.Common.isOnline:
155 log.info(
"Running Online with Partition: "+partition.name())
158 if flags.Trigger.Online.partitionName ==
'':
161 flags.Trigger.doLVL1 =
False
162 flags.Trigger.doHLT =
False
163 from AthenaConfiguration.AutoConfigOnlineRecoFlags
import autoConfigOnlineRecoFlags
164 autoConfigOnlineRecoFlags(flags, partition.name())
165 standalone = (partition.name()!=
"ATLAS")
166 if standalone : log.info(
"Using local menu because partition is not ATLAS")
167 elif len(flags.Input.Files)==0
and partition.isValid():
170 log.info(
"Waiting 2 minutes for LATOME to get their databases in order")
174if len(flags.Input.Files)>0:
175 flags.DQ.Environment =
"user"
178 standalone = ((flags.Input.ProjectName ==
"data_test")
or (re.match(
r"data\d\d_calib", flags.Input.ProjectName)))
179 if standalone :
print(
"Using local menu because project_name=",flags.Input.ProjectName)
180 if flags.Input.isMC : flags.Trigger.triggerConfig=
'FILE'
181 elif flags.Trigger.triggerConfig==
'INFILE':
183 flags.Trigger.triggerConfig=
"DB"
185 if flags.Input.isMC
and flags.Trigger.L1.doCalo:
186 log.info(
"Disabling legacy monitoring because it doesn't work with MC")
187 flags.Trigger.L1.doCalo=
False
190 flags.Trigger.triggerConfig=
'FILE'
193if flags.Exec.MaxEvents == 0:
195 flags.DQ.doMonitoring=
True
196 flags.Trigger.L1.doCalo=
True
197 flags.Trigger.L1.doCaloInputs=
True
198 flags.Trigger.L1.doeFex=
True
199 flags.Trigger.L1.dojFex=
True
200 flags.Trigger.L1.dogFex=
True
201 flags.Trigger.L1.doTopo=
True
202 flags.DQ.useTrigger=
True
203 flags.Exec.OutputLevel = Constants.INFO
206if flags.GeoModel.AtlasVersion
is None:
207 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
208 flags.GeoModel.AtlasVersion = defaultGeometryTags.autoconfigure(flags)
210if flags.Trigger.triggerConfig==
"FILE" and flags.Trigger.L1.doCalo:
213 log.warning(
"Cannot run Legacy sim/mon when using json l1 menu. Disabling")
214 flags.Trigger.L1.doCalo=
False
216if (flags.Input.Format == Format.POOL): flags.Trigger.L1.doTopo =
False
217if not flags.Trigger.L1.doTopo: flags.Trigger.L1.doMuon =
False
219if flags.Trigger.enableL1CaloPhase1:
222 from AthenaConfiguration.DetectorConfigFlags
import setupDetectorsFromList
223 setupDetectorsFromList(flags,[
'LAr',
'Tile',
'MBTS'] + ([
'RPC',
'TGC',
'MDT']
if flags.Trigger.L1.doMuon
else []),
True)
225from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
226cfg = MainServicesCfg(flags)
228log.setLevel(logging.INFO)
231if flags.Exec.MaxEvents == 0: flags.dump(evaluate=
True)
234if 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]):
235 log.fatal(
"You did not set any flags to specify what to run. ")
236 log.fatal(
"Please set at least one of the flags in Trigger.L1.(doCaloInputs, doCalo, doeFex, dojFex, dogFex, doTopo) ")
237 log.fatal(
"or use '--all' option to turn on everything (but that is slow)")
238 log.fatal(
"See --help for more info about the flags")
241if flags.Common.isOnline
and len(flags.Input.Files)==0:
242 flags.dump(evaluate=
True)
243 from ByteStreamEmonSvc.EmonByteStreamConfig
import EmonByteStreamCfg
244 cfg.merge(EmonByteStreamCfg(flags))
245 bsSvc = cfg.getService(
"ByteStreamInputSvc")
246 bsSvc.Partition = partition.name()
247 bsSvc.Key = os.environ.get(
"L1CALO_PTIO_KEY",
"REB" if partition.name()==
"L1CaloStandalone" else "dcm")
248 if partition.name()==
"L1CaloSTF": bsSvc.Key =
"SWROD"
249 bsSvc.KeyCount = int(os.environ.get(
"L1CALO_PTIO_KEY_COUNT",
"25"))
250 bsSvc.ISServer =
"Histogramming"
251 bsSvc.BufferSize = 10
252 bsSvc.UpdatePeriod = 30
253 bsSvc.Timeout = 240000
254 bsSvc.PublishName = os.getenv(
"L1CALO_ATHENA_JOB_NAME",
"testing")
255 bsSvc.StreamType = os.getenv(
"L1CALO_PTIO_STREAM_TYPE",
"physics")
256 bsSvc.ExitOnPartitionShutdown =
False
257 bsSvc.ClearHistograms =
True
258 bsSvc.GroupName =
"RecExOnline"
260 bsSvc.StreamNames = os.getenv(
"L1CALO_PTIO_STREAM_NAME",
"L1Calo:Main:MinBias:MinBiasOverlay:UPC:EnhancedBias:ZeroBias:HardProbes:Standby:ALFACalib").
split(
":")
261 bsSvc.StreamLogic = os.getenv(
"L1CALO_PTIO_STREAM_LOGIC",
"Or")
if partition.name() !=
"L1CaloStandalone" else "Ignore"
263 bsSvc.LVL1Logic =
"Ignore"
264elif flags.Input.Format == Format.POOL:
265 log.info(f
"Running Offline on {len(flags.Input.Files)} POOL files")
266 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
267 cfg.merge(PoolReadCfg(flags))
269 log.info(f
"Running Offline on {len(flags.Input.Files)} bytestream files")
272 from TriggerJobOpts.TriggerByteStreamConfig
import ByteStreamReadCfg
273 cfg.merge(ByteStreamReadCfg(flags))
276from AthenaMonitoring.AthMonitorCfgHelper
import getDQTHistSvc
277cfg.merge(getDQTHistSvc(flags))
280from TrigConfigSvc.TrigConfigSvcCfg
import L1ConfigSvcCfg,generateL1Menu, createL1PrescalesFileFromMenu,getL1MenuFileName
281if flags.Trigger.triggerConfig==
"FILE":
283 menuFilename = getL1MenuFileName(flags)
284 if customMenuFile ==
"":
285 if os.path.exists(menuFilename): os.remove(menuFilename)
286 generateL1Menu(flags)
291 os.symlink(customMenuFile, menuFilename)
293 if e.errno == errno.EEXIST:
294 os.remove(menuFilename)
295 os.symlink(customMenuFile, menuFilename)
298 menuFilename = customMenuFile
299 if os.path.exists(menuFilename):
300 log.info(f
"Using L1Menu: {menuFilename}")
302 log.fatal(f
"L1Menu file does not exist: {menuFilename}")
304 createL1PrescalesFileFromMenu(flags)
305cfg.merge(L1ConfigSvcCfg(flags))
312if flags.Common.isOnline
or (flags.Input.Format != Format.POOL
and not flags.Input.isMC):
313 from L1CaloFEXByteStream.L1CaloFEXByteStreamConfig
import eFexByteStreamToolCfg, jFexRoiByteStreamToolCfg, jFexInputByteStreamToolCfg, gFexByteStreamToolCfg, gFexInputByteStreamToolCfg
314 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))]
315 if flags.Trigger.L1.dojFex: decoderTools += [cfg.popToolsAndMerge(jFexRoiByteStreamToolCfg(flags=flags,name=
"jFexBSDecoderTool",writeBS=
False))]
316 if flags.Trigger.L1.dogFex: decoderTools += [cfg.popToolsAndMerge(gFexByteStreamToolCfg(flags=flags,name=
"gFexBSDecoderTool",writeBS=
False))]
318 if flags.Trigger.L1.doMuon:
319 from MuonConfig.MuonBytestreamDecodeConfig
import RpcBytestreamDecodeCfg,TgcBytestreamDecodeCfg
320 cfg.merge(RpcBytestreamDecodeCfg(flags))
321 cfg.merge(TgcBytestreamDecodeCfg(flags))
322 from TrigT1ResultByteStream.TrigT1ResultByteStreamConfig
import MuonRoIByteStreamToolCfg
323 decoderTools += [cfg.popToolsAndMerge(MuonRoIByteStreamToolCfg(flags, name=
"L1MuonBSDecoderTool", writeBS=
False))]
326 if flags.Trigger.L1.doCaloInputs:
327 if flags.Trigger.L1.dojFex: decoderTools += [cfg.popToolsAndMerge(jFexInputByteStreamToolCfg(flags=flags,name=
'jFexInputBSDecoderTool',writeBS=
False))]
328 if flags.Trigger.L1.dogFex: decoderTools += [cfg.popToolsAndMerge(gFexInputByteStreamToolCfg(flags=flags,name=
'gFexInputBSDecoderTool',writeBS=
False))]
330 if len(decoderTools) > 0:
331 from TrigT1ResultByteStream.TrigT1ResultByteStreamMonitoringConfig
import L1TriggerByteStreamDecoderMonitoringCfg
332 cfg.addEventAlgo(CompFactory.L1TriggerByteStreamDecoderAlg(
333 name=
"L1TriggerByteStreamDecoder",
334 OutputLevel=Constants.ERROR,
335 DecoderTools=decoderTools,
336 ByteStreamMetadataRHKey =
'',
337 MaybeMissingROBs= [id
for tool
in decoderTools
for id
in tool.ROBIDs ]
if partition.name()!=
"ATLAS" or not flags.Common.isOnline
else [],
338 MonTool= cfg.popToolsAndMerge(L1TriggerByteStreamDecoderMonitoringCfg(flags,
"L1TriggerByteStreamDecoder", decoderTools))
339 ),sequenceName=
'AthAlgSeq'
343if flags.Trigger.enableL1CaloPhase1:
344 from L1CaloFEXSim.L1CaloFEXSimCfg
import L1CaloFEXSimCfg
348 cfg.merge(
L1CaloFEXSimCfg(flags,outputSuffix=
"_ReSim" if flags.Input.Format == Format.POOL
else ""))
350 if flags.Trigger.L1.doeFex:
352 from TrigConfigSvc.TriggerConfigAccess
import getL1MenuAccess
353 L1_menu = getL1MenuAccess(flags)
354 L1_menu.printSummary()
355 em_algoVersion = L1_menu.thresholdExtraInfo(
"eEM").
get(
"algoVersion", 0)
356 tau_algoVersion = L1_menu.thresholdExtraInfo(
"eTAU").
get(
"algoVersion", 0)
357 log.info(f
"algoVersions: eEM: {em_algoVersion}, eTAU: {tau_algoVersion}")
361 if flags.Trigger.L1.doTopo:
362 from L1TopoSimulation.L1TopoSimulationConfig
import L1TopoSimulationCfg
363 cfg.merge(L1TopoSimulationCfg(flags,readMuCTPI=
True,doMonitoring=
False))
378if flags.DQ.doMonitoring:
379 if flags.Trigger.L1.doCalo:
380 from TrigT1CaloMonitoring.PprMonitorAlgorithm
import PprMonitoringConfig
381 cfg.merge(PprMonitoringConfig(flags))
382 from TrigT1CaloMonitoring.PPMSimBSMonitorAlgorithm
import PPMSimBSMonitoringConfig
383 cfg.merge(PPMSimBSMonitoringConfig(flags))
384 from TrigT1CaloMonitoring.OverviewMonitorAlgorithm
import OverviewMonitoringConfig
385 cfg.merge(OverviewMonitoringConfig(flags))
388 OverviewMonAlg = cfg.getEventAlgo(
"OverviewMonAlg")
389 OverviewMonAlg.CPMErrorLocation =
""
390 OverviewMonAlg.CPMMismatchLocation =
""
392 if flags.Trigger.L1.doeFex:
393 from TrigT1CaloMonitoring.EfexMonitorAlgorithm
import EfexMonitoringConfig
394 cfg.merge(EfexMonitoringConfig(flags))
395 EfexMonAlg = cfg.getEventAlgo(
'EfexMonAlg')
397 EfexMonAlg.eFexEMTobKeyList = [
'L1_eEMRoI',
'L1_eEMxRoI']
398 EfexMonAlg.eFexTauTobKeyList = [
'L1_eTauRoI',
'L1_eTauxRoI']
400 if flags.Input.Format == Format.POOL
or flags.Trigger.enableL1CaloPhase1:
401 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 ]
403 if not flags.Input.isMC
and flags.Trigger.enableL1CaloPhase1:
404 from TrigT1CaloMonitoring.EfexSimMonitorAlgorithm
import EfexSimMonitoringConfig
405 cfg.merge(EfexSimMonitoringConfig(flags))
408 from TrigT1CaloMonitoring.EfexMonitorAlgorithm
import EfexMonitoringHistConfig
409 cfg.merge(EfexMonitoringHistConfig(flags,EfexMonAlg))
411 if flags.Trigger.L1.dojFex:
412 from TrigT1CaloMonitoring.JfexMonitorAlgorithm
import JfexMonitoringConfig
413 cfg.merge(JfexMonitoringConfig(flags))
414 if not flags.Input.isMC
and flags.Trigger.enableL1CaloPhase1:
415 from TrigT1CaloMonitoring.JfexSimMonitorAlgorithm
import JfexSimMonitoringConfig
416 cfg.merge(JfexSimMonitoringConfig(flags))
417 if flags.Trigger.L1.dogFex:
418 from TrigT1CaloMonitoring.GfexMonitorAlgorithm
import GfexMonitoringConfig
419 cfg.merge(GfexMonitoringConfig(flags))
420 if not flags.Input.isMC
and flags.Trigger.enableL1CaloPhase1:
421 from TrigT1CaloMonitoring.GfexSimMonitorAlgorithm
import GfexSimMonitoringConfig
422 cfg.merge(GfexSimMonitoringConfig(flags))
425 if flags.DQ.useTrigger:
426 from TrigT1CaloMonitoring.JetEfficiencyMonitorAlgorithm
import JetEfficiencyMonitoringConfig
427 cfg.merge(JetEfficiencyMonitoringConfig(flags))
429 if flags.Trigger.L1.doTopo:
430 from L1TopoOnlineMonitoring.L1TopoOnlineMonitoringConfig
import Phase1TopoMonitoringCfg
431 cfg.merge(Phase1TopoMonitoringCfg(flags))
434 if flags.Trigger.L1.doCaloInputs
and not flags.Input.isMC:
435 from TrigT1CaloMonitoring.EfexInputMonitorAlgorithm
import EfexInputMonitoringConfig
436 if flags.Trigger.L1.doeFex: cfg.merge(EfexInputMonitoringConfig(flags))
437 from TrigT1CaloMonitoring.JfexInputMonitorAlgorithm
import JfexInputMonitoringConfig
438 if flags.Trigger.L1.dojFex: cfg.merge(JfexInputMonitoringConfig(flags))
439 from TrigT1CaloMonitoring.GfexInputMonitorAlgorithm
import GfexInputMonitoringConfig
440 if flags.Trigger.L1.dogFex: cfg.merge(GfexInputMonitoringConfig(flags))
442mainSeq =
"AthAllAlgSeq"
443if args.fexReadoutFilter:
445 topSeq = cfg.getSequence(
"AthAlgEvtSeq")
446 algSeq = cfg.getSequence(mainSeq)
447 mainSeq =
"New" + mainSeq
449 topSeq.Members = [topSeq.Members[0],CompFactory.AthSequencer(mainSeq),topSeq.Members[-1]]
450 cfg.addEventAlgo(CompFactory.L1IDFilterAlgorithm(),sequenceName=mainSeq)
451 cfg.getSequence(mainSeq).Members += [algSeq]
453if args.evtNumber
is not None:
454 print(
"filtering events",args.evtNumber)
456 topSeq = cfg.getSequence(
"AthAlgEvtSeq")
457 algSeq = cfg.getSequence(mainSeq)
458 mainSeq =
"New" + mainSeq
460 topSeq.Members = [topSeq.Members[0],CompFactory.AthSequencer(mainSeq),topSeq.Members[-1]]
461 cfg.addEventAlgo(CompFactory.EventNumberFilterAlgorithm(
"EvtNumberFilter",EventNumbers=args.evtNumber),sequenceName=mainSeq)
462 cfg.getSequence(mainSeq).Members += [algSeq]
464from PerfMonComps.PerfMonCompsConfig
import PerfMonMTSvcCfg
465cfg.merge( PerfMonMTSvcCfg(flags) )
467from AthenaConfiguration.Utils
import setupLoggingLevels
468setupLoggingLevels(flags,cfg)
470if any([s.name==
"AthenaEventLoopMgr" for s
in cfg.getServices()]): cfg.getService(
"AthenaEventLoopMgr").IntervalInSeconds = 30
471if any([s.name==
"AvalancheSchedulerSvc" for s
in cfg.getServices()]):
472 cfg.getService(
"AvalancheSchedulerSvc").ShowDataDependencies=
True
475if not flags.Input.isMC:
477 runinfo = getLArDTInfoForRun(flags.Input.RunNumbers[0], connstring=
"COOLONL_LAR/CONDBR2")
478 if runinfo.FWversion()==6:
480 if args.dbOverrides
is None: args.dbOverrides = []
481 args.dbOverrides += [
"/LAR/Identifier/LatomeMapping:LARIdentifierLatomeMapping-fw6"]
485if type(args.dbOverrides)==list:
486 from IOVDbSvc.IOVDbSvcConfig
import addOverride
490 for override
in args.dbOverrides:
491 folderName,dbPath = override.split(
"=",1)
if "=" in override
else (override,
"")
492 if folderName ==
"":
raise ValueError(
"Cannot parse dbOverride: " + override)
495 if ";dbname=" not in dbPath: dbPath +=
";dbname=CONDBR2"
496 dbPath,dbInst = dbPath.split(
";dbname=")
497 if not os.path.exists(dbPath):
raise ValueError(
"dbOverride file doesn't exist: " + dbPath)
498 db = f
"sqlite://;schema={dbPath};dbname={dbInst}"
500 if ":" in folderName:
501 folderName,tag = folderName.split(
":",1)
502 if folderName[0] !=
"/": folderName =
"/TRIGGER/L1Calo/V1/Calibration/" + folderName
503 log.info(
" ".join((
"Overriding COOL folder=",folderName,
"db=",db,
"tag=",tag)))
505 cfg.merge( addOverride(flags,folder=folderName,tag=tag))
507 cfg.merge( addOverride(flags,folder=folderName,db=db,tag=tag))
511if flags.Output.AODFileName !=
"":
513 if edmName.endswith(
"Sim")
and flags.Input.Format == Format.POOL: edmName = edmName.replace(
"Sim",
"_ReSim")
514 auxType = edmType.replace(
'Container',
'AuxContainer')
515 return [f
'{edmType}#{edmName}', f
'{auxType}#{edmName}Aux.']
519 if flags.Trigger.L1.doeFex:
520 outputEDM +=
addEDM(
'xAOD::eFexEMRoIContainer' ,
"L1_eEMRoI")
521 outputEDM +=
addEDM(
'xAOD::eFexEMRoIContainer' ,
"L1_eEMRoISim")
522 outputEDM +=
addEDM(
'xAOD::eFexEMRoIContainer' ,
"L1_eEMxRoI")
523 outputEDM +=
addEDM(
'xAOD::eFexEMRoIContainer' ,
"L1_eEMxRoISim")
525 outputEDM +=
addEDM(
'xAOD::eFexTauRoIContainer' ,
"L1_eTauRoI")
526 outputEDM +=
addEDM(
'xAOD::eFexTauRoIContainer' ,
"L1_eTauRoISim")
527 outputEDM +=
addEDM(
'xAOD::eFexTauRoIContainer' ,
"L1_eTauxRoI")
528 outputEDM +=
addEDM(
'xAOD::eFexTauRoIContainer' ,
"L1_eTauxRoISim")
530 if flags.Trigger.L1.dojFex:
531 outputEDM +=
addEDM(
'xAOD::jFexTowerContainer' ,
"L1_jFexDataTowers")
532 outputEDM +=
addEDM(
'xAOD::jFexTowerContainer' ,
"L1_jFexEmulatedTowers")
533 outputEDM +=
addEDM(
'xAOD::jFexSRJetRoIContainer',
'L1_jFexSRJetRoISim')
534 outputEDM +=
addEDM(
'xAOD::jFexLRJetRoIContainer',
'L1_jFexLRJetRoISim')
535 outputEDM +=
addEDM(
'xAOD::jFexTauRoIContainer' ,
'L1_jFexTauRoISim' )
536 outputEDM +=
addEDM(
'xAOD::jFexFwdElRoIContainer',
'L1_jFexFwdElRoISim')
537 outputEDM +=
addEDM(
'xAOD::jFexSumETRoIContainer',
'L1_jFexSumETRoISim')
538 outputEDM +=
addEDM(
'xAOD::jFexMETRoIContainer' ,
'L1_jFexMETRoISim' )
539 outputEDM +=
addEDM(
'xAOD::jFexSRJetRoIContainer',
'L1_jFexSRJetRoI')
540 outputEDM +=
addEDM(
'xAOD::jFexLRJetRoIContainer',
'L1_jFexLRJetRoI')
541 outputEDM +=
addEDM(
'xAOD::jFexTauRoIContainer' ,
'L1_jFexTauRoI' )
542 outputEDM +=
addEDM(
'xAOD::jFexFwdElRoIContainer',
'L1_jFexFwdElRoI')
543 outputEDM +=
addEDM(
'xAOD::jFexSumETRoIContainer',
'L1_jFexSumETRoI')
544 outputEDM +=
addEDM(
'xAOD::jFexMETRoIContainer' ,
'L1_jFexMETRoI' )
546 outputEDM +=
addEDM(
'xAOD::jFexSRJetRoIContainer',
'L1_jFexSRJetxRoI')
547 outputEDM +=
addEDM(
'xAOD::jFexLRJetRoIContainer',
'L1_jFexLRJetxRoI')
548 outputEDM +=
addEDM(
'xAOD::jFexTauRoIContainer' ,
'L1_jFexTauxRoI' )
549 outputEDM +=
addEDM(
'xAOD::jFexFwdElRoIContainer',
'L1_jFexFwdElxRoI')
550 outputEDM +=
addEDM(
'xAOD::jFexSumETRoIContainer',
'L1_jFexSumETxRoI')
551 outputEDM +=
addEDM(
'xAOD::jFexMETRoIContainer' ,
'L1_jFexMETxRoI' )
553 if flags.Trigger.L1.dogFex:
554 outputEDM +=
addEDM(
'xAOD::gFexGlobalRoIContainer',
'L1_gMETComponentsJwoj')
555 outputEDM +=
addEDM(
'xAOD::gFexGlobalRoIContainer',
'L1_gMETComponentsJwojSim')
556 outputEDM +=
addEDM(
'xAOD::gFexGlobalRoIContainer',
'L1_gMHTComponentsJwoj')
557 outputEDM +=
addEDM(
'xAOD::gFexGlobalRoIContainer',
'L1_gMHTComponentsJwojSim')
558 outputEDM +=
addEDM(
'xAOD::gFexGlobalRoIContainer',
'L1_gMSTComponentsJwoj')
559 outputEDM +=
addEDM(
'xAOD::gFexGlobalRoIContainer',
'L1_gMSTComponentsJwojSim')
560 outputEDM +=
addEDM(
'xAOD::gFexGlobalRoIContainer',
'L1_gScalarEJwoj')
561 outputEDM +=
addEDM(
'xAOD::gFexGlobalRoIContainer',
'L1_gScalarEJwojSim')
562 outputEDM +=
addEDM(
'xAOD::gFexGlobalRoIContainer',
'L1_gScalarENoiseCutSim')
563 outputEDM +=
addEDM(
'xAOD::gFexGlobalRoIContainer',
'L1_gScalarERmsSim')
565 outputEDM +=
addEDM(
'xAOD::gFexJetRoIContainer',
'L1_gFexLRJetRoI')
566 outputEDM +=
addEDM(
'xAOD::gFexJetRoIContainer',
'L1_gFexLRJetRoISim')
567 outputEDM +=
addEDM(
'xAOD::gFexJetRoIContainer',
'L1_gFexSRJetRoI')
568 outputEDM +=
addEDM(
'xAOD::gFexJetRoIContainer',
'L1_gFexSRJetRoISim')
569 outputEDM +=
addEDM(
'xAOD::gFexJetRoIContainer',
'L1_gFexRhoRoI')
570 outputEDM +=
addEDM(
'xAOD::gFexJetRoIContainer',
'L1_gFexRhoRoISim')
574 from OutputStreamAthenaPool.OutputStreamConfig
import OutputStreamCfg
575 cfg.merge(OutputStreamCfg(flags,
'AOD', ItemList=outputEDM, takeItemsFromInput=
True))
576 from xAODMetaDataCnv.InfileMetaDataConfig
import SetupMetaDataForStreamCfg
577 cfg.merge(SetupMetaDataForStreamCfg(flags,
'AOD'))
580if "MuonAlignmentCondAlg" in [a.name
for a
in cfg.getCondAlgos()]: cfg.getCondAlgo(
"MuonAlignmentCondAlg").OutputLevel=Constants.ERROR
583if flags.Trigger.L1.doeFex
and (args.evtNumber
is not None):
585 cfg.addEventAlgo(CompFactory.LVL1.eFexEventDumper(TowersKey=
"L1_eFexDataTowers",EMRoIKey=
"L1_eEMRoI",TauRoIKey=
"L1_eTauRoI"))
590for conf
in args.postConfig:
591 compName,propNameAndVal=conf.split(
".",1)
592 propName,propVal=propNameAndVal.split(
"=",1)
594 from collections
import defaultdict
595 availableComps = defaultdict(list)
596 for comp
in [c
for c
in cfg._allComponents()]+cfg.getServices():
597 availableComps[comp.getType()] += [comp.getName()]
598 if comp.getName()==compName
or comp.getType()==compName
or comp.toStringProperty()==compName:
601 log.info(
"Setting "+compName+
" property: "+propNameAndVal)
602 exec(f
"comp.{propNameAndVal}")
603 except AttributeError
as e:
604 log.fatal(
"Unknown property of " + compName +
" : " + propNameAndVal)
605 log.fatal(
"See next line for available properties:")
610 print(
"Available comps:")
611 for k,v
in availableComps.items():
613 raise ValueError(f
"postConfig {conf} had no effect ... typo? See list above of available components")
617if flags.Exec.MaxEvents==0: cfg.printConfig(withDetails =
True, summariseProps =
True, printDefaults =
True)
618log.info(
" ".join((
"Configured Services:",*[svc.name
for svc
in cfg.getServices()])) )
622if flags.Exec.MaxEvents==1:
624 cfg.getService(
"StoreGateSvc").Dump=
True
625 cfg.getService(
"DetectorStore").Dump=
True
628if cfg.getService(
"StoreGateSvc").Dump:
629 cfg.getService(
"StoreGateSvc").OutputLevel=3
630if cfg.getService(
"DetectorStore").Dump:
631 cfg.getService(
"DetectorStore").OutputLevel=3
633if flags.Exec.MaxEvents==0:
637 from TrigT1CaloMonitoring.LVL1CaloMonitoringConfig
import L1CaloMonitorCfgHelper
638 L1CaloMonitorCfgHelper.printHanConfig()
639 cfg._wasMerged =
True
642if 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=":")