CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
extraSlimmedMETs_MuEGFixMoriond2017 Namespace Reference

Functions

def addExtraMETCollections
 
def addExtraPuppiMETCorrections
 

Function Documentation

def extraSlimmedMETs_MuEGFixMoriond2017.addExtraMETCollections (   process,
  unCleanPFCandidateCollection,
  cleanElectronCollection,
  cleanPhotonCollection,
  unCleanElectronCollection,
  unCleanPhotonCollection 
)

Definition at line 8 of file extraSlimmedMETs_MuEGFixMoriond2017.py.

References addExtraPuppiMETCorrections(), helpers.addKeepStatement(), helpers.cloneProcessingSnippet(), helpers.massSearchReplaceAnyInputTag(), and runMETCorrectionsAndUncertainties.runMetCorAndUncForMiniAODProduction().

Referenced by customizeMiniAOD_MuEGFixMoriond2017.customizeAll().

8 
9  unCleanPhotonCollection ):
10 
11  # Muon/EGamma un/corrected pfMET ============
12  from PhysicsTools.PatUtils.tools.corMETFromMuonAndEG import corMETFromMuonAndEG
13  from PhysicsTools.PatUtils.tools.runMETCorrectionsAndUncertainties import runMetCorAndUncForMiniAODProduction
14 
15  # uncorrected MET
16  cloneProcessingSnippet(process, getattr(process,"makePatJets"),"BackupAllEvents")
17  massSearchReplaceAnyInputTag(getattr(process,"makePatJetsBackupAllEvents"), "ak4PFJetsCHS", "ak4PFJetsCHSBackupAllEvents")
18  massSearchReplaceAnyInputTag(getattr(process,"makePatJetsBackupAllEvents"), "pfCandidatesBadMuonsCleaned", "particleFlow")
19  del process.patJetsBackupAllEvents.userData
20  process.patJetsBackupAllEvents.addAssociatedTracks = cms.bool(False)
21  process.patJetsBackupAllEvents.addBTagInfo = cms.bool(False)
22  process.patJetsBackupAllEvents.addDiscriminators = cms.bool(False)
23  process.patJetsBackupAllEvents.addGenJetMatch = cms.bool(False)
24  process.patJetsBackupAllEvents.addGenPartonMatch = cms.bool(False)
25  process.patJetsBackupAllEvents.addJetCharge = cms.bool(False)
26  process.patJetsBackupAllEvents.addJetCorrFactors = cms.bool(True)
27  process.patJetsBackupAllEvents.addJetFlavourInfo = cms.bool(False)
28  process.patJetsBackupAllEvents.addJetID = cms.bool(False)
29  process.patJetsBackupAllEvents.addPartonJetMatch = cms.bool(False)
30  process.patJetsBackupAllEvents.addResolutions = cms.bool(False)
31  process.patJetsBackupAllEvents.addTagInfos = cms.bool(False)
32  process.patJetsBackupAllEvents.discriminatorSources = cms.VInputTag()
33  process.patJetsBackupAllEvents.embedGenJetMatch = cms.bool(False)
34 
36  metType="PF",
37  pfCandColl=cms.InputTag(unCleanPFCandidateCollection),
38  recoMetFromPFCs=True,
39  jetCollUnskimmed="patJetsBackupAllEvents",
40  postfix="Uncorrected"
41  )
42 
43  if not hasattr(process, "slimmedMETs"):
44  process.load('PhysicsTools.PatAlgos.slimming.slimmedMETs_cfi')
45 
46  process.slimmedMETsUncorrected = process.slimmedMETs.clone()
47  process.slimmedMETsUncorrected.src = cms.InputTag("patPFMetT1Uncorrected")
48  process.slimmedMETsUncorrected.rawVariation = cms.InputTag("patPFMetUncorrected")
49  process.slimmedMETsUncorrected.t1Uncertainties = cms.InputTag("patPFMetT1%sUncorrected")
50  process.slimmedMETsUncorrected.t01Variation = cms.InputTag("patPFMetT0pcT1Uncorrected")
51  process.slimmedMETsUncorrected.t1SmearedVarsAndUncs = cms.InputTag("patPFMetT1Smear%sUncorrected")
52  process.slimmedMETsUncorrected.tXYUncForRaw = cms.InputTag("patPFMetTxyUncorrected")
53  process.slimmedMETsUncorrected.tXYUncForT1 = cms.InputTag("patPFMetT1TxyUncorrected")
54  process.slimmedMETsUncorrected.tXYUncForT01 = cms.InputTag("patPFMetT0pcT1TxyUncorrected")
55  process.slimmedMETsUncorrected.tXYUncForT1Smear = cms.InputTag("patPFMetT1SmearTxyUncorrected")
56  process.slimmedMETsUncorrected.tXYUncForT01Smear = cms.InputTag("patPFMetT0pcT1SmearTxyUncorrected")
57  del process.slimmedMETsUncorrected.caloMET
58 
59  # EG corrected MET
60  corMETFromMuonAndEG(process,
61  pfCandCollection="", #not needed
62  electronCollection=unCleanElectronCollection,
63  photonCollection=unCleanPhotonCollection,
64  corElectronCollection=cleanElectronCollection,
65  corPhotonCollection=cleanPhotonCollection,
66  allMETEGCorrected=True,
67  muCorrection=False,
68  eGCorrection=True,
69  runOnMiniAOD=False,
70  eGPFix="Uncorrected",
71  postfix="EGOnly"
72  )
73  process.slimmedMETsEGClean = process.slimmedMETs.clone()
74  process.slimmedMETsEGClean.src = cms.InputTag("patPFMetT1UncorrectedEGOnly")
75  process.slimmedMETsEGClean.rawVariation = cms.InputTag("patPFMetRawUncorrectedEGOnly")
76  process.slimmedMETsEGClean.t1Uncertainties = cms.InputTag("patPFMetT1%sUncorrectedEGOnly")
77  process.slimmedMETsEGClean.t01Variation = cms.InputTag("patPFMetT0pcT1UncorrectedEGOnly")
78  process.slimmedMETsEGClean.t1SmearedVarsAndUncs = cms.InputTag("patPFMetT1Smear%sUncorrectedEGOnly")
79  process.slimmedMETsEGClean.tXYUncForRaw = cms.InputTag("patPFMetTxyUncorrectedEGOnly")
80  process.slimmedMETsEGClean.tXYUncForT1 = cms.InputTag("patPFMetT1TxyUncorrectedEGOnly")
81  process.slimmedMETsEGClean.tXYUncForT01 = cms.InputTag("patPFMetT0pcT1TxyUncorrectedEGOnly")
82  process.slimmedMETsEGClean.tXYUncForT1Smear = cms.InputTag("patPFMetT1SmearTxyUncorrectedEGOnly")
83  process.slimmedMETsEGClean.tXYUncForT01Smear = cms.InputTag("patPFMetT0pcT1SmearTxyUncorrectedEGOnly")
84  del process.slimmedMETsEGClean.caloMET
85 
86  # fully corrected MET
87  corMETFromMuonAndEG(process,
88  pfCandCollection="", #not needed
89  electronCollection=unCleanElectronCollection,
90  photonCollection=unCleanPhotonCollection,
91  corElectronCollection=cleanElectronCollection,
92  corPhotonCollection=cleanPhotonCollection,
93  allMETEGCorrected=True,
94  muCorrection=False,
95  eGCorrection=True,
96  runOnMiniAOD=False,
97  postfix="MuEGClean"
98  )
99  process.slimmedMETsMuEGClean = process.slimmedMETs.clone()
100  process.slimmedMETsMuEGClean.src = cms.InputTag("patPFMetT1MuEGClean")
101  process.slimmedMETsMuEGClean.rawVariation = cms.InputTag("patPFMetRawMuEGClean")
102  process.slimmedMETsMuEGClean.t1Uncertainties = cms.InputTag("patPFMetT1%sMuEGClean")
103  process.slimmedMETsMuEGClean.t01Variation = cms.InputTag("patPFMetT0pcT1MuEGClean")
104  process.slimmedMETsMuEGClean.t1SmearedVarsAndUncs = cms.InputTag("patPFMetT1Smear%sMuEGClean")
105  process.slimmedMETsMuEGClean.tXYUncForRaw = cms.InputTag("patPFMetTxyMuEGClean")
106  process.slimmedMETsMuEGClean.tXYUncForT1 = cms.InputTag("patPFMetT1TxyMuEGClean")
107  process.slimmedMETsMuEGClean.tXYUncForT01 = cms.InputTag("patPFMetT0pcT1TxyMuEGClean")
108  process.slimmedMETsMuEGClean.tXYUncForT1Smear = cms.InputTag("patPFMetT1SmearTxyMuEGClean")
109  process.slimmedMETsMuEGClean.tXYUncForT01Smear = cms.InputTag("patPFMetT0pcT1SmearTxyMuEGClean")
110  del process.slimmedMETsMuEGClean.caloMET
111 
112  addKeepStatement(process, "keep *_slimmedMETs_*_*",
113  ["keep *_slimmedMETsUncorrected_*_*", "keep *_slimmedMETsEGClean_*_*", "keep *_slimmedMETsMuEGClean_*_*"])
114 
115 
def cloneProcessingSnippet
Definition: helpers.py:315
def massSearchReplaceAnyInputTag
Definition: helpers.py:271
def addKeepStatement
Definition: helpers.py:427
def extraSlimmedMETs_MuEGFixMoriond2017.addExtraPuppiMETCorrections (   process,
  cleanPFCandidateCollection,
  unCleanPFCandidateCollection,
  cleanElectronCollection,
  cleanPhotonCollection,
  unCleanElectronCollection,
  unCleanPhotonCollection 
)

