From 6f0a3fe042062690b7b16b9c6f7f9066366de9c3 Mon Sep 17 00:00:00 2001 From: matt-komm Date: Tue, 17 Nov 2020 14:03:37 +0000 Subject: [PATCH] fix filter --- NANOProducer/test/crab.py | 25 +++++++++++----------- NANOProducer/test/produceNANO.py | 36 +++++++++++++++++++++++++++----- 2 files changed, 44 insertions(+), 17 deletions(-) diff --git a/NANOProducer/test/crab.py b/NANOProducer/test/crab.py index 31853e1..f3cab2e 100644 --- a/NANOProducer/test/crab.py +++ b/NANOProducer/test/crab.py @@ -921,6 +921,7 @@ } } +''' myJobsHNL = {} with open("HNL_samples.txt") as f: for line in f: @@ -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') @@ -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']: @@ -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: @@ -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"] @@ -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 diff --git a/NANOProducer/test/produceNANO.py b/NANOProducer/test/produceNANO.py index 62387e3..d1dbce1 100644 --- a/NANOProducer/test/produceNANO.py +++ b/NANOProducer/test/produceNANO.py @@ -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': { @@ -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( @@ -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 @@ -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+ @@ -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)