EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrackDensityVertexFinder.ipp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TrackDensityVertexFinder.ipp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2020 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 template <typename vfitter_t, typename track_density_t>
11  const std::vector<const InputTrack_t*>& trackVector,
12  const VertexingOptions<InputTrack_t>& vertexingOptions,
13  State& /*state*/) const -> Result<std::vector<Vertex<InputTrack_t>>> {
14  typename track_density_t::State densityState(trackVector.size());
15 
16  // Calculate z seed position
17  std::pair<double, double> zAndWidth =
18  m_cfg.trackDensityEstimator.globalMaximumWithWidth(
19  densityState, trackVector, m_extractParameters);
20 
21  double z = zAndWidth.first;
22 
23  // Calculate seed position
24  // Note: constraint position is (0,0,0) if no constraint provided
25  Vector3D seedPos =
26  vertexingOptions.vertexConstraint.position() + Vector3D(0., 0., z);
27 
28  Vertex<InputTrack_t> returnVertex = Vertex<InputTrack_t>(seedPos);
29 
30  ActsSymMatrixD<3> seedCov = vertexingOptions.vertexConstraint.covariance();
31 
32  // Check if a constraint is provided and set the new z position constraint
33  if (seedCov != ActsSymMatrixD<3>::Zero() && std::isnormal(zAndWidth.second)) {
34  seedCov(eZ, eZ) = zAndWidth.second * zAndWidth.second;
35  }
36 
37  returnVertex.setCovariance(seedCov);
38 
39  std::vector<Vertex<InputTrack_t>> seedVec{returnVertex};
40 
41  return seedVec;
42 }