ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SingleBoundTrackParameters.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file SingleBoundTrackParameters.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2016-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
13 
14 namespace Acts {
15 
26 template <class ChargePolicy>
27 class SingleBoundTrackParameters : public SingleTrackParameters<ChargePolicy> {
28  public:
31 
44  template <typename T = ChargePolicy,
47  std::optional<CovMatrix_t> cov,
48  const ParVector_t& parValues,
49  std::shared_ptr<const Surface> surface)
50  : SingleTrackParameters<ChargePolicy>(
51  std::move(cov), parValues,
52  detail::coordinate_transformation::parameters2globalPosition(
53  gctx, parValues, *surface),
54  detail::coordinate_transformation::parameters2globalMomentum(
55  parValues)),
56  m_pSurface(std::move(surface)) {
57  assert(m_pSurface);
58  }
59 
76  template <typename T = ChargePolicy,
79  std::optional<CovMatrix_t> cov,
80  const ActsVectorD<3>& position,
81  const ActsVectorD<3>& momentum, double dCharge,
82  double dTime,
83  std::shared_ptr<const Surface> surface)
84  : SingleTrackParameters<ChargePolicy>(
85  std::move(cov),
86  detail::coordinate_transformation::global2parameters(
87  gctx, position, momentum, dCharge, dTime, *surface),
88  position, momentum),
89  m_pSurface(std::move(surface)) {
90  assert(m_pSurface);
91  }
92 
106  template <typename T = ChargePolicy,
109  std::optional<CovMatrix_t> cov,
110  const ParVector_t& parValues,
111  std::shared_ptr<const Surface> surface)
112  : SingleTrackParameters<ChargePolicy>(
113  std::move(cov), parValues,
114  detail::coordinate_transformation::parameters2globalPosition(
115  gctx, parValues, *surface),
116  detail::coordinate_transformation::parameters2globalMomentum(
117  parValues)),
118  m_pSurface(std::move(surface)) {
119  assert(m_pSurface);
120  }
121 
138  template <typename T = ChargePolicy,
141  std::optional<CovMatrix_t> cov,
142  const ActsVectorD<3>& position,
143  const ActsVectorD<3>& momentum, double dTime,
144  std::shared_ptr<const Surface> surface)
145  : SingleTrackParameters<ChargePolicy>(
146  std::move(cov),
147  detail::coordinate_transformation::global2parameters(
148  gctx, position, momentum, 0, dTime, *surface),
149  position, momentum),
150  m_pSurface(std::move(surface)) {}
151 
156  : SingleTrackParameters<ChargePolicy>(copy) {
157  m_pSurface = copy.m_pSurface;
158  }
159 
163  : SingleTrackParameters<ChargePolicy>(std::move(other)),
164  m_pSurface(std::move(other.m_pSurface)) {}
165 
168  ~SingleBoundTrackParameters() final = default;
169 
171  SingleBoundTrackParameters<ChargePolicy>& operator=(
172  const SingleBoundTrackParameters<ChargePolicy>& rhs) {
173  // check for self-assignment
174  if (this != &rhs) {
176  m_pSurface = rhs.m_pSurface;
177  }
178  return *this;
179  }
180 
185  // check for self-assignment
186  if (this != &rhs) {
188  m_pSurface = std::move(rhs.m_pSurface);
189  }
190 
191  return *this;
192  }
193 
196  //
199  template <ParID_t par>
200  void set(const GeometryContext& gctx, ParValue_t newValue) {
201  this->getParameterSet().template setParameter<par>(newValue);
203  }
204 
206  const Surface& referenceSurface() const final { return *m_pSurface; }
207 
220  return std::move(
221  m_pSurface->referenceFrame(gctx, this->position(), this->momentum()));
222  }
223 
224  private:
225  std::shared_ptr<const Surface> m_pSurface;
226 };
227 
228 } // namespace Acts