ATLAS Offline Software
Loading...
Searching...
No Matches
python.runHLT Namespace Reference

Functions

 lock_and_restrict (flags)
 set_flags (flags)
 runHLTCfg (flags, checkMT=True)
 athenaHLTCfg (flags)
 athenaCfg (flags, parser=None)
 main (flags)

Variables

 flags = initConfigFlags()

Detailed Description

CA module to configure the (standalone) HLT for athena and athenaHLT.
There is a separate entry point for each application to tailor some
flags and services. All common code should go to runLTCfg(flags).

Usage:
  athena [options] TriggerJobOpts/runHLT.py [flags]
  athenaHLT [options] TriggerJobOpts.runHLT [flags]

  python -m TriggerJobOpts.runHLT  # not recommended (due to missing LD_PRELOADs)

Function Documentation

◆ athenaCfg()

python.runHLT.athenaCfg ( flags,
parser = None )
Top-level cfg function when running in athena

Definition at line 144 of file runHLT.py.

144def athenaCfg(flags, parser=None):
145 """Top-level cfg function when running in athena"""
146 from AthenaConfiguration.Enums import Format
147
148 # Set default flags for running HLT
149 set_flags(flags)
150
151 # To allow running from MC
152 flags.Common.isOnline = lambda f: not f.Input.isMC
153
154 # Add options to command line parser
155 if not parser:
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')
165
166 # Fill flags from command line
167 args = flags.fillFromArgs(parser=parser)
168
169 if flags.Trigger.writeBS:
170 flags.Output.doWriteBS = True
171 else: # RDO writing is default in athena
172 flags.Output.doWriteRDO = True
173 if not flags.Output.RDOFileName:
174 flags.Output.RDOFileName = 'RDO_TRIG.pool.root'
175
176 # Enable verbose control/data flow printouts if in a
177 # restricted menu, typical for debugging
178 if flags.Trigger.selectChains or len(flags.Trigger.enabledSignatures)==1:
179 flags.Scheduler.ShowControlFlow = True
180 flags.Scheduler.ShowDataDeps = True
181
182 processPreInclude(args, flags)
183 processPreExec(args, flags)
184
185 # Configure main services
186 _allflags = flags.clone() # copy including Concurrency flags
187 _allflags.lock()
188 if _allflags.Concurrency.NumThreads == 0:
189 raise RuntimeError("Trigger jobs must be run in multi-threaded mode. Use --threads=1 (or greater).")
190
191 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
192 cfg = MainServicesCfg(_allflags)
193 del _allflags
194
195 # Lock flags
196 lock_and_restrict(flags)
197
198 if flags.Input.Format is Format.BS:
199 from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg
200 cfg.merge(ByteStreamReadCfg(flags))
201 else:
202 from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
203 cfg.merge(PoolReadCfg(flags))
204
205 # Configure HLT
206 cfg.merge(runHLTCfg(flags, checkMT=False)) # MT check already done above
207
208 # Post-include
209 processPostInclude(args, flags, cfg)
210
211 # Post-exec
212 processPostExec(args, flags, cfg)
213
214 # Apply flags.Exec.XXXMessageComponents logic to configured job
215 from AthenaConfiguration.Utils import setupLoggingLevels
216 setupLoggingLevels(flags, cfg)
217
218 return cfg
219
220

◆ athenaHLTCfg()

python.runHLT.athenaHLTCfg ( flags)
Top-level cfg function when running in athenaHLT

Definition at line 123 of file runHLT.py.

123def athenaHLTCfg(flags):
124 """Top-level cfg function when running in athenaHLT"""
125
126 # Set default flags for running HLT
127 set_flags(flags)
128
129 # Decoding the flags from the command line is already done in athenaHLT.
130 # But we have to do it again in case some of the flags from set_flags
131 # get overwritten by the user.
132 from TrigPSC import PscConfig
133 for flag_arg in PscConfig.unparsedArguments:
134 flags.fillFromString(flag_arg)
135
136 # Lock flags
137 lock_and_restrict(flags)
138
139 # Configure HLT (always runs in MT mode)
140 cfg = runHLTCfg(flags, checkMT=False)
141 return cfg
142
143

◆ lock_and_restrict()

python.runHLT.lock_and_restrict ( flags)
Deny access to a few flags and lock

Definition at line 18 of file runHLT.py.

18def lock_and_restrict(flags):
19 """Deny access to a few flags and lock"""
20
21 def bomb(x):
22 raise RuntimeError("Concurrency flags cannot be used in the HLT to ensure "
23 "that the configuration is portable across different CPUs")
24
25 flags.Concurrency.NumProcs = bomb
26 flags.Concurrency.NumThreads = bomb
27 flags.Concurrency.NumConcurrentEvents = bomb
28
29 flags.lock()
30
31

◆ main()

python.runHLT.main ( flags)
This method is called by athenaHLT (with pre-populated flags)

Definition at line 221 of file runHLT.py.

