ATLAS Offline Software
Loading...
Searching...
No Matches
AdaptiveMultiPriVtxFinderTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ACTSTRKPRIVTXFINDERTOOL_ADAPTIVEMULTIPRIVTXFINDERTOOL_H
6#define ACTSTRKPRIVTXFINDERTOOL_ADAPTIVEMULTIPRIVTXFINDERTOOL_H
7
8// ATHENA
10#include "GaudiKernel/IInterface.h"
11#include "GaudiKernel/ServiceHandle.h"
12#include "Gaudi/Property.h"
13#include "GaudiKernel/EventContext.h"
19
20// Need to include this early; otherwise, we run into errors with
21// ReferenceWrapperAnyCompat in clang builds due the is_constructable
22// specialization defined there getting implicitly instantiated earlier.
23#include "Acts/Propagator/Propagator.hpp"
24#include "ActsInterop/Logger.h"
25
26// PACKAGE
31
32// ACTS
33#include "Acts/Propagator/EigenStepper.hpp"
34#include "Acts/Propagator/Propagator.hpp"
35#include "Acts/Propagator/Navigator.hpp"
36#include "Acts/Definitions/Units.hpp"
37#include "Acts/Utilities/Helpers.hpp"
38#include "Acts/Vertexing/AdaptiveMultiVertexFinder.hpp"
39#include "Acts/Vertexing/AdaptiveMultiVertexFitter.hpp"
40#include "Acts/Vertexing/HelicalTrackLinearizer.hpp"
41#include "Acts/Vertexing/TrackDensityVertexFinder.hpp"
42#include "Acts/Vertexing/TrackAtVertex.hpp"
43#include "Acts/Vertexing/Vertex.hpp"
44#include "Acts/Vertexing/ImpactPointEstimator.hpp"
45
46#include <cmath>
47
48namespace Acts {
49class Surface;
50class BoundaryCheck;
51}
52
53namespace ActsTrk {
54 class AdaptiveMultiPriVtxFinderTool : public extends<AthAlgTool, InDet::IVertexFinder>
55 {
56
57 // Track wrapper input for the Acts vertexing
59 public:
60 TrackWrapper(const Trk::ITrackLink* trkLink, const Acts::BoundTrackParameters& boundParams)
61 : m_trkLink(trkLink)
62 , m_boundParams(boundParams)
63 {}
64
65 const Acts::BoundTrackParameters& parameters() const {return m_boundParams;}
66
67 const Trk::ITrackLink* trackLink() const {return m_trkLink;}
68
69 static Acts::BoundTrackParameters extractParameters(const Acts::InputTrack& input) {
70 return input.template as<TrackWrapper>()->parameters();
71 }
72
73 private:
74 const Trk::ITrackLink* m_trkLink{nullptr};
75 Acts::BoundTrackParameters m_boundParams;
76 };
77
78 public:
79 virtual StatusCode initialize() override;
80
81 AdaptiveMultiPriVtxFinderTool(const std::string& type,
82 const std::string& name,
83 const IInterface* parent);
84
85 virtual std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
86 findVertex(const EventContext& ctx, const TrackCollection* trackTES) const override;
87
88 virtual std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
89 findVertex(const EventContext& ctx, const xAOD::TrackParticleContainer* trackParticles) const override;
90
91 private:
92
93 // Overload that takes vector of ITrackLink
94 std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
95 findVertex(const EventContext& ctx, const std::vector<std::unique_ptr<Trk::ITrackLink>>& trackVector) const;
96
97 // Convert Acts::BoundTrackParameters -> Trk::Perigee
99 const Acts::BoundTrackParameters& bound, const Acts::Vector3& surfCenter) const;
100
101 // Helper to compute "signal compatibility" for sorting vertices
102 double estimateSignalCompatibility(xAOD::Vertex* vtx) const;
103
104 // Provide access to the geometry tool
105 virtual
108 {
109 return m_trackingGeometryTool.get();
110 }
111
113 std::unique_ptr<const Acts::Logger> m_logger {nullptr};
114 const Acts::Logger &logger() const { return *m_logger; }
115
116 using Propagator = Acts::Propagator<Acts::EigenStepper<>, Acts::Navigator>;
117 using TrackLinearizer = Acts::HelicalTrackLinearizer;
118 using VertexFitter = Acts::AdaptiveMultiVertexFitter;
119 using VertexSeedFinder= Acts::TrackDensityVertexFinder;
120 using VertexFinder = Acts::AdaptiveMultiVertexFinder;
121
122 void initializeVertexFinder(VertexFinder::Config& finderConfig);
123
124 std::shared_ptr<VertexFinder> m_vertexFinder = nullptr;
125 std::shared_ptr<Propagator> m_propagator = nullptr;
126
127 // optional because of late initializatio
128 std::optional<TrackLinearizer> m_linearizer = std::nullopt;
129
130 PublicToolHandle<ActsTrk::ITrackingGeometryTool> m_trackingGeometryTool{this, "TrackingGeometryTool", "", "ActsTrackingGeometryTool"};
131 ToolHandle<ActsTrk::IExtrapolationTool> m_extrapolationTool{this, "ExtrapolationTool", "", "ActsExtrapolationTool"};
132 ToolHandle<InDet::IInDetTrackSelectionTool> m_trkFilter{this, "TrackSelector", "", "InDetTrackSelectionTool"};
133 SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey {this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot"};
134
135
136 // Configuration variables
137 // For details check ACTS documentation
138 //
139 // Annealing tool config
140 DoubleArrayProperty m_annealingTemps{this, "annealingTemps", {1.0}, "Annealing temperatures"};
141 DoubleProperty m_annealingCutOff{this, "annealingCutOff", 9., "Annealing cut-off value"};
142 // Fitter config variables
143 UnsignedIntegerProperty m_fitterMaxIterations{this, "fitterMaxIterations", 30, "Vertex fitter max. iterations"};
144 DoubleProperty m_fitterMaxDistToLinPoint{this, "fitterMaxDistToLinPoint", 0.5, "Vertex fitter max. distance to LinPoint"};
145 DoubleProperty m_fitterMaxRelativeShift{this, "fitterMaxRelativeShift", 0.01, "Vertex fitter max. relative shift"};
146 BooleanProperty m_fitterDoSmoothing{this, "fitterDoSmoothing", true, "Vertex fitter doSmoothing"};
147 DoubleProperty m_minWeightFitter{this, "minWeightFitter", 0.001, "Min track weight for fitter"};
148
149 // Finder config
150 BooleanProperty m_useBeamConstraint{this, "useBeamConstraint", true, "Use beam constraint"};
151 DoubleProperty m_tracksMaxZinterval{this, "tracksMaxZinterval", 1., "Tracks max. Z-interval"};
152 DoubleProperty m_tracksMaxSignificance{this, "tracksMaxSignificance", 5., "Tracks max. significance"};
153 DoubleProperty m_maxVertexChi2{this, "maxVertexChi2", 18.42, "Max vertex chi2"};
154 BooleanProperty m_doRealMultiVertex{this, "doRealMultiVertex", true, "Do real multivertex fit"};
155 BooleanProperty m_useFastCompatibility{this, "useFastCompatibility", true, "Use fast compatibility estimation"};
156 DoubleProperty m_maxMergeVertexSignificance{this, "maxMergeVertexSignificance", 3., "Max merge vertex significance"};
157 DoubleProperty m_minWeight{this, "minWeight", 0.0001, "Min track weight for finder"};
158 UnsignedIntegerProperty m_maxIterations{this, "maxIterations", 100, "Vertex finder max. iterations"};
159 BooleanProperty m_addSingleTrackVertices{this, "addSingleTrackVertices", false, "Add single-track vertices"};
160 BooleanProperty m_doFullSplitting{this, "doFullSplitting", false, "Do full-splitting"};
161 DoubleProperty m_maximumVertexContamination{this, "maximumVertexContamination", 0.5, "Max. vertex contamination"};
162 DoubleProperty m_looseConstrValue{this, "looseConstrValue", 1e+8, "Loose constraint value"};
163 BooleanProperty m_useVertexCovForIPEstimation{this, "useVertexCovForIPEstimation", false, "Use seed vertex cov for IPEstimation"};
164 BooleanProperty m_useSeedConstraint{this, "useSeedConstraint", false, "Use seed constraint in fit"};
165 // Final vertex selection variables
166 DoubleProperty m_finalCutMaxVertexChi2{this, "finalCutMaxVertexChi2", 18.42, "Final cut max. vertex chi2"};
167 // Gaussian seeder finder variables
168 DoubleProperty m_gaussianMaxD0Significance{this, "gaussianMaxD0Significance", 3.5, "Gaussian seeder max d0 track significance"};
169 DoubleProperty m_gaussianMaxZ0Significance{this, "gaussianMaxDZSignificance", 12.0, "Gaussian seeder max z0 track significance"};
170 // Grid seeder finder variables
171 UnsignedIntegerProperty m_gridMainGridSize{this, "GridMainGridSize", 20, "Main grid size for Acts::GaussianGridTrackDensity"};
172 UnsignedIntegerProperty m_gridTrkGridSize{this, "GridTrkGridSize", 10, "Track grid size for Acts::GaussianGridTrackDensity"};
173 BooleanProperty m_gridUseHighestSumZPosition{this, "GridUseHighestSumZPosition", false, "Use highest sum Z position in the grid seeder"};
174 // Grid seeder selection thresholds
175 DoubleProperty m_gridMaxD0Significance{this, "gridMaxD0Significance", 3.5, "Grid seeder max d0 track significance"};
176 DoubleProperty m_gridMaxZ0Significance{this, "gridMaxZ0Significance", 12.0, "Grid seeder max z0 track significance"};
177
178 // IP Estimator config
179 UnsignedIntegerProperty m_ipEstMaxIterations{this, "ipEstMaxIterations", 20, "IpEstimator max. iterations"};
180 DoubleProperty m_ipEstPrecision{this, "ipEstPrecision", 1e-10, "IpEstimator precision"};
181 StringProperty m_seederType{this, "seederType", "Gaussian", "type of seeder, \"Grid\" for Grid seeder, other for Gaussian seeder (default)"};
182 };
183}
184
185#endif // ACTSTRKPRIVTXFINDERTOOL_ADAPTIVEMULTIPRIVTXFINDERTOOL_H
186
DataVector< Trk::Track > TrackCollection
This typedef represents a collection of Trk::Track objects.
static Acts::BoundTrackParameters extractParameters(const Acts::InputTrack &input)
TrackWrapper(const Trk::ITrackLink *trkLink, const Acts::BoundTrackParameters &boundParams)
Trk::Perigee * actsBoundToTrkPerigee(const Acts::BoundTrackParameters &bound, const Acts::Vector3 &surfCenter) const
ToolHandle< ActsTrk::IExtrapolationTool > m_extrapolationTool
double estimateSignalCompatibility(xAOD::Vertex *vtx) const
AdaptiveMultiPriVtxFinderTool(const std::string &type, const std::string &name, const IInterface *parent)
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
void initializeVertexFinder(VertexFinder::Config &finderConfig)
virtual const ActsTrk::ITrackingGeometryTool * trackingGeometryTool() const
virtual std::pair< xAOD::VertexContainer *, xAOD::VertexAuxContainer * > findVertex(const EventContext &ctx, const TrackCollection *trackTES) const override
std::unique_ptr< const Acts::Logger > m_logger
logging instance
PublicToolHandle< ActsTrk::ITrackingGeometryTool > m_trackingGeometryTool
ToolHandle< InDet::IInDetTrackSelectionTool > m_trkFilter
Acts::Propagator< Acts::EigenStepper<>, Acts::Navigator > Propagator
Geometry helper tool extending the Tracking geometry service by the data dependency to fetch the geom...
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
Vertex_v1 Vertex
Define the latest version of the vertex class.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".