ATLAS Offline Software
Loading...
Searching...
No Matches
python.TrkVertexWeightCalculatorsConfig Namespace Reference

Functions

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

Variables

 acc = TrkVertexWeightCalculatorBDTDebugRunCfg()
 status = acc.run()

Function Documentation

◆ BDTVertexWeightCalculatorCfg()

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 32 of file TrkConfig/python/TrkVertexWeightCalculatorsConfig.py.

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

◆ BDTVertexWeightCalculatorSeqCfg()

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 51 of file TrkConfig/python/TrkVertexWeightCalculatorsConfig.py.

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

◆ DecorateVertexScoreAlgCfg()

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.

7def 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

◆ GNNVertexWeightCalculatorCfg()

python.TrkVertexWeightCalculatorsConfig.GNNVertexWeightCalculatorCfg ( flags,
name = "GNNVertexWeightCalculator",
** kwargs )

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

26 **kwargs):
27 acc = ComponentAccumulator()
28 acc.setPrivateTools(
29 CompFactory.GNNVertexWeightCalculator(name, **kwargs))
30 return acc
31

◆ JetRestrictedSumPt2VertexWeightCalculatorCfg()

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

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

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

◆ SumPt2VertexWeightCalculatorCfg()

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

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

8 **kwargs):
9 acc = ComponentAccumulator()
10 kwargs.setdefault("DoSumPt2Selection", True)
11 acc.setPrivateTools(
12 CompFactory.Trk.SumPtVertexWeightCalculator(name, **kwargs))
13 return acc
14
15

◆ SumPtVertexWeightCalculatorCfg()

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

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

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()

python.TrkVertexWeightCalculatorsConfig.TrkVertexWeightCalculatorBDTDebugRunCfg ( )

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

115def TrkVertexWeightCalculatorBDTDebugRunCfg():
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()

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.

25def 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(
55 DecorateVertexScoreAlgCfg(
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(
66 DecorateVertexScoreAlgCfg(
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

◆ status

python.TrkVertexWeightCalculatorsConfig.status = acc.run()