Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Option parser customization to the configuration #120

Merged
merged 2 commits into from
Dec 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions PhysObjectExtractor/python/poet_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,24 @@
import FWCore.Utilities.FileUtils as FileUtils
import FWCore.PythonUtilities.LumiList as LumiList
import FWCore.ParameterSet.Types as CfgTypes
from FWCore.ParameterSet.VarParsing import VarParsing
import sys

#---- sys.argv takes the parameters given as input cmsRun PhysObjectExtractor/python/poet_cfg.py <isData (default=False)>
#---- e.g: cmsRun PhysObjectExtractor/python/poet_cfg.py True
#---- NB the first two parameters are always "cmsRun" and the config file name
#---- Work with data (if False, assumed MC simulations)
#---- This needs to be in agreement with the input files/datasets below.
options = VarParsing ('analysis')
isData = False
if len(sys.argv) > 2:
isData = eval(sys.argv[2])
else:
isData = False
try:
isData = eval(sys.argv[2])
sys.argv.pop( 2 )
print "isData is set to ",isData
except:
pass
options.parseArguments()
isMC = True
if isData: isMC = False

Expand Down Expand Up @@ -230,4 +237,14 @@
process.looseAK8Jets+process.patJetCorrFactorsReapplyJECAK8+process.slimmedJetsAK8NewJEC+process.myfatjets+
process.uncorrectedMet+process.uncorrectedPatMet+process.Type1CorrForNewJEC+process.slimmedMETsNewJEC+process.mymets
# +process.mypackedcandidate
)
)
process.maxEvents.input = options.maxEvents
process.TFileService.fileName = options.outputFile
if len(options.inputFiles) > 0:
process.source.fileNames=options.inputFiles

print "Processing for maxEvents = ",process.maxEvents.input
print "Processing input files "
for fl in process.source.fileNames:
print " > ",fl
print "Output filename : ",process.TFileService.fileName