3 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory
import CompFactory
9 This algorithm decorates all the vertices with the score computed by a tool.
12 if not kwargs.get(
"VertexWeightCalculator",
None):
13 from TrkConfig.TrkVertexWeightCalculatorsConfig
import BDTVertexWeightCalculatorSeqCfg
15 tool = toolBDTAcc.popPrivateTools()
17 kwargs[
"VertexWeightCalculator"] = tool
19 kwargs.setdefault(
"VertexScoreDecor",
"score")
20 alg = CompFactory.DecorateVertexScoreAlg(name, **kwargs)
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.
31 from AthenaCommon.Logging
import logging
33 mlog = logging.getLogger(
"TrkVertexWeightCalculatorBDTDebugCfg")
35 "This is a test algorithm, it is not meant to be run in production."
41 "Setting the output level of BuildVertexPointingAlg, DecorateVertexScoreAlg, DecorateVertexScoreAlg/VertexSelectionTool to DEBUG"
43 acc.getEventAlgo(
"BuildVertexPointingAlg").OutputLevel = DEBUG
44 acc.getEventAlgo(
"DecorateVertexScoreAlg").OutputLevel = DEBUG
46 "DecorateVertexScoreAlg"
47 ).VertexWeightCalculator.OutputLevel = DEBUG
49 from TrkConfig.TrkVertexWeightCalculatorsConfig
import (
50 SumPt2VertexWeightCalculatorCfg,
57 "DecorateVertexScoreAlgSumPt2",
58 VertexWeightCalculator=tool_pt2,
59 VertexScoreDecor=
"score_sumpt2",
62 acc.getEventAlgo(
"DecorateVertexScoreAlgSumPt2").OutputLevel = DEBUG
64 tool = CompFactory.Trk.TrueVertexDistanceWeightCalculator()
68 "DecorateVertexScoreAlgTrueVertexDistance",
69 VertexWeightCalculator=tool,
70 VertexScoreDecor=
"score_true_vertex_distance",
73 acc.getEventAlgo(
"DecorateVertexScoreAlgTrueVertexDistance").OutputLevel = DEBUG
75 sysService = CompFactory.CP.SystematicsSvc(
"SystematicsSvc", sigmaRecommended=0)
76 acc.addService(sysService)
78 histoSvc = CompFactory.THistSvc(
80 f
"ANALYSIS DATAFILE='{flags.Output.HISTFileName}' TYPE='ROOT' OPT='RECREATE'"
83 acc.addService(histoSvc)
84 acc.setAppProperty(
"HistogramPersistency",
"ROOT")
87 CompFactory.CP.TreeMakerAlg(
"TreeMaker", TreeName=flags.Output.TreeName)
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",
104 CompFactory.CP.AsgxAODNTupleMakerAlg(
105 "NTupleMaker", TreeName=flags.Output.TreeName, Branches=branches
109 CompFactory.CP.TreeFillerAlg(
"TreeFiller", TreeName=flags.Output.TreeName)
116 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
119 flags.Exec.MaxEvents = 100
120 from AthenaConfiguration.TestDefaults
import defaultTestFiles
122 flags.Input.Files = defaultTestFiles.AOD_RUN3_MC
123 flags.Output.HISTFileName =
"test_tree.root"
124 flags.addFlag(
"Output.TreeName",
"tree")
130 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
134 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
139 acc.printConfig(withDetails=
True, summariseProps=
True)
140 acc.store(
open(
"TrkVertexWeightCalculatorBDTConfig.pkl",
"wb"))
144 if __name__ ==
"__main__":
150 sys.exit(
not status.isSuccess())