Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:03:31

0001 #! /usr/bin/env python3
0002 
0003 # A Pyrelval Wrapper
0004 
0005 from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
0006 import sys
0007 import os
0008 import re
0009 import Configuration.Applications
0010 from Configuration.Applications.ConfigBuilder import ConfigBuilder, defaultOptions
0011 import traceback
0012 # Prepare a parser to read the options
0013 usage=\
0014 """%(prog)s <TYPE> [options].
0015 Example:
0016 
0017 %(prog)s reco -s RAW2DIGI,RECO --conditions STARTUP_V4::All --eventcontent RECOSIM
0018 """
0019 parser = ArgumentParser(usage=usage, formatter_class=ArgumentDefaultsHelpFormatter)
0020 
0021 expertSettings = parser.add_argument_group('===============\n  Expert Options', 'Caution: please use only if you know what you are doing.')
0022 
0023 parser.add_argument("evt_type", metavar="TYPE", nargs='?', type=str)
0024 parser.add_argument("-s", "--step",
0025                     help="The desired step. The possible values are: "+\
0026                          "GEN,SIM,DIGI,L1,DIGI2RAW,HLT,RAW2DIGI,RECO,POSTRECO,DQM,ALCA,VALIDATION,HARVESTING, NONE or ALL.",
0027                     default="ALL",
0028                     type=str,
0029                     dest="step")
0030 
0031 parser.add_argument("--conditions",
0032                     help="What conditions to use (required; provide value 'help' to get list of options)",
0033                     required=True,
0034                     type=str,
0035                     dest="conditions")
0036 
0037 parser.add_argument("--eventcontent",
0038                     help="What event content to write out",
0039                     default='RECOSIM',
0040                     type=str,
0041                     dest="eventcontent")
0042 
0043 parser.add_argument("--filein",
0044                     help="The infile name.",
0045                     default="", #to be changed in the default form later
0046                     type=str,
0047                     dest="filein")
0048 
0049 parser.add_argument("--fileout",
0050                     help="The outfile name. If absent a default value is assigned",
0051                     default="", #to be changed in the default form later
0052                     type=str,
0053                     dest="fileout")
0054 
0055 parser.add_argument("--filetype",
0056                     help="The type of the infile",
0057                     default=defaultOptions.filetype,
0058                     type=str,
0059                     dest="filetype",
0060                     choices=['EDM','DAT','LHE','MDCB','DQM','DQMDAQ']
0061                   )
0062 
0063 parser.add_argument("-n", "--number",
0064                     help="The number of events.",
0065                     default=1,
0066                     type=int,
0067                     dest="number")
0068 
0069 parser.add_argument("-o", "--number_out",
0070                     help="The number of events in output.",
0071                     default=None,
0072                     type=int,
0073                     dest="number_out")
0074 
0075 parser.add_argument("--mc",
0076                     help="Specify that simulation is to be processed (default = guess based on options)",
0077                     action="store_true",
0078                     default=False,
0079                     dest="isMC")
0080 
0081 parser.add_argument("--data",
0082                     help="Specify that data is to be processed (default = guess based on options)",
0083                     action="store_true",
0084                     default=False,
0085                     dest="isData")
0086 
0087 parser.add_argument("--no_exec",
0088                     help="Do not exec cmsRun. Just prepare the python config file.",
0089                     action="store_true",
0090                     default=False,
0091                     dest="no_exec_flag")
0092 
0093 parser.add_argument("--fast",
0094                     help="Specify that the configuration is for FASTSIM",
0095                     action="store_true",
0096                     default=False)
0097 
0098 parser.add_argument("--runsAndWeightsForMC",
0099                     help="Assign run numbers to MC source according to relative weights. [(run1,weight1),...,(runN,weightN)])",
0100                     default=None,
0101                     dest="runsAndWeightsForMC")
0102 
0103 parser.add_argument("--runsScenarioForMC",
0104                     help="Load a scenario to set run numbers in MC.)",
0105                     default=None,
0106                     dest="runsScenarioForMC")
0107 
0108 parser.add_argument("--runsAndWeightsForMCIntegerWeights",
0109                     help="Assign run numbers to MC source according to relative weights where weighting is determined by the number of times the run number appears. [(run1,run2,...,runN)])",
0110                     default=None,
0111                     dest="runsAndWeightsForMCIntegerWeights")
0112 
0113 parser.add_argument("--runsScenarioForMCIntegerWeights",
0114                     help="Load a scenario to set run numbers in MC with integer IOV weights.",
0115                     default=None,
0116                     dest="runsScenarioForMCIntegerWeights")
0117 
0118 parser.add_argument("--runUnscheduled",
0119                     help="Automatically convert configuration to run unscheduled the EDProducers/EDFilters that were scheduled",
0120                     action="store_true",
0121                     default=False,
0122                     dest="runUnscheduled")
0123 
0124 # expert settings
0125 expertSettings.add_argument("--beamspot",
0126                             help="What beam spot to use (from Configuration/StandardSequences). Default depends on scenario",
0127                             default=None,
0128                             type=str,
0129                             dest="beamspot")
0130 
0131 expertSettings.add_argument("--customise",
0132                             help="Specify the file where the code to modify the process object is stored.",
0133                             default=[],
0134                             action="append",
0135                             type=str,
0136                             dest="customisation_file")
0137 
0138 expertSettings.add_argument("--customise_unsch",
0139                             help="Specify the file where the code to modify the process object is stored.",
0140                             default=[],
0141                             action="append",
0142                             type=str,
0143                             dest="customisation_file_unsch")
0144 
0145 expertSettings.add_argument("--customise_commands",
0146                             help="Specify a string of commands",
0147                             default="",
0148                             type=str,
0149                             dest="customise_commands")
0150 
0151 expertSettings.add_argument("--inline_custom",
0152                             help="inline the customisation file",
0153                             default=False,
0154                             action="store_true",
0155                             dest="inline_custom")
0156 
0157 expertSettings.add_argument("--datatier",
0158                             help="What data tier to use.",
0159                             default='',
0160                             type=str,
0161                             dest="datatier")
0162 
0163 expertSettings.add_argument( "--dirin",
0164                             help="The infile directory.",
0165                             default="",
0166                             type=str,
0167                             dest="dirin")
0168 
0169 expertSettings.add_argument( "--dirout",
0170                             help="The outfile directory.",
0171                             default="",
0172                             type=str,
0173                             dest="dirout")
0174 
0175 expertSettings.add_argument("--filtername",
0176                             help="What filter name to specify in output module",
0177                             default="",
0178                             type=str,
0179                             dest="filtername")
0180 
0181 expertSettings.add_argument("--geometry",
0182                             help="What simulation geometry to use. Comma-separated SimGeometry,RecoGeometry is supported.",
0183                             default=defaultOptions.geometry,
0184                             type=str,
0185                             dest="geometry")
0186 
0187 expertSettings.add_argument("--magField",
0188                             help="What magnetic field to use (from Configuration/StandardSequences).",
0189                             default=defaultOptions.magField,
0190                             type=str,
0191                             dest="magField")
0192 
0193 expertSettings.add_argument("--no_output",
0194                             help="Do not write anything to disk. This is for "+\
0195                             "benchmarking purposes.",
0196                             action="store_true",
0197                             default=False,
0198                             dest="no_output_flag")
0199 
0200 expertSettings.add_argument("--prefix",
0201                             help="Specify a prefix to the cmsRun command.",
0202                             default="",
0203                             type=str,
0204                             dest="prefix")
0205 
0206 expertSettings.add_argument("--suffix",
0207                             help="Specify a suffix to the cmsRun command.",
0208                             default="",
0209                             type=str,
0210                             dest="suffix")
0211 
0212 expertSettings.add_argument("--relval",
0213                             help="Set total number of events and events per job.", #this does not get used but get parsed in the command by DataOps
0214                             default="",
0215                             dest="relval")
0216 
0217 expertSettings.add_argument("--dump_python",
0218                             help="Dump the config file in python "+\
0219                             "and do a full expansion of imports.",
0220                             action="store_true",
0221                             default=False,
0222                             dest="dump_python")
0223 
0224 expertSettings.add_argument("--pileup",
0225                             help="What pileup config to use",
0226                             default=defaultOptions.pileup,
0227                             type=str,
0228                             dest="pileup")
0229     
0230 expertSettings.add_argument("--pileup_input",
0231                             help="define the pile up files to mix with",
0232                             default=None,
0233                             type=str,
0234                             dest="pileup_input")
0235 
0236 expertSettings.add_argument("--pileup_dasoption",
0237                             help="Additional option for DAS query of pile up",
0238                             default="",
0239                             type=str,
0240                             dest="pileup_dasoption")
0241 
0242 expertSettings.add_argument("--datamix",
0243                             help="What datamix config to use",
0244                             default=defaultOptions.datamix,
0245                             type=str,
0246                             dest="datamix")
0247 
0248 expertSettings.add_argument("--gflash",
0249                             help="Run the FULL SIM using the GFlash parameterization.",
0250                             action="store_true",
0251                             default=defaultOptions.gflash,
0252                             dest="gflash")
0253 
0254 expertSettings.add_argument("--python_filename",
0255                             help="Change the name of the created config file",
0256                             default='',
0257                             type=str,
0258                             dest="python_filename")
0259 
0260 expertSettings.add_argument("--secondfilein",
0261                             help="The secondary infile name."+\
0262                                 "for the two-file solution. Default is no file",
0263                             default="", #to be changed in the default form later
0264                             type=str,
0265                             dest="secondfilein")
0266 
0267 expertSettings.add_argument("--processName",
0268                             help="set process name explicitly",
0269                             default = None,
0270                             type=str,
0271                             dest="name")
0272 
0273 expertSettings.add_argument("--triggerResultsProcess",
0274                             help="for splitting jobs specify from which process to take edm::TriggerResults",
0275                             default = None,
0276                             type=str,
0277                             dest="triggerResultsProcess")
0278 
0279 expertSettings.add_argument("--hltProcess",
0280                             help="modify the DQM sequence to look for HLT trigger results with the specified process name",
0281                             default = None,
0282                             type=str,
0283                             dest="hltProcess")
0284 
0285 expertSettings.add_argument("--scenario",
0286                             help="Select scenario overriding standard settings",
0287                             default='pp',
0288                             type=str,
0289                             dest="scenario",
0290                             choices=defaultOptions.scenarioOptions)
0291 
0292 expertSettings.add_argument("--harvesting",
0293                             help="What harvesting to use (from Configuration/StandardSequences)",
0294                             default=defaultOptions.harvesting,
0295                             type=str,
0296                             dest="harvesting")
0297 
0298 expertSettings.add_argument("--particle_table",
0299                             help="Which particle properties table is loaded",
0300                             default=defaultOptions.particleTable,
0301                             type=str,
0302                             dest="particleTable")
0303 
0304 expertSettings.add_argument("--dasquery",
0305                             help="Allow to define the source.fileNames from the das search command",
0306                             default='',
0307                             type=str,
0308                             dest="dasquery")
0309 
0310 expertSettings.add_argument("--dasoption",
0311                             help="Additional option for DAS query",
0312                             default='',
0313                             type=str,
0314                             dest="dasoption")
0315 
0316 expertSettings.add_argument("--dbsquery",
0317                             help="Deprecated. Please use dasquery option. Functions for backward compatibility",
0318                             default='',
0319                             type=str,
0320                             dest="dasquery")
0321 
0322 expertSettings.add_argument("--lazy_download",
0323                             help="Enable lazy downloading of input files",
0324                             action="store_true",
0325                             default=False,
0326                             dest="lazy_download")
0327 
0328 expertSettings.add_argument("--repacked",
0329                             help="When the input file is a file with repacked raw data with label rawDataRepacker",
0330                             action="store_true",
0331                             default=False,
0332                             dest="isRepacked")
0333 
0334 expertSettings.add_argument("--custom_conditions",
0335                             help="Allow to give a few overriding tags for the GT",
0336                             default='',
0337                             type=str,
0338                             dest='custom_conditions')
0339 
0340 expertSettings.add_argument("--inline_eventcontent",
0341                             help="expand event content definitions",
0342                             action="store_true",
0343                             default=False,
0344                             dest="inlineEventContent")
0345 
0346 expertSettings.add_argument("--inline_object",
0347                             help="expand explicitly the definition of a list of objects",
0348                             default='',
0349                             type=str,
0350                             dest="inlineObjects")
0351 
0352 expertSettings.add_argument("--hideGen",
0353                             help="do not inline the generator information, just load it",
0354                             default=False,
0355                             action="store_true")
0356 
0357 expertSettings.add_argument("--output",
0358                             help="specify the list of output modules using dict",
0359                             default='',
0360                             type=str,
0361                             dest="outputDefinition")
0362 
0363 expertSettings.add_argument("--inputCommands",
0364                             help="specify the input commands; i.e dropping products",
0365                             default=None,
0366                             type=str,
0367                             dest="inputCommands")
0368 
0369 expertSettings.add_argument("--outputCommands",
0370                             help="specify the extra output commands;",
0371                             default=None,
0372                             type=str,
0373                             dest="outputCommands")
0374 
0375 expertSettings.add_argument("--inputEventContent",
0376                             help="specify the input event content",
0377                             default=defaultOptions.inputEventContent,
0378                             type=str,
0379                             dest="inputEventContent")
0380 
0381 expertSettings.add_argument("--dropDescendant",
0382                             help="allow to drop descendant on input",
0383                             default=defaultOptions.dropDescendant,
0384                             action="store_true")
0385 
0386 expertSettings.add_argument("--donotDropOnInput",
0387                             help="when using reSTEP, prevent the automatic product dropping on input",
0388                             default=defaultOptions.donotDropOnInput,
0389                             type=str)
0390 
0391 # specifying '--restoreRNDSeeds' results in 'options.restoreRNDSeeds = True'
0392 # specifying '--restoreRNDSeeds arg' results in 'options.restoreRNDSeeds = arg'
0393 expertSettings.add_argument("--restoreRNDSeeds",
0394                             help="restore the random number engine state",
0395                             default=False,
0396                             const=True,
0397                             type=str,
0398                             nargs='?')
0399 
0400 expertSettings.add_argument("--era",
0401                             help="Specify which era to use (e.g. \"run2\")",
0402                             default=None,
0403                             type=str,
0404                             dest="era")
0405 
0406 expertSettings.add_argument("--procModifiers",
0407                             help="Specify any process Modifiers to include (in Configuration/ProcessModiers) - comma separated list",
0408                             default=[],
0409                             action="append",
0410                             type=str,
0411                             dest="procModifiers")
0412 
0413 expertSettings.add_argument("--evt_type",
0414                             help="specify the gen fragment",
0415                             default=None,
0416                             type=str,
0417                             dest="evt_type")
0418 
0419 expertSettings.add_argument("--profile",
0420                             help="add the IgprofService with the parameter provided PROFILER:START:STEP:PEREVENOUTPUTFORMAT:ENDOFJOBOUTPUTFORMAT",
0421                             default=None,
0422                             type=str,
0423                             dest="profile")
0424 
0425 expertSettings.add_argument("--heap_profile",
0426                             help="add the JeProfService with the parameter provided PROFILER:START:STEP:PEREVENOUTPUTFORMAT:ENDOFJOBOUTPUTFORMAT",
0427                             default=False,
0428                             action="store_true",
0429                             dest="heap_profile")
0430 
0431 expertSettings.add_argument("--maxmem_profile",
0432                             help="add the PerfTools/MaxMemoryPreload monitor",
0433                             default=False,
0434                             action="store_true",
0435                             dest="maxmem_profile")
0436 
0437 expertSettings.add_argument("--io",
0438                             help="Create a json file with io informations",
0439                             default=None,
0440                             type=str,
0441                             dest="io")
0442 
0443 expertSettings.add_argument("--lumiToProcess",
0444                             help="specify a certification json file in input to run on certified data",
0445                             default=None,
0446                             type=str,
0447                             dest='lumiToProcess')
0448 
0449 expertSettings.add_argument("--timeoutOutput",
0450                             help="use a TimeoutPoolOutputModule instead of a PoolOutputModule (needed for evt. display)",
0451                             default=False,
0452                             action="store_true",
0453                             dest='timeoutOutput')
0454 
0455 expertSettings.add_argument("--nThreads",
0456                             help="How many threads should CMSSW use",
0457                             default=defaultOptions.nThreads,
0458                             type=int,
0459                             dest='nThreads')
0460 
0461 expertSettings.add_argument("--nStreams",
0462                             help="How many streams should CMSSW use if nThreads > 1 (default is 0 which makes it same as nThreads)",
0463                             default=defaultOptions.nStreams,
0464                             type=int,
0465                             dest='nStreams')
0466 
0467 expertSettings.add_argument("--nConcurrentLumis",
0468                             help="How many concurrent LuminosityBlocks should CMSSW use if nThreads > 1 (default is 0 which means 1 for 1 stream and 2 for >= 2 streams)",
0469                             default=defaultOptions.nConcurrentLumis,
0470                             type=int,
0471                             dest='nConcurrentLumis')
0472 
0473 expertSettings.add_argument("--nConcurrentIOVs",
0474                             help="How many concurrent IOVs should CMSSW use if nThreads > 1",
0475                             default=defaultOptions.nConcurrentIOVs,
0476                             type=int,
0477                             dest='nConcurrentIOVs')
0478 
0479 expertSettings.add_argument("--accelerators",
0480                             help="Comma-separated list of accelerators to enable; if 'cpu' is not included, the job will fail if none of the accelerators is available (default is not set, enabling all available accelerators, including the cpu)",
0481                             default=None,
0482                             type=str,
0483                             dest='accelerators')