ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
python.D3PDObject.DeferArg Class Reference
Inheritance diagram for python.D3PDObject.DeferArg:
Collaboration diagram for python.D3PDObject.DeferArg:

Public Member Functions

def __init__ (self, str, gdict=globals(), **kw)
 
def __call__ (self, hookargs={}, **kw)
 

Public Attributes

 str
 
 gdict
 
 kw
 

Detailed Description

Defer evaluating a block argument until the D3PDObject is instantiated.

Sometimes you want to pass an argument to a block function that isn't
known at the time the D3PDObject is defined, for example the
StoreGate key to use.  You could do this with a hook function
or a LOD function, but that's a bit cumbersome.  Instead, you can
use DeferArg.  DeferArg stores a string.  If a block argument
has a value that's an instance of DeferArg, then this string
is evaluated at the time the D3PDObject is instantiated.
The arguments passed to the D3PDObject will be available
in the context in which the string is evaluated.
A global dictionary may be provided as an optional argument;
any additional keyword arguments will be merged into this
dictionary.

Example:

  FooD3PDObject.defineBlock (1, 'SomeBlock', SomeTool,
                             Name = DeferArg ('"name_" + sgkey'))

If FooD3PDObject is then instantiated with a StoreGate key of `Bar',
then the Name argument of this block will be set to `name_Bar'.

Definition at line 59 of file D3PDObject.py.

Constructor & Destructor Documentation

◆ __init__()

def python.D3PDObject.DeferArg.__init__ (   self,
  str,
  gdict = globals(),
**  kw 
)

Definition at line 83 of file D3PDObject.py.

83  def __init__ (self, str, gdict = globals(), **kw): # noqa: B008 (globals is already a global ref.)
84  self.str = str
85  self.gdict = gdict
86  self.kw = kw
87  return
88 
89 

Member Function Documentation

◆ __call__()

def python.D3PDObject.DeferArg.__call__ (   self,
  hookargs = {},
**  kw 
)

Definition at line 90 of file D3PDObject.py.

90  def __call__ (self, hookargs = {}, **kw):
91  gdict = self.gdict.copy()
92  gdict.update (self.kw)
93  hookargs = hookargs.copy()
94  hookargs.update (kw)
95  return eval (self.str, gdict, hookargs)
96 
97 
98 

Member Data Documentation

◆ gdict

python.D3PDObject.DeferArg.gdict

Definition at line 85 of file D3PDObject.py.

◆ kw

python.D3PDObject.DeferArg.kw

Definition at line 86 of file D3PDObject.py.

◆ str

python.D3PDObject.DeferArg.str

Definition at line 84 of file D3PDObject.py.


The documentation for this class was generated from the following file:
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
calibdata.copy
bool copy
Definition: calibdata.py:27