ATLAS Offline Software
Functions | Variables
python.TrkVertexWeightCalculatorsConfig Namespace Reference

Functions

def SumPt2VertexWeightCalculatorCfg (flags, name="SumPt2VertexWeightCalculator", **kwargs)
 
def SumPtVertexWeightCalculatorCfg (flags, name="SumPtVertexWeightCalculator", **kwargs)
 
def BDTVertexWeightCalculatorCfg (flags, **kwargs)
 
def BDTVertexWeightCalculatorSeqCfg (flags, container='Photons', **kwargs)
 
def JetRestrictedSumPt2VertexWeightCalculatorCfg (flags, name="JetRestrictedSumPt2VertexWeightCalculator", TrackParticleLocation="InDetTrackParticles", **kwargs)
 
def DecorateVertexScoreAlgCfg (flags, name="DecorateVertexScoreAlg", **kwargs)
 
def TrkVertexWeightCalculatorDebugCfg (flags, **kwargs)
 
def TrkVertexWeightCalculatorBDTDebugRunCfg ()
 

Variables

 acc
 
 status
 

Function Documentation

◆ BDTVertexWeightCalculatorCfg()

def python.TrkVertexWeightCalculatorsConfig.BDTVertexWeightCalculatorCfg (   flags,
**  kwargs 
)
Configure the BDTVertexWeightCalculator. Note: this tool needs to be run after the
DecoratePhotonPointingAlg and BuildVertexPointingAlg.
Use BDTVertexWeightCalculatorSeqCfg to have the full sequence.

Definition at line 25 of file TrkConfig/python/TrkVertexWeightCalculatorsConfig.py.

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 

◆ BDTVertexWeightCalculatorSeqCfg()

def python.TrkVertexWeightCalculatorsConfig.BDTVertexWeightCalculatorSeqCfg (   flags,
  container = 'Photons',
**  kwargs 
)
Configure BDTVertexWeightCalculator and the algorithms that are needed to run before.
Optional parameters are passed only to the tool.

Definition at line 44 of file TrkConfig/python/TrkVertexWeightCalculatorsConfig.py.

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 

◆ DecorateVertexScoreAlgCfg()

def python.TrkVertexWeightCalculatorsConfig.DecorateVertexScoreAlgCfg (   flags,
  name = "DecorateVertexScoreAlg",
**  kwargs 
)
This algorithm decorates all the vertices with the score computed by a tool.

Definition at line 7 of file TrkVertexFitter/TrkVertexWeightCalculators/python/TrkVertexWeightCalculatorsConfig.py.

7 def DecorateVertexScoreAlgCfg(flags, name="DecorateVertexScoreAlg", **kwargs):
8  """
9  This algorithm decorates all the vertices with the score computed by a tool.
10  """
11  acc = ComponentAccumulator()
12  if not kwargs.get("VertexWeightCalculator", None):
13  from TrkConfig.TrkVertexWeightCalculatorsConfig import BDTVertexWeightCalculatorSeqCfg
14  toolBDTAcc = BDTVertexWeightCalculatorSeqCfg(flags)
15  tool = toolBDTAcc.popPrivateTools()
16  acc.merge(toolBDTAcc)
17  kwargs["VertexWeightCalculator"] = tool
18 
19  kwargs.setdefault("VertexScoreDecor", "score")
20  alg = CompFactory.DecorateVertexScoreAlg(name, **kwargs)
21  acc.addEventAlgo(alg)
22  return acc
23 
24 

◆ JetRestrictedSumPt2VertexWeightCalculatorCfg()

def python.TrkVertexWeightCalculatorsConfig.JetRestrictedSumPt2VertexWeightCalculatorCfg (   flags,
  name = "JetRestrictedSumPt2VertexWeightCalculator",
  TrackParticleLocation = "InDetTrackParticles",
**  kwargs 
)

Definition at line 77 of file TrkConfig/python/TrkVertexWeightCalculatorsConfig.py.

78  flags,
79  name="JetRestrictedSumPt2VertexWeightCalculator",
80  TrackParticleLocation="InDetTrackParticles",
81  **kwargs):
82  acc = ComponentAccumulator()
83  kwargs.setdefault("DoSumPt2Selection", True)
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

◆ SumPt2VertexWeightCalculatorCfg()

def python.TrkVertexWeightCalculatorsConfig.SumPt2VertexWeightCalculatorCfg (   flags,
  name = "SumPt2VertexWeightCalculator",
**  kwargs 
)

Definition at line 7 of file TrkConfig/python/TrkVertexWeightCalculatorsConfig.py.

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 

◆ SumPtVertexWeightCalculatorCfg()

