ATLAS Offline Software
Loading...
Searching...
No Matches
TruthVertexDecoratorConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4from AthenaConfiguration.ComponentFactory import CompFactory
5
6
7def TruthVertexDecoratorCfg(flags, name="TruthVertexDecoratorAlg", **kwargs):
8 """Configure TruthVertexDecoratorAlg.
9
10 Decorates tracks and truth particles with truth vertex labels
11 (vertex ID, vertex type, PV distance, etc.) using the FatVertex
12 classification.
13 """
14 acc = ComponentAccumulator()
15
16 from InDetTrackSystematicsTools.InDetTrackSystematicsToolsConfig import (
17 InDetTrackTruthOriginToolCfg,
18 )
19 kwargs.setdefault(
20 "trackTruthOriginTool",
21 acc.popToolsAndMerge(InDetTrackTruthOriginToolCfg(flags)),
22 )
23
24 acc.addEventAlgo(
25 CompFactory.ParticleJetTools.TruthVertexDecoratorAlg(name, **kwargs)
26 )
27 return acc
28
29
31 flags, name="JetTruthVertexSummaryDecoratorAlg", **kwargs
32):
33 """Configure JetTruthVertexSummaryDecoratorAlg.
34
35 Decorates jets with counts of associated truth vertices by type
36 (b, c, tau, strange, pion, material interaction, other).
37 Reads truth particle decorations produced by TruthVertexDecoratorAlg.
38 """
39 acc = ComponentAccumulator()
40 acc.addEventAlgo(
41 CompFactory.ParticleJetTools.JetTruthVertexSummaryDecoratorAlg(
42 name, **kwargs
43 )
44 )
45 return acc
46
47
48def TruthVertexDecoratorsCfg(flags, jetCollections=None, **kwargs):
49 """Convenience: schedule truth vertex decorator + one summary alg per jet collection.
50
51 TruthVertexDecoratorAlg runs first (decorates truth particles once), then
52 one JetTruthVertexSummaryDecoratorAlg is scheduled per entry in
53 ``jetCollections`` (reads the TP decorations, writes per-jet summary
54 decorations keyed to that jet container).
55
56 Args:
57 flags: Athena ConfigFlags.
58 jetCollections: list of ``(jetContainer, drThreshold)`` tuples. Each
59 entry schedules a summary alg reading the given jet container and
60 matching truth vertices to those jets within ``drThreshold``.
61 Defaults to ``[("AntiKt4EMPFlowJets", 0.4)]``.
62 **kwargs: forwarded to ``TruthVertexDecoratorCfg`` (the TP decorator).
63 """
64 if jetCollections is None:
65 jetCollections = [("AntiKt4EMPFlowJets", 0.4)]
66 acc = ComponentAccumulator()
67 acc.merge(TruthVertexDecoratorCfg(flags, **kwargs))
68 for (jet_container, dr) in jetCollections:
70 flags,
71 name=f"JetTruthVertexSummaryDecoratorAlg_{jet_container}",
72 jetContainer=jet_container,
73 drThreshold=dr,
74 ))
75 return acc
JetTruthVertexSummaryDecoratorCfg(flags, name="JetTruthVertexSummaryDecoratorAlg", **kwargs)
TruthVertexDecoratorCfg(flags, name="TruthVertexDecoratorAlg", **kwargs)
TruthVertexDecoratorsCfg(flags, jetCollections=None, **kwargs)