EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VertexingHelpers.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file VertexingHelpers.hpp
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 #pragma once
10 
14 
15 #include <vector>
16 
17 namespace ActsExamples {
18 
23 inline std::vector<const Acts::BoundTrackParameters*>
25  const TrackParametersContainer& trackParameters) {
26  std::vector<const Acts::BoundTrackParameters*> trackParametersPointers;
27  trackParametersPointers.reserve(trackParameters.size());
28 
29  for (const auto& trackParam : trackParameters) {
30  trackParametersPointers.push_back(&trackParam);
31  }
32  return trackParametersPointers;
33 }
34 
45  const TrackParametersContainer& trackParameters,
47  ProtoVertexContainer protoVertices;
48  protoVertices.reserve(vertices.size());
49 
50  // use pointer arithmetic to compute the position/index of the original
51  // parameters in the input track parameters container.
52  const Acts::BoundTrackParameters* first = trackParameters.data();
53  for (const auto& vertex : vertices) {
54  ProtoVertex protoVertex;
55  protoVertex.reserve(vertex.tracks().size());
56 
57  for (const auto& track : vertex.tracks()) {
58  protoVertex.push_back(std::distance(first, track.originalParams));
59  }
60  protoVertices.push_back(std::move(protoVertex));
61  }
62 
63  return protoVertices;
64 }
65 
66 } // namespace ActsExamples