3 from PhysicsTools.SelectorUtils.centralIDRegistry
import central_id_registry
12 if not hasattr(cutflow,
'idName'):
13 raise Exception(
'InvalidVIDCutFlow',
'The cutflow configuation provided is malformed and does not have a specified name!')
14 if not hasattr(cutflow,
'cutFlow'):
15 raise Exception(
'InvalidVIDCutFlow',
'The cutflow configuration provided is malformed and does not have a specific cutflow!')
16 cutflow_md5 = central_id_registry.getMD5FromName(cutflow.idName)
17 isPOGApproved = cms.untracked.bool(
False)
18 if hasattr(cutflow,
'isPOGApproved'):
19 isPOGApproved = cutflow.isPOGApproved
20 del cutflow.isPOGApproved
21 vidproducer.physicsObjectIDs.append(
22 cms.PSet( idDefinition = cutflow,
23 isPOGApproved = isPOGApproved,
24 idMD5 = cms.string(cutflow_md5) )
26 sys.stderr.write(
'Added ID \'%s\' to %s\n'%(cutflow.idName.value(),vidproducer.label()))
31 for key
in patProducer.__dict__.keys():
32 if 'IDSources' in key:
33 patProducerIDs = getattr(patProducer,key)
35 userDatas = getattr(patProducer,key)
36 if patProducerIDs
is None:
37 raise Exception(
'StrangePatModule',
'%s does not have ID sources!'%patProducer.label())
39 raise Exception(
'StrangePatModule',
'%s does not have UserData sources!'%patProducer.label())
40 setattr(patProducerIDs,idName,cms.InputTag(
'%s:%s'%(idProducer,idName)))
41 if( len(userDatas.userClasses.src) == 1
and
42 type(userDatas.userClasses.src[0])
is str
and
43 userDatas.userClasses.src[0] ==
'' ):
44 userDatas.userClasses.src = cms.VInputTag(cms.InputTag(
'%s:%s'%(idProducer,idName)))
46 userDatas.userClasses.src.append(cms.InputTag(
'%s:%s'%(idProducer,idName)))
47 sys.stderr.write(
'\t--- %s:%s added to %s\n'%(idProducer,idName,patProducer.label()))
51 idmod= __import__(id_module_name, globals(), locals(), [
'idName',
'cutFlow'])
52 for name
in dir(idmod):
53 item = getattr(idmod,name)
54 if hasattr(item,
'idName')
and hasattr(item,
'cutFlow'):
55 setupFunction(process,item,patProducer)
69 process.load(
'RecoEgamma.ElectronIdentification.egmGsfElectronIDs_cff')
70 dataFormatString =
"Undefined"
71 if dataFormat == DataFormat.AOD:
73 dataFormatString =
"AOD"
74 elif dataFormat == DataFormat.MiniAOD:
77 process.egmGsfElectronIDs.physicsObjectSrc = cms.InputTag(
'slimmedElectrons')
78 dataFormatString =
"MiniAOD"
80 raise Exception(
'InvalidVIDDataFormat',
'The requested data format is different from AOD or MiniAOD')
82 sys.stderr.write(
'Added \'egmGsfElectronIDs\' to process definition (%s format)!\n' % dataFormatString)
85 if not hasattr(process,
'egmGsfElectronIDs'):
86 raise Exception(
'VIDProducerNotAvailable',
'egmGsfElectronIDs producer not available in process!')
89 if hasattr(process,
'patElectrons')
or patProducer
is not None:
90 if patProducer
is None:
91 patProducer = process.patElectrons
92 idName = cutflow.idName.value()
102 process.load(
'RecoMuon.MuonIdentification.muoMuonIDs_cff')
103 dataFormatString =
"Undefined"
104 if dataFormat == DataFormat.AOD:
106 dataFormatString =
"AOD"
107 elif dataFormat == DataFormat.MiniAOD:
110 process.muoMuonIDs.physicsObjectSrc = cms.InputTag(
'slimmedMuons')
111 dataFormatString =
"MiniAOD"
113 raise Exception(
'InvalidVIDDataFormat',
'The requested data format is different from AOD or MiniAOD')
115 sys.stderr.write(
'Added \'muoMuonIDs\' to process definition (%s format)!\n' % dataFormatString)
118 moduleName =
"muoMuonIDs"
119 if not hasattr(process, moduleName):
120 raise Exception(
"VIDProducerNotAvailable",
"%s producer not available in process!" % moduleName)
136 process.load(
'RecoEgamma.PhotonIdentification.egmPhotonIDs_cff')
137 dataFormatString =
"Undefined"
138 if dataFormat == DataFormat.AOD:
140 dataFormatString =
"AOD"
141 elif dataFormat == DataFormat.MiniAOD:
144 process.egmPhotonIDs.physicsObjectSrc = cms.InputTag(
'slimmedPhotons')
145 dataFormatString =
"MiniAOD"
147 raise Exception(
'InvalidVIDDataFormat',
'The requested data format is different from AOD or MiniAOD')
149 sys.stderr.write(
'Added \'egmPhotonIDs\' to process definition (%s format)!\n' % dataFormatString)
152 if not hasattr(process,
'egmPhotonIDs'):
153 raise Exception(
'VIDProducerNotAvailable',
'egmPhotonIDs producer not available in process!\n')
156 if hasattr(process,
'patPhotons')
or patProducer
is not None:
157 if patProducer
is None:
158 patProducer = process.patPhotons
159 idName = cutflow.idName.value()
if(conf.exists("allCellsPositionCalc"))