File indexing completed on 2024-04-06 12:25:04
0001 import FWCore.ParameterSet.Config as cms
0002
0003 """
0004 makes a modifier config to load all the cutbased VID bits into the pat::Electron/pat::Photon userdata
0005 any ID which starts with "mva" will not be stored
0006 """
0007 def makeVIDBitsModifier(process,eleVIDModuleName,phoVIDModuleName):
0008 vidCutBitsModifier = cms.PSet(
0009 modifierName = cms.string('EGExtraInfoModifierFromUIntToIntValueMaps'),
0010 electron_config = cms.PSet(),
0011 photon_config = cms.PSet()
0012 )
0013
0014 phoVIDModule = getattr(process,phoVIDModuleName)
0015 for egid in phoVIDModule.physicsObjectIDs:
0016 if egid.idDefinition.idName.value().find("mva")!=0:
0017 setattr(vidCutBitsModifier.photon_config,egid.idDefinition.idName.value(),cms.InputTag(phoVIDModuleName+':'+egid.idDefinition.idName.value()+"Bitmap"))
0018
0019 eleVIDModule = getattr(process,eleVIDModuleName)
0020 for egid in eleVIDModule.physicsObjectIDs:
0021 if egid.idDefinition.idName.value().find("mva")!=0:
0022 setattr(vidCutBitsModifier.electron_config,egid.idDefinition.idName.value(),cms.InputTag(eleVIDModuleName+':'+egid.idDefinition.idName.value()+"Bitmap"))
0023
0024 return vidCutBitsModifier
0025
0026 """
0027 make a modifer config to load all the VID ids into the pat::Electron/pat::Photon electron/photonIDs
0028 """
0029 def makeVIDinPATIDsModifier(process,eleVIDModuleName,phoVIDModuleName):
0030 vidInPATIDsModifier = cms.PSet(
0031 modifierName = cms.string('EGExtraInfoModifierFromEGIDValueMaps'),
0032 electron_config = cms.PSet(),
0033 photon_config = cms.PSet()
0034 )
0035 phoVIDModule = getattr(process,phoVIDModuleName)
0036 for egid in phoVIDModule.physicsObjectIDs:
0037 setattr(vidInPATIDsModifier.photon_config,egid.idDefinition.idName.value(),cms.InputTag(phoVIDModuleName+':'+egid.idDefinition.idName.value()))
0038
0039 eleVIDModule = getattr(process,eleVIDModuleName)
0040 for egid in eleVIDModule.physicsObjectIDs:
0041 setattr(vidInPATIDsModifier.electron_config,egid.idDefinition.idName.value(),cms.InputTag(eleVIDModuleName+':'+egid.idDefinition.idName.value()))
0042
0043 return vidInPATIDsModifier
0044
0045
0046
0047 def makeEnergyScaleAndSmearingSysModifier(eleProdName,phoProdName):
0048 energyScaleAndSmearing = cms.PSet(
0049 modifierName = cms.string('EGExtraInfoModifierFromFloatValueMaps'),
0050 electron_config = cms.PSet(),
0051 photon_config = cms.PSet()
0052 )
0053
0054 from RecoEgamma.EgammaTools.calibratedEgammas_cff import prefixName
0055 import RecoEgamma.EgammaTools.calibratedElectronProducer_cfi
0056 for valueMapName in RecoEgamma.EgammaTools.calibratedElectronProducer_cfi.calibratedElectronProducer.valueMapsStored:
0057 setattr(energyScaleAndSmearing.electron_config,valueMapName,cms.InputTag(eleProdName,valueMapName))
0058 import RecoEgamma.EgammaTools.calibratedPhotonProducer_cfi
0059 for valueMapName in RecoEgamma.EgammaTools.calibratedPhotonProducer_cfi.calibratedPhotonProducer.valueMapsStored:
0060 setattr(energyScaleAndSmearing.photon_config,valueMapName,cms.InputTag(phoProdName,valueMapName))
0061 return energyScaleAndSmearing