![]() |
ATLAS Offline Software
|
Public Member Functions | |
| __init__ (self, maker, default_prefix='', default_object_name='', default_name=None, allow_args=[], **kw) | |
| defineBlock (self, lod, name, func, prefix=None, **kw) | |
| removeBlock (self, name, allowMissing=False) | |
| defineHook (self, hook) | |
| allBlocknames (self) | |
| __call__ (self, level, name=None, prefix=None, name_prefix='', parent_prefix='', object_name=None, include=[], exclude=[], blockargs={}, parent_hookargs=None, *args, **kw) | |
| blockFillers (self, level, parent_name, parent_prefix='', include=[], exclude=[], blockargs={}, hookargs={}) | |
| copy (self, default_prefix=None, default_object_name=None, default_name=None, **kw_in) | |
Static Public Member Functions | |
| runHooks (c, flags, acc) | |
Protected Member Functions | |
| _add_blockname (self, n, warnonly=False) | |
| _remove_blockname (self, n) | |
| _makeBlockFillers (self, c, level, parent_prefix, include, exclude, blockargs, hookargs) | |
Protected Attributes | |
| _maker = maker | |
| _default_object_name = default_object_name | |
| list | _blocks = [] |
| list | _hooks = [] |
| dict | _all_blocknames = {} |
| _default_prefix = default_prefix | |
| _default_name = default_name | |
| _hookArgs = kw | |
| _parent = None | |
| _allow_args = allow_args | |
Static Protected Attributes | |
| dict | _hookArgsStore = {} |
D3PD object creator class.
For each type of object written to the D3PD, create
an instance of this class. The arguments to the constructor
are a function to create the Configurable for the object filler
tool and a default value for the variable name prefix
for this block.
After creating the instance, one calls defineBlock to define
the blocks of variables that can be written for this object.
Finally, one calls the object in order to create the
configurable.
So, a typical usage might look like this.
def makeElectronD3PDObject (name, prefix,
getter = None,
sgkey = 'ElectronAODCollection')
if not getter:
getter = CompFactory.D3PD.SGDataVectorGetterTool \
(name + '_Getter',
TypeName = 'ElectronContainer',
SGKey = sgkey)
return CompFactory.D3PD.VectorFillerTool (name,
Prefix = prefix,
Getter = getter)
ElectronD3PDObject = D3PDObject (makeElectronD3PDObject, 'el_')
ElectronD3PDObject.defineBlock (0, 'Kinematics',
EventCommonD3PDMaker.FourMomFillerTool)
alg = ...
alg += ElectronD3PDObject (level)
Definition at line 99 of file D3PDObject.py.
| python.D3PDObject.D3PDObject.__init__ | ( | self, | |
| maker, | |||
| default_prefix = '', | |||
| default_object_name = '', | |||
| default_name = None, | |||
| allow_args = [], | |||
| ** | kw ) |
Constructor.
Arguments:
maker: A function to create the IObjFillerTool Configurable
for this object. It is called with two fixed arguments,
the tool name and the variable name prefix. Any other
arguments provided to the call will be passed through.
default_prefix: Default variable name prefix for objects
of this type.
default_object_name: Default D3PDObject name, something like
'EventInfoD3PDObject'
default_name: If specified, the default tool name to use
for these objects.
allow_args: Additional arguments that may be passed in when
instantiating the D3PDObject, but which are not
to be passed to the maker function. This can be
used to allow for additional arguments to hook
or level-of-detail functions.
Any additional arguments are passed into any hook functions.
Definition at line 141 of file D3PDObject.py.
| python.D3PDObject.D3PDObject.__call__ | ( | self, | |
| level, | |||
| name = None, | |||
| prefix = None, | |||
| name_prefix = '', | |||
| parent_prefix = '', | |||
| object_name = None, | |||
| include = [], | |||
| exclude = [], | |||
| blockargs = {}, | |||
| parent_hookargs = None, | |||
| * | args, | ||
| ** | kw ) |
Create a Configurable to fill an object of this type.
Arguments:
level: Requested level of detail for this object. An integer.
name: Tool name. If omitted, one will be constructed.
prefix: Variable name prefix for this object.
name_prefix: If name wasn't specified, this is a prefix
to add to the tool name.
parent_prefix: Variable name prefix for any parent tool.
object_name: Name of the D3PDObject, like 'EventInfoD3PDObject'
include: List of block names to include, regardless
of level of detail.
exclude: List of block names to exclude, regardless
of level of detail.
blockargs: Extra arguments to pass to block filler tools.
The keys are block names.
Values are dictionaries of keyword arguments.
These override anything specified in defineBlock.
parent_hookargs: [Not to be used by user code.]
Dictionary of hook args from the parent,
to be merged into our hook arg dictionary.
args, kw: Additional arguments to pass to the maker function.
However, any entries in KW that have the form
BLOCK_parm, where BLOCK is a known block name,
will instead be interpreted as arguments to pass
to a block filler tool. These override entries
in BLOCKARGS.
Definition at line 316 of file D3PDObject.py.
|
protected |
Add a new block name N to the list of all names. Raises an exception if a block name is duplicated.
Definition at line 276 of file D3PDObject.py.
|
protected |
Create block filler tools for object C, for the specified
level of detail.
Arguments:
c: Object for which to create the block fillers.
level: Requested level of detail for this object. An integer.
parent_prefix: Variable name prefix for any parent tool.
include: List of block names to include, regardless
of level of detail.
exclude: List of block names to exclude, regardless
of level of detail.
blockargs: Extra arguments to pass to block filler tools.
The keys are block names.
Values are dictionaries of keyword arguments.
These override anything specified in defineBlock.
hookargs: Arguments passed to the D3PD object, to be passed
on to LOD functions.
Definition at line 540 of file D3PDObject.py.
|
protected |
Remove block name N.
Definition at line 300 of file D3PDObject.py.
| python.D3PDObject.D3PDObject.allBlocknames | ( | self | ) |
Return a dictionary the keys of which are the names of all blocks defined for this object. This list will include any blocks defined recursively.
Definition at line 308 of file D3PDObject.py.
| python.D3PDObject.D3PDObject.blockFillers | ( | self, | |
| level, | |||
| parent_name, | |||
| parent_prefix = '', | |||
| include = [], | |||
| exclude = [], | |||
| blockargs = {}, | |||
| hookargs = {} ) |
Return a list of block filler tool configurables.
Arguments:
level: Requested level of detail for this object. An integer.
parent_name: Name of the parent component.
parent_prefix: Variable name prefix for any parent tool.
include: List of block names to include, regardless
of level of detail.
exclude: List of block names to exclude, regardless
of level of detail.
blockargs: Extra arguments to pass to block filler tools.
The keys are block names.
Values are dictionaries of keyword arguments.
These override anything specified in defineBlock.
hookargs: Arguments passed to the D3PD object, to be passed
on to LOD functions.
Definition at line 464 of file D3PDObject.py.
| python.D3PDObject.D3PDObject.copy | ( | self, | |
| default_prefix = None, | |||
| default_object_name = None, | |||
| default_name = None, | |||
| ** | kw_in ) |
Return a copy of this D3PD object, possibly changing parameters.
Definition at line 574 of file D3PDObject.py.
| python.D3PDObject.D3PDObject.defineBlock | ( | self, | |
| lod, | |||
| name, | |||
| func, | |||
| prefix = None, | |||
| ** | kw ) |
Define a new block of variables for this object type. Arguments: lod: Level of detail of this block. See below. name: Name of this block. func: Function to create the block Configurable. prefix: Variable name prefix for this block. kw: Arguments to pass to the creation function. The creation function will be called like this: b.func (name, BlockName = blockname, **b.kw) where name is the name for the tool. However, if b.func is a class deriving from D3PDObject, then the creation function will instead be called like this: b.func (level, name, parent_prefix, **b.kw) LOD is used to control whether this block should be included. In the simple case, this is an integer, and the block is included if the block's level of detail is less than or equal to the requested level of detail (unless the block was explicitly included or excluded). In the general case, LOD may be a function. The first two arguments passed to the function will be the requested level of detail and the block filler arguments. The requested level of detail will be an integer; it will be 999 if the block was explicitly included, and -999 if the block was explicitly excluded. The block filler arguments is a dictionary of keyword arguments. The LOD function should return a boolean value saying whether or not the block should be included. It may also alter the dictionary of arguments (this overrides all other argument settings). The LOD function may optionally take a third argument; if present, this is a dictionary of the arguments passed to the D3PDObject (the same arguments that are passed to hook functions).
Definition at line 178 of file D3PDObject.py.
| python.D3PDObject.D3PDObject.defineHook | ( | self, | |
| hook ) |
Define a new hook function for this D3PD object. HOOK is a function that will be called for each instance of this D3PD object after all block filler tools have been added. The arguments to the hook function are the object filler tool, followed by the arguments that were passed to __call__.
Definition at line 263 of file D3PDObject.py.
| python.D3PDObject.D3PDObject.removeBlock | ( | self, | |
| name, | |||
| allowMissing = False ) |
Remove the block NAME from this object.
Definition at line 238 of file D3PDObject.py.
|
static |
Run creation hooks for configurable C. Should be run by the D3PD maker algorithm; not for general use.
Definition at line 446 of file D3PDObject.py.
|
protected |
Definition at line 169 of file D3PDObject.py.
|
protected |
Definition at line 174 of file D3PDObject.py.
|
protected |
Definition at line 167 of file D3PDObject.py.
|
protected |
Definition at line 171 of file D3PDObject.py.
|
protected |
Definition at line 166 of file D3PDObject.py.
|
protected |
Definition at line 170 of file D3PDObject.py.
|
protected |
Definition at line 172 of file D3PDObject.py.
|
staticprotected |
Definition at line 138 of file D3PDObject.py.
|
protected |
Definition at line 168 of file D3PDObject.py.
|
protected |
Definition at line 165 of file D3PDObject.py.
|
protected |
Definition at line 173 of file D3PDObject.py.