CMS 3D CMS Logo

egmPhotonIDs_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
3 from PhysicsTools.SelectorUtils.tools.DataFormat import DataFormat
4 
5 def loadEgmIdSequence(process, dataFormat):
6  process.load("RecoEgamma.PhotonIdentification.egmPhotonIDs_cfi")
7  from PhysicsTools.SelectorUtils.centralIDRegistry import central_id_registry
8 
9  # Load the producer module to build full 5x5 cluster shapes and whatever
10  # else is needed for IDs
11  process.load("RecoEgamma.PhotonIdentification.PhotonIDValueMapProducer_cfi")
12 
13  # Load the producer for MVA IDs. Make sure it is also added to the sequence!
14  process.load("RecoEgamma.PhotonIdentification.PhotonMVAValueMapProducer_cfi")
15  process.load("RecoEgamma.PhotonIdentification.PhotonRegressionValueMapProducer_cfi")
16 
17  # Load tasks for isolations computed with CITK for both AOD and miniAOD cases
18  process.egmPhotonIDTask = cms.Task()
19  # The isolation piece is different depending on the input format
20  if dataFormat== DataFormat.AOD:
21  process.load("RecoEgamma.EgammaIsolationAlgos.egmPhotonIsolationAOD_cff")
22  #if particleFlowTmpPtrs was not create we should create it
23  if not hasattr(process, "particleFlowTmpPtrs"):
24  process.particleFlowTmpPtrs = cms.EDProducer("PFCandidateFwdPtrProducer",
25  src = cms.InputTag('particleFlow')
26  )
27  process.egmPhotonIDTask.add(process.particleFlowTmpPtrs,
28  process.egmPhotonIsolationAODTask)
29  else :
30  process.egmPhotonIDTask.add(process.egmPhotonIsolationAODTask)
31 
32  elif dataFormat== DataFormat.MiniAOD:
33  process.load("RecoEgamma.EgammaIsolationAlgos.egmPhotonIsolationMiniAOD_cff")
34  process.egmPhotonIDTask.add(process.egmPhotonIsolationMiniAODTask)
35  else:
36  raise Exception('InvalidVIDDataFormat', 'The requested data format is different from AOD or MiniAOD')
37  # Add everything else other then isolation
38  process.egmPhotonIDTask.add(process.photonIDValueMapProducer,
39  process.photonMVAValueMapProducer,
40  process.egmPhotonIDs,
41  process.photonRegressionValueMapProducer)
42  process.egmPhotonIDSequence = cms.Sequence(process.egmPhotonIDTask)
def loadEgmIdSequence(process, dataFormat)