Definition at line 123 of file extraSlimmedMETs_MuEGFixMoriond2017.py.

References helpers.addKeepStatement().

Referenced by addExtraMETCollections(), and customizeMiniAOD_MuEGFixMoriond2017.customizeAll().

124  ):
125 
126  from PhysicsTools.PatUtils.tools.corMETFromMuonAndEG import corMETFromMuonAndEG
127 
128  #EG correction for puppi, muon correction done right above
129  corMETFromMuonAndEG(process,
130  pfCandCollection="puppiForMET",
131  electronCollection=unCleanElectronCollection,
132  photonCollection=unCleanPhotonCollection,
133  corElectronCollection=cleanElectronCollection,
134  corPhotonCollection=cleanPhotonCollection,
135  allMETEGCorrected=True,
136  muCorrection=False,
137  eGCorrection=True,
138  runOnMiniAOD=False,
139  eGPfCandMatching=True,
140  eGPFix="Puppi",
141  postfix="PuppiClean"
142  )
143 
144  if not hasattr(process, "slimmedMETs"):
145  process.load('PhysicsTools.PatAlgos.slimming.slimmedMETs_cfi')
146 
147  process.slimmedMETsPuppi.src = cms.InputTag("patPFMetT1PuppiPuppiClean")
148  process.slimmedMETsPuppi.rawVariation = cms.InputTag("patPFMetRawPuppiPuppiClean")
149  process.slimmedMETsPuppi.t1Uncertainties = cms.InputTag("patPFMetT1%sPuppiPuppiClean")
150  process.slimmedMETsPuppi.t01Variation = cms.InputTag("patPFMetT0pcT1PuppiPuppiClean")
151  process.slimmedMETsPuppi.t1SmearedVarsAndUncs = cms.InputTag("patPFMetT1Smear%sPuppiPuppiClean")
152  process.slimmedMETsPuppi.tXYUncForRaw = cms.InputTag("patPFMetTxyPuppiPuppiClean")
153  process.slimmedMETsPuppi.tXYUncForT1 = cms.InputTag("patPFMetT1TxyPuppiPuppiClean")
154  process.slimmedMETsPuppi.tXYUncForT01 = cms.InputTag("patPFMetT0pcT1TxyPuppiPuppiClean")
155  process.slimmedMETsPuppi.tXYUncForT1Smear = cms.InputTag("patPFMetT1SmearTxyPuppiPuppiClean")
156  process.slimmedMETsPuppi.tXYUncForT01Smear = cms.InputTag("patPFMetT0pcT1SmearTxyPuppiPuppiClean")
157  #del process.slimmedMETsPuppi.caloMET
158 
159  #EGamma correction
160  process.puppiMETEGCor = cms.EDProducer("CorrMETDataExtractor",
161  corrections = cms.VInputTag(
162  cms.InputTag("corMETPhotonPuppiClean"),
163  cms.InputTag("corMETElectronPuppiClean") )
164  )
165 
166  #Muon correction, restarting from PF candidates to take the weights
167  process.puppiMuonCorrection = cms.EDProducer("ShiftedParticleMETcorrInputProducer",
168  srcOriginal = cms.InputTag(unCleanPFCandidateCollection),
169  srcShifted = cms.InputTag(cleanPFCandidateCollection),
170  )
171 
172  process.puppiMETMuCor = cms.EDProducer("CorrMETDataExtractor",
173  corrections = cms.VInputTag(
174  cms.InputTag("puppiMuonCorrection") )
175  )
176  addKeepStatement(process, "keep *_slimmedMETsPuppi_*_*",
177  ["keep *_puppiMETEGCor_*_*", "keep *_puppiMETMuCor_*_*"])
def addKeepStatement
Definition: helpers.py:427