Skip to content

Commit

Permalink
minor clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
veelken committed Mar 20, 2013
1 parent 1fa0f61 commit b3ed6a3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
16 changes: 6 additions & 10 deletions PhysicsTools/PatUtils/python/tools/jmeUncertaintyTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,23 +170,21 @@ def _addSmearedJets(self, process, jetCollection, smearedJetCollectionName_parts

def _propagateMEtUncertainties(self, process,
particleCollection, particleType, shiftType, particleCollectionShiftUp, particleCollectionShiftDown,
metProducer, sequence, postfix):
metProducer, metType, sequence, postfix):

# produce MET correction objects
# (sum of differences in four-momentum between original and up/down shifted particle collection)
moduleMETcorrShiftUp = cms.EDProducer("ShiftedParticleMETcorrInputProducer",
srcOriginal = cms.InputTag(particleCollection),
srcShifted = cms.InputTag(particleCollectionShiftUp)
srcShifted = cms.InputTag(particleCollectionShiftUp)
)
moduleMETcorrShiftUpName = "patPFMETcorr%s%sUp" % (particleType, shiftType)
moduleMETcorrShiftUpName += postfix
moduleMETcorrShiftUpName = "pat%sMETcorr%s%sUp%s" % (metType, particleType, shiftType, postfix)
setattr(process, moduleMETcorrShiftUpName, moduleMETcorrShiftUp)
sequence += moduleMETcorrShiftUp
moduleMETcorrShiftDown = moduleMETcorrShiftUp.clone(
srcShifted = cms.InputTag(particleCollectionShiftDown)
)
moduleMETcorrShiftDownName = "patPFMETcorr%s%sDown" % (particleType, shiftType)
moduleMETcorrShiftDownName += postfix
moduleMETcorrShiftDownName = "pat%sMETcorr%s%sDown%s" % (metType, particleType, shiftType, postfix)
setattr(process, moduleMETcorrShiftDownName, moduleMETcorrShiftDown)
sequence += moduleMETcorrShiftDown

Expand All @@ -203,17 +201,15 @@ def _propagateMEtUncertainties(self, process,
metProducerLabel = metProducerLabel[0:-len(postfix)]
else:
raise StandardError("Tried to remove postfix %s from label %s, but it wasn't there" % (postfix, metProducerLabel))
moduleMETshiftUpName = "%s%s%sUp" % (metProducerLabel, particleType, shiftType)
moduleMETshiftUpName += postfix
moduleMETshiftUpName = "%s%s%sUp%s" % (metProducerLabel, particleType, shiftType, postfix)
setattr(process, moduleMETshiftUpName, moduleMETshiftUp)
sequence += moduleMETshiftUp
moduleMETshiftDown = moduleMETshiftUp.clone(
srcType1Corrections = cms.VInputTag(
cms.InputTag(moduleMETcorrShiftDownName)
)
)
moduleMETshiftDownName = "%s%s%sDown" % (metProducerLabel, particleType, shiftType)
moduleMETshiftDownName += postfix
moduleMETshiftDownName = "%s%s%sDown%s" % (metProducerLabel, particleType, shiftType, postfix)
setattr(process, moduleMETshiftDownName, moduleMETshiftDown)
sequence += moduleMETshiftDown

Expand Down
14 changes: 7 additions & 7 deletions PhysicsTools/PatUtils/python/tools/runType1PFMEtUncertainties.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,14 @@ def _addCorrPFMEt(self, process, metUncertaintySequence,
self._propagateMEtUncertainties(
process, shiftedParticleCollections['lastJetCollection'], "Jet", "En",
shiftedParticleCollections['jetCollectionEnUpForRawMEt'], shiftedParticleCollections['jetCollectionEnDownForRawMEt'],
getattr(process, "patPFMet" + postfix), metUncertaintySequence, postfix)
getattr(process, "patPFMet" + postfix), "PF", metUncertaintySequence, postfix)
collectionsToKeep.extend(metCollectionsUp_DownForRawMEt)

metCollectionsUp_DownForCorrMEt = \
self._propagateMEtUncertainties(
process, shiftedParticleCollections['lastJetCollection'], "Jet", "En",
shiftedParticleCollections['jetCollectionEnUpForCorrMEt'], shiftedParticleCollections['jetCollectionEnDownForCorrMEt'],
getattr(process, "patType1CorrectedPFMet" + postfix), metUncertaintySequence, postfix)
getattr(process, "patType1CorrectedPFMet" + postfix), "PF", metUncertaintySequence, postfix)
collectionsToKeep.extend(metCollectionsUp_DownForCorrMEt)

# propagate shifts in jet energy to Type 1 + 2 corrected MET
Expand Down Expand Up @@ -244,7 +244,7 @@ def _addCorrPFMEt(self, process, metUncertaintySequence,
self._propagateMEtUncertainties(
process, shiftedParticleCollections['lastJetCollection'], "Jet", "Res",
shiftedParticleCollections['jetCollectionResUp'], shiftedParticleCollections['jetCollectionResDown'],
metProducer, metUncertaintySequence, postfix)
metProducer, "PF", metUncertaintySequence, postfix)
collectionsToKeep.extend(metCollectionsUp_Down)

# propagate shifts in jet resolution to Type 1 + 2 corrected MET
Expand Down Expand Up @@ -412,31 +412,31 @@ def _addCorrPFMEt(self, process, metUncertaintySequence,
self._propagateMEtUncertainties(
process, shiftedParticleCollections['electronCollection'].value(), "Electron", "En",
shiftedParticleCollections['electronCollectionEnUp'], shiftedParticleCollections['electronCollectionEnDown'],
metProducer, metUncertaintySequence, postfix)
metProducer, "PF", metUncertaintySequence, postfix)
collectionsToKeep.extend(metCollectionsUp_Down)

if self._isValidInputTag(shiftedParticleCollections['photonCollection']):
metCollectionsUp_Down = \
self._propagateMEtUncertainties(
process, shiftedParticleCollections['photonCollection'].value(), "Photon", "En",
shiftedParticleCollections['photonCollectionEnUp'], shiftedParticleCollections['photonCollectionEnDown'],
metProducer, metUncertaintySequence, postfix)
metProducer, "PF", metUncertaintySequence, postfix)
collectionsToKeep.extend(metCollectionsUp_Down)

if self._isValidInputTag(shiftedParticleCollections['muonCollection']):
metCollectionsUp_Down = \
self._propagateMEtUncertainties(
process, shiftedParticleCollections['muonCollection'].value(), "Muon", "En",
shiftedParticleCollections['muonCollectionEnUp'], shiftedParticleCollections['muonCollectionEnDown'],
metProducer, metUncertaintySequence, postfix)
metProducer, "PF", metUncertaintySequence, postfix)
collectionsToKeep.extend(metCollectionsUp_Down)

if self._isValidInputTag(shiftedParticleCollections['tauCollection']):
metCollectionsUp_Down = \
self._propagateMEtUncertainties(
process, shiftedParticleCollections['tauCollection'].value(), "Tau", "En",
shiftedParticleCollections['tauCollectionEnUp'], shiftedParticleCollections['tauCollectionEnDown'],
metProducer, metUncertaintySequence, postfix)
metProducer, "PF", metUncertaintySequence, postfix)
collectionsToKeep.extend(metCollectionsUp_Down)

def __call__(self, process,
Expand Down

0 comments on commit b3ed6a3

Please sign in to comment.