ATLAS Offline Software
Loading...
Searching...
No Matches
Block.py
Go to the documentation of this file.
1# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2
3#
4# @file D3PDMakerCoreComps/python/Block.py
5# @author scott snyder <snyder@bnl.gov>
6# @date Aug, 2009
7# @brief Hold information about one D3PD block.
8#
9
10
11class Block:
12 """Hold information about one D3PD block.
13
14 Attributes:
15 name: Name of this block.
16 lod: Level of detail. See below.
17 func: Function to create the block Configurable.
18 kw: Arguments to pass to the creation function.
19
20 The creation function will be called like this:
21
22 b.func (name, **b.kw)
23
24 where name is the name for the tool.
25
26 However, if b.func is a class deriving from D3PDObject, then the creation
27 function will instead be called like this:
28
29 b.func (level, name, parent_prefix, **b.kw)
30
31 LOD is used to control whether this block should be included.
32
33 In the simple case, this is an integer, and the block is included
34 if the block's level of detail is less than or equal to the
35 requested level of detail (unless the block was explicitly
36 included or excluded).
37
38 In the general case, LOD may be a function. This is called with
39 two arguments, the requested level of detail and the block filler
40 arguments. The requested level of detail will be an integer;
41 it will be 999 if the block was explicitly included, and -999
42 if the block was explicitly excluded. The block filler arguments
43 is a dictionary of keyword arguments. The LOD function should
44 return a boolean value saying whether or not the block should
45 be included. It may also alter the dictionary of arguments
46 (this overrides all other argument settings).
47"""
48 def __init__ (self, name, lod, func, kw):
49 self.name = name
50 self.lod = lod
51 self.func = func
52 self.kw = kw
53 self._hooks = []
54 return
55
56
57 # Allow attaching hooks to a Block.
58 def defineHook (self, hook):
59 self._hooks.append (hook)
60 return
__init__(self, name, lod, func, kw)
Definition Block.py:48
defineHook(self, hook)
Definition Block.py:58