EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SimMultiTrajectory.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file SimMultiTrajectory.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 
15 
16 #include <unordered_map>
17 #include <utility>
18 
19 namespace ActsExamples {
20 using IndexedParams = std::unordered_map<size_t, Acts::BoundTrackParameters>;
21 
33  public:
36  SimMultiTrajectory() = default;
37 
45  const std::vector<size_t>& tTips,
47  : m_multiTrajectory(multiTraj),
48  m_trackTips(tTips),
49  m_trackParameters(parameters) {}
50 
58 
63  : m_multiTrajectory(std::move(rhs.m_multiTrajectory)),
64  m_trackTips(std::move(rhs.m_trackTips)),
65  m_trackParameters(std::move(rhs.m_trackParameters)) {}
66 
69  ~SimMultiTrajectory() = default;
70 
78  return *this;
79  }
80 
85  m_multiTrajectory = std::move(rhs.m_multiTrajectory);
86  m_trackTips = std::move(rhs.m_trackTips);
87  m_trackParameters = std::move(rhs.m_trackParameters);
88  return *this;
89  }
90 
96  bool hasTrajectory(const size_t& entryIndex) const {
97  return std::count(m_trackTips.begin(), m_trackTips.end(), entryIndex) > 0;
98  }
99 
105  bool hasTrackParameters(const size_t& entryIndex) const {
106  return m_trackParameters.count(entryIndex) > 0;
107  }
108 
114  std::pair<std::vector<size_t>, Acts::MultiTrajectory<SimSourceLink>>
115  trajectory() const {
116  return std::make_pair(m_trackTips, m_multiTrajectory);
117  }
118 
125  const size_t& entryIndex) const {
126  auto it = m_trackParameters.find(entryIndex);
127  if (it != m_trackParameters.end()) {
128  return it->second;
129  } else {
130  throw std::runtime_error(
131  "No fitted track parameters for trajectory with entry index = " +
132  std::to_string(entryIndex));
133  }
134  }
135 
141  std::vector<ParticleHitCount> identifyMajorityParticle(
142  const size_t& entryIndex) const;
143 
144  private:
145  // The multiTrajectory
147 
148  // The entry indices of trajectories stored in multiTrajectory
149  std::vector<size_t> m_trackTips = {};
150 
151  // The fitted parameters at the provided surface for individual trajectories
153 };
154 
155 } // namespace ActsExamples