CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 9 of file extraSlimmedMETs_MuEGFixMoriond2017.py.

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

Referenced by customizeMiniAOD_MuEGFixMoriond2017.customizeAll().

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

Definition at line 129 of file extraSlimmedMETs_MuEGFixMoriond2017.py.

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

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

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