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_cff")
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 
16  # Load tasks for isolations computed with CITK for both AOD and miniAOD cases
17  process.egmPhotonIDTask = cms.Task()
18  # The isolation piece is different depending on the input format
19  if dataFormat== DataFormat.AOD:
20  process.load("RecoEgamma.EgammaIsolationAlgos.egmPhotonIsolationAOD_cff")
21  #if particleFlowTmpPtrs was not create we should create it
22  if not hasattr(process, "particleFlowTmpPtrs"):
23  process.particleFlowTmpPtrs = cms.EDProducer("PFCandidateFwdPtrProducer",
24  src = cms.InputTag('particleFlow')
25  )
26  process.egmPhotonIDTask.add(process.particleFlowTmpPtrs,
27  process.egmPhotonIsolationAODTask)
28  else :
29  process.egmPhotonIDTask.add(process.egmPhotonIsolationAODTask)
30 
31  elif dataFormat== DataFormat.MiniAOD:
32  process.load("RecoEgamma.EgammaIsolationAlgos.egmPhotonIsolationMiniAOD_cff")
33  process.egmPhotonIDTask.add(process.egmPhotonIsolationMiniAODTask)
34  else:
35  raise Exception('InvalidVIDDataFormat', 'The requested data format is different from AOD or MiniAOD')
36  # Add everything else other then isolation
37  process.egmPhotonIDTask.add(process.photonIDValueMapProducer,
38  process.photonMVAValueMapProducer,
39  process.egmPhotonIDs)
40  process.egmPhotonIDSequence = cms.Sequence(process.egmPhotonIDTask)
def loadEgmIdSequence(process, dataFormat)