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)
39 "Add the `modules` after the `target` in any Sequence, Paths or EndPath that contains the latter." 40 for sequence
in itertools.chain(
41 process._Process__sequences.itervalues(),
42 process._Process__paths.itervalues(),
43 process._Process__endpaths.itervalues()
46 position = sequence.index(target)
50 for module
in reversed(modules):
51 sequence.insert(position+1, module)
56 """Replace one object with a different one of the same type. 58 This function replaces the contents of `fromObj` object with those of `toObj`, 59 so all references ot it remain valid. 62 if type(toObj) != type(fromObj):
63 raise TypeError(
'replaceWith requires both arguments to be the same type')
65 if isinstance(toObj, cms._ModuleSequenceType):
66 fromObj._seq = toObj._seq
68 elif isinstance(toObj, cms._Parameterizable):
70 for p
in fromObj.parameterNames_():
72 for p
in toObj.parameterNames_():
73 setattr(fromObj, p, getattr(toObj, p))
74 if isinstance(toObj, cms._TypedParameterizable):
75 fromObj._TypedParameterizable__type = toObj._TypedParameterizable__type
78 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 insert_modules_after(process, target, modules)
def analyzers_by_type(process, types)
def esproducers_by_type(process, types)