Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:50:41

0001 """
0002 Helper functions to extract the dictionary with
0003  - all EDFilters
0004  - all EDProducers
0005  - all EDAnalyzers
0006  - all modules
0007 either from a dictionary (either a cms.Process.__dict__ or from the locals() inside a _cff.py fragment)
0008 """
0009 
0010 import FWCore.ParameterSet.Config as cms
0011 
0012 def findEDFilters(holder):
0013   if isinstance(holder, cms.Process):
0014     return process.filters_()
0015   else:
0016     return dict( (name, module) for name, module in holder.items() if isinstance(module, cms.EDFilter) )
0017 
0018 
0019 def findEDProducers(holder):
0020   if isinstance(holder, cms.Process):
0021     return process.producers_()
0022   else:
0023     return dict( (name, module) for name, module in holder.items() if isinstance(module, cms.EDProducer) )
0024 
0025 
0026 def findEDAnalyzers(holder):
0027   if isinstance(holder, cms.Process):
0028     return process.analyzers_()
0029   else:
0030     return dict( (name, module) for name, module in holder.items() if isinstance(module, cms.EDAnalyzer) )
0031 
0032 
0033 def findModules(holder):
0034   if isinstance(holder, cms.Process):
0035     modules = dict()
0036     modules.upate(process.analyzers_())
0037     modules.upate(process.producers_())
0038     modules.upate(process.filters_())
0039     return modules
0040   else:
0041     return dict( (name, module) for name, module in holder.items() if isinstance(module, (cms.EDAnalyzer, _cms.EDProducer, _cms.EDFilter)) )
0042 
0043