CMS 3D CMS Logo

Functions
puppiForMET_cff Namespace Reference

Functions

def makePuppies (process)
 
def makePuppiesFromMiniAOD (process, createScheduledSequence=False)
 

Function Documentation

def puppiForMET_cff.makePuppies (   process)

Definition at line 8 of file puppiForMET_cff.py.

References helpers.addToProcessAndTask(), and helpers.getPatAlgosToolsTask().

Referenced by miniAOD_tools.miniAOD_customizeCommon().

8 def makePuppies( process ):
9 
10  task = getPatAlgosToolsTask(process)
11 
12  process.load('CommonTools.PileupAlgos.Puppi_cff')
13  task.add(process.puppi)
14  process.pfNoLepPUPPI = cms.EDFilter("PdgIdCandViewSelector",
15  src = cms.InputTag("particleFlow"),
16  pdgId = cms.vint32( 1,2,22,111,130,310,2112,211,-211,321,-321,999211,2212,-2212 )
17  )
18  task.add(process.pfNoLepPUPPI)
19  process.pfLeptonsPUPPET = cms.EDFilter("PdgIdCandViewSelector",
20  src = cms.InputTag("particleFlow"),
21  pdgId = cms.vint32(-11,11,-13,13),
22  )
23  task.add(process.pfLeptonsPUPPET)
24 
25  addToProcessAndTask('puppiNoLep', process.puppi.clone(), process, task)
26  process.puppiNoLep.candName = cms.InputTag('pfNoLepPUPPI')
27  process.puppiMerged = cms.EDProducer("CandViewMerger",src = cms.VInputTag( 'puppiNoLep','pfLeptonsPUPPET'))
28  task.add(process.puppiMerged)
29  process.load('CommonTools.PileupAlgos.PhotonPuppi_cff')
30  task.add(process.puppiPhoton)
31  addToProcessAndTask('puppiForMET', process.puppiPhoton.clone(), process, task)
32  #Line below replaces reference linking wiht delta R matching because the puppi references after merging are not consistent with those of the original PF collection
33  process.puppiForMET.useRefs = False
34  #Line below points puppi MET to puppi no lepton which increases the response
35  process.puppiForMET.puppiCandName = 'puppiMerged'
36 
37 
def addToProcessAndTask(label, module, process, task)
Definition: helpers.py:29
def makePuppies(process)
def getPatAlgosToolsTask(process)
Definition: helpers.py:14
def puppiForMET_cff.makePuppiesFromMiniAOD (   process,
  createScheduledSequence = False 
)

Definition at line 38 of file puppiForMET_cff.py.

References helpers.addToProcessAndTask(), helpers.getPatAlgosToolsTask(), and PhotonPuppi_cff.setupPuppiPhotonMiniAOD().

38 def makePuppiesFromMiniAOD( process, createScheduledSequence=False ):
39  task = getPatAlgosToolsTask(process)
40  process.load('CommonTools.PileupAlgos.Puppi_cff')
41  task.add(process.puppi)
42  process.puppi.candName = cms.InputTag('packedPFCandidates')
43  process.puppi.clonePackedCands = cms.bool(True)
44  process.puppi.vertexName = cms.InputTag('offlineSlimmedPrimaryVertices')
45  process.puppi.useExistingWeights = cms.bool(True)
46  process.pfNoLepPUPPI = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedPFCandidates"), cut = cms.string("abs(pdgId) != 13 && abs(pdgId) != 11 && abs(pdgId) != 15"))
47  task.add(process.pfNoLepPUPPI)
48  process.pfLeptonsPUPPET = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedPFCandidates"), cut = cms.string("abs(pdgId) == 13 || abs(pdgId) == 11 || abs(pdgId) == 15"))
49  task.add(process.pfLeptonsPUPPET)
50  addToProcessAndTask('puppiNoLep', process.puppi.clone(), process, task)
51  process.puppiNoLep.candName = cms.InputTag('pfNoLepPUPPI')
52  process.puppiNoLep.useWeightsNoLep = cms.bool(True)
53  process.puppiNoLep.useExistingWeights = cms.bool(True)
54  process.puppiMerged = cms.EDProducer("CandViewMerger",src = cms.VInputTag( 'puppiNoLep','pfLeptonsPUPPET'))
55  task.add(process.puppiMerged)
56  process.load('CommonTools.PileupAlgos.PhotonPuppi_cff')
57  task.add(process.puppiPhoton)
58  addToProcessAndTask('puppiForMET', process.puppiPhoton.clone(), process, task)
59  process.puppiForMET.candName = cms.InputTag('packedPFCandidates')
60  process.puppiForMET.photonName = cms.InputTag('slimmedPhotons')
61  process.puppiForMET.runOnMiniAOD = cms.bool(True)
63  task.add(process.egmPhotonIDTask)
64  #Line below replaces reference linking wiht delta R matching because the puppi references after merging are not consistent with those of the original packed candidate collection
65  process.puppiForMET.useRefs = False
66  #Line below points puppi MET to puppi no lepton which increases the response
67  process.puppiForMET.puppiCandName = 'puppiMerged'
68 
69  #making a sequence for people running the MET tool in scheduled mode
70  if createScheduledSequence:
71  puppiMETSequence = cms.Sequence(process.puppi*process.pfLeptonsPUPPET*process.pfNoLepPUPPI*process.puppiNoLep*process.puppiMerged*process.puppiForMET)
72  setattr(process, "puppiMETSequence", puppiMETSequence)
73 
def addToProcessAndTask(label, module, process, task)
Definition: helpers.py:29
def setupPuppiPhotonMiniAOD(process)
def getPatAlgosToolsTask(process)
Definition: helpers.py:14
def makePuppiesFromMiniAOD(process, createScheduledSequence=False)