ATLAS Offline Software
Loading...
Searching...
No Matches
TrkConfig/python/TrkVertexWeightCalculatorsConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2# Configuration of TrkVertexWeightCalculators package
3from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4from AthenaConfiguration.ComponentFactory import CompFactory
5
6
7def SumPt2VertexWeightCalculatorCfg(flags, name="SumPt2VertexWeightCalculator",
8 **kwargs):
9 acc = ComponentAccumulator()
10 kwargs.setdefault("DoSumPt2Selection", True)
11 acc.setPrivateTools(
12 CompFactory.Trk.SumPtVertexWeightCalculator(name, **kwargs))
13 return acc
14
15
16def SumPtVertexWeightCalculatorCfg(flags, name="SumPtVertexWeightCalculator",
17 **kwargs):
18 acc = ComponentAccumulator()
19 kwargs.setdefault("DoSumPt2Selection", False)
20 acc.setPrivateTools(
21 CompFactory.Trk.SumPtVertexWeightCalculator(name, **kwargs))
22 return acc
23
24
25def GNNVertexWeightCalculatorCfg(flags, name="GNNVertexWeightCalculator",
26 **kwargs):
27 acc = ComponentAccumulator()
28 acc.setPrivateTools(
29 CompFactory.GNNVertexWeightCalculator(name, **kwargs))
30 return acc
31
32def BDTVertexWeightCalculatorCfg(flags, **kwargs):
33 """
34 Configure the BDTVertexWeightCalculator. Note: this tool needs to be run after the
35 DecoratePhotonPointingAlg and BuildVertexPointingAlg.
36 Use BDTVertexWeightCalculatorSeqCfg to have the full sequence.
37 """
38 acc = ComponentAccumulator()
39 kwargs.setdefault(
40 "BDTFile", "PhotonVertexSelection/BDT/2023-02-28/global_ggHW_phcount_BDT.root"
41 )
42 kwargs.setdefault("BDTName", "lgbm")
43 kwargs.setdefault("PointingVertexContainerKey", "PhotonPointingVertices")
44 tool = CompFactory.BDTVertexWeightCalculator(
45 "BDTVertexWeightCalculator", **kwargs
46 )
47 acc.setPrivateTools(tool)
48 return acc
49
50
51def BDTVertexWeightCalculatorSeqCfg(flags, container='Photons', **kwargs):
52 """
53 Configure BDTVertexWeightCalculator and the algorithms that are needed to run before.
54 Optional parameters are passed only to the tool.
55 """
56 acc = ComponentAccumulator()
57
58 from PhotonVertexSelection.PhotonVertexSelectionConfig import (
59 DecoratePhotonPointingAlgCfg,
60 BuildVertexPointingAlgCfg,
61 )
62
63 # this algorithm decorates the photons with the pointing information
64 acc.merge(DecoratePhotonPointingAlgCfg(flags, "DecoratePhotonPointingAlg", PhotonContainerKey=container))
65
66 # this algorithm creates the vertex from photon pointing
67 acc.merge(
68 BuildVertexPointingAlgCfg(
69 flags,
70 "BuildVertexPointingAlg",
71 PhotonContainerKey=container,
72 PointingVertexContainerKey=kwargs.get(
73 "PointingVertexContainerKey", "PhotonPointingVertices"
74 ),
75 )
76 )
77
78 accTool = BDTVertexWeightCalculatorCfg(flags, **kwargs)
79 tool = acc.popToolsAndMerge(accTool)
80 acc.setPrivateTools(tool)
81 return acc
82
83
85 flags,
86 name="JetRestrictedSumPt2VertexWeightCalculator",
87 TrackParticleLocation="InDetTrackParticles",
88 **kwargs):
89 acc = ComponentAccumulator()
90 kwargs.setdefault("DoSumPt2Selection", True)
91 kwargs.setdefault("JetContainer", "AntiKt4EMTopoJets")
92 acc.setPrivateTools(
93 CompFactory.Trk.JetRestrictedSumPtVertexWeightCalculator(
94 name,
95 TracksInConeTool=CompFactory.xAOD.TrackParticlesInConeTool(
96 'JetVertexTracksInCone',
97 TrackParticleLocation=TrackParticleLocation
98 ),
99 **kwargs,
100 ))
101 return acc
SumPtVertexWeightCalculatorCfg(flags, name="SumPtVertexWeightCalculator", **kwargs)
SumPt2VertexWeightCalculatorCfg(flags, name="SumPt2VertexWeightCalculator", **kwargs)
JetRestrictedSumPt2VertexWeightCalculatorCfg(flags, name="JetRestrictedSumPt2VertexWeightCalculator", TrackParticleLocation="InDetTrackParticles", **kwargs)
GNNVertexWeightCalculatorCfg(flags, name="GNNVertexWeightCalculator", **kwargs)