ATLAS Offline Software
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
3 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory import CompFactory
5 
6 
7 def SumPt2VertexWeightCalculatorCfg(flags, name="SumPt2VertexWeightCalculator",
8  **kwargs):
10  kwargs.setdefault("DoSumPt2Selection", True)
11  acc.setPrivateTools(
12  CompFactory.Trk.SumPtVertexWeightCalculator(name, **kwargs))
13  return acc
14 
15 
16 def 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 
25 def GNNVertexWeightCalculatorCfg(flags, name="GNNVertexWeightCalculator",
26  **kwargs):
27  acc = ComponentAccumulator()
28  acc.setPrivateTools(
29  CompFactory.GNNVertexWeightCalculator(name, **kwargs))
30  return acc
31 
32 def 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 
51 def 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(
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
PhotonVertexSelectionConfig.BuildVertexPointingAlgCfg
def BuildVertexPointingAlgCfg(flags, name="BuildVertexPointingAlg", **kwargs)
Definition: PhotonVertexSelectionConfig.py:41
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.TrkVertexWeightCalculatorsConfig.SumPt2VertexWeightCalculatorCfg
def SumPt2VertexWeightCalculatorCfg(flags, name="SumPt2VertexWeightCalculator", **kwargs)
Definition: TrkConfig/python/TrkVertexWeightCalculatorsConfig.py:7
PhotonVertexSelectionConfig.DecoratePhotonPointingAlgCfg
def DecoratePhotonPointingAlgCfg(flags, name="DecoratePhotonPointingAlg", **kwargs)
Definition: PhotonVertexSelectionConfig.py:21
python.TrkVertexWeightCalculatorsConfig.BDTVertexWeightCalculatorCfg
def BDTVertexWeightCalculatorCfg(flags, **kwargs)
Definition: TrkConfig/python/TrkVertexWeightCalculatorsConfig.py:32
python.TrkVertexWeightCalculatorsConfig.SumPtVertexWeightCalculatorCfg
def SumPtVertexWeightCalculatorCfg(flags, name="SumPtVertexWeightCalculator", **kwargs)
Definition: TrkConfig/python/TrkVertexWeightCalculatorsConfig.py:16
python.TrkVertexWeightCalculatorsConfig.GNNVertexWeightCalculatorCfg
def GNNVertexWeightCalculatorCfg(flags, name="GNNVertexWeightCalculator", **kwargs)
Definition: TrkConfig/python/TrkVertexWeightCalculatorsConfig.py:25
python.TrkVertexWeightCalculatorsConfig.BDTVertexWeightCalculatorSeqCfg
def BDTVertexWeightCalculatorSeqCfg(flags, container='Photons', **kwargs)
Definition: TrkConfig/python/TrkVertexWeightCalculatorsConfig.py:51
python.TrkVertexWeightCalculatorsConfig.JetRestrictedSumPt2VertexWeightCalculatorCfg
def JetRestrictedSumPt2VertexWeightCalculatorCfg(flags, name="JetRestrictedSumPt2VertexWeightCalculator", TrackParticleLocation="InDetTrackParticles", **kwargs)
Definition: TrkConfig/python/TrkVertexWeightCalculatorsConfig.py:84