ATLAS Offline Software
Loading...
Searching...
No Matches
ParametersCommon.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5/* @brief ParametersCommon common base class
6 * for ParametersT, CurvilinearParameters and PatternTrackParameters
7 */
8
9#ifndef TRKPARAMETERSCOMMON_PARAMETERSCOMMON_H
10#define TRKPARAMETERSCOMMON_PARAMETERSCOMMON_H
11//
14// Amg
18//
19#include <optional>
20#include <limits>
21
22namespace Trk {
23class Surface;
24
30
31namespace InvalidParam {
32constexpr double INVALID = std::numeric_limits<double>::quiet_NaN();
33constexpr double INVALID_P(10e9);
34constexpr double INVALID_QOP(10e-9);
35}
36
43
44template <int DIM, class T>
46 public:
47 static_assert((std::is_same<T, Trk::Charged>::value ||
48 std::is_same<T, Trk::Neutral>::value),
49 "Parameters must be Charged or Neutral");
50 static constexpr int dim = DIM;
51
53 const AmgVector(DIM) & parameters() const;
54 AmgVector(DIM) & parameters();
55
58 const AmgSymMatrix(DIM) * covariance() const;
59 AmgSymMatrix(DIM) * covariance();
60
63 constexpr bool isCharged() const;
67
69 void setParameters(const AmgVector(DIM) & param);
70
72 void setCovariance(const AmgSymMatrix(DIM) & cov);
73
83 void updateParameters(const AmgVector(DIM) &, const AmgSymMatrix(DIM) &);
84
91 void updateParameters(const AmgVector(DIM) &);
92
94 virtual bool hasSurface() const = 0;
95
97 virtual const Surface& associatedSurface() const = 0;
98
104
107 virtual ParametersCommon<DIM, T>* clone() const = 0;
108
110 constexpr virtual ParametersType type() const = 0;
111
114 virtual SurfaceType surfaceType() const = 0;
115
117 virtual ~ParametersCommon() = default;
118
119 protected:
120 /*
121 * This is an abstract class and we can not instantiate objects directly.
122 * In the other hand derived classed can use ctors
123 */
124 ParametersCommon() = default;
125 ParametersCommon(ParametersCommon&&) noexcept = default;
126 ParametersCommon& operator=(ParametersCommon&&) noexcept = default;
129 /* Helper ctors for derived classes*/
131 std::optional<AmgSymMatrix(DIM)>&& covariance,
132 const T chargeDef);
133
134 ParametersCommon(std::optional<AmgSymMatrix(DIM)>&& covariance);
135
137 std::optional<AmgSymMatrix(DIM)>&& covariance = std::nullopt);
138
139
140 /* Helper implementing the specific per derived class logic for
141 * the update of parameters*/
142 virtual void updateParametersHelper(const AmgVector(DIM) &) = 0;
143
145 AmgVector(DIM) m_parameters;
147 std::optional<AmgSymMatrix(DIM)> m_covariance = std::nullopt;
150};
151} // end of namespace Trk
152
154
155#endif
#define AmgSymMatrix(dim)
#define AmgVector(rows)
void updateParameters(const AmgVector(DIM) &, const AmgSymMatrix(DIM) &)
Update parameters and covariance , passing covariance by ref.
void updateParameters(const AmgVector(DIM) &)
Update parameters.
virtual const Surface & associatedSurface() const =0
Access to the Surface associated to the Parameters.
virtual Amg::RotationMatrix3D measurementFrame() const =0
Return the measurement frame - this is needed for alignment, in particular for StraightLine and Perig...
virtual ~ParametersCommon()=default
virtual Destructor
virtual ParametersCommon< DIM, T > * clone() const =0
clone method for polymorphic deep copy
const AmgSymMatrix(DIM) *covariance() const
Access method for the covariance matrix - returns nullptr if no covariance matrix is given.
virtual bool hasSurface() const =0
Test to see if there's a not null surface ptr.
ParametersCommon(ParametersCommon &&) noexcept=default
virtual SurfaceType surfaceType() const =0
Returns the Surface Type enum for the surface used to define the derived class.
constexpr bool isCharged() const
Returns true if Charged or false if Neutral.
AmgVector(DIM) &parameters()
AmgSymMatrix(DIM) *covariance()
ParametersCommon()=default
void setParameters(const AmgVector(DIM) &param)
set parameters
virtual void updateParametersHelper(const AmgVector(DIM) &)=0
void setCovariance(const AmgSymMatrix(DIM) &cov)
set covariance
const AmgVector(DIM) &parameters() const
Access methods for the parameters.
Amg::Vector2D localPosition() const
Access method for the local coordinates, local parameter definitions differ for each surface type.
virtual constexpr ParametersType type() const =0
Return the ParametersType enum.
Abstract Base Class for tracking surfaces.
Eigen::Matrix< double, 3, 3 > RotationMatrix3D
Eigen::Matrix< double, 2, 1 > Vector2D
constexpr double INVALID_P(10e9)
constexpr double INVALID
constexpr double INVALID_QOP(10e-9)
Ensure that the ATLAS eigen extensions are properly loaded.
SurfaceType
This enumerator simplifies the persistency & calculations,.
ParametersType
Enum to avoid dynamic cast for different parameter types.
STL namespace.