Analysis Software
Documentation for sPHENIX simulation 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  Vector3 seedPos = vertexingOptions.constraint.position() + Vector3(0., 0., z);
26 
27  Vertex<InputTrack_t> returnVertex = Vertex<InputTrack_t>(seedPos);
28 
29  SquareMatrix3 seedCov = vertexingOptions.constraint.covariance();
30 
31  // Check if a constraint is provided and set the new z position constraint
32  if (seedCov != SquareMatrix3::Zero() && std::isnormal(zAndWidth.second)) {
33  seedCov(eZ, eZ) = zAndWidth.second * zAndWidth.second;
34  }
35 
36  returnVertex.setCovariance(seedCov);
37 
38  std::vector<Vertex<InputTrack_t>> seedVec{returnVertex};
39 
40  return seedVec;
41 }