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