def python.TrkVertexWeightCalculatorsConfig.SumPtVertexWeightCalculatorCfg (   flags,
  name = "SumPtVertexWeightCalculator",
**  kwargs 
)

Definition at line 16 of file TrkConfig/python/TrkVertexWeightCalculatorsConfig.py.

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 

◆ TrkVertexWeightCalculatorBDTDebugRunCfg()

def python.TrkVertexWeightCalculatorsConfig.TrkVertexWeightCalculatorBDTDebugRunCfg ( )

Definition at line 115 of file TrkVertexFitter/TrkVertexWeightCalculators/python/TrkVertexWeightCalculatorsConfig.py.

116  from AthenaConfiguration.AllConfigFlags import initConfigFlags
117 
118  flags = initConfigFlags()
119  flags.Exec.MaxEvents = 100
120  from AthenaConfiguration.TestDefaults import defaultTestFiles
121 
122  flags.Input.Files = defaultTestFiles.AOD_RUN3_MC
123  flags.Output.HISTFileName = "test_tree.root"
124  flags.addFlag("Output.TreeName", "tree")
125 
126  flags.fillFromArgs()
127  flags.lock()
128  flags.dump()
129 
130  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
131 
132  acc = MainServicesCfg(flags)
133 
134  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
135 
136  acc.merge(PoolReadCfg(flags))
137 
138  acc.merge(TrkVertexWeightCalculatorDebugCfg(flags))
139  acc.printConfig(withDetails=True, summariseProps=True)
140  acc.store(open("TrkVertexWeightCalculatorBDTConfig.pkl", "wb"))
141  return acc
142 
143 

◆ TrkVertexWeightCalculatorDebugCfg()

def python.TrkVertexWeightCalculatorsConfig.TrkVertexWeightCalculatorDebugCfg (   flags,
**  kwargs 
)
This is a test configuration for the TrkVertexWeightCalculator. It is not meant to be run in production.
It produces a ROOT file with a tree containing relevant information to check the performance of the tool.

Definition at line 25 of file TrkVertexFitter/TrkVertexWeightCalculators/python/TrkVertexWeightCalculatorsConfig.py.

25 def TrkVertexWeightCalculatorDebugCfg(flags, **kwargs):
26  """
27  This is a test configuration for the TrkVertexWeightCalculator. It is not meant to be run in production.
28  It produces a ROOT file with a tree containing relevant information to check the performance of the tool.
29  """
30  from AthenaCommon.Constants import DEBUG
31  from AthenaCommon.Logging import logging
32 
33  mlog = logging.getLogger("TrkVertexWeightCalculatorBDTDebugCfg")
34  mlog.warning(
35  "This is a test algorithm, it is not meant to be run in production."
36  )
37 
38  acc = ComponentAccumulator()
39  acc.merge(DecorateVertexScoreAlgCfg(flags, **kwargs))
40  mlog.info(
41  "Setting the output level of BuildVertexPointingAlg, DecorateVertexScoreAlg, DecorateVertexScoreAlg/VertexSelectionTool to DEBUG"
42  )
43  acc.getEventAlgo("BuildVertexPointingAlg").OutputLevel = DEBUG
44  acc.getEventAlgo("DecorateVertexScoreAlg").OutputLevel = DEBUG
45  acc.getEventAlgo(
46  "DecorateVertexScoreAlg"
47  ).VertexWeightCalculator.OutputLevel = DEBUG
48 
49  from TrkConfig.TrkVertexWeightCalculatorsConfig import (
50  SumPt2VertexWeightCalculatorCfg,
51  )
52 
53  tool_pt2 = acc.popToolsAndMerge(SumPt2VertexWeightCalculatorCfg(flags))
54  acc.merge(
56  flags,
57  "DecorateVertexScoreAlgSumPt2",
58  VertexWeightCalculator=tool_pt2,
59  VertexScoreDecor="score_sumpt2",
60  )
61  )
62  acc.getEventAlgo("DecorateVertexScoreAlgSumPt2").OutputLevel = DEBUG
63 
64  tool = CompFactory.Trk.TrueVertexDistanceWeightCalculator()
65  acc.merge(
67  flags,
68  "DecorateVertexScoreAlgTrueVertexDistance",
69  VertexWeightCalculator=tool,
70  VertexScoreDecor="score_true_vertex_distance",
71  )
72  )
73  acc.getEventAlgo("DecorateVertexScoreAlgTrueVertexDistance").OutputLevel = DEBUG
74 
75  sysService = CompFactory.CP.SystematicsSvc("SystematicsSvc", sigmaRecommended=0)
76  acc.addService(sysService)
77 
78  histoSvc = CompFactory.THistSvc(
79  Output=[
80  f"ANALYSIS DATAFILE='{flags.Output.HISTFileName}' TYPE='ROOT' OPT='RECREATE'"
81  ]
82  )
83  acc.addService(histoSvc)
84  acc.setAppProperty("HistogramPersistency", "ROOT")
85 
86  acc.addEventAlgo(
87  CompFactory.CP.TreeMakerAlg("TreeMaker", TreeName=flags.Output.TreeName)
88  )
89  branches = [
90  "EventInfo.runNumber -> runNumber",
91  "EventInfo.eventNumber -> eventNumber",
92  "EventInfo.actualInteractionsPerCrossing -> actualInteractionsPerCrossing",
93  "EventInfo.averageInteractionsPerCrossing -> averageInteractionsPerCrossing",
94  "PrimaryVertices.x -> vtx_x",
95  "PrimaryVertices.y -> vtx_y",
96  "PrimaryVertices.z -> vtx_z",
97  "PrimaryVertices.score -> vtx_score",
98  "PhotonPointingVertices.z -> z_common",
99  "PhotonPointingVertices.nphotons_good -> nphotons_good",
100  "PrimaryVertices.score_sumpt2 -> vtx_score_sumpt2",
101  "PrimaryVertices.score_true_vertex_distance -> vtx_score_true_vertex_distance",
102  ]
103  acc.addEventAlgo(
104  CompFactory.CP.AsgxAODNTupleMakerAlg(
105  "NTupleMaker", TreeName=flags.Output.TreeName, Branches=branches
106  )
107  )
108  acc.addEventAlgo(
109  CompFactory.CP.TreeFillerAlg("TreeFiller", TreeName=flags.Output.TreeName)
110  )
111 
112  return acc
113 
114 

