3 from PhysicsTools.SelectorUtils.centralIDRegistry
import central_id_registry
10 if not hasattr(cutflow,
'idName'):
11 raise Exception(
'InvalidVIDCutFlow',
'The cutflow configuation provided is malformed and does not have a specified name!')
12 if not hasattr(cutflow,
'cutFlow'):
13 raise Exception(
'InvalidVIDCutFlow',
'The cutflow configuration provided is malformed and does not have a specific cutflow!')
14 cutflow_md5 = central_id_registry.getMD5FromName(cutflow.idName)
15 vidproducer.physicsObjectIDs.append(
16 cms.PSet( idDefinition = cutflow,
17 idMD5 = cms.string(cutflow_md5) )
19 print 'Added ID \'%s\' to %s'%(cutflow.idName.value(),vidproducer.label())
23 for key
in patProducer.__dict__.keys():
24 if 'IDSources' in key:
25 patProducerIDs = getattr(patProducer,key)
26 if patProducerIDs
is None:
27 raise Exception(
'StrangePatModule',
'%s does not have ID sources!'%patProducer.label())
28 setattr(patProducerIDs,idName,cms.InputTag(
'%s:%s'%(idProducer,idName)))
29 print '\t--- %s:%s added to %s'%(idProducer,idName,patProducer.label())
33 idmod= __import__(id_module_name, globals(), locals(), [
'idName',
'cutFlow'])
34 for name
in dir(idmod):
35 item = getattr(idmod,name)
36 if hasattr(item,
'idName')
and hasattr(item,
'cutFlow'):
37 setupFunction(process,item,patProducer)
46 process.load(
'RecoEgamma.ElectronIdentification.egmGsfElectronIDs_cff')
47 print 'Added \'egmGsfElectronIDs\' to process definition!'
50 if not hasattr(process,
'egmGsfElectronIDs'):
51 raise Exception(
'VIDProducerNotAvailable',
'egmGsfElectronIDs producer not available in process!')
54 if hasattr(process,
'patElectrons')
or patProducer
is not None:
55 if patProducer
is None:
56 patProducer = process.patElectrons
57 idName = cutflow.idName.value()