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