Template Class ParameterSet¶
Defined in File ParameterSet.hpp
Class Documentation¶
-
template<ParID_t...
params
>
classActs
::
ParameterSet
¶ Description of a set of (local) parameters.
The template parameter pack
params
must be given in a strictly ascending order. The parameter pack must be non-empty and it cannot contain more elements thanActs::eBoundParametersSize
.- Pre
The template parameter
ParameterPolicy
must fulfill the following requirements:It must contain a
typedef ParID_t
specifying an integral type used to identify different parameters. This could for example be anenum
,short
, orunsigned int
. Thistypedef
must be convertible to anunsigned int
It must contain a
typedef ParValue_t
specifying the type of the parameter values. This could for instance bedouble
, orfloat
.It must contain a definition of an integral constant named
N
which is assignable to anunsigned int
and which is equal to the total number of parameters in the system.
- Pre
- Template Parameters
ParameterPolicy
: struct or class containing the parameter definitions (see above)params
: parameter pack containing the (local) parameters stored in this class
Public Types
-
using
CovMatrix_t
= ActsSymMatrix<ParValue_t, NPars>¶ type of covariance matrix
-
using
ParVector_t
= ActsVector<ParValue_t, NPars>¶ vector type for stored parameters
-
using
Projection_t
= ActsMatrix<ParValue_t, NPars, eBoundParametersSize>¶ matrix type for projecting full parameter vector onto local parameter space
Public Functions
-
template<typename ...
Tail
>ParameterSet
(std::optional<CovMatrix_t> cov, std::enable_if_t<sizeof...(Tail) + 1 == NPars, ParValue_t> head, Tail... values)¶ initialize values of stored parameters and their covariance matrix
- Note
No validation of the given covariance matrix is performed (e.g. that it is symmetric).
- Parameters
cov
: unique pointer to covariance matrix (nullptr is accepted)head
: value for first parametervalues
: values for the remaining stored parameters
-
ParameterSet
(std::optional<CovMatrix_t> cov, const ParVector_t &values)¶ initialize parameter values from vector and set their covariance matrix
- Note
The values in the passed vector are interpreted as parameter values in the order given by the class template
params
. No validation of the given covariance matrix is performed.- Parameters
cov
: unique pointer to covariance matrix (nullptr is accepted)values
: vector with parameter values
-
ParameterSet
(const ParSet_t ©)¶ copy constructor
- Parameters
copy
: object whose content is copied into the newParameterSet
object
-
ParameterSet
(ParSet_t &©)¶ move constructor
- Parameters
copy
: object whose content is moved into the newParameterSet
object
-
~ParameterSet
() = default¶ standard destructor
-
template<ParID_t
parameter
>
boolcontains
() const¶ checks whether a given parameter is included in this set of parameters
- Remark
parameter
must be part of the template parameter packparams
. Otherwise a compile-time error is generated.- Return
true
if the parameter is stored in this set, otherwisefalse
- Template Parameters
parameter
: identifier for the parameter to be retrieved
-
const std::optional<CovMatrix_t> &
getCovariance
() const¶ access covariance matrix for stored parameters
- Note
The ownership of the covariance matrix is not transferred with this call.
- Return
raw pointer to covariance matrix (can be a nullptr)
-
template<ParID_t
parameter
>
ParValue_tgetParameter
() const¶ retrieve stored value for given parameter
- Remark
parameter
must be part of the template parameter packparams
. Otherwise a compile-time error is generated.- Return
value of the stored parameter
- Template Parameters
parameter
: identifier for the parameter to be retrieved
-
ParVector_t
getParameters
() const¶ access vector with stored parameters
- Return
column vector with
NPars
rows
-
template<ParID_t
parameter
>
ParValue_tgetUncertainty
() const¶ access uncertainty for individual parameter
- Remark
parameter
must be part of the template parameter packparams
. Otherwise a compile-time error is generated.- Return
uncertainty \(\sigma \ge 0\) of given parameter, a negative value is returned if no covariance matrix is set
- Template Parameters
parameter
: identifier for the parameter to be retrieved
-
bool
operator!=
(const ParSet_t &rhs) const¶ inequality operator
- Return
true
if both objects are not equal, otherwisefalse
- See
ParameterSet::operator==
-
ParSet_t &
operator=
(const ParSet_t &rhs)¶ assignment operator
- Parameters
rhs
: object whose content is assigned to thisParameterSet
object
-
ParSet_t &
operator=
(ParSet_t &&rhs)¶ move assignment operator
- Parameters
rhs
: object whose content is moved into thisParameterSet
object
-
bool
operator==
(const ParSet_t &rhs) const¶ equality operator
- Return
true
if stored parameter values are equal and both covariance matrices are either identical or not set, otherwisefalse
-
ParVector_t
project
(const FullParameterSet &fullParSet) const¶ project vector of full parameter set onto parameter sub-space
Let \( \left(p_1 \dots p_N \right)\) be the full set of parameters out of which the \(m\) parameters \( \left( p_{i_1} \dots p_{i_m} \right), i_1 < i_2 < \dots < i_m, m \le N, i_j \le N\) are stored in this ParameterSet object. Let \( \left(v^0_1 \dots v^0_N \right)\) be the parameter values given in the full ParameterSet, then this methods applies the following mapping:
\[\begin{split} \mathbb{R}^{N \times 1} \mapsto \mathbb{R}^{m \times 1} : \left( \begin{array}{c} v_1^0 \\ \vdots \\ v_N^0 \end{array} \right) \mapsto \left( \begin{array}{c} v_{i_1}^0 \\ \vdots \\ v_{i_m}^0 \end{array} \right) \end{split}\]- Return
vector containing only the parameter values from the full parameter vector which are also defined for this ParameterSet object
- Parameters
fullParSet
: ParameterSet object containing values for all defined parameters
-
ParVector_t
residual
(const FullParameterSet &fullParSet) const¶ calculate residual difference to full parameter vector
Calculate the residual differences of the stored parameter values with respect to the corresponding parameter values in the full parameter vector. Hereby, the residual vector is defined as
\[\begin{split} \vec{r} = \left( \begin{array}{c} r_{i_1} \\ \vdots \\ r_{i_m} \end{array} \right) = \left( \begin{array}{c} v_{i_1} \\ \vdots \\ v_{i_m} \end{array} \right) - \mathrm{Proj} \left( \begin{array}{c} v^0_{1} \\ \vdots \\ v^0_{N} \end{array} \right) = \vec{v} - \mathrm{Proj} \left( \vec{v}^0 \right) \end{split}\]where \(\mathrm{Proj}\) is the projection matrix, \(\vec{v}\) is the vector of parameter values of this ParameterSet object and \(\vec{v}^0\) is the full parameter value vector.
- Note
Constraint and cyclic parameter value ranges are taken into account when calculating the residual values.
- Return
vector containing the residual parameter values of this ParameterSet object with respect to the given full parameter vector
- See
ParameterSet::projector
- Parameters
fullParSet
: ParameterSet object containing the full set of parameters
-
ParVector_t
residual
(const ParSet_t &otherParSet) const¶ calculate residual difference to other parameter vector
Calculate the residual differences of the stored parameter values with respect to the values of another ParameterSet object containing the same set of parameters. Hereby, the residual vector is defined as
\[\begin{split} \vec{r} = \left( \begin{array}{c} r_{i_1} \\ \vdots \\ r_{i_m} \end{array} \right) = \left( \begin{array}{c} v_{i_1} \\ \vdots \\ v_{i_m} \end{array} \right) - \left( \begin{array}{c} v^0_{1} \\ \vdots \\ v^0_{N} \end{array} \right) = \vec{v} - \left( \vec{v}^0 \right) \end{split}\]where \(\vec{v}\) is the vector of parameter values of this ParameterSet object and \(\vec{v}^0\) is the parameter value vector of the other ParameterSet object.
- Note
Constraint and cyclic parameter value ranges are taken into account when calculating the residual values.
- Return
vector containing the residual parameter values of this ParameterSet object with respect to the given other parameter set
- Parameters
otherParSet
: ParameterSet object with identical set of contained parameters
-
void
setCovariance
(const CovMatrix_t &cov)¶ update covariance matrix
- Note
No validation of the given covariance matrix is performed.
- Parameters
cov
: unique pointer to new covariance matrix (nullptr is accepted)
-
template<ParID_t
parameter
>
voidsetParameter
(ParValue_t value)¶ sets value for given parameter
- Remark
parameter
must be part of the template parameter packparams
. Otherwise a compile-time error is generated.- Return
previously stored value of this parameter
- Template Parameters
parameter
: identifier for the parameter to be stored
-
void
setParameters
(const ParVector_t &values)¶ sets values of stored parameters
The values of the given vector are interpreted as parameter values in the order of the class template
params...
.- Parameters
values
: vector of length NPars
Public Static Functions
-
void
correctValues
(ParVector_t &values)¶ correct given parameter values
Check that the given values are within in a valid range for the corresponding parameter. If not, an in-place correction is applied. The values are interpreted as parameter values in the same order as specified in the class template
params
.- Parameters
values
: vector with parameter values to be checked and corrected if necessary
-
template<ParID_t
parameter
>
constexpr size_tgetIndex
()¶ return index of parameter identifier in parameter list
- Remark
parameter
must be part of the template parameter packparams
. Otherwise a compile-time error is generated.- Return
position of parameter in variadic template parameter set
params
- Template Parameters
parameter
: identifier for the parameter to be retrieved
-
template<size_t
index
>
constexpr ParID_tgetParID
()¶ return parameter identifier for given index
- Remark
index
must be a positive number smaller than the size of the parameter packparams
. Otherwise a compile-time error is generated.- Return
parameter identifier at position
index
in variadic template parameter setparams
- Template Parameters
index
: position of parameter identifier inparams
-
const ActsMatrix<ParValue_t, NPars, eBoundParametersSize>
projector
()¶ get projection matrix
The projection matrix performs a mapping of the full parameter space onto the sub-space spanned by the parameters defined in this ParameterSet object.
- Return
constant matrix with
NPars
rows andActs::eBoundParametersSize
columns
-
constexpr unsigned int
size
()¶ number of stored parameters
- Return
number of stored parameters
Friends
-
friend void
swap
(ParSet_t &first, ParSet_t &second) noexcept¶ swap two objects