ATLAS Offline Software
Functions | Variables
python.SimpleAssociation Namespace Reference

Functions

def SimpleAssociation (parent, assoctool, prefix='', matched='', level=0, blockname=None, suffix='', **kw)
 
def IdentityAssociation (parent, **kw)
 

Variables

 D3PD = CompFactory.D3PD
 

Function Documentation

◆ IdentityAssociation()

def python.SimpleAssociation.IdentityAssociation (   parent,
**  kw 
)
A SimpleAssociation configured with an identity association.

This can be useful to group blocks together in subblocks.

Definition at line 80 of file SimpleAssociation.py.

80 def IdentityAssociation (parent, **kw):
81  """A SimpleAssociation configured with an identity association.
82 
83 This can be useful to group blocks together in subblocks.
84 """
85  return SimpleAssociation (parent,
87  **kw)

◆ SimpleAssociation()

def python.SimpleAssociation.SimpleAssociation (   parent,
  assoctool,
  prefix = '',
  matched = '',
  level = 0,
  blockname = None,
  suffix = '',
**  kw 
)
Helper for setting up an association to a contained object.

parent: The parent D3PDobject or block.
assoctool: The class for the (single) association tool.
prefix: Prefix to add to the contained variables, if any.
matched: If not null, a flag variable with this name will
         be created, set to true when the association succeeds.
level: Level of detail for the block.
blockname: Name for the block.
suffix: Suffix to add to the contained variables, if any.

Extra arguments are passed to the association tool.

Here's an example.  Suppose we have a generic tool that tuples
Perigee objects, producing variables z0, d0, etc.  Suppose that
we also have an `electron' object that has a method to return
a Perigee.  We want to use the Perigee filling tool to tuple
these variables as a new block.

We can do this by creating an associator tool that will go from
an electron object to its contained Perigee object.  We then configure
things by creating a ContainedAssociationFillerTool using this
associator.  We then add this as a block to the electron object,
and then add a Perigee block to the associator block.  The helper
here reduces the amount of boilerplate configuration code
we need to do this.

Usage is something like this:

   ElectronObject = ...
   ElectronPerigee = SimpleAssocation (ElectronObject,
                                       electronPerigeeAssociator)
   ElectronPerigee.defineBlock (1, 'Perigee', PerigeeFillerTool)

If the electron prefix is `el_', this would create variables
`el_z0', etc.  With `prefix="track"', the names would be
`el_trackz0', etc.

If we add `matched="hastrack"', then this will add a boolean
variable `el_hastrack', which is true if the association succeeded.

Definition at line 17 of file SimpleAssociation.py.

17 def SimpleAssociation (parent,
18  assoctool,
19  prefix = '',
20  matched = '',
21  level = 0,
22  blockname = None,
23  suffix = '',
24  **kw):
25  """Helper for setting up an association to a contained object.
26 
27  parent: The parent D3PDobject or block.
28  assoctool: The class for the (single) association tool.
29  prefix: Prefix to add to the contained variables, if any.
30  matched: If not null, a flag variable with this name will
31  be created, set to true when the association succeeds.
32  level: Level of detail for the block.
33  blockname: Name for the block.
34  suffix: Suffix to add to the contained variables, if any.
35 
36  Extra arguments are passed to the association tool.
37 
38  Here's an example. Suppose we have a generic tool that tuples
39  Perigee objects, producing variables z0, d0, etc. Suppose that
40  we also have an `electron' object that has a method to return
41  a Perigee. We want to use the Perigee filling tool to tuple
42  these variables as a new block.
43 
44  We can do this by creating an associator tool that will go from
45  an electron object to its contained Perigee object. We then configure
46  things by creating a ContainedAssociationFillerTool using this
47  associator. We then add this as a block to the electron object,
48  and then add a Perigee block to the associator block. The helper
49  here reduces the amount of boilerplate configuration code
50  we need to do this.
51 
52  Usage is something like this:
53 
54  ElectronObject = ...
55  ElectronPerigee = SimpleAssocation (ElectronObject,
56  electronPerigeeAssociator)
57  ElectronPerigee.defineBlock (1, 'Perigee', PerigeeFillerTool)
58 
59  If the electron prefix is `el_', this would create variables
60  `el_z0', etc. With `prefix="track"', the names would be
61  `el_trackz0', etc.
62 
63  If we add `matched="hastrack"', then this will add a boolean
64  variable `el_hastrack', which is true if the association succeeded.
65 """
66  if blockname is None:
67  blockname = assoctool.__name__
68 
69  def maker (name, prefix, object_name, **kw2):
70  assoc = assoctool (name + 'Assoc', **kw2)
72  (name, Prefix = prefix, Suffix = suffix,
73  Associator = assoc, Matched = matched)
74 
75  obj = D3PDObject (maker, prefix)
76  parent.defineBlock (level, blockname, obj, **kw)
77  return obj
78 
79 

Variable Documentation

◆ D3PD

python.SimpleAssociation.D3PD = CompFactory.D3PD

Definition at line 14 of file SimpleAssociation.py.

D3PD::IdentityAssociationTool
A generic identity association; i.e., one that simply returns its input.
Definition: IdentityAssociationTool.h:34
python.SimpleAssociation.SimpleAssociation
def SimpleAssociation(parent, assoctool, prefix='', matched='', level=0, blockname=None, suffix='', **kw)
Definition: SimpleAssociation.py:17
D3PD::ContainedAssociationFillerTool
Represent a single association by containment.
Definition: ContainedAssociationFillerTool.h:54
python.SimpleAssociation.IdentityAssociation
def IdentityAssociation(parent, **kw)
Definition: SimpleAssociation.py:80