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 BDTVertexWeightCalculatorCfg(flags, **kwargs):
26  """
27  Configure the BDTVertexWeightCalculator. Note: this tool needs to be run after the
28  DecoratePhotonPointingAlg and BuildVertexPointingAlg.
29  Use BDTVertexWeightCalculatorSeqCfg to have the full sequence.
30  """
31  acc = ComponentAccumulator()
32  kwargs.setdefault(
33  "BDTFile", "PhotonVertexSelection/BDT/2023-02-28/global_ggHW_phcount_BDT.root"
34  )
35  kwargs.setdefault("BDTName", "lgbm")
36  kwargs.setdefault("PointingVertexContainerKey", "PhotonPointingVertices")
37  tool = CompFactory.BDTVertexWeightCalculator(
38  "BDTVertexWeightCalculator", **kwargs
39  )
40  acc.setPrivateTools(tool)
41  return acc
42 
43 
44 def BDTVertexWeightCalculatorSeqCfg(flags, container='Photons', **kwargs):
45  """
46  Configure BDTVertexWeightCalculator and the algorithms that are needed to run before.
47  Optional parameters are passed only to the tool.
48  """
49  acc = ComponentAccumulator()
50 
51  from PhotonVertexSelection.PhotonVertexSelectionConfig import (
52  DecoratePhotonPointingAlgCfg,
53  BuildVertexPointingAlgCfg,
54  )
55 
56  # this algorithm decorates the photons with the pointing information
57  acc.merge(DecoratePhotonPointingAlgCfg(flags, "DecoratePhotonPointingAlg", PhotonContainerKey=container))
58 
59  # this algorithm creates the vertex from photon pointing
60  acc.merge(
62  flags,
63  "BuildVertexPointingAlg",
64  PhotonContainerKey=container,
65  PointingVertexContainerKey=kwargs.get(
66  "PointingVertexContainerKey", "PhotonPointingVertices"
67  ),
68  )
69  )
70 
71  accTool = BDTVertexWeightCalculatorCfg(flags, **kwargs)
72  tool = acc.popToolsAndMerge(accTool)
73  acc.setPrivateTools(tool)
74  return acc
75 
76 
78  flags,
79  name="JetRestrictedSumPtVertexWeightCalculator",
80  TrackParticleLocation="InDetTrackParticles",
81  **kwargs):
82  acc = ComponentAccumulator()
83  kwargs.setdefault("DoSumPt2Selection", False)
84  kwargs.setdefault("JetContainer", "AntiKt4EMTopoJets")
85  acc.setPrivateTools(
86  CompFactory.Trk.JetRestrictedSumPtVertexWeightCalculator(
87  name,
88  TracksInConeTool=CompFactory.xAOD.TrackParticlesInConeTool(
89  'JetVertexTracksInCone',
90  TrackParticleLocation=TrackParticleLocation
91  ),
92  **kwargs,
93  ))
94  return acc
PhotonVertexSelectionConfig.BuildVertexPointingAlgCfg
def BuildVertexPointingAlgCfg(flags, name="BuildVertexPointingAlg", **kwargs)
Definition: PhotonVertexSelectionConfig.py:36
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:20
python.TrkVertexWeightCalculatorsConfig.BDTVertexWeightCalculatorCfg
def BDTVertexWeightCalculatorCfg(flags, **kwargs)
Definition: TrkConfig/python/TrkVertexWeightCalculatorsConfig.py:25
python.TrkVertexWeightCalculatorsConfig.SumPtVertexWeightCalculatorCfg
def SumPtVertexWeightCalculatorCfg(flags, name="SumPtVertexWeightCalculator", **kwargs)
Definition: TrkConfig/python/TrkVertexWeightCalculatorsConfig.py:16
python.TrkVertexWeightCalculatorsConfig.JetRestrictedSumPtVertexWeightCalculatorCfg
def JetRestrictedSumPtVertexWeightCalculatorCfg(flags, name="JetRestrictedSumPtVertexWeightCalculator", TrackParticleLocation="InDetTrackParticles", **kwargs)
Definition: TrkConfig/python/TrkVertexWeightCalculatorsConfig.py:77
python.TrkVertexWeightCalculatorsConfig.BDTVertexWeightCalculatorSeqCfg
def BDTVertexWeightCalculatorSeqCfg(flags, container='Photons', **kwargs)
Definition: TrkConfig/python/TrkVertexWeightCalculatorsConfig.py:44