ATLAS Offline Software
Loading...
Searching...
No Matches
TruthParticleD3PDObject.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 TruthD3PDMaker/python/TruthParticleD3PDObject.py
5# @author scott snyder <snyder@bnl.gov>
6# @date Dec, 2009
7# @brief Define D3PD object for a collection of TruthParticle's.
8#
9
10
11from D3PDMakerCoreComps.D3PDObject import make_SGDataVector_D3PDObject
12from D3PDMakerCoreComps.SimpleAssociation import SimpleAssociation
13from TruthD3PDMaker.TruthParticleChildAssociation import TruthParticleChildAssociation
14from TruthD3PDMaker.TruthParticleParentAssociation import TruthParticleParentAssociation
15from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags
16from AthenaConfiguration.ComponentFactory import CompFactory
17
18D3PD = CompFactory.D3PD
19
20
21TruthParticleD3PDObject = make_SGDataVector_D3PDObject \
22 ('DataVector<xAOD::TruthParticle_v1>',
23 D3PDMakerFlags.TruthParticlesSGKey,
24 'mc_',
25 'TruthParticleD3PDObject')
26
27TruthParticleD3PDObject.defineBlock (0, 'TruthKin',
29
30TruthParticleD3PDObject.defineBlock (0, 'TruthInfo',
32
33ProdVertexAssoc = SimpleAssociation \
34 (TruthParticleD3PDObject,
36 level = 1,
37 prefix = 'vx_',
38 blockname = 'ProdVert')
39ProdVertexAssoc.defineBlock (
40 1, 'ProdVertPos',
42 Vars = ['x', 'y', 'z', 'uid'])
43
44
45ChildAssoc = TruthParticleChildAssociation(
46 parent = TruthParticleD3PDObject,
47 prefix = 'child_',
48 # target = '', # filled by hook
49 level = 0 )
50
51def _TruthParticleAssocHook (c, flags, acc, *args, parent_prefix = None, **kw):
52 indexer = c.BlockFillers[0]
53 indexer.Target = parent_prefix
54 return
55ChildAssoc.defineHook(_TruthParticleAssocHook)
56
57ParentAssoc = TruthParticleParentAssociation(
58 parent = TruthParticleD3PDObject,
59 prefix = 'parent_',
60 # target = '', # filled by hook
61 level = 0 )
62ParentAssoc.defineHook(_TruthParticleAssocHook)
63
Copy aux data to D3PD.
Block filler tool for a four-momentum.
Associate from a TruthParticle to its GenVertex production vertex.
_TruthParticleAssocHook(c, flags, acc, *args, parent_prefix=None, **kw)