Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Functions | Variables
python.runHLT Namespace Reference

Functions

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

Variables

 flags
 

Function Documentation

◆ athenaCfg()

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

Definition at line 144 of file runHLT.py.

144 def 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()

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

Definition at line 123 of file runHLT.py.

123 def 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()

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

Definition at line 18 of file runHLT.py.

18 def 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()

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

Definition at line 221 of file runHLT.py.

221 def 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

◆ runHLTCfg()

def 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.

53 def 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()

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

Definition at line 32 of file runHLT.py.

32 def 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

Definition at line 229 of file runHLT.py.

python.runHLT.lock_and_restrict
def lock_and_restrict(flags)
Definition: runHLT.py:18
python.runHLT.set_flags
def set_flags(flags)
Definition: runHLT.py:32
python.TransformUtils.processPreExec
def processPreExec(runArgs, flags)
Definition: Tools/PyJobTransforms/python/TransformUtils.py:41
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.Lvl1SimulationConfig.Lvl1SimulationCfg
def Lvl1SimulationCfg(flags, seqName=None)
this function sets up the top L1 simulation sequence
Definition: Lvl1SimulationConfig.py:8
python.TransformUtils.processPostExec
def processPostExec(runArgs, flags, cfg)
Definition: Tools/PyJobTransforms/python/TransformUtils.py:50
python.TransformUtils.processPostInclude
def processPostInclude(runArgs, flags, cfg)
Definition: Tools/PyJobTransforms/python/TransformUtils.py:69
python.ByteStreamConfig.ByteStreamReadCfg
def ByteStreamReadCfg(flags, type_names=None)
Definition: Event/ByteStreamCnvSvc/python/ByteStreamConfig.py:25
python.TransformUtils.processPreInclude
def processPreInclude(runArgs, flags)
Definition: Tools/PyJobTransforms/python/TransformUtils.py:62
python.LumiBlockMuWriterConfig.LumiBlockMuWriterCfg
def LumiBlockMuWriterCfg(flags, name='LumiBlockMuWriter', seqName="AthAlgSeq")
Definition: LumiBlockMuWriterConfig.py:14
python.Utils.setupLoggingLevels
def setupLoggingLevels(flags, ca)
Definition: Control/AthenaConfiguration/python/Utils.py:50
python.TrkEventCnvToolsConfig.TrkEventCnvSuperToolCfg
def TrkEventCnvSuperToolCfg(flags, name='EventCnvSuperTool', **kwargs)
Definition: TrkEventCnvToolsConfig.py:51
SGInputLoaderConfig.SGInputLoaderCfg
def SGInputLoaderCfg(flags, Load=None, **kwargs)
Definition: SGInputLoaderConfig.py:7
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
python.runHLT.athenaHLTCfg
def athenaHLTCfg(flags)
Definition: runHLT.py:123
python.TriggerHistSvcConfig.TriggerHistSvcConfig
def TriggerHistSvcConfig(flags)
Definition: TriggerHistSvcConfig.py:17
TrigOnlineMonitorConfig.trigOpMonitorCfg
def trigOpMonitorCfg(flags)
Definition: TrigOnlineMonitorConfig.py:8
python.runHLT.main
def main(flags)
Definition: runHLT.py:221
python.runHLT.athenaCfg
def athenaCfg(flags, parser=None)
Definition: runHLT.py:144
python.TriggerConfig.triggerRunCfg
def triggerRunCfg(flags, menu=None)
Definition: TriggerConfig.py:644
python.runHLT.runHLTCfg
def runHLTCfg(flags, checkMT=True)
Definition: runHLT.py:53
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69
python.TriggerTransBSConfig.triggerTransBSCfg_Calo
def triggerTransBSCfg_Calo(flags, seqName="AthAlgSeq")
Definition: TriggerTransBSConfig.py:83