Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Trajectories.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Trajectories.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2019-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 
16 
17 #include <algorithm>
18 #include <unordered_map>
19 #include <vector>
20 
21 namespace ActsExamples {
22 
30 struct Trajectories final {
31  public:
35  using IndexedParameters =
36  std::unordered_map<Acts::MultiTrajectoryTraits::IndexType,
38 
41  Trajectories() = default;
47  Trajectories(const MultiTrajectory& multiTraj,
48  const std::vector<Acts::MultiTrajectoryTraits::IndexType>& tTips,
50  : m_multiTrajectory(&multiTraj),
51  m_trackTips(tTips),
52  m_trackParameters(parameters) {}
53 
55  bool empty() const { return m_trackTips.empty(); }
56 
59  throw_assert(m_multiTrajectory != nullptr, "MultiTrajectory is null");
60  return *m_multiTrajectory;
61  }
62 
64  const std::vector<Acts::MultiTrajectoryTraits::IndexType>& tips() const {
65  return m_trackTips;
66  }
67 
73  return (0 < std::count(m_trackTips.begin(), m_trackTips.end(), entryIndex));
74  }
75 
81  Acts::MultiTrajectoryTraits::IndexType entryIndex) const {
82  return (0 < m_trackParameters.count(entryIndex));
83  }
84 
90  Acts::MultiTrajectoryTraits::IndexType entryIndex) const {
91  auto it = m_trackParameters.find(entryIndex);
92  if (it == m_trackParameters.end()) {
93  throw std::runtime_error(
94  "No fitted track parameters for trajectory with entry index = " +
95  std::to_string(entryIndex));
96  }
97  return it->second;
98  }
99 
100  private:
101  // The track container
103  // The entry indices of trajectories stored in multiTrajectory
104  std::vector<Acts::MultiTrajectoryTraits::IndexType> m_trackTips = {};
105  // The fitted parameters at the provided surface for individual trajectories
107 };
108 
110 using TrajectoriesContainer = std::vector<Trajectories>;
111 
112 } // namespace ActsExamples