4 ReleaseBase = os.path.join(os.environ[
'CMSSW_BASE'],
"src")
5 ReleaseVersion = os.environ[
'CMSSW_VERSION']
7 print "CMSSW enviroment not set, please run cmsenv!"
11 import FWCore.ParameterSet.VarParsing
as VarParsing
18 options.register(
'maxEvents',
20 VarParsing.VarParsing.multiplicity.singleton,
21 VarParsing.VarParsing.varType.int,
22 "Specify events to run."
25 options.register(
'eventType',
27 VarParsing.VarParsing.multiplicity.singleton,
28 VarParsing.VarParsing.varType.string,
30 "Specify the type of events to validate. (and generate, if using fast or fullsim)\
38 \n\t\t\tRealData (Jets faking taus)\
39 \n\t\t\tRealMuonsData (Iso Muons faking taus)\
40 \n\t\t\tRealElectronsData (Iso Electrons faking taus)\n"
43 allowedOptions[
'eventType'] = [
'ZTT',
'QCD',
'ZEE',
'ZMM',
'RealData',
'RealMuonsData',
'RealElectronsData',
'ZTTFastSim',
'ZEEFastSim']
45 options.register(
'label',
47 VarParsing.VarParsing.multiplicity.singleton,
48 VarParsing.VarParsing.varType.string,
49 "Validation output files will be stored in folder Validation_<label>. The root file will also use this label.\n"
52 options.register(
'dataSource',
54 VarParsing.VarParsing.multiplicity.singleton,
55 VarParsing.VarParsing.varType.string,
56 "Specify where the data should come from. \n\t\tOptions: \
57 \n\t\t\trecoFiles:\t\t\tGet data from [sourceFile] (must have RECO)\
58 \n\t\t\trecoFiles+PFTau:\t\tGet reco data as above, and rerun PFTau with current tags \
59 \n\t\t\trecoFiles+PFTau+CaloTau:\t\tRun CaloTau too \
60 \n\t\t\tdigiFiles:\t\t\tGet data from [sourceFile] (must have DIGI) and rerun RECO \
61 \n\t\t\tfastsim:\t\t\tRun FastSim \
62 \n\t\t\tfullsim:\t\t\tGen-Sim-Digi-Reco-Validate!\n"
65 allowedOptions[
'dataSource'] = [
'recoFiles',
'recoFiles+PFTau',
'recoFiles+PFTau+CaloTau',
'recoFiles+CaloTau',
'recoFiles+CaloTau+PFTau',
'fastsim',
'digiFiles',
'fullsim']
67 options.register(
'sourceFile',
69 VarParsing.VarParsing.multiplicity.singleton,
70 VarParsing.VarParsing.varType.string,
71 "Specify a file containing events to read if using the recoFiles or digiFiles options. If left as none files will be taken from\
72 \n\t\t\trecoFiles:\t\t\tGet data from [sourceFile]EventSource_<eventType>_RECO_cff.py \
73 \n\t\t\tdigiFiles:\t\t\tGet data from EventSource_<eventType>_DIGI_cff.py \n"
76 options.register(
'conditions',
78 VarParsing.VarParsing.multiplicity.singleton,
79 VarParsing.VarParsing.varType.string,
80 "Specify global tag for conditions. If left as default ('whatever'), whatever is defined in Configuration.FrontierConditions_GlobalTag_cff will be taken\n"
83 options.register(
'myModifications',
85 VarParsing.VarParsing.multiplicity.list,
86 VarParsing.VarParsing.varType.string,
87 "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"
90 options.register(
'batchNumber',
92 VarParsing.VarParsing.multiplicity.singleton,
93 VarParsing.VarParsing.varType.int,
94 "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 \
98 options.register(
'writeEDMFile',
100 VarParsing.VarParsing.multiplicity.singleton,
101 VarParsing.VarParsing.varType.string,
102 "Specify an (optional) output file. Batch number and .root suffix will be appended. Event content will PFTau RECO content along with genParticles"
105 options.register(
'edmFileContents',
107 VarParsing.VarParsing.multiplicity.list,
108 VarParsing.VarParsing.varType.string,
109 "Specify event content. Not yet implemented"
112 options.register(
'gridJob',
114 VarParsing.VarParsing.multiplicity.singleton,
115 VarParsing.VarParsing.varType.bool,
116 "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."
126 options.register(
'nJobs',
128 VarParsing.VarParsing.multiplicity.singleton,
129 VarParsing.VarParsing.varType.int,
130 "Number of jobs to submit to LXBatch. [Batchmode only]"
133 options.register(
'copyToCastorDir',
135 VarParsing.VarParsing.multiplicity.singleton,
136 VarParsing.VarParsing.varType.string,
137 "If writeEDMFile is specified, copy the edmOutputFile to castor. Specify <home> to use your home dir. [Batchmode only]"
140 options.register(
'lxbatchQueue',
142 VarParsing.VarParsing.multiplicity.singleton,
143 VarParsing.VarParsing.varType.string,
144 "LXBatch queue (8nm, 1nh, 8nh, 1nd, 1nw) [Batchmode only]"
147 allowedOptions[
'lxbatchQueue'] = [
'8nm',
'1nh',
'8nh',
'1nd',
'1nw']
152 for optionName, allowedValues
in allowedOptions.iteritems():
153 if not getattr(options, optionName)
in allowedValues:
154 print "Bad input to option: %s" % optionName
158 ''' Returns true of this python file is being called via cmsRun '''
159 if sys.argv[0].
find(
'cmsRun') == -1:
165 ''' Make sure that our CMSSW environment doesn't point ot another release!'''
166 if ReleaseBase != os.path.commonprefix([ReleaseBase, os.getcwd()]):
172 ''' format the options to be passed on the command line. Used when submitting batch jobs'''
174 for optionsName, optionValue
in options.__dict__[
'_singletons'].iteritems():
175 outputString +=
" %s=%s" % (optionsName, optionValue)
177 for optionsName, optionValues
in options.__dict__[
'_lists'].iteritems():
178 for anOption
in optionValues:
179 outputString +=
" %s=%s" % (optionsName, anOption)
def CMSSWEnvironmentIsCurrent
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
def checkOptionsForBadInput
Batchmode options.