ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
D3PDMaker
D3PDMakerCoreComps
python
IndexAssociation.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/IndexAssociation.py
5
# @author Nicolas Berger <nberger@mail.cern.ch>, scott snyder <snyder@bnl.gov>
6
# @date Nov, 2009
7
# @brief Helper for setting up an association via an index.
8
#
9
10
11
from
.D3PDObject
import
D3PDObject
12
from
AthenaConfiguration.ComponentFactory
import
CompFactory
13
14
D3PD = CompFactory.D3PD
15
16
17
def
IndexAssociation (parent,
18
assoctool,
19
target,
20
prefix = '',
21
level = 0,
22
blockname = None,
23
allowMissing = False,
24
containerIndexName = '',
25
**kw):
26
27
"""Helper for setting up an association via an index.
28
29
parent: The parent D3PDobject or block.
30
assoctool: The class for the (single) association tool.
31
target: The label for the getter within which we look up the index.
32
prefix: Prefix to add to the contained variables, if any.
33
level: Level of detail for the block.
34
blockname: Name for the block.
35
allowMissing: If true, then it is not considered an error for the
36
target getter to fail to find the input objects.
37
38
Extra arguments are passed to the association tool.
39
"""
40
41
if
blockname
is
None
:
42
blockname = assoctool.__name__
43
44
def
maker (name, prefix, object_name, **kw2):
45
this_target = target
46
if
'target'
in
kw2:
47
this_target = kw2[
'target'
]
48
del kw2[
'target'
]
49
50
if
this_target ==
''
:
51
this_target = []
52
elif
not
isinstance(this_target, list):
53
this_target = [ this_target ]
54
55
assoc = assoctool (name +
'Assoc'
, **kw2)
56
filler =
D3PD.ContainedAssociationFillerTool
\
57
(name, Prefix = prefix, Associator = assoc, Matched =
''
)
58
indexer =
D3PD.IndexFillerTool
\
59
(name +
'Index'
,
60
Targets = this_target,
61
ContainerIndexName = containerIndexName,
62
AllowMissing = allowMissing)
63
filler.BlockFillers += [indexer]
64
filler += [indexer]
65
return
filler
66
67
obj = D3PDObject (maker, prefix)
68
parent.defineBlock (level, blockname, obj, **kw)
69
return
obj
D3PD::ContainedAssociationFillerTool
Represent a single association by containment.
Definition
ContainedAssociationFillerTool.h:54
D3PD::IndexFillerTool
Fill an index of an object within a container.
Definition
IndexFillerTool.h:32
Generated on
for ATLAS Offline Software by
1.17.0