1 from __future__
import print_function
6 ReleaseBase = os.path.join(os.environ[
'CMSSW_BASE'],
"src")
7 ReleaseVersion = os.environ[
'CMSSW_VERSION']
9 print(
"CMSSW enviroment not set, please run cmsenv!")
12 import FWCore.ParameterSet.Config
as cms
13 import FWCore.ParameterSet.VarParsing
as VarParsing
20 options.register(
'maxEvents',
22 VarParsing.VarParsing.multiplicity.singleton,
23 VarParsing.VarParsing.varType.int,
24 "Specify events to run." 27 options.register(
'eventType',
29 VarParsing.VarParsing.multiplicity.singleton,
30 VarParsing.VarParsing.varType.string,
32 "Specify the type of events to validate. (and generate, if using fast or fullsim)\ 40 \n\t\t\tRealData (Jets faking taus)\ 41 \n\t\t\tRealMuonsData (Iso Muons faking taus)\ 42 \n\t\t\tRealElectronsData (Iso Electrons faking taus)\n" 45 allowedOptions[
'eventType'] = [
'ZTT',
'QCD',
'ZEE',
'ZMM',
'RealData',
'RealMuonsData',
'RealElectronsData',
'ZTTFastSim',
'ZEEFastSim']
47 options.register(
'label',
49 VarParsing.VarParsing.multiplicity.singleton,
50 VarParsing.VarParsing.varType.string,
51 "Validation output files will be stored in folder Validation_<label>. The root file will also use this label.\n" 54 options.register(
'dataSource',
56 VarParsing.VarParsing.multiplicity.singleton,
57 VarParsing.VarParsing.varType.string,
58 "Specify where the data should come from. \n\t\tOptions: \ 59 \n\t\t\trecoFiles:\t\t\tGet data from [sourceFile] (must have RECO)\ 60 \n\t\t\trecoFiles+PFTau:\t\tGet reco data as above, and rerun PFTau with current tags \ 61 \n\t\t\trecoFiles+PFTau+CaloTau:\t\tRun CaloTau too \ 62 \n\t\t\tdigiFiles:\t\t\tGet data from [sourceFile] (must have DIGI) and rerun RECO \ 63 \n\t\t\tfastsim:\t\t\tRun FastSim \ 64 \n\t\t\tfullsim:\t\t\tGen-Sim-Digi-Reco-Validate!\n" 67 allowedOptions[
'dataSource'] = [
'recoFiles',
'recoFiles+PFTau',
'recoFiles+PFTau+CaloTau',
'recoFiles+CaloTau',
'recoFiles+CaloTau+PFTau',
'fastsim',
'digiFiles',
'fullsim']
69 options.register(
'sourceFile',
71 VarParsing.VarParsing.multiplicity.singleton,
72 VarParsing.VarParsing.varType.string,
73 "Specify a file containing events to read if using the recoFiles or digiFiles options. If left as none files will be taken from\ 74 \n\t\t\trecoFiles:\t\t\tGet data from [sourceFile]EventSource_<eventType>_RECO_cff.py \ 75 \n\t\t\tdigiFiles:\t\t\tGet data from EventSource_<eventType>_DIGI_cff.py \n" 78 options.register(
'conditions',
80 VarParsing.VarParsing.multiplicity.singleton,
81 VarParsing.VarParsing.varType.string,
82 "Specify global tag for conditions. If left as default ('whatever'), whatever is defined in Configuration.FrontierConditions_GlobalTag_cff will be taken\n" 85 options.register(
'myModifications',
87 VarParsing.VarParsing.multiplicity.list,
88 VarParsing.VarParsing.varType.string,
89 "Specify one (or more) files to be loaded in the process. You can use this to modifiy cfi parameters from their defaults. See ExampleModification_cfi.py" 92 options.register(
'batchNumber',
94 VarParsing.VarParsing.multiplicity.singleton,
95 VarParsing.VarParsing.varType.int,
96 "Run in batch mode: add batch number to output file, dont' compute efficiency, and change random seed. If running from files, skipEvents will automatically be \ 100 options.register(
'writeEDMFile',
102 VarParsing.VarParsing.multiplicity.singleton,
103 VarParsing.VarParsing.varType.string,
104 "Specify an (optional) output file. Batch number and .root suffix will be appended. Event content will PFTau RECO content along with genParticles" 107 options.register(
'edmFileContents',
109 VarParsing.VarParsing.multiplicity.list,
110 VarParsing.VarParsing.varType.string,
111 "Specify event content. Not yet implemented" 114 options.register(
'gridJob',
116 VarParsing.VarParsing.multiplicity.singleton,
117 VarParsing.VarParsing.varType.bool,
118 "Set to true makes some modifications to enable to run on grid. On the analysis has the same effect of running in batch, but has also other features." 128 options.register(
'nJobs',
130 VarParsing.VarParsing.multiplicity.singleton,
131 VarParsing.VarParsing.varType.int,
132 "Number of jobs to submit to LXBatch. [Batchmode only]" 135 options.register(
'copyToCastorDir',
137 VarParsing.VarParsing.multiplicity.singleton,
138 VarParsing.VarParsing.varType.string,
139 "If writeEDMFile is specified, copy the edmOutputFile to castor. Specify <home> to use your home dir. [Batchmode only]" 142 options.register(
'lxbatchQueue',
144 VarParsing.VarParsing.multiplicity.singleton,
145 VarParsing.VarParsing.varType.string,
146 "LXBatch queue (8nm, 1nh, 8nh, 1nd, 1nw) [Batchmode only]" 149 allowedOptions[
'lxbatchQueue'] = [
'8nm',
'1nh',
'8nh',
'1nd',
'1nw']
154 for optionName, allowedValues
in six.iteritems(allowedOptions):
155 if not getattr(options, optionName)
in allowedValues:
156 print(
"Bad input to option: %s" % optionName)
160 ''' Returns true of this python file is being called via cmsRun ''' 161 if sys.argv[0].
find(
'cmsRun') == -1:
167 ''' Make sure that our CMSSW environment doesn't point ot another release!''' 168 if ReleaseBase != os.path.commonprefix([ReleaseBase, os.getcwd()]):
174 ''' format the options to be passed on the command line. Used when submitting batch jobs''' 176 for optionsName, optionValue
in six.iteritems(options.__dict__[
'_singletons']):
177 outputString +=
" %s=%s" % (optionsName, optionValue)
179 for optionsName, optionValues
in six.iteritems(options.__dict__[
'_lists']):
180 for anOption
in optionValues:
181 outputString +=
" %s=%s" % (optionsName, anOption)
def returnOptionsString()
def CMSSWEnvironmentIsCurrent()
S & print(S &os, JobReport::InputFile const &f)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
def checkOptionsForBadInput()
Batchmode options.