Skip to content

Commit

Permalink
fix filter
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-komm authored and matt-komm committed Nov 17, 2020
1 parent 6df3ac7 commit 6f0a3fe
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 17 deletions.
25 changes: 13 additions & 12 deletions NANOProducer/test/crab.py
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,7 @@
}
}

'''
myJobsHNL = {}
with open("HNL_samples.txt") as f:
for line in f:
Expand All @@ -942,13 +943,13 @@
"addLLPInfo": True,
"addSignalLHE": True
}

'''
myJobs = myJobsTraining
myJobs = myJobsHNL
#myJobs = myJobsHNL


requestName = "NANOX_200720"
userName = "vcepaiti"
requestName = "NANOX_201117"
userName = "mkomm"
configTmpl = Configuration()

configTmpl.section_('General')
Expand Down Expand Up @@ -1016,7 +1017,6 @@ def submit(config):

isData = myJob.get('isData', False)
year = str(myJob.get('year', '0'))
addLLPInfo = str(myJob.get('addLLPInfo', False))
addSignalLHE = str(myJob.get('addSignalLHE', False))

if year not in ['2016','2017','2018','2018D']:
Expand All @@ -1025,7 +1025,6 @@ def submit(config):
print "year:", year

config.JobType.pyCfgParams.append("year="+str(year))
config.JobType.pyCfgParams.append("addLLPInfo={}".format(addLLPInfo))
config.JobType.pyCfgParams.append("addSignalLHE={}".format(addSignalLHE))

if isData:
Expand All @@ -1044,13 +1043,13 @@ def submit(config):

else:
config.JobType.pyCfgParams.append("isData=False")
if myJobs == myJobsHNL:
if myJob.has_key('unitsPerJob'):
config.Data.splitting = 'FileBased'
config.JobType.maxJobRuntimeMin= 8*60
config.JobType.maxJobRuntimeMin= 12*60
config.Data.unitsPerJob = myJob.get('unitsPerJob', 1)
else:
config.Data.splitting = 'Automatic'
config.Data.unitsPerJob = 8*60
config.Data.unitsPerJob = 10*60

if "params" in myJob:
params = myJob["params"]
Expand All @@ -1077,9 +1076,11 @@ def submit(config):

print "Submitting job ",i," of ",len(myJobs.keys()),":",config.General.workArea

p = Process(target=submit, args=(config,))
p.start()
p.join()
#p = Process(target=submit, args=(config,))
#p.start()
#p.join()
break

print
print

36 changes: 31 additions & 5 deletions NANOProducer/test/produceNANO.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
input = cms.untracked.int32(1000)
)

process.options = cms.untracked.PSet()
process.options = cms.untracked.PSet(wantSummary = cms.untracked.bool(True))

files = {
'test': {
Expand Down Expand Up @@ -140,7 +140,9 @@
filterName = cms.untracked.string('')
),
SelectEvents = cms.untracked.PSet(
SelectEvents = cms.vstring('llpnanoAOD_step') #only events passing this path will be saved
SelectEvents = cms.vstring(
['llpnanoAOD_step_mu','llpnanoAOD_step_ele'] if options.isData else ['llpnanoAOD_step']
) #only events passing this path will be saved
),
fileName = cms.untracked.string('nano.root'),
#outputCommands = process.NANOAODSIMEventContent.outputCommands+cms.untracked.vstring(
Expand Down Expand Up @@ -369,6 +371,20 @@
process.selectedMuonsForFilter+process.selectedMuonsMinFilter
)


process.selectedElectronsForFilter = cms.EDFilter("CandViewSelector",
src = cms.InputTag("slimmedElectrons"),
cut = cms.string("pt>25")
)
process.selectedElectronsMinFilter = cms.EDFilter("CandViewCountFilter",
src = cms.InputTag("selectedElectronsForFilter"),
minNumber = cms.uint32(1)
)

process.electronFilterSequence = cms.Sequence(
process.selectedElectronsForFilter+process.selectedElectronsMinFilter
)

# Automatic addition of the customisation function from PhysicsTools.NanoAOD.nano_cff
from PhysicsTools.NanoAOD.nano_cff import nanoAOD_customizeData,nanoAOD_customizeMC

Expand All @@ -381,13 +397,20 @@


if options.isData:
process.llpnanoAOD_step = cms.Path(
process.llpnanoAOD_step_mu = cms.Path(
process.muonFilterSequence+
process.nanoSequence+
process.adaptedVertexing+
process.pfXTagInfos+
process.nanoTable
)
process.llpnanoAOD_step_ele = cms.Path(
process.electronFilterSequence+
process.nanoSequence+
process.adaptedVertexing+
process.pfXTagInfos+
process.nanoTable
)
else:
process.llpnanoAOD_step = cms.Path(
process.nanoSequenceMC+
Expand All @@ -407,8 +430,11 @@
process.NANOAODSIMoutput_step = cms.EndPath(process.NANOAODSIMoutput)



process.schedule = cms.Schedule(process.llpnanoAOD_step,process.endjob_step,process.NANOAODSIMoutput_step)
if options.isData:
process.schedule = cms.Schedule(process.llpnanoAOD_step_mu,process.llpnanoAOD_step_ele,process.endjob_step,process.NANOAODSIMoutput_step)
else:
process.schedule = cms.Schedule(process.llpnanoAOD_step,process.endjob_step,process.NANOAODSIMoutput_step)

from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask
associatePatAlgosToolsTask(process)

Expand Down

0 comments on commit 6f0a3fe

Please sign in to comment.