ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SingleCurvilinearTrackParameters.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file SingleCurvilinearTrackParameters.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
10 #include <memory>
14 
15 namespace Acts {
16 
25 template <typename ChargePolicy>
27  : public SingleTrackParameters<ChargePolicy> {
28  public:
31 
40  template <typename T = ChargePolicy,
42  SingleCurvilinearTrackParameters(std::optional<CovMatrix_t> cov,
43  const ActsVectorD<3>& position,
44  const ActsVectorD<3>& momentum,
45  double dCharge, double dTime)
46  : SingleTrackParameters<ChargePolicy>(
47  std::move(cov),
48  detail::coordinate_transformation::global2curvilinear(
49  position, momentum, dCharge, dTime),
50  position, momentum),
51  m_upSurface(Surface::makeShared<PlaneSurface>(position, momentum)) {}
52 
60  template <typename T = ChargePolicy,
62  SingleCurvilinearTrackParameters(std::optional<CovMatrix_t> cov,
63  const ActsVectorD<3>& position,
64  const ActsVectorD<3>& momentum, double dTime)
65  : SingleTrackParameters<ChargePolicy>(
66  std::move(cov),
67  detail::coordinate_transformation::global2curvilinear(
68  position, momentum, 0, dTime),
69  position, momentum),
70  m_upSurface(Surface::makeShared<PlaneSurface>(position, momentum)) {}
71 
76  : SingleTrackParameters<ChargePolicy>(copy),
77  m_upSurface(copy.m_upSurface) // copy shared ptr
78  {}
79 
84  : SingleTrackParameters<ChargePolicy>(std::move(other)),
85  m_upSurface(std::move(other.m_upSurface)) {}
86 
87  ~SingleCurvilinearTrackParameters() final = default;
88 
91  SingleCurvilinearTrackParameters<ChargePolicy>& operator=(
92  const SingleCurvilinearTrackParameters<ChargePolicy>& rhs) {
93  // check for self-assignment
94  if (this != &rhs) {
96  m_upSurface =
97  Surface::makeShared<PlaneSurface>(this->position(), this->momentum());
98  }
99  return *this;
100  }
101 
106  // check for self-assignment
107  if (this != &rhs) {
109  m_upSurface = std::move(rhs.m_upSurface);
110  }
111  return *this;
112  }
113 
124  template <
125  ParID_t par,
126  std::enable_if_t<std::is_same_v<BoundParameterType<par>, local_parameter>,
127  int> = 0>
128  void set(const GeometryContext& gctx, ParValue_t newValue) {
129  // set the parameter & update the new global position
130  this->getParameterSet().template setParameter<par>(newValue);
132  // recreate the surface
133  m_upSurface = Surface::makeShared<PlaneSurface>(
134  this->position(), this->momentum().normalized());
135  // reset to (0,0)
136  this->getParameterSet().template setParameter<par>(0.);
137  }
138 
149  template <ParID_t par,
151  not std::is_same_v<BoundParameterType<par>, local_parameter>,
152  int> = 0>
153  void set(const GeometryContext& gctx, ParValue_t newValue) {
154  this->getParameterSet().template setParameter<par>(newValue);
156  // recreate the surface
157  m_upSurface = Surface::makeShared<PlaneSurface>(
158  this->position(), this->momentum().normalized());
159  }
160 
162  const Surface& referenceSurface() const final { return *m_upSurface; }
163 
174  return m_upSurface->transform(gctx).linear();
175  }
176 
177  private:
178  std::shared_ptr<PlaneSurface> m_upSurface;
179 };
180 } // namespace Acts