CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2_patch1/src/HLTrigger/Configuration/python/Tools/helper.py

Go to the documentation of this file.
00001 """
00002 Helper functions to extract the dictionary with
00003  - all EDFilters
00004  - all EDProducers
00005  - all EDAnalyzers
00006  - all modules
00007 either from a dictionary (either a cms.Process.__dict__ or from the locals() inside a _cff.py fragment)
00008 """
00009 
00010 import FWCore.ParameterSet.Config as cms
00011 
00012 def findEDFilters(holder):
00013   if isinstance(holder, cms.Process):
00014     return process.filters_()
00015   else:
00016     return dict( (name, module) for name, module in holder.iteritems() if isinstance(module, cms.EDFilter) )
00017 
00018 
00019 def findEDProducers(holder):
00020   if isinstance(holder, cms.Process):
00021     return process.producers_()
00022   else:
00023     return dict( (name, module) for name, module in holder.iteritems() if isinstance(module, cms.EDProducer) )
00024 
00025 
00026 def findEDAnalyzers(holder):
00027   if isinstance(holder, cms.Process):
00028     return process.analyzers_()
00029   else:
00030     return dict( (name, module) for name, module in holder.iteritems() if isinstance(module, cms.EDAnalyzer) )
00031 
00032 
00033 def findModules(holder):
00034   if isinstance(holder, cms.Process):
00035     modules = dict()
00036     modules.upate(process.analyzers_())
00037     modules.upate(process.producers_())
00038     modules.upate(process.filters_())
00039     return modules
00040   else:
00041     return dict( (name, module) for name, module in holder.iteritems() if isinstance(module, (cms.EDAnalyzer, _cms.EDProducer, _cms.EDFilter)) )
00042 
00043