Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:48:53

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