File indexing completed on 2025-01-18 09:11:33
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Acts/Vertexing/TrackDensityVertexFinder.hpp"
0010
0011 Acts::Result<std::vector<Acts::Vertex>> Acts::TrackDensityVertexFinder::find(
0012 const std::vector<InputTrack>& trackVector,
0013 const VertexingOptions& vertexingOptions,
0014 IVertexFinder::State& ) const {
0015 GaussianTrackDensity::State densityState(trackVector.size());
0016
0017
0018 auto zAndWidthRes = m_cfg.trackDensityEstimator.globalMaximumWithWidth(
0019 densityState, trackVector);
0020 if (!zAndWidthRes.ok()) {
0021 return zAndWidthRes.error();
0022 }
0023 const auto& zAndWidthOpt = *zAndWidthRes;
0024 if (!zAndWidthOpt) {
0025 return std::vector<Vertex>();
0026 }
0027 const auto& zAndWidth = *zAndWidthOpt;
0028
0029 double z = zAndWidth.first;
0030
0031
0032
0033 Vector4 seedPos =
0034 vertexingOptions.constraint.fullPosition() + Vector4(0., 0., z, 0.);
0035
0036 Vertex returnVertex = Vertex(seedPos);
0037
0038 SquareMatrix4 seedCov = vertexingOptions.constraint.fullCovariance();
0039
0040
0041 if (seedCov != SquareMatrix4::Zero() && std::isnormal(zAndWidth.second)) {
0042 seedCov(eZ, eZ) = zAndWidth.second * zAndWidth.second;
0043 }
0044
0045 returnVertex.setFullCovariance(seedCov);
0046
0047 return std::vector<Vertex>{returnVertex};
0048 }