Back to home page

Project CMSSW displayed by LXR

 
 

    


Warning, /HLTrigger/Configuration/scripts/hltGetConfiguration is written in an unsupported language. File is not indexed.

0001 #!/usr/bin/env python3
0002 
0003 from __future__ import print_function
0004 import sys, os
0005 import argparse
0006 from HLTrigger.Configuration.extend_argparse import *
0007 
0008 import HLTrigger.Configuration.Tools.confdb  as confdb
0009 import HLTrigger.Configuration.Tools.options as options
0010 
0011 # define an argparse parser to parse our options
0012 textwidth = int( 80 )
0013 try:
0014     textwidth = int( os.popen("stty size 2> /dev/null", "r").read().split()[1] )
0015 except:
0016     pass
0017 formatter = FixedWidthFormatter( HelpFormatterRespectNewlines, width = textwidth )
0018 
0019 parser = argparse.ArgumentParser(
0020   description       = 'Extract an HLT configuration (or fragment thereof) from the ConfDB database.''',
0021   argument_default  = argparse.SUPPRESS,
0022   formatter_class   = formatter,
0023   add_help          = False )
0024 
0025 # read defaults
0026 defaults = options.HLTProcessOptions()
0027 
0028 # required argument
0029 parser.add_argument('menu',
0030                     action  = 'store',
0031                     type    = options.ConnectionHLTMenu,
0032                     metavar = 'MENU',
0033                     help    = 'HLT menu to dump from the database. Supported formats are:\n  - /path/to/configuration[/Vn]\n  - [[{v1|v2|v3}/]{run3|run2|online|adg}:]/path/to/configuration[/Vn]\n  - run:runnumber\nThe possible converters are "v1", "v2, and "v3" (default).\nThe possible databases are "run3" (default, used for offline development), "run2" (used for accessing run2 offline development menus), "online" (used to extract online menus within Point 5) and "adg" (used to extract the online menus outside Point 5).\nIf no menu version is specified, the latest one is automatically used.\nIf "run:" is used instead, the HLT menu used for the given run number is looked up and used.\nNote other converters and databases exist as options but they are only for expert/special use.' )
0034 
0035 # options
0036 parser.add_argument('--process',
0037                     dest    = 'name',
0038                     action  = 'store',
0039                     default = defaults.name,
0040                     metavar = 'PROCESS',
0041                     help    = 'Override the process name (the default is %(default)s)' )
0042 parser.add_argument('--type',
0043                     dest    = 'type',
0044                     action  = 'store',
0045                     metavar = 'TYPE',
0046                     choices = options.globalTag,
0047                     default = defaults.type,
0048                     help    = 'Set global options according to a specific HLT luminosity and type (%(choices)s).' )
0049 parser.add_argument('--globaltag',
0050                     dest    = 'globaltag',
0051                     action  = 'store',
0052                     metavar = 'TAG',
0053                     default = defaults.globaltag,
0054                     help    = 'Override the GlobalTag in the HLT menu:\n- when running on data, the default behaviour is to not override the GobalTag in the HLT menu\n- when running on MC, the default behaviour is to use the GlobalTag from "type" and the current PyRelVal configuration.\nTo run on data with a different release than the menu was designed for, try "auto:hltonline"' )
0055 parser.add_argument('--l1',
0056                     dest    = 'l1',
0057                     action  = 'store',
0058                     type    = options.ConnectionL1TMenu,
0059                     default = defaults.l1,
0060                     metavar = 'MENU',
0061                     help    = 'Override the L1 menu, using the given payload from the database. %(metavar)s should have the format "L1GtTriggerMenu_MENU_mc".\nThe default behaviour is to run with the L1 menu from the GlobalTag' )
0062 parser.add_argument('--l1Xml',
0063                     dest    = 'l1Xml',
0064                     action  = 'store',
0065                     type    = options.ConnectionL1TMenuXml,
0066                     default = defaults.l1Xml,
0067                     metavar = 'MENU',
0068                     help    = 'Override the L1 menu, using the given Xml file. %(metavar)s should have the format "L1Menu_Collisions2012_v0_L1T_Scales_20101224_Imp0_0x1027.xml".\nThe default behaviour is to run with the L1 menu from the GlobalTag' )
0069 parser.add_argument('--l1-emulator',
0070                     dest    = 'emulator',
0071                     action  = 'store',
0072                     metavar = 'EMULATOR',
0073                     nargs   = '?',
0074                     choices = [ 'Full', 'FullMC', 'Full2015Data', 'uGT' ],
0075                     default = defaults.emulator,
0076                     const   = 'Full',
0077                     help    = 'Run the Full stage-2 L1T emulator.' )
0078 
0079 parser.add_argument('--dbproxy',
0080                     dest    = 'proxy',
0081                     action  = 'store_true',
0082                     default = defaults.proxy,
0083                     help    = 'Use a socks proxy to connect outside CERN network (default: False)' )
0084 parser.add_argument('--dbproxyport',
0085                     dest    = 'proxy_port',
0086                     action  = 'store',
0087                     metavar = 'PROXYPORT',
0088                     default = defaults.proxy_port,
0089                     help    = 'Port of the socks proxy (default: 8080)' )
0090 parser.add_argument('--dbproxyhost',
0091                     dest    = 'proxy_host',
0092                     action  = 'store',
0093                     metavar = 'PROXYHOST',
0094                     default = defaults.proxy_host,
0095                     help    = 'Host of the socks proxy (default: "localhost")' )
0096 
0097 group = parser.add_mutually_exclusive_group()
0098 group.add_argument('--prescale',
0099                     dest    = 'prescale',
0100                     action  = 'store',
0101                     default = defaults.prescale,
0102                     help    = 'Force using one specific prescale column.\nUse "--prescale none" to run without any HLT prescales' )
0103 group.add_argument('--no-prescale',
0104                     dest    = 'prescale',
0105                     action  = 'store_const',
0106                     const   = 'none',
0107                     help    = 'Same as "--prescale none"' )
0108 group.add_argument('--unprescale',
0109                     dest    = 'prescale',
0110                     action  = 'store_const',
0111                     const   = 'none',
0112                     help    = 'Same as "--prescale none"' )
0113 
0114 parser.add_argument('--open',
0115                     dest    = 'open',
0116                     action  = 'store_true',
0117                     default = defaults.open,
0118                     help    = 'Run the HLT in "open" mode, overriding all ED/HLTFilters to always pass (overrides "--prescale" and implies "--prescale none")' )
0119 parser.add_argument('--eras',
0120                     dest    = 'eras',
0121                     action  = 'store',
0122                     type    = str,
0123                     default = defaults.eras,
0124                     metavar = 'ERAS',
0125                     help    = 'Select the defined Eras in HLT configuration (e.g. phase1Pixel)' )
0126 parser.add_argument('--customise',
0127                     dest    = 'customise',
0128                     action  = 'store',
0129                     type    = str,
0130                     default = defaults.customise,
0131                     metavar = 'CUSTOMISE',
0132                     help    = 'Apply the user-defined customization functions using the format HLTrigger/Configuration/customizeHLTTrackingForPhaseI2017.customizeHLTForPFTrackingPhaseI2017' )
0133 parser.add_argument('--error-events',
0134                     dest    = 'errortype',
0135                     action  = 'store_true',
0136                     default = defaults.errortype,
0137                     help    = 'Modify all HLTTriggerTypeFilter EDFilters to accept only error events (SelectedTriggerType = 0)' )
0138 parser.add_argument('--profiling',
0139                     dest    = 'profiling',
0140                     action  = 'store_true',
0141                     default = defaults.profiling,
0142                     help    = 'Instrument the menu with the modules for profiling studies (hltGetRaw and hltGetConditions), disable options' )
0143 parser.add_argument('--timing',
0144                     dest    = 'timing',
0145                     action  = 'store_true',
0146                     default = defaults.timing,
0147                     help    = 'Instrument the menu with the Service, EDModules and EndPath needed for timing studies (implies --profiling)' )
0148 parser.add_argument('--paths',
0149                     dest    = 'paths',
0150                     action  = 'store',
0151                     type    = str,
0152                     default = defaults.paths,
0153                     metavar = 'PATHS',
0154                     help    = 'Include only the given comma-separated-list of paths in the dump (wildcards are accepted)\nNote that in a full dump the "smart prescale" modules will likely fail, unless removed with "--output none" or "--output minimal"' )
0155 parser.add_argument('--input',
0156                     dest    = 'input',
0157                     action  = 'store',
0158                     type    = str,
0159                     default = defaults.input,
0160                     metavar = 'SOURCE',
0161                     help    = 'If set, specify the SOURCE input file(s) or dataset, otherwise a default is chosen up depending on the other options.\nSOURCE can be a single file nane, a comma-separated list of file names, or have the format "dataset:DATASET" to query a DATASET definition from DAS' )
0162 parser.add_argument('--parent',
0163                     dest    = 'parent',
0164                     action  = 'store',
0165                     type    = str,
0166                     default = defaults.parent,
0167                     metavar = 'PARENT',
0168                     help    = 'If set, specify the PARENT input file(s) or dataset, using the same syntax as SOURCE, above' )
0169 parser.add_argument('--max-events',
0170                     dest    = 'events',
0171                     action  = 'store',
0172                     type    = int,
0173                     default = defaults.events,
0174                     metavar = 'EVENTS',
0175                     help    = 'Run on EVENTS events (-1 for unlimited)' )
0176 parser.add_argument('--setup',
0177                     dest    = 'setup',
0178                     action  = 'store',
0179                     type    = str,
0180                     default = defaults.setup,
0181                     metavar = 'STORE',
0182                     help    = 'If set, download setup_cff from the specified configuration and load it. Note, it is forced to be the same database and converter as specified by primary menu configuration, in fact it is an error to specify a converter/database here and the command will fail' )
0183 
0184 group = parser.add_mutually_exclusive_group()
0185 group.add_argument('--output',
0186                     dest    = 'output',
0187                     action  = 'store',
0188                     metavar = 'OUTPUT',
0189                     choices = [ 'all', 'minimal', 'none', 'full' ],
0190                     default = defaults.output,
0191                     help    = 'Use:\n- "all" to output all output modules (default)\n- "minimal" to only output the TriggerResults\n- "none" to remove all output modules\n- "full" to output a single root file with "keep *" event content.' )
0192 group.add_argument('--no-output',
0193                     dest    = 'output',
0194                     action  = 'store_const',
0195                     const   = 'none',
0196                     help    = 'Same as "--output none"' )
0197 
0198 group = parser.add_mutually_exclusive_group()
0199 group.add_argument('--data',
0200                     dest    = 'data',
0201                     action  = 'store_true',
0202                     default = defaults.data,
0203                     help    = 'Prepare a menu for running on data (raw events in "source") (default)' )
0204 group.add_argument('--mc',
0205                     dest    = 'data',
0206                     action  = 'store_false',
0207                     default = not defaults.data,
0208                     help    = 'Prepare a menu for running on MC (raw events in "rawDataCollector")' )
0209 
0210 parser.add_argument('--hilton',
0211                     dest    = 'hilton',
0212                     action  = 'store_true',
0213                     default = defaults.hilton,
0214                     help    = 'Keep the hilton-specific modules' )
0215 
0216 group = parser.add_mutually_exclusive_group()
0217 group.add_argument('--full',
0218                     dest    = 'fragment',
0219                     action  = 'store_false',
0220                     default = not defaults.fragment,
0221                     help    = 'Generate a full configuration file, with minimal modifications (default)' )
0222 group.add_argument('--fragment', '--cff',
0223                     dest    = 'fragment',
0224                     action  = 'store_true',
0225                     default = defaults.fragment,
0226                     help    = 'Generate a stripped down configuration file fragment, for inclusion by e.g. cmsDriver.py (with no input or output sections)' )
0227 
0228 group = parser.add_mutually_exclusive_group()
0229 group.add_argument('--online',
0230                     dest    = 'unused',
0231                     action  = 'store_true',
0232                     help    = 'Ignored' )
0233 group.add_argument('--offline',
0234                     dest    = 'unused',
0235                     action  = 'store_true',
0236                     help    = 'Ignored' )
0237 
0238 # redefine "--help" to be the last option, and use a customized message
0239 parser.add_argument('--help',
0240                     action  = 'help',
0241                     help    = 'Show this help message and exit' )
0242 
0243 # parse command line arguments and options
0244 config = parser.parse_args(namespace = options.HLTProcessOptions())
0245 
0246 cmdArgs = sys.argv
0247 cmdArgs[0] = os.path.basename(sys.argv[0])
0248 cmdLine = ' '.join(cmdArgs)
0249 print('# ' + cmdLine)
0250 print()
0251 print(confdb.HLTProcess(config).dump())