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

fix crab issue #4

Open
wants to merge 1 commit into
base: 10_6_12
Choose a base branch
from
Open
Show file tree
Hide file tree
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
78 changes: 38 additions & 40 deletions UFHZZ4LAna/python/templateData_102X_Legacy17_2l_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@

process.source = cms.Source("PoolSource",fileNames = myfilelist,
duplicateCheckMode = cms.untracked.string('noDuplicateCheck'),
eventsToProcess = cms.untracked.VEventRange('304062:1844:2257734751')
#eventsToProcess = cms.untracked.VEventRange('304062:1844:2257734751')
)

process.TFileService = cms.Service("TFileService",
fileName = cms.string("DUMMYFILENAME.root")
)

# clean muons by segments
# clean muons by segments
process.boostedMuons = cms.EDProducer("PATMuonCleanerBySegments",
src = cms.InputTag("slimmedMuons"),
preselection = cms.string("track.isNonnull"),
Expand Down Expand Up @@ -90,14 +90,14 @@
## # add them to the VID producer
## for idmod in my_id_modules:
## setupAllVIDIdsInModule(process,idmod,setupVIDElectronSelection)
##
##
## #process.egmGsfElectronIDs.physicsObjectSrc = cms.InputTag('calibratedPatElectrons')
## #process.electronMVAVariableHelper.srcMiniAOD = cms.InputTag('calibratedPatElectrons')
## #process.electronMVAValueMapProducer.srcMiniAOD= cms.InputTag('calibratedPatElectrons')
## process.egmGsfElectronIDs.physicsObjectSrc = cms.InputTag('selectedElectrons')
## process.electronMVAVariableHelper.srcMiniAOD = cms.InputTag('selectedElectrons')
## process.electronMVAValueMapProducer.srcMiniAOD= cms.InputTag('selectedElectrons')
##
##
## process.electronsMVA = cms.EDProducer("SlimmedElectronMvaIDProducer",
## mvaValuesMap = cms.InputTag("electronMVAValueMapProducer:ElectronMVAEstimatorRun2Fall17IsoV2Values"),
## #electronsCollection = cms.InputTag("calibratedPatElectrons"),
Expand Down Expand Up @@ -132,7 +132,7 @@
label= cms.untracked.string("AK4PFchs")
),

