ATLAS Offline Software
Loading...
Searching...
No Matches
ParametersCommon.icc
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5// Trk
6#include "TrkEventPrimitives/ParamDefs.h"
7// STD
8#include <utility>
9
10namespace Trk {
11// Helper protected ctor
12template <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) {}
20
21// Helper protected ctor
22template <int DIM, class T>
23ParametersCommon<DIM, T>::ParametersCommon(
24 std::optional<AmgSymMatrix(DIM)>&& covariance)
25 : m_parameters(),
26 m_covariance(std::move(covariance)),
27 m_chargeDef{} {}
28
29
30// Protected Constructor with local arguments
31template <int DIM, class T>
32ParametersCommon<DIM, T>::ParametersCommon(
33 const AmgVector(DIM) & parameters,
34 std::optional<AmgSymMatrix(DIM)>&& covariance)
35 : m_parameters(parameters),
36 m_covariance(std::move(covariance)),
37 m_chargeDef{} {}
38
39template <int DIM, class T>
40 const AmgVector(DIM) & ParametersCommon<DIM, T>::parameters() const {
41 return m_parameters;
42}
43
44template <int DIM, class T>
45AmgVector(DIM) & ParametersCommon<DIM, T>::parameters() {
46 return m_parameters;
47}
48
49template <int DIM, class T>
50const AmgSymMatrix(DIM) *ParametersCommon<DIM, T>::covariance() const {
51 if (m_covariance != std::nullopt) {
52 return m_covariance.operator->();
53 } else {
54 return nullptr;
55 }
56}
57
58template <int DIM, class T>
59AmgSymMatrix(DIM) * ParametersCommon<DIM, T>::covariance() {
60 if (m_covariance != std::nullopt) {
61 return m_covariance.operator->();
62 } else {
63 return nullptr;
64 }
65}
66
67template <int DIM, class T>
68constexpr bool ParametersCommon<DIM, T>::isCharged() const {
69 if constexpr (std::is_same<T, Trk::Neutral>::value) {
70 return false;
71 } else {
72 return true;
73 }
74}
75
76template <int DIM, class T>
77Amg::Vector2D ParametersCommon<DIM, T>::localPosition() const {
78 return Amg::Vector2D(m_parameters[Trk::loc1], m_parameters[Trk::loc2]);
79}
80
81template <int DIM, class T>
82void ParametersCommon<DIM, T>::setParameters(
83 const AmgVector(DIM) & param) {
84 m_parameters = param;
85}
86
87template <int DIM, class T>
88void ParametersCommon<DIM, T>::setCovariance(
89 const AmgSymMatrix(DIM) & cov) {
90 m_covariance = cov;
91}
92
93template <int DIM, class T>
94void ParametersCommon<DIM, T>::updateParameters(
95 const AmgVector(DIM)& updatedParameters) {
96 this->updateParametersHelper(updatedParameters);
97}
98
99template <int DIM, class T>
100void ParametersCommon<DIM, T>::updateParameters(
101 const AmgVector(DIM) &updatedParameters,
102 const AmgSymMatrix(DIM) & updatedCovariance) {
103 m_covariance = updatedCovariance;
104 this->updateParametersHelper(updatedParameters);
105}
106
107} // end of namespace Trk
108