1 import FWCore.ParameterSet.Config
as cms
4 "Find all EDProducers in the Process that are instances of the given C++ type."
5 return (module
for module
in process._Process__producers.values()
if module._TypedParameterizable__type
in types)
8 "Find all EDFilters in the Process that are instances of the given C++ type."
9 return (filter
for filter
in process._Process__filters.values()
if filter._TypedParameterizable__type
in types)
12 "Find all EDAnalyzers in the Process that are instances of the given C++ type."
13 return (analyzer
for analyzer
in process._Process__analyzers.values()
if analyzer._TypedParameterizable__type
in types)
16 "Find all ESProducers in the Process that are instances of the given C++ type."
17 return (module
for module
in process._Process__esproducers.values()
if module._TypedParameterizable__type
in types)
22 """Replace one object with a different one of the same type.
24 This function replaces the contents of `fromObj` object with those of `toObj`,
25 so all references ot it remain valid.
28 if type(toObj) != type(fromObj):
29 raise TypeError(
'replaceWith requires both arguments to be the same type')
31 if isinstance(toObj, cms._ModuleSequenceType):
32 fromObj._seq = toObj._seq
34 elif isinstance(toObj, cms._Parameterizable):
36 for p
in fromObj.parameterNames_():
38 for p
in toObj.parameterNames_():
39 setattr(fromObj, p, getattr(toObj, p))
40 if isinstance(toObj, cms._TypedParameterizable):
41 fromObj._TypedParameterizable__type = toObj._TypedParameterizable__type
44 raise TypeError(
'replaceWith does not work with "%s" objects' % str(type(fromObj)))