CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
helper.py
Go to the documentation of this file.
1 """
2 Helper functions to extract the dictionary with
3  - all EDFilters
4  - all EDProducers
5  - all EDAnalyzers
6  - all modules
7 either from a dictionary (either a cms.Process.__dict__ or from the locals() inside a _cff.py fragment)
8 """
9 
10 import FWCore.ParameterSet.Config as cms
11 
12 def findEDFilters(holder):
13  if isinstance(holder, cms.Process):
14  return process.filters_()
15  else:
16  return dict( (name, module) for name, module in holder.iteritems() if isinstance(module, cms.EDFilter) )
17 
18 
19 def findEDProducers(holder):
20  if isinstance(holder, cms.Process):
21  return process.producers_()
22  else:
23  return dict( (name, module) for name, module in holder.iteritems() if isinstance(module, cms.EDProducer) )
24 
25 
26 def findEDAnalyzers(holder):
27  if isinstance(holder, cms.Process):
28  return process.analyzers_()
29  else:
30  return dict( (name, module) for name, module in holder.iteritems() if isinstance(module, cms.EDAnalyzer) )
31 
32 
33 def findModules(holder):
34  if isinstance(holder, cms.Process):
35  modules = dict()
36  modules.upate(process.analyzers_())
37  modules.upate(process.producers_())
38  modules.upate(process.filters_())
39  return modules
40  else:
41  return dict( (name, module) for name, module in holder.iteritems() if isinstance(module, (cms.EDAnalyzer, _cms.EDProducer, _cms.EDFilter)) )
42 
43 
def findEDAnalyzers
Definition: helper.py:26
def findModules
Definition: helper.py:33
def findEDProducers
Definition: helper.py:19
def findEDFilters
Definition: helper.py:12