test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
puppiForMET_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
4 from CommonTools.PileupAlgos.PhotonPuppi_cff import setupPuppiPhoton,setupPuppiPhotonMiniAOD
5 
6 def makePuppies( process ):
7 
8  process.load('CommonTools.PileupAlgos.Puppi_cff')
9 
10  process.pfNoLepPUPPI = cms.EDFilter("PdgIdCandViewSelector",
11  src = cms.InputTag("particleFlow"),
12  pdgId = cms.vint32( 1,2,22,111,130,310,2112,211,-211,321,-321,999211,2212,-2212 )
13  )
14  process.pfLeptonsPUPPET = cms.EDFilter("PdgIdCandViewSelector",
15  src = cms.InputTag("particleFlow"),
16  pdgId = cms.vint32(-11,11,-13,13),
17  )
18 
19  process.puppiNoLep = process.puppi.clone()
20  process.puppiNoLep.candName = cms.InputTag('pfNoLepPUPPI')
21  process.puppiMerged = cms.EDProducer("CandViewMerger",src = cms.VInputTag( 'puppiNoLep','pfLeptonsPUPPET'))
22  process.load('CommonTools.PileupAlgos.PhotonPuppi_cff')
23  process.puppiForMET = process.puppiPhoton.clone()
24  #Line below replaces reference linking wiht delta R matching this is because the reference key in packed candidates differs to PF candidates (must be done when reading Reco)
25  process.puppiForMET.useRefs = False
26  #Line below points puppi MET to puppi no lepton which increases the response
27  process.puppiForMET.puppiCandName = 'puppiMerged'
28 
29 
30 def makePuppiesFromMiniAOD( process ):
31  process.load('CommonTools.PileupAlgos.Puppi_cff')
32  process.puppi.candName = cms.InputTag('packedPFCandidates')
33  process.puppi.vertexName = cms.InputTag('offlineSlimmedPrimaryVertices')
34  process.pfNoLepPUPPI = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedPFCandidates"), cut = cms.string("abs(pdgId) != 13 && abs(pdgId) != 11 && abs(pdgId) != 15"))
35  process.pfLeptonsPUPPET = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedPFCandidates"), cut = cms.string("abs(pdgId) == 13 || abs(pdgId) == 11 || abs(pdgId) == 15"))
36  process.puppiNoLep = process.puppi.clone()
37  process.puppiNoLep.candName = cms.InputTag('pfNoLepPUPPI')
38  process.puppiNoLep.useWeightsNoLep = cms.bool(True)
39  process.puppiMerged = cms.EDProducer("CandViewMerger",src = cms.VInputTag( 'puppiNoLep','pfLeptonsPUPPET'))
40  process.load('CommonTools.PileupAlgos.PhotonPuppi_cff')
41  process.puppiForMET = process.puppiPhoton.clone()
43  #Line below doesn't work because of an issue with references in MiniAOD without setting useRefs=>False and using delta R
44  #process.puppiForMET.puppiCandName = 'puppiMerged'
45  #process.puppiForMET.useRefs = False
46