CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
Config.Modifier Class Reference
Inheritance diagram for Config.Modifier:

Public Member Functions

def __init__
 
def isChosen
 
def makeProcessModifier
 
def toModify
 

Private Member Functions

def _setChosen
 

Private Attributes

 __chosen
 
 __processModifiers
 

Detailed Description

This class is used to define standard modifications to a Process.
An instance of this class is declared to denote a specific modification,e.g. era2017 could
reconfigure items in a process to match our expectation of running in 2017. Once declared,
these Modifier instances are imported into a configuration and items which need to be modified
are then associated with the Modifier and with the action to do the modification.
The registered modifications will only occur if the Modifier was passed to 
the cms.Process' constructor.

Definition at line 1090 of file Config.py.

Constructor & Destructor Documentation

def Config.Modifier.__init__ (   self)

Definition at line 1099 of file Config.py.

1100  def __init__(self):
self.__chosen = False

Member Function Documentation

def Config.Modifier._setChosen (   self)
private
Should only be called by cms.Process instances

Definition at line 1124 of file Config.py.

References Config.Modifier.__chosen.

1125  def _setChosen(self):
1126  """Should only be called by cms.Process instances"""
self.__chosen = True
def Config.Modifier.isChosen (   self)

Definition at line 1127 of file Config.py.

References Config.Modifier.__chosen.

Referenced by Config.Modifier.toModify().

1128  def isChosen(self):
1129  return self.__chosen
def Config.Modifier.makeProcessModifier (   self,
  func 
)
This is used to create a ProcessModifer which can perform actions on the process as a whole.
   This takes as argument a callable object (e.g. function) which takes as its sole argument an instance of Process.
   In order to work, the value returned from this function must be assigned to a uniquely named variable.

Definition at line 1102 of file Config.py.

1103  def makeProcessModifier(self,func):
1104  """This is used to create a ProcessModifer which can perform actions on the process as a whole.
1105  This takes as argument a callable object (e.g. function) which takes as its sole argument an instance of Process.
1106  In order to work, the value returned from this function must be assigned to a uniquely named variable.
1107  """
return ProcessModifier(self,func)
def makeProcessModifier
Definition: Config.py:1102
def Config.Modifier.toModify (   self,
  obj,
  func = None,
  kw 
)
This is used to register an action to be performed on the specific object. Two different forms are allowed
Form 1: A callable object (e.g. function) can be passed as the second. This callable object is expected to take one argument
which will be the object passed in as the first argument.
Form 2: A list of parameter name, value pairs can be passed
   mod.toModify(foo, fred=cms.int32(7), barney = cms.double(3.14))

Definition at line 1108 of file Config.py.

References Config.Modifier.isChosen(), and groupFilesInBlocks.temp.

1109  def toModify(self,obj, func=None,**kw):
1110  """This is used to register an action to be performed on the specific object. Two different forms are allowed
1111  Form 1: A callable object (e.g. function) can be passed as the second. This callable object is expected to take one argument
1112  which will be the object passed in as the first argument.
1113  Form 2: A list of parameter name, value pairs can be passed
1114  mod.toModify(foo, fred=cms.int32(7), barney = cms.double(3.14))
1115  """
1116  if func is not None and len(kw) != 0:
1117  raise TypeError("toModify takes either two arguments or one argument and key/value pairs")
1118  if not self.isChosen():
1119  return
1120  if func is not None:
1121  func(obj)
1122  else:
1123  temp =_ParameterModifier(kw)
temp(obj)

Member Data Documentation

Config.Modifier.__chosen
private

Definition at line 1101 of file Config.py.

Referenced by Config.Modifier._setChosen(), Config.ModifierChain._setChosen(), Config.Modifier.isChosen(), and Config.ModifierChain.isChosen().

Config.Modifier.__processModifiers
private

Definition at line 1100 of file Config.py.