2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
6 #include "TrkEventPrimitives/ParamDefs.h"
11 // Helper protected ctor
12 template <int DIM, class T>
13 ParametersCommon<DIM, T>::ParametersCommon(
14 const AmgVector(DIM) parameters,
15 std::optional<AmgSymMatrix(DIM)>&& covariance, const T chargeDef)
16 : m_parameters(parameters),
17 m_covariance(std::move(covariance)),
18 // cppcheck-suppress missingReturn; false positive
19 m_chargeDef(chargeDef) {}
21 // Helper protected ctor
22 template <int DIM, class T>
23 ParametersCommon<DIM, T>::ParametersCommon(
24 std::optional<AmgSymMatrix(DIM)>&& covariance)
26 m_covariance(std::move(covariance)),
30 // Protected Constructor with local arguments
31 template <int DIM, class T>
32 ParametersCommon<DIM, T>::ParametersCommon(
33 const AmgVector(DIM) & parameters,
34 std::optional<AmgSymMatrix(DIM)>&& covariance)
35 : m_parameters(parameters),
36 m_covariance(std::move(covariance)),
39 template <int DIM, class T>
40 const AmgVector(DIM) & ParametersCommon<DIM, T>::parameters() const {
44 template <int DIM, class T>
45 AmgVector(DIM) & ParametersCommon<DIM, T>::parameters() {
49 template <int DIM, class T>
50 const AmgSymMatrix(DIM) *ParametersCommon<DIM, T>::covariance() const {
51 if (m_covariance != std::nullopt) {
52 return m_covariance.operator->();
58 template <int DIM, class T>
59 AmgSymMatrix(DIM) * ParametersCommon<DIM, T>::covariance() {
60 if (m_covariance != std::nullopt) {
61 return m_covariance.operator->();
67 template <int DIM, class T>
68 constexpr bool ParametersCommon<DIM, T>::isCharged() const {
69 if constexpr (std::is_same<T, Trk::Neutral>::value) {
76 template <int DIM, class T>
77 Amg::Vector2D ParametersCommon<DIM, T>::localPosition() const {
78 return Amg::Vector2D(m_parameters[Trk::loc1], m_parameters[Trk::loc2]);
81 template <int DIM, class T>
82 void ParametersCommon<DIM, T>::setParameters(
83 const AmgVector(DIM) & param) {
87 template <int DIM, class T>
88 void ParametersCommon<DIM, T>::setCovariance(
89 const AmgSymMatrix(DIM) & cov) {
93 template <int DIM, class T>
94 void ParametersCommon<DIM, T>::updateParameters(
95 const AmgVector(DIM)& updatedParameters) {
96 this->updateParametersHelper(updatedParameters);
99 template <int DIM, class T>
100 void ParametersCommon<DIM, T>::updateParameters(
101 const AmgVector(DIM) &updatedParameters,
102 const AmgSymMatrix(DIM) & updatedCovariance) {
103 m_covariance = updatedCovariance;
104 this->updateParametersHelper(updatedParameters);
107 } // end of namespace Trk