ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrackState.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TrackState.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2018 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 <optional>
17 
18 namespace Acts {
19 
27  HoleFlag = 3,
30 };
31 
32 using TrackStateType = std::bitset<TrackStateFlag::NumTrackStateFlags>;
33 
34 class Surface;
35 
46 template <typename source_link_t, typename parameters_t>
47 class TrackState {
48  static_assert(SourceLinkConcept<source_link_t>,
49  "Source link does not fulfill SourceLinkConcept");
50 
51  public:
52  using SourceLink = source_link_t;
53  using Parameters = parameters_t;
54  using Jacobian = typename Parameters::CovMatrix_t;
55 
60  measurement.uncalibrated = std::move(m);
62  }
63 
68  TrackState(parameters_t p) {
69  m_surface = &p.referenceSurface();
70  parameter.predicted = std::move(p);
72  }
73 
75  virtual ~TrackState() = default;
76 
80  TrackState(const TrackState& rhs)
81  : parameter(rhs.parameter),
83  m_surface(rhs.m_surface),
84  m_typeFlags(rhs.m_typeFlags) {}
85 
90  : parameter(std::move(rhs.parameter)),
91  measurement(std::move(rhs.measurement)),
92  m_surface(std::move(rhs.m_surface)),
93  m_typeFlags(std::move(rhs.m_typeFlags)) {}
94 
99  parameter = rhs.parameter;
100  measurement = rhs.measurement;
101  m_surface = rhs.m_surface;
102  m_typeFlags = rhs.m_typeFlags;
103  return (*this);
104  }
105 
110  parameter = std::move(rhs.parameter);
111  measurement = std::move(rhs.measurement);
112  m_surface = std::move(rhs.m_surface);
113  m_typeFlags = std::move(rhs.m_typeFlags);
114  return (*this);
115  }
116 
118  const Surface& referenceSurface() const { return (*m_surface); }
119 
121  void setType(const TrackStateFlag& flag, bool status = true) {
122  m_typeFlags.set(flag, status);
123  }
124 
126  bool isType(const TrackStateFlag& flag) const {
127  assert(flag < NumTrackStateFlags);
128  return m_typeFlags.test(flag);
129  }
130 
132  TrackStateType type() const { return m_typeFlags; }
133 
139  std::optional<size_t> size() {
140  if (this->measurement.calibrated) {
141  return MeasurementHelpers::getSize(*this->measurement.calibrated);
142  }
143  return std::nullopt;
144  }
145 
150  struct {
152  std::optional<Parameters> predicted{std::nullopt};
154  std::optional<Parameters> filtered{std::nullopt};
156  std::optional<Parameters> smoothed{std::nullopt};
158  std::optional<Jacobian> jacobian{std::nullopt};
160  double pathLength = 0.;
162  double chi2 = 0;
163  } parameter;
164 
168  struct {
170  std::optional<SourceLink> uncalibrated{std::nullopt};
172  std::optional<FittableMeasurement<SourceLink>> calibrated{std::nullopt};
173  } measurement;
174 
175  private:
177  const Surface* m_surface = nullptr;
180 };
181 } // namespace Acts