cms.PSet(
cms.PSet(
record = cms.string("JetCorrectionsRecord"),
tag = cms.string("JetCorrectorParametersCollection_"+era+"_AK8PFchs"),
label= cms.untracked.string("AK8PFchs")
Expand All @@ -146,12 +146,12 @@

process.jetCorrFactors = process.updatedPatJetCorrFactors.clone(
src = cms.InputTag("slimmedJets"),
levels = ['L1FastJet',
'L2Relative',
levels = ['L1FastJet',
'L2Relative',
'L3Absolute',
'L2L3Residual'
],
payload = 'AK4PFchs' )
payload = 'AK4PFchs' )

process.AK8PFJetCorrFactors = process.updatedPatJetCorrFactors.clone(
src = cms.InputTag("slimmedJetsAK8"),
Expand Down Expand Up @@ -183,36 +183,35 @@
process.slimmedJetsJEC.userData.userFloats.src += ['pileupJetIdUpdated:fullDiscriminant']
process.slimmedJetsJEC.userData.userInts.src += ['pileupJetIdUpdated:fullId']


## JER
#process.load("JetMETCorrections.Modules.JetResolutionESProducer_cfi")
JER
process.load("JetMETCorrections.Modules.JetResolutionESProducer_cfi")
## for hpc
##dBJERFile = os.environ.get('CMSSW_BASE')+"/src/UFHZZAnalysisRun2/UFHZZ4LAna/data/Summer15_25nsV6_MC_JER.db"
#dBJERFile = os.environ.get('CMSSW_BASE')+"/src/UFHZZAnalysisRun2/UFHZZ4LAna/data/Fall17_V3_94X_MC.db"
dBJERFile = os.environ.get('CMSSW_BASE')+"/src/UFHZZAnalysisRun2/UFHZZ4LAna/data/Fall17_V3_94X_MC.db"
## for crab
#dBFile = "src/UFHZZAnalysisRun2/UFHZZ4LAna/data/Fall17_V3_94X_MC.db"
#process.jer = cms.ESSource("PoolDBESSource",
# CondDBSetup,
# connect = cms.string("sqlite_file:"+dBJERFile),
# toGet = cms.VPSet(
# cms.PSet(
# record = cms.string('JetResolutionRcd'),
# tag = cms.string('JR_Fall17_V3_94X_MC_PtResolution_AK4PFchs'),
# label = cms.untracked.string('AK4PFchs_pt')
# ),
# cms.PSet(
# record = cms.string('JetResolutionRcd'),
# tag = cms.string('JR_Fall17_V3_94X_MC_PhiResolution_AK4PFchs'),
# label = cms.untracked.string('AK4PFchs_phi')
# ),
# cms.PSet(
# record = cms.string('JetResolutionScaleFactorRcd'),
# tag = cms.string('JR_Fall17_V3_94X_MC_SF_AK4PFchs'),
# label = cms.untracked.string('AK4PFchs')
# )
# )
# )
#process.es_prefer_jer = cms.ESPrefer('PoolDBESSource', 'jer')
process.jer = cms.ESSource("PoolDBESSource",
CondDBSetup,
connect = cms.string("sqlite_file:"+dBJERFile),
toGet = cms.VPSet(
cms.PSet(
record = cms.string('JetResolutionRcd'),
tag = cms.string('JR_Fall17_V3_94X_MC_PtResolution_AK4PFchs'),
label = cms.untracked.string('AK4PFchs_pt')
),
cms.PSet(
record = cms.string('JetResolutionRcd'),
tag = cms.string('JR_Fall17_V3_94X_MC_PhiResolution_AK4PFchs'),
label = cms.untracked.string('AK4PFchs_phi')
),
cms.PSet(
record = cms.string('JetResolutionScaleFactorRcd'),
tag = cms.string('JR_Fall17_V3_94X_MC_SF_AK4PFchs'),
label = cms.untracked.string('AK4PFchs')
)
)
)
process.es_prefer_jer = cms.ESPrefer('PoolDBESSource', 'jer')


#QGTag
Expand Down Expand Up @@ -243,7 +242,7 @@
# compute corrected pruned jet mass
process.corrJets = cms.EDProducer ( "CorrJetsProducer",
jets = cms.InputTag( "slimmedJetsAK8JEC" ),
vertex = cms.InputTag( "offlineSlimmedPrimaryVertices" ),
vertex = cms.InputTag( "offlineSlimmedPrimaryVertices" ),
rho = cms.InputTag( "fixedGridRhoFastjetAll" ),
payload = cms.string ( "AK8PFchs" ),
isData = cms.bool ( True ),
Expand Down Expand Up @@ -314,7 +313,7 @@
reweightForPU = cms.untracked.bool(True),
triggerSrc = cms.InputTag("TriggerResults","","HLT"),
triggerObjects = cms.InputTag("slimmedPatTrigger"),
doJER = cms.untracked.bool(False),
doJER = cms.untracked.bool(True),
doJEC = cms.untracked.bool(True),
doTriggerMatching = cms.untracked.bool(False),
triggerList = cms.untracked.vstring(
Expand All @@ -337,9 +336,9 @@
'HLT_Ele40_WPTight_Gsf_v',
'HLT_IsoMu27_v',
),
verbose = cms.untracked.bool(False),
skimLooseLeptons = cms.untracked.int32(2),
skimTightLeptons = cms.untracked.int32(2),
verbose = cms.untracked.bool(False),
skimLooseLeptons = cms.untracked.int32(2),
skimTightLeptons = cms.untracked.int32(2),
#bestCandMela = cms.untracked.bool(False),
year = cms.untracked.int32(2017),
isCode4l = cms.untracked.bool(False),
Expand Down Expand Up @@ -368,4 +367,3 @@
# process.mergedGenParticles*process.myGenerator*process.rivetProducerHTXS*#process.rivetProducerHZZFid*
process.Ana
)

40 changes: 21 additions & 19 deletions UFHZZ4LAna/python/templateMC_102X_Legacy18_2l_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
from FWCore.ParameterSet.VarParsing import VarParsing

process = cms.Process("UFHZZ4LAnalysis")
process.options = cms.untracked.PSet(
numberOfThreads = cms.untracked.uint32(2)
)

process.load("FWCore.MessageService.MessageLogger_cfi")
process.MessageLogger.cerr.FwkReport.reportEvery = 1000
Expand Down Expand Up @@ -38,7 +41,7 @@
fileName = cms.string("DUMMYFILENAME.root")
)

# clean muons by segments
# clean muons by segments
process.boostedMuons = cms.EDProducer("PATMuonCleanerBySegments",
src = cms.InputTag("slimmedMuons"),
preselection = cms.string("track.isNonnull"),
Expand Down Expand Up @@ -131,7 +134,7 @@
## process.egmGsfElectronIDs.physicsObjectSrc = cms.InputTag('selectedElectrons')
## process.electronMVAVariableHelper.srcMiniAOD = cms.InputTag('selectedElectrons')
## process.electronMVAValueMapProducer.srcMiniAOD = cms.InputTag('selectedElectrons')
##
##
## process.electronsMVA = cms.EDProducer("SlimmedElectronMvaIDProducer",
## mvaValuesMap = cms.InputTag("electronMVAValueMapProducer:ElectronMVAEstimatorRun2Autumn18IdIsoValues"),
## # electronsCollection = cms.InputTag("calibratedPatElectrons"),
Expand All @@ -148,7 +151,7 @@
from CondCore.DBCommon.CondDBSetup_cfi import *
era = "Autumn18_V19_MC"
# for HPC
dBFile = os.environ.get('CMSSW_BASE')+"/src/UFHZZAnalysisRun2/UFHZZ4LAna/data/"+era+".db"
#dBFile = os.environ.get('CMSSW_BASE')+"/src/UFHZZAnalysisRun2/UFHZZ4LAna/data/"+era+".db"
# for crab
dBFile = "src/UFHZZAnalysisRun2/UFHZZ4LAna/data/"+era+".db"
process.jec = cms.ESSource("PoolDBESSource",
Expand Down Expand Up @@ -180,10 +183,10 @@

process.jetCorrFactors = process.updatedPatJetCorrFactors.clone(
src = cms.InputTag("slimmedJets"),
levels = ['L1FastJet',
'L2Relative',
levels = ['L1FastJet',
'L2Relative',
'L3Absolute'],
payload = 'AK4PFchs' )
payload = 'AK4PFchs' )

process.AK8PFJetCorrFactors = process.updatedPatJetCorrFactors.clone(
src = cms.InputTag("slimmedJetsAK8"),
Expand Down Expand Up @@ -216,7 +219,7 @@
# JER
process.load("JetMETCorrections.Modules.JetResolutionESProducer_cfi")
# for hpc
dBJERFile = os.environ.get('CMSSW_BASE')+"/src/UFHZZAnalysisRun2/UFHZZ4LAna/data/Autumn18_V7_MC.db"
#dBJERFile = os.environ.get('CMSSW_BASE')+"/src/UFHZZAnalysisRun2/UFHZZ4LAna/data/Autumn18_V7_MC.db"
# for crab
dBJERFile = "src/UFHZZAnalysisRun2/UFHZZ4LAna/data/Autumn18_V7_MC.db"
process.jer = cms.ESSource("PoolDBESSource",
Expand Down Expand Up @@ -247,7 +250,7 @@
process.load("CondCore.CondDB.CondDB_cfi")
qgDatabaseVersion = 'cmssw8020_v2'
# for hpc
QGdBFile = os.environ.get('CMSSW_BASE')+"/src/UFHZZAnalysisRun2/UFHZZ4LAna/data/QGL_"+qgDatabaseVersion+".db"
#QGdBFile = os.environ.get('CMSSW_BASE')+"/src/UFHZZAnalysisRun2/UFHZZ4LAna/data/QGL_"+qgDatabaseVersion+".db"
# for crab
QGdBFile = "src/UFHZZAnalysisRun2/UFHZZ4LAna/data/QGL_"+qgDatabaseVersion+".db"
process.QGPoolDBESSource = cms.ESSource("PoolDBESSource",
Expand All @@ -272,7 +275,7 @@
# compute corrected pruned jet mass
process.corrJets = cms.EDProducer ( "CorrJetsProducer",
jets = cms.InputTag( "slimmedJetsAK8JEC" ),
vertex = cms.InputTag( "offlineSlimmedPrimaryVertices" ),
vertex = cms.InputTag( "offlineSlimmedPrimaryVertices" ),
rho = cms.InputTag( "fixedGridRhoFastjetAll" ),
payload = cms.string ( "AK8PFchs" ),
isData = cms.bool ( False ),
Expand Down Expand Up @@ -352,7 +355,7 @@
doTriggerMatching = cms.untracked.bool(False),
triggerList = cms.untracked.vstring(
# Toni
'HLT_Ele32_WPTight_Gsf_v',
'HLT_Ele32_WPTight_Gsf_v',
'HLT_IsoMu24_v',
'HLT_Ele23_Ele12_CaloIdL_TrackIdL_IsoVL_v',
'HLT_DoubleEle25_CaloIdL_MW_v',
Expand All @@ -362,9 +365,9 @@
'HLT_Mu12_TrkIsoVVL_Ele23_CaloIdL_TrackIdL_IsoVL_DZ_v',
'HLT_Mu23_TrkIsoVVL_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_v',
'HLT_DiMu9_Ele9_CaloIdL_TrackIdL_DZ_v',
'HLT_TripleMu_10_5_5_DZ_v',
'HLT_TripleMu_12_10_5_v',
'HLT_Mu8_DiEle12_CaloIdL_TrackIdL_v',
'HLT_TripleMu_10_5_5_DZ_v',
'HLT_TripleMu_12_10_5_v',
'HLT_Mu8_DiEle12_CaloIdL_TrackIdL_v',
'HLT_Mu8_DiEle12_CaloIdL_TrackIdL_DZ_v',
# OLD
# 'HLT_Ele32_WPTight_Gsf_v',
Expand All @@ -382,13 +385,13 @@
# 'HLT_TripleMu_10_5_5_DZ_v',
# 'HLT_TripleMu_12_10_5_v',
),
verbose = cms.untracked.bool(False),
skimLooseLeptons = cms.untracked.int32(2),
skimTightLeptons = cms.untracked.int32(2),
verbose = cms.untracked.bool(False),
skimLooseLeptons = cms.untracked.int32(2),
skimTightLeptons = cms.untracked.int32(2),
#bestCandMela = cms.untracked.bool(False),
# verbose = cms.untracked.bool(True),
# verbose = cms.untracked.bool(True),
year = cms.untracked.int32(2018),####for year put 2016,2017, or 2018 to select correct setting
isCode4l = cms.untracked.bool(False),
#isCode4l = cms.untracked.bool(False),
)


Expand All @@ -415,4 +418,3 @@
process.mergedGenParticles*process.myGenerator*process.rivetProducerHTXS*#process.rivetProducerHZZFid*
process.Ana
)

38 changes: 23 additions & 15 deletions Utilities/crab/SubmitCrabJobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def submitAnalyzer():
currentDir = os.getcwd()

tag = opt.TAG
outDir='resultsAna_'+tag
outDir='resultsAna_'+tag

if (not os.path.isdir(outDir)):
cmd = 'mkdir '+outDir
Expand Down Expand Up @@ -79,15 +79,15 @@ def submitAnalyzer():

datasets.append(dataset)
cross_section[dataset] = float(line.split()[1])

#cmd = './das_client.py --query="file dataset='+dataset+'" --limit=10 | grep ".root"'
#output = processCmd(cmd)
#while ('error' in output):
# time.sleep(1.0);
# output = processCmd(cmd)
#datasetfiles[dataset] = output.split()
#nfiles[dataset] = len(datasetfiles[dataset])

#cmd = './das_client.py --query="dataset dataset='+dataset+' | grep dataset.nevents" --limit=0'
#output = processCmd(cmd)
#while ('error' in output):
Expand All @@ -104,9 +104,14 @@ def submitAnalyzer():
jobCount=0

for dataset in datasets:

#continue
filename = dataset.split('/')[1]+'_'+dataset.split('/')[2]
print " length of filename = " + str(len(filename))
if(len(filename)>99):
print " reduce the length of filename"
filename = filename.split('_up')[0]
print " get new file name = " + filename

cfgfile = dataset.lstrip('/')
cfgfile = cfgfile.replace('/','_')+'.py'
Expand All @@ -125,13 +130,13 @@ def submitAnalyzer():
#filelist = filelist.rstrip(',')

#cmd = "sed -i 's~DUMMYFILELIST~"+filelist+"~g' "+outDir+'/cfg/'+cfgfile
cmd = "sed -i 's~DUMMYFILELIST~ ~g' "+outDir+'/cfg/'+cfgfile
output = processCmd(cmd)
#cmd = "sed -i 's~DUMMYFILELIST~ ~g' "+outDir+'/cfg/'+cfgfile
#output = processCmd(cmd)

filename = dataset.split('/')[1]+'_'+dataset.split('/')[2]
if (len(filename)>99):
newfilename = filename.split('-PU')[0]
filename = newfilename
#filename = dataset.split('/')[1]+'_'+dataset.split('/')[2]
#if (len(filename)>99):
# newfilename = filename.split('-PU')[0]
# filename = newfilename

cmd = "sed -i 's~DUMMYFILENAME~"+filename+"~g' "+outDir+'/cfg/'+cfgfile
output = processCmd(cmd)
Expand Down Expand Up @@ -159,7 +164,7 @@ def submitAnalyzer():
cmd = "sed -i 's~checkOnlySingle = cms.untracked.bool(False)~checkOnlySingle = cms.untracked.bool(True)~g' "+outDir+'/cfg/'+cfgfile
output = processCmd(cmd)

crabcfgfile = 'crabConfig_'+filename+'.py'
crabcfgfile = 'crabConfig_'+filename+'.py'

cmd = 'cp crabConfig_TEMPLATE.py '+outDir+'/cfg/'+crabcfgfile
output = processCmd(cmd)
Expand All @@ -170,14 +175,17 @@ def submitAnalyzer():
cmd = "sed -i 's~CFGFILE~"+outDir+"/cfg/"+cfgfile+"~g' "+outDir+'/cfg/'+crabcfgfile
output = processCmd(cmd)


cmd = "sed -i 's~OUTFILENAME~"+filename+"~g' "+outDir+'/cfg/'+crabcfgfile
#cmd = "sed -i 's~OUTFILENAME~"+testname+"~g' "+outDir+'/cfg/'+crabcfgfile
print "OUTFILENAME = "+filename
output = processCmd(cmd)

cmd = "sed -i 's~DATASETNAME~"+dataset+"~g' "+outDir+'/cfg/'+crabcfgfile
output = processCmd(cmd)

cmd = 'crab submit -c '+outDir+'/cfg/'+crabcfgfile
print cmd
print cmd

output = processCmd(cmd)
if ("ERROR!!!" in output):
Expand All @@ -195,6 +203,6 @@ def submitAnalyzer():
else:
print output

# run the submitAnalyzer() as main()
if __name__ == "__main__":
submitAnalyzer()
# run the submitAnalyzer() as main()
if __name__ == "__main__":
submitAnalyzer()
Loading