Esempio n. 1
0
def calibrateReducedEgamma(process):
    process.load("RecoEgamma.EgammaTools.calibratedEgammas_cff")
    process.calibratedPhotons.produceCalibratedObjs = False
    process.calibratedElectrons.produceCalibratedObjs = False
    process.slimmingTask.add(process.calibratedPhotons)
    process.slimmingTask.add(process.calibratedElectrons)
    process.reducedEgamma.applyPhotonCalibOnData = False
    process.reducedEgamma.applyPhotonCalibOnMC = False
    process.reducedEgamma.applyGsfElectronCalibOnData = False
    process.reducedEgamma.applyGsfElectronCalibOnMC = False
    process.reducedEgamma.photonCalibEnergySource = cms.InputTag("calibratedPhotons","ecalEnergyPostCorr")
    process.reducedEgamma.photonCalibEnergyErrSource = cms.InputTag("calibratedPhotons","ecalEnergyErrPostCorr")
    process.reducedEgamma.gsfElectronCalibEnergySource = cms.InputTag("calibratedElectrons","ecalTrkEnergyPostCorr")
    process.reducedEgamma.gsfElectronCalibEnergyErrSource = cms.InputTag("calibratedElectrons","ecalTrkEnergyErrPostCorr")

    process.reducedEgamma.gsfElectronCalibEcalEnergySource = cms.InputTag("calibratedElectrons","ecalEnergyPostCorr")
    process.reducedEgamma.gsfElectronCalibEcalEnergyErrSource = cms.InputTag("calibratedElectrons","ecalEnergyErrPostCorr")
    from RecoEgamma.EgammaTools.calibratedEgammas_cff import prefixName
    import RecoEgamma.EgammaTools.calibratedElectronProducer_cfi
    for valueMapName in RecoEgamma.EgammaTools.calibratedElectronProducer_cfi.calibratedElectronProducer.valueMapsStored:
        process.reducedEgamma.gsfElectronFloatValueMapSources.append(cms.InputTag("calibratedElectrons",valueMapName))
        process.reducedEgamma.gsfElectronFloatValueMapOutput.append(prefixName("calibEle",valueMapName))
    import RecoEgamma.EgammaTools.calibratedPhotonProducer_cfi
    for valueMapName in RecoEgamma.EgammaTools.calibratedPhotonProducer_cfi.calibratedPhotonProducer.valueMapsStored:
        process.reducedEgamma.photonFloatValueMapSources.append(cms.InputTag("calibratedPhotons",valueMapName))
        process.reducedEgamma.photonFloatValueMapOutput.append(prefixName("calibPho",valueMapName))
#from RecoEgamma.EgammaTools.regressionModifier_cfi import *

#egamma_modifications.append( regressionModifier )

#############################################################
# Scale and Smearing Modifiers
#############################################################
reducedEgammaEnergyScaleAndSmearingModifier = cms.PSet(
    modifierName    = cms.string('EGExtraInfoModifierFromFloatValueMaps'),
    electron_config = cms.PSet(),
    photon_config   = cms.PSet()
)
from RecoEgamma.EgammaTools.calibratedEgammas_cff import prefixName
import RecoEgamma.EgammaTools.calibratedElectronProducer_cfi
for valueMapName in RecoEgamma.EgammaTools.calibratedElectronProducer_cfi.calibratedElectronProducer.valueMapsStored:
    setattr(reducedEgammaEnergyScaleAndSmearingModifier.electron_config,valueMapName,cms.InputTag("reducedEgamma",prefixName("calibEle",valueMapName)))

import RecoEgamma.EgammaTools.calibratedPhotonProducer_cfi
for valueMapName in RecoEgamma.EgammaTools.calibratedPhotonProducer_cfi.calibratedPhotonProducer.valueMapsStored:
    setattr(reducedEgammaEnergyScaleAndSmearingModifier.photon_config,valueMapName,cms.InputTag("reducedEgamma",prefixName("calibPho",valueMapName)))

