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
16
17// Need to include this early; otherwise, we run into errors with
18// ReferenceWrapperAnyCompat in clang builds due the is_constructable
19// specialization defined there getting implicitly instantiated earlier.
20#include "Acts/Propagator/Propagator.hpp"
21#include "ActsInterop/Logger.h"
22
23// PACKAGE
26
28// ACTS
29#include "Acts/Propagator/EigenStepper.hpp"
30#include "Acts/Propagator/Propagator.hpp"
31#include "Acts/Propagator/Navigator.hpp"
32#include "Acts/Definitions/Units.hpp"
33#include "Acts/Utilities/Helpers.hpp"
34#include "Acts/Vertexing/AdaptiveMultiVertexFinder.hpp"
35#include "Acts/Vertexing/AdaptiveMultiVertexFitter.hpp"
36#include "Acts/Vertexing/HelicalTrackLinearizer.hpp"
37#include "Acts/Vertexing/TrackDensityVertexFinder.hpp"
38#include "Acts/Vertexing/TrackAtVertex.hpp"
39#include "Acts/Vertexing/Vertex.hpp"
40#include "Acts/Vertexing/ImpactPointEstimator.hpp"
41
42#include <cmath>
43
44namespace Acts {
45class Surface;
46class BoundaryCheck;
47}
48
49namespace ActsTrk {
50 class AdaptiveMultiPriVtxFinderTool : public extends<AthAlgTool, InDet::IVertexFinder>
51 {
52
53 // Track wrapper input for the Acts vertexing
55 public:
56 TrackWrapper(const Trk::ITrackLink* trkLink, const Acts::BoundTrackParameters& boundParams)
57 : m_trkLink(trkLink)
58 , m_boundParams(boundParams)
59 {}
60
61 const Acts::BoundTrackParameters& parameters() const {return m_boundParams;}
62
63 const Trk::ITrackLink* trackLink() const {return m_trkLink;}
64
65 static Acts::BoundTrackParameters extractParameters(const Acts::InputTrack& input) {
66 return input.template as<TrackWrapper>()->parameters();
67 }
68
69 private:
70 const Trk::ITrackLink* m_trkLink{nullptr};
71 Acts::BoundTrackParameters m_boundParams;
72 };
73
74 public:
75 virtual StatusCode initialize() override;
76
77 using base_class::base_class;
78
79 virtual std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
80 findVertex(const EventContext& ctx, const TrackCollection* trackTES) const override;
81
82 virtual std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
83 findVertex(const EventContext& ctx, const xAOD::TrackParticleContainer* trackParticles) const override;
84
85 private:
86
87 // Overload that takes vector of ITrackLink
88 std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*>
89 findVertex(const EventContext& ctx, const std::vector<std::unique_ptr<Trk::ITrackLink>>& trackVector) const;
90
91 // Convert Acts::BoundTrackParameters -> Trk::Perigee
93 const Acts::BoundTrackParameters& bound, const Acts::Vector3& surfCenter) const;
94
95 // Helper to compute "signal compatibility" for sorting vertices
97
99 std::unique_ptr<const Acts::Logger> m_logger {nullptr};
100 const Acts::Logger &logger() const { return *m_logger; }
101
102 using Propagator = Acts::Propagator<Acts::EigenStepper<>, Acts::Navigator>;
103 using TrackLinearizer = Acts::HelicalTrackLinearizer;
104 using VertexFitter = Acts::AdaptiveMultiVertexFitter;
105 using VertexSeedFinder= Acts::TrackDensityVertexFinder;
106 using VertexFinder = Acts::AdaptiveMultiVertexFinder;
107
108 void initializeVertexFinder(VertexFinder::Config& finderConfig);
109
110 std::shared_ptr<VertexFinder> m_vertexFinder = nullptr;
111 std::shared_ptr<Propagator> m_propagator = nullptr;
112
113 // optional because of late initializatio
114 std::optional<TrackLinearizer> m_linearizer = std::nullopt;
115
118
119 ServiceHandle<ActsTrk::ITrackingGeometrySvc> m_trackingGeometrySvc{this, "TrackingGeometrySvc", "ActsTrackingGeometrySvc"};
120
121 ToolHandle<InDet::IInDetTrackSelectionTool> m_trkFilter{this, "TrackSelector", "", "InDetTrackSelectionTool"};
122 SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey {this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot"};
123
124
125 // Configuration variables
126 // For details check ACTS documentation
127 //
128 // Annealing tool config
129 DoubleArrayProperty m_annealingTemps{this, "annealingTemps", {1.0}, "Annealing temperatures"};
130 DoubleProperty m_annealingCutOff{this, "annealingCutOff", 9., "Annealing cut-off value"};
131 // Fitter config variables
132 UnsignedIntegerProperty m_fitterMaxIterations{this, "fitterMaxIterations", 30, "Vertex fitter max. iterations"};
133 DoubleProperty m_fitterMaxDistToLinPoint{this, "fitterMaxDistToLinPoint", 0.5, "Vertex fitter max. distance to LinPoint"};
134 DoubleProperty m_fitterMaxRelativeShift{this, "fitterMaxRelativeShift", 0.01, "Vertex fitter max. relative shift"};
135 BooleanProperty m_fitterDoSmoothing{this, "fitterDoSmoothing", true, "Vertex fitter doSmoothing"};
136 DoubleProperty m_minWeightFitter{this, "minWeightFitter", 0.001, "Min track weight for fitter"};
137
138 // Finder config
139 BooleanProperty m_useBeamConstraint{this, "useBeamConstraint", true, "Use beam constraint"};
140 DoubleProperty m_tracksMaxZinterval{this, "tracksMaxZinterval", 1., "Tracks max. Z-interval"};
141 DoubleProperty m_tracksMaxSignificance{this, "tracksMaxSignificance", 5., "Tracks max. significance"};
142 DoubleProperty m_maxVertexChi2{this, "maxVertexChi2", 18.42, "Max vertex chi2"};
143 BooleanProperty m_doRealMultiVertex{this, "doRealMultiVertex", true, "Do real multivertex fit"};
144 BooleanProperty m_useFastCompatibility{this, "useFastCompatibility", true, "Use fast compatibility estimation"};
145 DoubleProperty m_maxMergeVertexSignificance{this, "maxMergeVertexSignificance", 3., "Max merge vertex significance"};
146 DoubleProperty m_minWeight{this, "minWeight", 0.0001, "Min track weight for finder"};
147 UnsignedIntegerProperty m_maxIterations{this, "maxIterations", 100, "Vertex finder max. iterations"};
148 BooleanProperty m_addSingleTrackVertices{this, "addSingleTrackVertices", false, "Add single-track vertices"};
149 BooleanProperty m_doFullSplitting{this, "doFullSplitting", false, "Do full-splitting"};
150 DoubleProperty m_maximumVertexContamination{this, "maximumVertexContamination", 0.5, "Max. vertex contamination"};
151 DoubleProperty m_looseConstrValue{this, "looseConstrValue", 1e+8, "Loose constraint value"};
152 BooleanProperty m_useVertexCovForIPEstimation{this, "useVertexCovForIPEstimation", false, "Use seed vertex cov for IPEstimation"};
153 BooleanProperty m_useSeedConstraint{this, "useSeedConstraint", false, "Use seed constraint in fit"};
154 // Final vertex selection variables
155 DoubleProperty m_finalCutMaxVertexChi2{this, "finalCutMaxVertexChi2", 18.42, "Final cut max. vertex chi2"};
156 // Gaussian seeder finder variables
157 DoubleProperty m_gaussianMaxD0Significance{this, "gaussianMaxD0Significance", 3.5, "Gaussian seeder max d0 track significance"};
158 DoubleProperty m_gaussianMaxZ0Significance{this, "gaussianMaxDZSignificance", 12.0, "Gaussian seeder max z0 track significance"};
159 // Grid seeder finder variables
160 UnsignedIntegerProperty m_gridMainGridSize{this, "GridMainGridSize", 20, "Main grid size for Acts::GaussianGridTrackDensity"};
161 UnsignedIntegerProperty m_gridTrkGridSize{this, "GridTrkGridSize", 10, "Track grid size for Acts::GaussianGridTrackDensity"};
162 BooleanProperty m_gridUseHighestSumZPosition{this, "GridUseHighestSumZPosition", false, "Use highest sum Z position in the grid seeder"};
163 // Grid seeder selection thresholds
164 DoubleProperty m_gridMaxD0Significance{this, "gridMaxD0Significance", 3.5, "Grid seeder max d0 track significance"};
165 DoubleProperty m_gridMaxZ0Significance{this, "gridMaxZ0Significance", 12.0, "Grid seeder max z0 track significance"};
166
167 // IP Estimator config
168 UnsignedIntegerProperty m_ipEstMaxIterations{this, "ipEstMaxIterations", 20, "IpEstimator max. iterations"};
169 DoubleProperty m_ipEstPrecision{this, "ipEstPrecision", 1e-10, "IpEstimator precision"};
170 StringProperty m_seederType{this, "seederType", "Gaussian", "type of seeder, \"Grid\" for Grid seeder, other for Gaussian seeder (default)"};
171 };
172}
173
174#endif // ACTSTRKPRIVTXFINDERTOOL_ADAPTIVEMULTIPRIVTXFINDERTOOL_H
175
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)
ContextUtility m_ctxProvider
Auxiliary class to access the magnetic field, geometry and calibration context.
Trk::Perigee * actsBoundToTrkPerigee(const Acts::BoundTrackParameters &bound, const Acts::Vector3 &surfCenter) const
double estimateSignalCompatibility(xAOD::Vertex *vtx) const
ServiceHandle< ActsTrk::ITrackingGeometrySvc > m_trackingGeometrySvc
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
void initializeVertexFinder(VertexFinder::Config &finderConfig)
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
ToolHandle< InDet::IInDetTrackSelectionTool > m_trkFilter
Acts::Propagator< Acts::EigenStepper<>, Acts::Navigator > Propagator
Utility class to handle the three contexts neeeded in an ACTS reconstruction job 1) GeometryContext -...
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".