3 import FWCore.ParameterSet.Config
as cms
6 "Find all EDProducers in the Process that are instances of the given C++ type." 7 return (module
for module
in process._Process__producers.values()
if module._TypedParameterizable__type
in types)
10 "Find all EDFilters in the Process that are instances of the given C++ type." 11 return (filter
for filter
in process._Process__filters.values()
if filter._TypedParameterizable__type
in types)
14 "Find all EDAnalyzers in the Process that are instances of the given C++ type." 15 return (analyzer
for analyzer
in process._Process__analyzers.values()
if analyzer._TypedParameterizable__type
in types)
18 "Find all ESProducers in the Process that are instances of the given C++ type." 19 return (module
for module
in process._Process__esproducers.values()
if module._TypedParameterizable__type
in types)
23 "Add the `modules` before the `target` in any Sequence, Paths or EndPath that contains the latter." 24 for sequence
in itertools.chain(
25 process._Process__sequences.itervalues(),
26 process._Process__paths.itervalues(),
27 process._Process__endpaths.itervalues()
30 position = sequence.index(target)
34 for module
in reversed(modules):
35 sequence.insert(position, module)
40 """Replace one object with a different one of the same type. 42 This function replaces the contents of `fromObj` object with those of `toObj`, 43 so all references ot it remain valid. 46 if type(toObj) != type(fromObj):
47 raise TypeError(
'replaceWith requires both arguments to be the same type')
49 if isinstance(toObj, cms._ModuleSequenceType):
50 fromObj._seq = toObj._seq
52 elif isinstance(toObj, cms._Parameterizable):
54 for p
in fromObj.parameterNames_():
56 for p
in toObj.parameterNames_():
57 setattr(fromObj, p, getattr(toObj, p))
58 if isinstance(toObj, cms._TypedParameterizable):
59 fromObj._TypedParameterizable__type = toObj._TypedParameterizable__type
62 raise TypeError(
'replaceWith does not work with "%s" objects' %
str(type(fromObj)))
def replace_with(fromObj, toObj)
def filters_by_type(process, types)
def insert_modules_before(process, target, modules)
def producers_by_type(process, types)
def analyzers_by_type(process, types)
def esproducers_by_type(process, types)