CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
egammaObjectModifications_tools.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
3 """
4 makes a modifier config to load all the cutbased VID bits into the pat::Electron/pat::Photon userdata
5 any ID which starts with "mva" will not be stored
6 """
7 def makeVIDBitsModifier(process,eleVIDModuleName,phoVIDModuleName):
8  vidCutBitsModifier = cms.PSet(
9  modifierName = cms.string('EGExtraInfoModifierFromUIntToIntValueMaps'),
10  electron_config = cms.PSet(),
11  photon_config = cms.PSet()
12  )
13 
14  phoVIDModule = getattr(process,phoVIDModuleName)
15  for egid in phoVIDModule.physicsObjectIDs:
16  if egid.idDefinition.idName.value().find("mva")!=0:
17  setattr(vidCutBitsModifier.photon_config,egid.idDefinition.idName.value(),cms.InputTag(phoVIDModuleName+':'+egid.idDefinition.idName.value()+"Bitmap"))
18 
19  eleVIDModule = getattr(process,eleVIDModuleName)
20  for egid in eleVIDModule.physicsObjectIDs:
21  if egid.idDefinition.idName.value().find("mva")!=0:
22  setattr(vidCutBitsModifier.electron_config,egid.idDefinition.idName.value(),cms.InputTag(eleVIDModuleName+':'+egid.idDefinition.idName.value()+"Bitmap"))
23 
24  return vidCutBitsModifier
25 
26 """
27 make a modifer config to load all the VID ids into the pat::Electron/pat::Photon electron/photonIDs
28 """
29 def makeVIDinPATIDsModifier(process,eleVIDModuleName,phoVIDModuleName):
30  vidInPATIDsModifier = cms.PSet(
31  modifierName = cms.string('EGExtraInfoModifierFromEGIDValueMaps'),
32  electron_config = cms.PSet(),
33  photon_config = cms.PSet()
34  )
35  phoVIDModule = getattr(process,phoVIDModuleName)
36  for egid in phoVIDModule.physicsObjectIDs:
37  setattr(vidInPATIDsModifier.photon_config,egid.idDefinition.idName.value(),cms.InputTag(phoVIDModuleName+':'+egid.idDefinition.idName.value()))
38 
39  eleVIDModule = getattr(process,eleVIDModuleName)
40  for egid in eleVIDModule.physicsObjectIDs:
41  setattr(vidInPATIDsModifier.electron_config,egid.idDefinition.idName.value(),cms.InputTag(eleVIDModuleName+':'+egid.idDefinition.idName.value()))
42 
43  return vidInPATIDsModifier
44 
45 
46 
47 def makeEnergyScaleAndSmearingSysModifier(eleProdName,phoProdName):
48  energyScaleAndSmearing = cms.PSet(
49  modifierName = cms.string('EGExtraInfoModifierFromFloatValueMaps'),
50  electron_config = cms.PSet(),
51  photon_config = cms.PSet()
52  )
53 
54  from RecoEgamma.EgammaTools.calibratedEgammas_cff import prefixName
55  import RecoEgamma.EgammaTools.calibratedElectronProducer_cfi
56  for valueMapName in RecoEgamma.EgammaTools.calibratedElectronProducer_cfi.calibratedElectronProducer.valueMapsStored:
57  setattr(energyScaleAndSmearing.electron_config,valueMapName,cms.InputTag(eleProdName,valueMapName))
58  import RecoEgamma.EgammaTools.calibratedPhotonProducer_cfi
59  for valueMapName in RecoEgamma.EgammaTools.calibratedPhotonProducer_cfi.calibratedPhotonProducer.valueMapsStored:
60  setattr(energyScaleAndSmearing.photon_config,valueMapName,cms.InputTag(phoProdName,valueMapName))
61  return energyScaleAndSmearing
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19