CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
common Namespace Reference

Functions

def analyzers_by_type
 
def esproducers_by_type
 
def filters_by_type
 
def producers_by_type
 
def replace_with
 

Function Documentation

def common.analyzers_by_type (   process,
  types 
)

Definition at line 11 of file common.py.

11 
12 def analyzers_by_type(process, *types):
13  "Find all EDAnalyzers in the Process that are instances of the given C++ type."
14  return (analyzer for analyzer in process._Process__analyzers.values() if analyzer._TypedParameterizable__type in types)
def analyzers_by_type
Definition: common.py:11
def common.esproducers_by_type (   process,
  types 
)

Definition at line 15 of file common.py.

Referenced by customizeHLTforCMSSW.customiseFor14833(), customizeHLTforCMSSW.customiseFor16670(), and customizeHLTTrackingForPhaseI2017.customizeHLTPhaseIPixelGeom().

15 
16 def esproducers_by_type(process, *types):
17  "Find all ESProducers in the Process that are instances of the given C++ type."
18  return (module for module in process._Process__esproducers.values() if module._TypedParameterizable__type in types)
19 
20 
# logic from Modifier.toModify from FWCore/ParameterSet/python/Config.py
def esproducers_by_type
Definition: common.py:15
def common.filters_by_type (   process,
  types 
)

Definition at line 7 of file common.py.

7 
8 def filters_by_type(process, *types):
9  "Find all EDFilters in the Process that are instances of the given C++ type."
10  return (filter for filter in process._Process__filters.values() if filter._TypedParameterizable__type in types)
def filters_by_type
Definition: common.py:7
def common.producers_by_type (   process,
  types 
)

Definition at line 3 of file common.py.

Referenced by customizeHLTforCMSSW.customiseFor13753(), customizeHLTforCMSSW.customiseFor15440(), customizeHLTforCMSSW.customiseFor15499(), customizeHLTforCMSSW.customiseFor16792(), customizeHLTforCMSSW.customiseFor17098(), customizeHLTforCMSSW.customiseFor17170(), customizeHLTforHighPU.customizeHLTforHighPU(), and customizeHLTTrackingForPhaseI2017.customizeHLTPhaseIPixelGeom().

3 
4 def producers_by_type(process, *types):
5  "Find all EDProducers in the Process that are instances of the given C++ type."
6  return (module for module in process._Process__producers.values() if module._TypedParameterizable__type in types)
def producers_by_type
Definition: common.py:3
def common.replace_with (   fromObj,
  toObj 
)
Replace one object with a different one of the same type.

This function replaces the contents of `fromObj` object with those of `toObj`,
so all references ot it remain valid.

Definition at line 21 of file common.py.

Referenced by customizeHLTTrackingForPhaseI2017.customizeHLTForPFTrackingPhaseI2017().

21 
22 def replace_with(fromObj, toObj):
23  """Replace one object with a different one of the same type.
24 
25  This function replaces the contents of `fromObj` object with those of `toObj`,
26  so all references ot it remain valid.
27  """
28 
29  if type(toObj) != type(fromObj):
30  raise TypeError('replaceWith requires both arguments to be the same type')
31 
32  if isinstance(toObj, cms._ModuleSequenceType):
33  fromObj._seq = toObj._seq
34 
35  elif isinstance(toObj, cms._Parameterizable):
36  # delete the old items, in case `toObj` is not a complete superset of `fromObj`
37  for p in fromObj.parameterNames_():
38  delattr(fromObj, p)
39  for p in toObj.parameterNames_():
40  setattr(fromObj, p, getattr(toObj, p))
41  if isinstance(toObj, cms._TypedParameterizable):
42  fromObj._TypedParameterizable__type = toObj._TypedParameterizable__type
43 
44  else:
45  raise TypeError('replaceWith does not work with "%s" objects' % str(type(fromObj)))
46 
def replace_with
Definition: common.py:21