#############################################################
# 8X to 9X modifiers (fills in variables new to 9X w.r.t 8X)
#############################################################
egamma8XObjectUpdateModifier = cms.PSet(
    modifierName  = cms.string('EG8XObjectUpdateModifier'),
    ecalRecHitsEB = cms.InputTag("reducedEgamma","reducedEBRecHits"),
    ecalRecHitsEE = cms.InputTag("reducedEgamma","reducedEERecHits"),
)

#############################################################
#egamma_modifications.append( regressionModifier )

#############################################################
# Scale and Smearing Modifiers
#############################################################
reducedEgammaEnergyScaleAndSmearingModifier = cms.PSet(
    modifierName=cms.string('EGExtraInfoModifierFromFloatValueMaps'),
    electron_config=cms.PSet(),
    photon_config=cms.PSet())
from RecoEgamma.EgammaTools.calibratedEgammas_cff import prefixName
import RecoEgamma.EgammaTools.calibratedElectronProducer_cfi
for valueMapName in RecoEgamma.EgammaTools.calibratedElectronProducer_cfi.calibratedElectronProducer.valueMapsStored:
    setattr(
        reducedEgammaEnergyScaleAndSmearingModifier.electron_config,
        valueMapName,
        cms.InputTag("reducedEgamma", prefixName("calibEle", valueMapName)))

import RecoEgamma.EgammaTools.calibratedPhotonProducer_cfi
for valueMapName in RecoEgamma.EgammaTools.calibratedPhotonProducer_cfi.calibratedPhotonProducer.valueMapsStored:
    setattr(
        reducedEgammaEnergyScaleAndSmearingModifier.photon_config,
        valueMapName,
        cms.InputTag("reducedEgamma", prefixName("calibPho", valueMapName)))

#############################################################
# 8X to 9X modifiers (fills in variables new to 9X w.r.t 8X)
#############################################################
egamma8XObjectUpdateModifier = cms.PSet(
    modifierName=cms.string('EG8XObjectUpdateModifier'),
    ecalRecHitsEB=cms.InputTag("reducedEgamma", "reducedEBRecHits"),
    ecalRecHitsEE=cms.InputTag("reducedEgamma", "reducedEERecHits"),
#from RecoEgamma.EgammaTools.regressionModifier_cfi import *

#egamma_modifications.append( regressionModifier )

#############################################################
# Scale and Smearing Modifiers
#############################################################
reducedEgammaEnergyScaleAndSmearingModifier = cms.PSet(
    modifierName    = cms.string('EGExtraInfoModifierFromFloatValueMaps'),
    electron_config = cms.PSet(),
    photon_config   = cms.PSet()
)
from RecoEgamma.EgammaTools.calibratedEgammas_cff import prefixName
import RecoEgamma.EgammaTools.calibratedElectronProducer_cfi
for valueMapName in RecoEgamma.EgammaTools.calibratedElectronProducer_cfi.calibratedElectronProducer.valueMapsStored:
    setattr(reducedEgammaEnergyScaleAndSmearingModifier.electron_config,valueMapName,cms.InputTag("reducedEgamma",prefixName("calibEle",valueMapName)))

import RecoEgamma.EgammaTools.calibratedPhotonProducer_cfi
for valueMapName in RecoEgamma.EgammaTools.calibratedPhotonProducer_cfi.calibratedPhotonProducer.valueMapsStored:
    setattr(reducedEgammaEnergyScaleAndSmearingModifier.photon_config,valueMapName,cms.InputTag("reducedEgamma",prefixName("calibPho",valueMapName)))

#############################################################
# 8X to 9X modifiers (fills in variables new to 9X w.r.t 8X)
#############################################################
egamma8XObjectUpdateModifier = cms.PSet(
    modifierName  = cms.string('EG8XObjectUpdateModifier'),
    ecalRecHitsEB = cms.InputTag("reducedEgamma","reducedEBRecHits"),
    ecalRecHitsEE = cms.InputTag("reducedEgamma","reducedEERecHits"),
)

#############################################################