CMS 3D CMS Logo

puppiForMET_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
4 
5 from PhysicsTools.PatAlgos.tools.helpers import getPatAlgosToolsTask, addToProcessAndTask
6 
7 def makePuppies( process ):
8  task = getPatAlgosToolsTask(process)
9  process.load('CommonTools.PileupAlgos.Puppi_cff')
10  task.add(process.puppi)
11  process.pfNoLepPUPPI = cms.EDFilter("PdgIdCandViewSelector",
12  src = cms.InputTag("particleFlow"),
13  pdgId = cms.vint32( 1,2,22,111,130,310,2112,211,-211,321,-321,999211,2212,-2212 )
14  )
15  task.add(process.pfNoLepPUPPI)
16  process.pfLeptonsPUPPET = cms.EDFilter("PdgIdCandViewSelector",
17  src = cms.InputTag("particleFlow"),
18  pdgId = cms.vint32(-11,11,-13,13),
19  )
20  task.add(process.pfLeptonsPUPPET)
21  addToProcessAndTask('puppiNoLep', process.puppi.clone(), process, task)
22  process.puppiNoLep.candName = cms.InputTag('pfNoLepPUPPI')
23  process.puppiNoLep.PtMaxPhotons = 20.
24  process.puppiForMET = cms.EDProducer("CandViewMerger",src = cms.VInputTag( 'puppiNoLep','pfLeptonsPUPPET'))
25  task.add(process.puppiForMET)
26 
27 def makePuppiesFromMiniAOD( process, createScheduledSequence=False ):
28  task = getPatAlgosToolsTask(process)
29  process.load('CommonTools.PileupAlgos.Puppi_cff')
30  task.add(process.puppi)
31  process.puppi.candName = cms.InputTag('packedPFCandidates')
32  process.puppi.clonePackedCands = True
33  process.puppi.vertexName = cms.InputTag('offlineSlimmedPrimaryVertices')
34  process.puppi.useExistingWeights = True
35  process.pfNoLepPUPPI = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedPFCandidates"), cut = cms.string("abs(pdgId) != 13 && abs(pdgId) != 11 && abs(pdgId) != 15"))
36  task.add(process.pfNoLepPUPPI)
37  process.pfLeptonsPUPPET = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedPFCandidates"), cut = cms.string("abs(pdgId) == 13 || abs(pdgId) == 11 || abs(pdgId) == 15"))
38  task.add(process.pfLeptonsPUPPET)
39  addToProcessAndTask('puppiNoLep', process.puppi.clone(), process, task)
40  process.puppiNoLep.candName = cms.InputTag('pfNoLepPUPPI')
41  process.puppiNoLep.useWeightsNoLep = True
42  process.puppiNoLep.PtMaxPhotons = 20.
43  process.puppiForMET = cms.EDProducer("CandViewMerger",src = cms.VInputTag( 'puppiNoLep','pfLeptonsPUPPET'))
44  task.add(process.puppiForMET)
45 
46  #making a sequence for people running the MET tool in scheduled mode
47  if createScheduledSequence:
48  puppiMETSequence = cms.Sequence(process.puppi*process.pfLeptonsPUPPET*process.pfNoLepPUPPI*process.puppiNoLep*process.puppiForMET)
49  setattr(process, "puppiMETSequence", puppiMETSequence)
def addToProcessAndTask(label, module, process, task)
Definition: helpers.py:29
def makePuppies(process)
def getPatAlgosToolsTask(process)
Definition: helpers.py:14
def makePuppiesFromMiniAOD(process, createScheduledSequence=False)