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 PVNNVertexWeightCalculatorCfg(flags, name="PVNNVertexWeightCalculator",
26 **kwargs):
27 acc = ComponentAccumulator()
28 kwargs.setdefault("ScoreKey", "PrimaryVertices_initial.HSGN2_phsvertex")
29 acc.setPrivateTools(
30 CompFactory.VertexWeightCalculator(name, **kwargs))
31 return acc
32
33
34def HGamNNVertexWeightCalculatorCfg(flags, name="HGamNNVertexWeightCalculator",
35 **kwargs):
36 acc = ComponentAccumulator()
37 kwargs.setdefault("ScoreKey", "HggPrimaryVertices.vertexScore")
38 acc.setPrivateTools(
39 CompFactory.VertexWeightCalculator(name, **kwargs))
40 return acc
41
42
43def BDTVertexWeightCalculatorCfg(flags, **kwargs):
44 """
45 Configure the BDTVertexWeightCalculator. Note: this tool needs to be run after the
46 DecoratePhotonPointingAlg and BuildVertexPointingAlg.
47 Use BDTVertexWeightCalculatorSeqCfg to have the full sequence.
48 """
49 acc = ComponentAccumulator()
50 kwargs.setdefault(
51 "BDTFile", "PhotonVertexSelection/BDT/2023-02-28/global_ggHW_phcount_BDT.root"
52 )
53 kwargs.setdefault("BDTName", "lgbm")
54 kwargs.setdefault("PointingVertexContainerKey", "PhotonPointingVertices")
55 tool = CompFactory.BDTVertexWeightCalculator(
56 "BDTVertexWeightCalculator", **kwargs
57 )
58 acc.setPrivateTools(tool)
59 return acc
60
61
62def BDTVertexWeightCalculatorSeqCfg(flags, container='Photons', **kwargs):
63 """
64 Configure BDTVertexWeightCalculator and the algorithms that are needed to run before.
65 Optional parameters are passed only to the tool.
66 """
67 acc = ComponentAccumulator()
68
69 from PhotonVertexSelection.PhotonVertexSelectionConfig import (
70 DecoratePhotonPointingAlgCfg,
71 BuildVertexPointingAlgCfg,
72 )
73
74 # this algorithm decorates the photons with the pointing information
75 acc.merge(DecoratePhotonPointingAlgCfg(flags, "DecoratePhotonPointingAlg", PhotonContainerKey=container))
76
77 # this algorithm creates the vertex from photon pointing
78 acc.merge(
79 BuildVertexPointingAlgCfg(
80 flags,
81 "BuildVertexPointingAlg",
82 PhotonContainerKey=container,
83 PointingVertexContainerKey=kwargs.get(
84 "PointingVertexContainerKey", "PhotonPointingVertices"
85 ),
86 )
87 )
88
89 accTool = BDTVertexWeightCalculatorCfg(flags, **kwargs)
90 tool = acc.popToolsAndMerge(accTool)
91 acc.setPrivateTools(tool)
92 return acc
93
94
96 flags,
97 name="JetRestrictedSumPt2VertexWeightCalculator",
98 TrackParticleLocation="InDetTrackParticles",
99 **kwargs):
100 acc = ComponentAccumulator()
101 kwargs.setdefault("DoSumPt2Selection", True)
102 kwargs.setdefault("JetContainer", "AntiKt4EMTopoJets")
103 acc.setPrivateTools(
104 CompFactory.Trk.JetRestrictedSumPtVertexWeightCalculator(
105 name,
106 TracksInConeTool=CompFactory.xAOD.TrackParticlesInConeTool(
107 'JetVertexTracksInCone',
108 TrackParticleLocation=TrackParticleLocation
109 ),
110 **kwargs,
111 ))
112 return acc
PVNNVertexWeightCalculatorCfg(flags, name="PVNNVertexWeightCalculator", **kwargs)
SumPtVertexWeightCalculatorCfg(flags, name="SumPtVertexWeightCalculator", **kwargs)
HGamNNVertexWeightCalculatorCfg(flags, name="HGamNNVertexWeightCalculator", **kwargs)
SumPt2VertexWeightCalculatorCfg(flags, name="SumPt2VertexWeightCalculator", **kwargs)
JetRestrictedSumPt2VertexWeightCalculatorCfg(flags, name="JetRestrictedSumPt2VertexWeightCalculator", TrackParticleLocation="InDetTrackParticles", **kwargs)