221def main(flags):
222 """This method is called by athenaHLT (with pre-populated flags)"""
223 return athenaHLTCfg(flags)
224
225
226# This entry point is only used when running in athena
int main()
Definition hello.cxx:18

◆ runHLTCfg()

python.runHLT.runHLTCfg ( flags,
checkMT = True )
Main function to configure the HLT in athena and athenaHLT.

checkMT: perform sanity check if we are running in MT mode

Definition at line 53 of file runHLT.py.

53def runHLTCfg(flags, checkMT=True):
54 """Main function to configure the HLT in athena and athenaHLT.
55
56 checkMT: perform sanity check if we are running in MT mode
57 """
58
59 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
60 from AthenaCommon.Logging import logging
61
62 log = logging.getLogger('runHLT')
63 cfg = ComponentAccumulator()
64
65 # This needs to be conditional on checkMT because for the HLT use-case, we trapped the
66 # Concurrency flags and they cannot be accessed at this point anymore.
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).")
69
70 # Load these objects from StoreGate
71 loadFromSG = [('xAOD::EventInfo', 'StoreGateSvc+EventInfo'),
72 ('TrigConf::L1Menu','DetectorStore+L1TriggerMenu'),
73 ('TrigConf::HLTMenu','DetectorStore+HLTTriggerMenu')]
74
75 from SGComps.SGInputLoaderConfig import SGInputLoaderCfg
76 cfg.merge(SGInputLoaderCfg(flags, loadFromSG))
77
78 from TriggerJobOpts.TriggerHistSvcConfig import TriggerHistSvcConfig
79 cfg.merge(TriggerHistSvcConfig(flags))
80
81 # Menu
82 from TriggerMenuMT.HLT.Config.GenerateMenuMT import generateMenuMT
83 from TriggerJobOpts.TriggerConfig import triggerRunCfg
84 menu = triggerRunCfg(flags, menu=generateMenuMT)
85 cfg.merge(menu)
86
87 from LumiBlockComps.LumiBlockMuWriterConfig import LumiBlockMuWriterCfg
88 cfg.merge(LumiBlockMuWriterCfg(flags), sequenceName="HLTBeginSeq")
89
90 if flags.Trigger.doTransientByteStream and flags.Trigger.doCalo:
91 from TriggerJobOpts.TriggerTransBSConfig import triggerTransBSCfg_Calo
92 cfg.merge(triggerTransBSCfg_Calo(flags), sequenceName="HLTBeginSeq")
93
94 # L1 simulation
95 if flags.Trigger.doLVL1:
96 from TriggerJobOpts.Lvl1SimulationConfig import Lvl1SimulationCfg
97 cfg.merge(Lvl1SimulationCfg(flags), sequenceName="HLTBeginSeq")
98
99 # Track overlay needs this to ensure that the collections are copied correctly
100 # (due to the hardcoding of the name in the converters)
101 if flags.Overlay.doTrackOverlay:
102 from TrkEventCnvTools.TrkEventCnvToolsConfig import TrkEventCnvSuperToolCfg
103 cfg.merge(TrkEventCnvSuperToolCfg(flags))
104
105 if flags.Common.isOnline:
106 from TrigOnlineMonitor.TrigOnlineMonitorConfig import trigOpMonitorCfg
107 cfg.merge( trigOpMonitorCfg(flags) )
108
109 # Print config and statistics
110 if log.getEffectiveLevel() <= logging.DEBUG:
111 cfg.printConfig(withDetails=False, summariseProps=True, printDefaults=True)
112
113 # Disable spurious warnings from HepMcParticleLink (ATR-21838)
114 if flags.Input.isMC:
115 cfg.addService(CompFactory.MessageSvc(setError=["HepMcParticleLink"]))
116
117 from AthenaConfiguration.AccumulatorCache import AccumulatorDecorator
118 AccumulatorDecorator.printStats()
119
120 return cfg
121
122

◆ set_flags()

python.runHLT.set_flags ( flags)
Set default flags for running HLT

Definition at line 32 of file runHLT.py.

32def set_flags(flags):
33 """Set default flags for running HLT"""
34 from AthenaConfiguration.Enums import BeamType
35
36 flags.Trigger.doHLT = True # needs to be set early as other flags depend on it
37 flags.Beam.Type = BeamType.Collisions
38 flags.InDet.useDCS = False # DCS is in general not available online
39 flags.Muon.MuonTrigger = True # Setup muon reconstruction for trigger
40
41 # Disable some forward detetors
42 flags.Detector.GeometryALFA = False
43 flags.Detector.GeometryFwdRegion = False
44 flags.Detector.GeometryLucid = False
45
46 # Increase scheduler checks and verbosity
47 flags.Scheduler.CheckDependencies = True
48 flags.Scheduler.EnableVerboseViews = True
49 flags.Input.FailOnUnknownCollections = True
50 flags.Scheduler.AutoLoadUnmetDependencies = False
51
52

Variable Documentation

◆ flags

python.runHLT.flags = initConfigFlags()

Definition at line 229 of file runHLT.py.