5 shiftType, particleCollectionShiftUp,
6 particleCollectionShiftDown, metProducer,
7 metType, sequence, postfix):
12 moduleMETcorrShiftUp = cms.EDProducer(
"ShiftedParticleMETcorrInputProducer",
13 srcOriginal = cms.InputTag(particleCollection),
14 srcShifted = cms.InputTag(particleCollectionShiftUp)
16 moduleMETcorrShiftUpName =
"pat%sMETcorr%s%sUp" % (metType,particleType, shiftType)
17 moduleMETcorrShiftUpName += postfix
18 setattr(process, moduleMETcorrShiftUpName, moduleMETcorrShiftUp)
19 sequence += moduleMETcorrShiftUp
20 moduleMETcorrShiftDown = moduleMETcorrShiftUp.clone(
21 srcShifted = cms.InputTag(particleCollectionShiftDown)
23 moduleMETcorrShiftDownName =
"pat%sMETcorr%s%sDown" % (metType,particleType, shiftType)
24 moduleMETcorrShiftDownName += postfix
25 setattr(process, moduleMETcorrShiftDownName, moduleMETcorrShiftDown)
26 sequence += moduleMETcorrShiftDown
29 moduleMETshiftUp = metProducer.clone(
30 src = cms.InputTag(metProducer.label()),
31 srcType1Corrections = cms.VInputTag(
32 cms.InputTag(moduleMETcorrShiftUpName)
35 metProducerLabel = metProducer.label()
37 if metProducerLabel[-len(postfix):] == postfix:
38 metProducerLabel = metProducerLabel[0:-len(postfix)]
40 raise StandardError(
"Tried to remove postfix %s from label %s, but it wasn't there" % (postfix, metProducerLabel))
41 moduleMETshiftUpName =
"%s%s%sUp" % (metProducerLabel, particleType, shiftType)
42 moduleMETshiftUpName += postfix
43 setattr(process, moduleMETshiftUpName, moduleMETshiftUp)
44 sequence += moduleMETshiftUp
45 moduleMETshiftDown = moduleMETshiftUp.clone(
46 srcType1Corrections = cms.VInputTag(
47 cms.InputTag(moduleMETcorrShiftDownName)
50 moduleMETshiftDownName =
"%s%s%sDown" % (metProducerLabel, particleType, shiftType)
51 moduleMETshiftDownName += postfix
52 setattr(process, moduleMETshiftDownName, moduleMETshiftDown)
53 sequence += moduleMETshiftDown
55 metCollectionsUp_Down = [
57 moduleMETshiftDownName
60 return metCollectionsUp_Down
66 metType, sequence, postfix):
68 metCollectionsUpDown = []
72 for shiftedCol
in shiftedParticleCollections.keys():
73 if shiftedCol.find(
'jet')!=-1
or shiftedCol.find(
'Jet')!=-1
or shiftedCol.find(
'Up')!=-1
or shiftedCol.find(
'Down')!=-1 :
77 if shiftedCol.find(
'electron')!=-1:
78 particleType=
"Electron"
79 if shiftedCol.find(
'photon')!=-1:
81 if shiftedCol.find(
'muon')!=-1:
83 if shiftedCol.find(
'tau')!=-1:
86 for metProducer
in metProducers:
88 shiftedParticleCollections[shiftedCol],
90 shiftedParticleCollections[shiftedCol+
'EnUp'],
91 shiftedParticleCollections[shiftedCol+
'EnDown'],
92 metProducer, metType, sequence, postfix)
94 metCollectionsUpDown.extend( tmpMetCollections )
96 return metCollectionsUpDown
115 metType, sequence, postfix):
117 metCollectionsUpDown = []
119 for metProducer
in metProducers:
122 shiftedParticleCollections[
'lastJetCollection'],
"Jet",
"Res",
123 shiftedParticleCollections[
'jetCollectionResUp'],
124 shiftedParticleCollections[
'jetCollectionResDown'],
125 metProducer, metType, sequence, postfix)
127 metCollectionsUpDown.extend( tmpMetCollections )
129 return metCollectionsUpDown
136 applyT2Cor=
False, applyT0pcCor=
False, applyXYShiftCor=
False,
137 applyUncEnCalib=
False,sysShiftCorrParameter=cms.VPSet(), postfix=
""):
146 metModName =
"pat"+metType+
"Met"
147 metModNameT1=metModName
148 metModNameT1T2=metModName
150 metModNameT1 +=
"T0pc"
151 metModNameT1T2 +=
"T0pc"
153 metModNameT1T2 +=
"T1T2"
155 metModNameT1 +=
"Txy"
156 metModNameT1T2 +=
"Txy"
164 setattr(process, metModName, getattr(process, metModName ) )
166 setattr(process, metModNameT1+postfix, getattr(process, metModNameT1 ).
clone(
167 src = cms.InputTag(metModName + postfix)
169 metPatSequence += getattr(process, metModNameT1+postfix)
171 setattr(process, metModNameT1T2+postfix, getattr(process, metModNameT1T2 ).
clone(
172 src = cms.InputTag(metModName + postfix)
174 metPatSequence += getattr(process, metModNameT1T2+postfix)
176 patMetCorrectionsCentralValue = []
181 patMetCorrectionsCentralValue = [ cms.InputTag(
'patPFJetMETtype1p2Corr' + postfix,
'type1') ]
183 patMetCorrectionsCentralValue.extend([ cms.InputTag(
'patPFMETtype0Corr' + postfix) ])
188 if not hasattr(process,
'pfMEtSysShiftCorrSequence'):
189 process.load(
"JetMETCorrections.Type1MET.pfMETsysShiftCorrections_cfi")
191 configtools.cloneProcessingSnippet(process, process.pfMEtSysShiftCorrSequence, postfix)
193 getattr(process,
"pfMEtSysShiftCorr" + postfix).parameter = sysShiftCorrParameter
194 metPatSequence += getattr(process,
"pfMEtSysShiftCorrSequence" + postfix)
196 patMetCorrectionsCentralValue.extend([ cms.InputTag(
'pfMEtSysShiftCorr' + postfix) ])
201 getattr(process, metModNameT1 + postfix).srcType1Corrections = cms.VInputTag(patMetCorrectionsCentralValue)
203 getattr(process, metModNameT1T2 + postfix).srcType1Corrections = cms.VInputTag(patMetCorrectionsCentralValue)
211 patPFMetT1T2 = getattr(process, metModNameT1T2)
212 patPFMetT1T2.applyType2Corrections = cms.bool(
True)
213 patPFMetT1T2.srcUnclEnergySums = cms.VInputTag(
214 cms.InputTag(
'pfCandMETresidualCorr' + postfix),
215 cms.InputTag(
"patPFJetMETtype1p2Corr" + postfix,
"type2")
217 patPFMetT1T2.type2CorrFormula = cms.string(
"A")
218 patPFMetT1T2.type2CorrParameter = cms.PSet(A = cms.double(2.))
221 collectionsToKeep = [
'patPFMet' + postfix ]
223 collectionsToKeep.append( metModNameT1 + postfix )
225 collectionsToKeep.append( metModNameT1T2 + postfix )
227 return (metModName, metModNameT1, metModNameT1T2, collectionsToKeep)
234 patPFJetMETtype1p2Corr = getattr(process,
"patPFJetMETtype1p2Corr" + postfix)
235 patPFJetMETtype1p2Corr.type2ResidualCorrLabel = cms.string(
"")
236 patPFJetMETtype1p2Corr.type2ResidualCorrEtaMax = cms.double(9.9)
237 patPFJetMETtype1p2Corr.type2ResidualCorrOffset = cms.double(1.)
238 patPFJetMETtype1p2Corr.type2ExtraCorrFactor = cms.double(1.)
239 patPFJetMETtype1p2Corr.isMC = cms.bool(
True)
240 patPFJetMETtype1p2Corr.srcGenPileUpSummary = cms.InputTag(
'addPileupInfo')
241 patPFJetMETtype1p2Corr.type2ResidualCorrVsNumPileUp = cms.PSet(
243 offset = cms.FileInPath(
'JetMETCorrections/Type1MET/data/unclEnResidualCorr_Data_runs190456to208686_pfCands_offset.txt'),
244 slope = cms.FileInPath(
'JetMETCorrections/Type1MET/data/unclEnResidualCorr_Data_runs190456to208686_pfCands_slope.txt')
247 offset = cms.FileInPath(
'JetMETCorrections/Type1MET/data/unclEnResidualCorr_ZplusJets_madgraph_pfCands_offset.txt'),
248 slope = cms.FileInPath(
'JetMETCorrections/Type1MET/data/unclEnResidualCorr_ZplusJets_madgraph_pfCands_slope.txt')
251 patPFJetMETtype1p2Corr.verbosity = cms.int32(0)
252 pfCandMETcorr = getattr(process,
"pfCandMETcorr" + postfix)
253 pfCandMETresidualCorr = pfCandMETcorr.clone(
254 residualCorrLabel = cms.string(
""),
255 residualCorrEtaMax = cms.double(9.9),
256 residualCorrOffset = cms.double(1.),
257 extraCorrFactor = cms.double(1.),
258 isMC = cms.bool(
True),
259 srcGenPileUpSummary = cms.InputTag(
'addPileupInfo'),
260 residualCorrVsNumPileUp = cms.PSet(
262 offset = cms.FileInPath(
'JetMETCorrections/Type1MET/data/unclEnResidualCorr_Data_runs190456to208686_pfCands_offset.txt'),
263 slope = cms.FileInPath(
'JetMETCorrections/Type1MET/data/unclEnResidualCorr_Data_runs190456to208686_pfCands_slope.txt')
266 offset = cms.FileInPath(
'JetMETCorrections/Type1MET/data/unclEnResidualCorr_ZplusJets_madgraph_pfCands_offset.txt'),
267 slope = cms.FileInPath(
'JetMETCorrections/Type1MET/data/unclEnResidualCorr_ZplusJets_madgraph_pfCands_slope.txt')
270 verbosity = cms.int32(0)
272 setattr(process,
"pfCandMETresidualCorr" + postfix, pfCandMETresidualCorr)
273 getattr(process,
"producePatPFMETCorrectionsUnc" + postfix).
replace(pfCandMETcorr, pfCandMETcorr + pfCandMETresidualCorr)
def propagateERShiftedJets
def applyUnclEnergyCalibrationOnPfT1T2Met
def propagateShiftedSingleParticles
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
def propagateMEtUncertainties