EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrkrClusterMultiTrajectory.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TrkrClusterMultiTrajectory.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2019 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 
11 #include <unordered_map>
12 #include <utility>
13 
18 
19 namespace ActsExamples {
20  using IndexedParams = std::unordered_map<size_t, Acts::BoundTrackParameters>;
22 
34  public:
37  TrkrClusterMultiTrajectory() = default;
38 
46  const std::vector<size_t>& tTips,
48  const int& vertexId)
49  : m_multiTrajectory(multiTraj),
50  m_trackTips(tTips),
51  m_trackParameters(parameters),
52  m_vertexId(vertexId){}
53 
61  m_vertexId(rhs.m_vertexId){}
62 
67  : m_multiTrajectory(std::move(rhs.m_multiTrajectory)),
68  m_trackTips(std::move(rhs.m_trackTips)),
69  m_trackParameters(std::move(rhs.m_trackParameters)),
70  m_vertexId(std::move(rhs.m_vertexId)){}
71 
74  ~TrkrClusterMultiTrajectory() = default;
75 
83  m_vertexId = rhs.m_vertexId;
84  return *this;
85  }
86 
91  m_multiTrajectory = std::move(rhs.m_multiTrajectory);
92  m_trackTips = std::move(rhs.m_trackTips);
93  m_trackParameters = std::move(rhs.m_trackParameters);
94  m_vertexId = std::move(rhs.m_vertexId);
95  return *this;
96  }
97 
103  bool hasTrajectory(const size_t& entryIndex) const {
104  return std::count(m_trackTips.begin(), m_trackTips.end(), entryIndex) > 0;
105  }
106 
112  bool hasTrackParameters(const size_t& entryIndex) const {
113  return m_trackParameters.count(entryIndex) > 0;
114  }
115 
121  std::pair<std::vector<size_t>, Acts::MultiTrajectory<SourceLink>>
122  trajectory() const {
123  return std::make_pair(m_trackTips, m_multiTrajectory);
124  }
125 
131  const Acts::BoundTrackParameters& trackParameters(const size_t& entryIndex) const {
132  auto it = m_trackParameters.find(entryIndex);
133  if (it != m_trackParameters.end()) {
134  return it->second;
135  } else {
136  throw std::runtime_error(
137  "No fitted track parameters for trajectory with entry index = " +
138  std::to_string(entryIndex));
139  }
140  }
141 
142  private:
143  // The multiTrajectory
145 
146  // The entry indices of trajectories stored in multiTrajectory
147  std::vector<size_t> m_trackTips = {};
148 
149  // The fitted parameters at the provided surface for individual trajectories
151 
152  unsigned int m_vertexId = 9999;
153 };
154 
155 } // namespace ActsExamples