4 CA module to configure the (standalone) HLT for athena and athenaHLT.
5 There is a separate entry point for each application to tailor some
6 flags and services. All common code should go to runLTCfg(flags).
9 athena [options] TriggerJobOpts/runHLT.py [flags]
10 athenaHLT [options] TriggerJobOpts.runHLT [flags]
12 python -m TriggerJobOpts.runHLT # not recommended (due to missing LD_PRELOADs)
15 from AthenaConfiguration.ComponentFactory
import CompFactory
16 from PyJobTransforms.TransformUtils
import processPreExec, processPostExec, processPreInclude, processPostInclude
19 """Deny access to a few flags and lock"""
22 raise RuntimeError(
"Concurrency flags cannot be used in the HLT to ensure "
23 "that the configuration is portable across different CPUs")
25 flags.Concurrency.NumProcs = bomb
26 flags.Concurrency.NumThreads = bomb
27 flags.Concurrency.NumConcurrentEvents = bomb
33 """Set default flags for running HLT"""
34 from AthenaConfiguration.Enums
import BeamType
36 flags.Trigger.doHLT =
True
37 flags.Beam.Type = BeamType.Collisions
38 flags.InDet.useDCS =
False
39 flags.Muon.MuonTrigger =
True
42 flags.Detector.GeometryALFA =
False
43 flags.Detector.GeometryFwdRegion =
False
44 flags.Detector.GeometryLucid =
False
47 flags.Scheduler.CheckDependencies =
True
48 flags.Scheduler.EnableVerboseViews =
True
49 flags.Input.FailOnUnknownCollections =
True
50 flags.Scheduler.AutoLoadUnmetDependencies =
False
54 """Main function to configure the HLT in athena and athenaHLT.
56 checkMT: perform sanity check if we are running in MT mode
59 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
60 from AthenaCommon.Logging
import logging
62 log = logging.getLogger(
'runHLT')
67 if checkMT
and flags.Concurrency.NumThreads == 0:
68 raise RuntimeError(
"Trigger jobs must be run in multi-threaded mode. Use --threads=1 (or greater).")
71 loadFromSG = [(
'xAOD::EventInfo',
'StoreGateSvc+EventInfo'),
72 (
'TrigConf::L1Menu',
'DetectorStore+L1TriggerMenu'),
73 (
'TrigConf::HLTMenu',
'DetectorStore+HLTTriggerMenu')]
75 from SGComps.SGInputLoaderConfig
import SGInputLoaderCfg
78 from TriggerJobOpts.TriggerHistSvcConfig
import TriggerHistSvcConfig
82 from TriggerMenuMT.HLT.Config.GenerateMenuMT
import generateMenuMT
83 from TriggerJobOpts.TriggerConfig
import triggerRunCfg
87 from LumiBlockComps.LumiBlockMuWriterConfig
import LumiBlockMuWriterCfg
90 if flags.Trigger.doTransientByteStream
and flags.Trigger.doCalo:
91 from TriggerJobOpts.TriggerTransBSConfig
import triggerTransBSCfg_Calo
95 if flags.Trigger.doLVL1:
96 from TriggerJobOpts.Lvl1SimulationConfig
import Lvl1SimulationCfg
101 if flags.Overlay.doTrackOverlay:
102 from TrkEventCnvTools.TrkEventCnvToolsConfig
import TrkEventCnvSuperToolCfg
105 if flags.Common.isOnline:
106 from TrigOnlineMonitor.TrigOnlineMonitorConfig
import trigOpMonitorCfg
110 if log.getEffectiveLevel() <= logging.DEBUG:
111 cfg.printConfig(withDetails=
False, summariseProps=
True, printDefaults=
True)
115 cfg.addService(CompFactory.MessageSvc(setError=[
"HepMcParticleLink"]))
117 from AthenaConfiguration.AccumulatorCache
import AccumulatorDecorator
118 AccumulatorDecorator.printStats()
124 """Top-level cfg function when running in athenaHLT"""
132 from TrigPSC
import PscConfig
133 for flag_arg
in PscConfig.unparsedArguments:
134 flags.fillFromString(flag_arg)
145 """Top-level cfg function when running in athena"""
146 from AthenaConfiguration.Enums
import Format
152 flags.Common.isOnline =
lambda f:
not f.Input.isMC
156 parser = flags.getArgumentParser()
157 parser.add_argument(
'--preExec', metavar=
'CMD', nargs=
'+',
158 help=
'Commands executed before Python configuration')
159 parser.add_argument(
'--postExec', metavar=
'CMD', nargs=
'+',
160 help=
'Commands executed after Python configuration')
161 parser.add_argument(
'--preInclude', metavar=
'CMD', nargs=
'+',
162 help=
'Module to execute before Python configuration')
163 parser.add_argument(
'--postInclude', metavar=
'CMD', nargs=
'+',
164 help=
'Module to execute after Python configuration')
167 args = flags.fillFromArgs(parser=parser)
169 if flags.Trigger.writeBS:
170 flags.Output.doWriteBS =
True
172 flags.Output.doWriteRDO =
True
173 if not flags.Output.RDOFileName:
174 flags.Output.RDOFileName =
'RDO_TRIG.pool.root'
178 if flags.Trigger.selectChains
or len(flags.Trigger.enabledSignatures)==1:
179 flags.Scheduler.ShowControlFlow =
True
180 flags.Scheduler.ShowDataDeps =
True
186 _allflags = flags.clone()
188 if _allflags.Concurrency.NumThreads == 0:
189 raise RuntimeError(
"Trigger jobs must be run in multi-threaded mode. Use --threads=1 (or greater).")
191 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
198 if flags.Input.Format
is Format.BS:
199 from ByteStreamCnvSvc.ByteStreamConfig
import ByteStreamReadCfg
202 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
206 cfg.merge(
runHLTCfg(flags, checkMT=
False))
215 from AthenaConfiguration.Utils
import setupLoggingLevels
222 """This method is called by athenaHLT (with pre-populated flags)"""
227 if __name__ ==
"__main__":
228 from AthenaConfiguration.AllConfigFlags
import initConfigFlags