320 parser = argparse.ArgumentParser(prog=
'athenaHLT.py', formatter_class=
321 lambda prog : argparse.ArgumentDefaultsHelpFormatter(prog, max_help_position=32, width=100),
322 usage =
'%(prog)s [OPTION]... -f FILE jobOptions',
324 parser.expert_groups = []
327 g = parser.add_argument_group(
'Options')
328 g.add_argument(
'jobOptions', nargs=
'?', help=
'job options, CA module or JSON file')
329 g.add_argument(
'--threads', metavar=
'N', type=int, default=1, help=
'number of threads')
330 g.add_argument(
'--nprocs', metavar=
'N', type=int, default=1, help=
'number of children to fork')
331 g.add_argument(
'--concurrent-events', metavar=
'N', type=int, help=
'number of concurrent events if different from --threads')
332 g.add_argument(
'--log-level',
'-l', metavar=
'LVL', type=arg_log_level, default=
'INFO,ERROR', help=
'OutputLevel of athena,POOL')
333 g.add_argument(
'--precommand',
'-c', metavar=
'CMD', action=
'append', default=[],
334 help=
'Python commands executed before job options or database configuration')
335 g.add_argument(
'--postcommand',
'-C', metavar=
'CMD', action=
'append', default=[],
336 help=
'Python commands executed after job options or database configuration')
337 g.add_argument(
'--interactive',
'-i', action=
'store_true', help=
'interactive mode')
338 g.add_argument(
'--help',
'-h', nargs=
'?', choices=[
'all'], action=MyHelp, help=
'show help')
340 g = parser.add_argument_group(
'Input/Output')
341 g.add_argument(
'--file',
'--filesInput',
'-f', action=
'append', help=
'input RAW file')
342 g.add_argument(
'--save-output',
'-o', metavar=
'FILE', help=
'output file name')
343 g.add_argument(
'--number-of-events',
'--evtMax',
'-n', metavar=
'N', type=int, default=-1, help=
'processes N events (<=0 means all)')
344 g.add_argument(
'--skip-events',
'--skipEvents',
'-k', metavar=
'N', type=int, default=0, help=
'skip N first events')
345 g.add_argument(
'--loop-files', action=
'store_true', help=
'loop over input files if no more events')
348 g = parser.add_argument_group(
'Performance and debugging')
349 g.add_argument(
'--debug',
'-d', nargs=
'?', const=
'child', choices=[
'parent',
'child'],
350 help=
'attach debugger (to child by default)')
351 g.add_argument(
'--script-after-fork', metavar=
'CMD', help=
'Execute a command after forking. The command has to be in the'
352 ' form "whichProc:cmd" where whichProc is one of [mother,firstFork,allForks] and cmd can contain a format'
353 ' string {pid} which will be replaced with the PID of the corresponding process (mother or fork).')
354 g.add_argument(
'--perfmon', action=
'store_true', help=
'enable PerfMon')
355 g.add_argument(
'--tcmalloc', action=
'store_true', default=
True, help=
'use tcmalloc')
356 g.add_argument(
'--stdcmalloc', action=
'store_true', help=
'use stdcmalloc')
357 g.add_argument(
'--stdcmath', action=
'store_true', help=
'use stdcmath library')
358 g.add_argument(
'--imf', action=
'store_true', default=
True, help=
'use Intel math library')
359 g.add_argument(
'--show-includes',
'-s', action=
'store_true', help=
'show printout of included files')
360 g.add_argument(
'--timeout', metavar=
'MSEC', default=60*60*1000, help=
'timeout in milliseconds')
363 g = parser.add_argument_group(
'Database')
364 g.add_argument(
'--use-database',
'-b', action=
'store_true',
365 help=
'configure from trigger database, reading keys from COOL if not specified')
366 g.add_argument(
'--db-server', metavar=
'DB', default=
'TRIGGERDB_RUN3', help=
'DB server name')
367 g.add_argument(
'--smk', type=int, default=
None, help=
'Super Master Key')
368 g.add_argument(
'--l1psk', type=int, default=
None, help=
'L1 prescale key')
369 g.add_argument(
'--hltpsk', type=int, default=
None, help=
'HLT prescale key')
370 g.add_argument(
'--dump-config', action=
'store_true', help=
'Dump joboptions JSON file')
371 g.add_argument(
'--dump-config-exit', action=
'store_true', help=
'Dump joboptions JSON file and exit')
374 g = parser.add_argument_group(
'Online Histogramming')
375 g.add_argument(
'--oh-monitoring',
'-M', action=
'store_true',
376 help=
'enable OH monitoring')
377 g.add_argument(
'--oh-interval', metavar=
'SEC', type=int, default=5,
378 help=
'seconds between histogram publications.')
381 g = parser.add_argument_group(
'Conditions')
382 g.add_argument(
'--run-number',
'-R', metavar=
'RUN', type=int,
383 help=
'run number (if None, read from first event)')
384 g.add_argument(
'--lb-number',
'-L', metavar=
'LBN', type=int,
385 help=
'lumiblock number (if None, read from first event)')
386 g.add_argument(
'--sor-time', type=arg_sor_time,
387 help=
'The Start Of Run time. Three formats are accepted: '
388 '1) the string "now", for current time; '
389 '2) the number of nanoseconds since epoch (e.g. 1386355338658000000 or int(time.time() * 1e9)); '
390 '3) human-readable "20/11/18 17:40:42.3043". If not specified the sor-time is read from COOL')
391 g.add_argument(
'--detector-mask', metavar=
'MASK', type=arg_detector_mask,
392 help=
'detector mask (if None, read from COOL), use string "all" to enable all detectors')
395 g = parser.add_argument_group(
'Expert')
396 parser.expert_groups.append(g)
397 g.add_argument(
'--joboptionsvc-type', metavar=
'TYPE', default=
'TrigConf::JobOptionsSvc', help=
'JobOptionsSvc type')
398 g.add_argument(
'--msgsvc-type', metavar=
'TYPE', default=
'TrigMessageSvc', help=
'MessageSvc type')
399 g.add_argument(
'--partition',
'-p', metavar=
'NAME', default=
'athenaHLT', help=
'partition name')
400 g.add_argument(
'--no-ers-signal-handlers', action=
'store_true', help=
'disable ERS signal handlers')
401 g.add_argument(
'--preloadlib', metavar=
'LIB', help=
'preload an arbitrary library')
402 g.add_argument(
'--unique-log-files',
'-ul', action=
'store_true', help=
'add pid/timestamp to worker log files')
403 g.add_argument(
'--debug-fork', action=
'store_true', help=
'Dump open files/threads during forking')
404 g.add_argument(
'--hltresult-size', metavar=
'MB', type=int, default=10, help=
'Maximum HLT result size in MB')
405 g.add_argument(
'--extra-l1r-robs', metavar=
'ROBS', type=arg_eval, default=[],
406 help=
'List of additional ROB IDs that are considered part of the L1 result and passed to the HLT')
407 g.add_argument(
'--ros2rob', metavar=
'DICT', type=arg_ros2rob, default={},
408 help=
'Either a string in the form of python dictionary that contains ros-rob mappings '
409 'or a file path that contains such string. For example, /path/to/rosmap.txt or '
410 '{"ROS0":[0x11205,0x11206],"ROS1":[2120005,2120006]}')
411 g.add_argument(
'--cfgdict', metavar=
'DICT', type=arg_eval, default={},
412 help=
'HLTMPPy config dictionary with additional options, e.g.: '
413 '--cfgdict \'{"global": {"log_root" : "/tmp"}}\'')
415 (args, unparsed_args) = parser.parse_known_args()
419 from ROOT
import gROOT
423 import AthenaCommon.Logging
424 AthenaCommon.Logging.log.setLevel(getattr(logging, args.log_level[0]))
425 AthenaCommon.Logging.log.setFormat(
"%(asctime)s Py:%(name)-31s %(levelname)7s %(message)s")
426 if args.show_includes:
427 from AthenaCommon.Include
import include
428 include.setShowIncludes(
True )
431 if not args.concurrent_events:
432 args.concurrent_events = args.threads
434 if args.loop_files
and args.number_of_events<0:
435 log.warning(
"Looping over files without specifying number of events will run forever!")
438 if args.interactive
and not (args.use_database
or args.jobOptions.endswith(
'.json')):
439 args.interactive =
False
442 from TrigPSC
import PscConfig
445 if args.use_database:
447 PscConfig.forcePSK = (args.hltpsk
is not None)
461 from TrigPSC.PscDefaultFlags
import defaultOnlineFlags
465 if not args.use_database
and not args.jobOptions.endswith(
'.json'):
466 PscConfig.unparsedArguments = unparsed_args
467 for flag_arg
in unparsed_args:
468 flags.fillFromString(flag_arg)
470 PscConfig.interactive = args.interactive
471 PscConfig.exitAfterDump = args.dump_config_exit
473 flags.PerfMon.doFastMonMT = args.perfmon
474 flags.Trigger.Online.useOnlineTHistSvc = args.oh_monitoring
477 from HLTMPPy.runner
import runHLTMPPy