ATLAS Offline Software
InDetPriVxFinderConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 # Configuration of InDetPriVxFinder package
3 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
4 from AthenaConfiguration.ComponentFactory import CompFactory
5 
6 
8  name: str = "InDetPriVxFinder",
9  **kwargs) -> ComponentAccumulator:
10  acc = ComponentAccumulator()
11 
12  if "VertexCollectionSortingTool" not in kwargs:
13  from TrkConfig.TrkVertexToolsConfig import (
14  VertexCollectionSortingToolCfg)
15  kwargs.setdefault("VertexCollectionSortingTool", acc.popToolsAndMerge(
17 
18  if "VertexFinderTool" not in kwargs:
19  from InDetConfig.InDetPriVxFinderToolConfig import (
20  VertexFinderToolCfg)
21  kwargs.setdefault("VertexFinderTool", acc.popToolsAndMerge(
22  VertexFinderToolCfg(flags)))
23 
24  kwargs.setdefault("doVertexSorting", True)
25 
26  if flags.Tracking.perigeeExpression == "Vertex":
27  from xAODTrackingCnv.xAODTrackingCnvConfig import (
28  BeamLineTrackParticleCnvAlgCfg)
29  from InDetConfig.TrackRecoConfig import (
30  ClusterSplitProbabilityContainerName)
32  flags,
33  ClusterSplitProbabilityName = \
35  AssociationMapName = "PRDtoTrackMapMerge_CombinedInDetTracks",
36  xAODTrackParticlesFromTracksContainerName = \
37  "InDetTrackParticlesTemporary"))
38  kwargs["TracksName"]="InDetTrackParticlesTemporary"
39 
40  acc.addEventAlgo(CompFactory.InDet.InDetPriVxFinder(name, **kwargs))
41  return acc
42 
44  inputTracks: str,
45  outputVtx: str,
46  name: str = "InDetTrigPriVxFinder",
47  **kwargs) -> ComponentAccumulator:
48 
49  acc = ComponentAccumulator()
50 
51  kwargs["TracksName"] = inputTracks
52  kwargs["VxCandidatesOutputName"] = outputVtx
53 
54  if "VertexFinderTool" not in kwargs:
55  from InDetConfig.InDetPriVxFinderToolConfig import (
56  TrigVertexFinderToolCfg)
57  kwargs.setdefault("VertexFinderTool", acc.popToolsAndMerge(
59 
60  if "VertexCollectionSortingTool" not in kwargs:
61  from TrkConfig.TrkVertexToolsConfig import (
62  SumPt2VertexCollectionSortingToolCfg)
63  kwargs.setdefault("VertexCollectionSortingTool", acc.popToolsAndMerge(
65 
66  if "PriVxMonTool" not in kwargs:
67  from InDetPriVxFinder.InDetPriVxFinderMonitoring import (
68  InDetPriVxFinderMonitoringTool)
69  kwargs.setdefault("PriVxMonTool", InDetPriVxFinderMonitoringTool(flags))
70 
71  kwargs.setdefault("doVertexSorting", True)
72 
73  acc.addEventAlgo(CompFactory.InDet.InDetPriVxFinder(name+flags.Tracking.ActiveConfig.input_name,
74  **kwargs))
75  return acc
76 
77 
79  name: str = "InDetPriVxFinder",
80  vxCandidatesOutputName: str = "PrimaryVertices",
81  **kwargs) -> ComponentAccumulator:
82 
83  acc = InDetPriVxFinderCfg(flags,
84  name,
85  VxCandidatesOutputName=vxCandidatesOutputName,
86  **kwargs)
87 
88  if flags.Tracking.perigeeExpression == "Vertex":
89  from xAODTrackingCnv.xAODTrackingCnvConfig import TrackParticleCnvAlgCfg
90  from InDetConfig.TrackRecoConfig import (
91  ClusterSplitProbabilityContainerName)
92  acc.merge(TrackParticleCnvAlgCfg(
93  flags,
94  ClusterSplitProbabilityName=ClusterSplitProbabilityContainerName(
95  flags),
96  AssociationMapName="PRDtoTrackMapMerge_CombinedInDetTracks"))
97 
98  from OutputStreamAthenaPool.OutputStreamConfig import addToESD, addToAOD
99 
100  excludedVtxAuxData = "-vxTrackAtVertex.-MvfFitInfo.-isInitialized.-VTAV.-TruthEventMatchingInfos.-TruthEventRawMatchingInfos.-VertexMatchType"
101  verticesContainer = [
102  f"xAOD::VertexContainer#{vxCandidatesOutputName}",
103  f"xAOD::VertexAuxContainer#{vxCandidatesOutputName}Aux." + excludedVtxAuxData,
104  ]
105 
106  acc.merge(addToAOD(flags, verticesContainer))
107  acc.merge(addToESD(flags, verticesContainer))
108 
109  return acc
110 
111 if __name__ == "__main__":
112  from AthenaCommon.Logging import logging
113  from AthenaConfiguration.AllConfigFlags import initConfigFlags
114  flags = initConfigFlags()
115 
116  from AthenaConfiguration.TestDefaults import defaultTestFiles
117  from AthenaConfiguration.ComponentAccumulator import printProperties
118  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
119  from TrkConfig.VertexFindingFlags import VertexSetup
120 
121  flags.Input.Files = defaultTestFiles.RDO_RUN2
122  import sys
123  if 'ActsGaussAdaptiveMultiFinding' in sys.argv:
124  flags.Tracking.PriVertex.setup = VertexSetup.ActsGaussAMVF
125  elif "IterativeFinding" in sys.argv:
126  flags.Tracking.PriVertex.setup = VertexSetup.IVF
127  elif "FastIterativeFinding" in sys.argv:
128  flags.Tracking.PriVertex.setup = VertexSetup.FastIVF
129  flags.lock()
130 
131  acc = MainServicesCfg(flags)
132  acc.merge(primaryVertexFindingCfg(flags))
133 
134  mlog = logging.getLogger("primaryVertexFindingConfigTest")
135  mlog.info("Configuring primaryVertexFinding: ")
136 
138  mlog,
139  acc.getEventAlgo("InDetPriVxFinder"),
140  nestLevel=2,
141  printDefaults=True,
142  )
143 
144  acc.wasMerged()
python.TrkVertexToolsConfig.SumPt2VertexCollectionSortingToolCfg
def SumPt2VertexCollectionSortingToolCfg(flags, name="SumPt2VertexCollectionSortingTool", **kwargs)
Definition: TrkVertexToolsConfig.py:7
python.InDetPriVxFinderToolConfig.TrigVertexFinderToolCfg
def TrigVertexFinderToolCfg(flags, **kwargs)
Definition: InDetPriVxFinderToolConfig.py:135
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.InDetPriVxFinderConfig.InDetPriVxFinderCfg
ComponentAccumulator InDetPriVxFinderCfg(flags, str name="InDetPriVxFinder", **kwargs)
Definition: InDetPriVxFinderConfig.py:7
python.InDetPriVxFinderConfig.InDetTrigPriVxFinderCfg
ComponentAccumulator InDetTrigPriVxFinderCfg(flags, str inputTracks, str outputVtx, str name="InDetTrigPriVxFinder", **kwargs)
Definition: InDetPriVxFinderConfig.py:43
python.TrackRecoConfig.ClusterSplitProbabilityContainerName
def ClusterSplitProbabilityContainerName(flags)
Definition: TrackRecoConfig.py:86
InDetPriVxFinderMonitoring.InDetPriVxFinderMonitoringTool
def InDetPriVxFinderMonitoringTool(flags)
Definition: InDetPriVxFinderMonitoring.py:4
python.TrkVertexToolsConfig.VertexCollectionSortingToolCfg
def VertexCollectionSortingToolCfg(flags, **kwargs)
Definition: TrkVertexToolsConfig.py:54
python.InDetPriVxFinderToolConfig.VertexFinderToolCfg
def VertexFinderToolCfg(flags, **kwargs)
Definition: InDetPriVxFinderToolConfig.py:120
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
python.OutputStreamConfig.addToESD
def addToESD(flags, itemOrList, **kwargs)
Definition: OutputStreamConfig.py:127
xAODTrackingCnvConfig.BeamLineTrackParticleCnvAlgCfg
def BeamLineTrackParticleCnvAlgCfg(flags, name="BeamLineTrackParticleCnvAlg", ClusterSplitProbabilityName="", AssociationMapName="", **kwargs)
Definition: xAODTrackingCnvConfig.py:210
python.InDetPriVxFinderConfig.primaryVertexFindingCfg
ComponentAccumulator primaryVertexFindingCfg(flags, str name="InDetPriVxFinder", str vxCandidatesOutputName="PrimaryVertices", **kwargs)
Definition: InDetPriVxFinderConfig.py:78
extractSporadic.printProperties
def printProperties(h, q, hLB)
Definition: extractSporadic.py:8
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.OutputStreamConfig.addToAOD
def addToAOD(flags, itemOrList, **kwargs)
Definition: OutputStreamConfig.py:142
xAODTrackingCnvConfig.TrackParticleCnvAlgCfg
def TrackParticleCnvAlgCfg(flags, name="TrackParticleCnvAlg", ClusterSplitProbabilityName="", AssociationMapName="", **kwargs)
TrackParticleCnvAlg.
Definition: xAODTrackingCnvConfig.py:97