Variable Documentation

◆ acc

python.TrkVertexWeightCalculatorsConfig.acc

◆ status

python.TrkVertexWeightCalculatorsConfig.status
PhotonVertexSelectionConfig.BuildVertexPointingAlgCfg
def BuildVertexPointingAlgCfg(flags, name="BuildVertexPointingAlg", **kwargs)
Definition: PhotonVertexSelectionConfig.py:37
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.TrkVertexWeightCalculatorsConfig.SumPt2VertexWeightCalculatorCfg
def SumPt2VertexWeightCalculatorCfg(flags, name="SumPt2VertexWeightCalculator", **kwargs)
Definition: TrkConfig/python/TrkVertexWeightCalculatorsConfig.py:7
python.TrkVertexWeightCalculatorsConfig.DecorateVertexScoreAlgCfg
def DecorateVertexScoreAlgCfg(flags, name="DecorateVertexScoreAlg", **kwargs)
Definition: TrkVertexFitter/TrkVertexWeightCalculators/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:25
python.TrkVertexWeightCalculatorsConfig.SumPtVertexWeightCalculatorCfg
def SumPtVertexWeightCalculatorCfg(flags, name="SumPtVertexWeightCalculator", **kwargs)
Definition: TrkConfig/python/TrkVertexWeightCalculatorsConfig.py:16
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
Constants
some useful constants -------------------------------------------------—
Trk::open
@ open
Definition: BinningType.h:40
python.TrkVertexWeightCalculatorsConfig.BDTVertexWeightCalculatorSeqCfg
def BDTVertexWeightCalculatorSeqCfg(flags, container='Photons', **kwargs)
Definition: TrkConfig/python/TrkVertexWeightCalculatorsConfig.py:44
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.TrkVertexWeightCalculatorsConfig.JetRestrictedSumPt2VertexWeightCalculatorCfg
def JetRestrictedSumPt2VertexWeightCalculatorCfg(flags, name="JetRestrictedSumPt2VertexWeightCalculator", TrackParticleLocation="InDetTrackParticles", **kwargs)
Definition: TrkConfig/python/TrkVertexWeightCalculatorsConfig.py:77
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69
python.TrkVertexWeightCalculatorsConfig.TrkVertexWeightCalculatorBDTDebugRunCfg
def TrkVertexWeightCalculatorBDTDebugRunCfg()
Definition: TrkVertexFitter/TrkVertexWeightCalculators/python/TrkVertexWeightCalculatorsConfig.py:115
python.TrkVertexWeightCalculatorsConfig.TrkVertexWeightCalculatorDebugCfg
def TrkVertexWeightCalculatorDebugCfg(flags, **kwargs)
Definition: TrkVertexFitter/TrkVertexWeightCalculators/python/TrkVertexWeightCalculatorsConfig.py:25