ECCE @ 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) const
14  typename track_density_t::State densityState(trackVector.size());
15 
16  std::vector<BoundParameters> trackList;
17  trackList.reserve(trackVector.size());
18 
19  for (const auto& trk : trackVector) {
20  trackList.push_back(m_extractParameters(*trk));
21  }
22 
23  // Calculate z seed position
24  std::pair<double, double> zAndWidth =
25  m_cfg.trackDensityEstimator.globalMaximumWithWidth(trackList,
26  densityState);
27 
28  double z = zAndWidth.first;
29 
30  // Calculate seed position
31  // Note: constraint position is (0,0,0) if no constraint provided
32  Vector3D seedPos =
33  vertexingOptions.vertexConstraint.position() + Vector3D(0., 0., z);
34 
35  Vertex<InputTrack_t> returnVertex = Vertex<InputTrack_t>(seedPos);
36 
37  ActsSymMatrixD<3> seedCov = vertexingOptions.vertexConstraint.covariance();
38 
39  // Check if a constraint is provided and set the new z position constraint
40  if (seedCov != ActsSymMatrixD<3>::Zero() && std::isnormal(zAndWidth.second)) {
41  seedCov(eZ, eZ) = zAndWidth.second * zAndWidth.second;
42  }
43 
44  returnVertex.setCovariance(seedCov);
45 
46  std::vector<Vertex<InputTrack_t>> seedVec{returnVertex};
47 
48  return seedVec;
49 }