8#include <tracking/trackFindingCDC/geometry/UncertainParameters.icc.h>
10#include <tracking/trackFindingCDC/geometry/HelixParameters.h>
12#include <tracking/trackFindingCDC/numerics/CovarianceMatrixUtil.h>
13#include <tracking/trackFindingCDC/numerics/ParameterVectorUtil.h>
15#include <tracking/trackFindingCDC/numerics/Angle.h>
18using namespace TrackFindingCDC;
71 const HelixCovariance& fromCov,
72 const HelixParameters& toPar,
73 const HelixCovariance& toCov,
74 HelixParameters& avgPar,
75 HelixCovariance& avgCov)
78 HelixParameters refPar = (fromPar + toPar) / 2.0;
81 HelixParameters relFromPar = fromPar - refPar;
84 HelixParameters relToPar = toPar - refPar;
87 HelixParameters relAvgPar;
91 avgPar = relAvgPar + refPar;
98 const PerigeeCovariance& fromCov,
99 const PerigeeHelixAmbiguity& fromAmbiguity,
100 const HelixParameters& toPar,
101 const HelixCovariance& toCov,
102 HelixParameters& avgPar,
103 HelixCovariance& avgCov)
108 PerigeeParameters refPar = (fromPar + toPar.
head<3>()) / 2.0;
111 HelixParameters refHelixPar =
stack(refPar, toPar.
tail<2>());
113 PerigeeParameters relFromPar = fromPar - refPar;
116 HelixParameters relToPar = toPar - refHelixPar;
119 HelixParameters relAvgPar;
131 avgPar = relAvgPar + refHelixPar;
138 const PerigeeCovariance& fromCov,
139 const PerigeeHelixAmbiguity& fromAmbiguity,
140 const PerigeeParameters& toPar,
141 const PerigeeCovariance& toCov,
142 const PerigeeHelixAmbiguity& toAmbiguity,
143 const SZParameters& szParameters,
144 HelixParameters& avgPar,
145 HelixCovariance& avgCov)
148 PerigeeParameters refPar = (fromPar + toPar) / 2.0;
151 HelixParameters refHelixPar =
stack(refPar, szParameters);
153 PerigeeParameters relFromPar = fromPar - refPar;
156 PerigeeParameters relToPar = toPar - refPar;
159 HelixParameters relAvgPar;
171 avgPar = relAvgPar + refHelixPar;
PlainMatrix< T, K, N > tail() const
Get the K bottom rows of the matrix.
static PlainMatrix< T, M, N > Zero()
Construct a matrix initialized with zeros.
PlainMatrix< T, K, N > head() const
Get the K top rows of the matrix.
Namespace to hide the contained enum constants.
Namespace to hide the contained enum constants.
Abstract base class for different kinds of events.
static void normalise(double &angle)
Normalise an angle inplace to lie in the range from [-pi, pi].
static double average(const double angle1, double angle2)
Combines two angular values to the one that lies half way between them on the short arc.
static CovarianceMatrix< N1+N2 > stackBlocks(const CovarianceMatrix< N1 > &block1, const CovarianceMatrix< N2 > &block2)
Combines two covariance matrices by putting them in two blocks on the diagonal of a larger matrix.
static double average(const ParameterVector< N > &par1, const CovarianceMatrix< N > &cov1, const ParameterVector< N > &par2, const CovarianceMatrix< N > &cov2, ParameterVector< N > &par, CovarianceMatrix< N > &cov)
Averages two parameter vectors taking into account their respective covariances.
static double average(const HelixUtil::ParameterVector &fromPar, const HelixUtil::CovarianceMatrix &fromCov, const HelixUtil::ParameterVector &toPar, const HelixUtil::CovarianceMatrix &toCov, HelixUtil::ParameterVector &avgPar, HelixUtil::CovarianceMatrix &avgCov)
Calculates the weighted average between two helix parameter sets with their respective covariance mat...
static SZUtil::CovarianceMatrix getSZCovariance(const CovarianceMatrix &helixCov)
Get sz covariance matrix.
static SZUtil::ParameterVector getSZParameters(const ParameterVector &helixPar)
Get sz parameters.
TrackFindingCDC::JacobianMatrix< 3, 5 > PerigeeAmbiguity
Matrix type for the ambiguity to the perigee parameters, e.g. under the stereo projection.
static PerigeeUtil::ParameterVector getPerigeeParameters(const ParameterVector &helixPar)
Get helix parameters related to the xy space.
static PerigeeAmbiguity defaultPerigeeAmbiguity()
Initialise a default covariance matrix to zero.
static HelixUtil::CovarianceMatrix stackBlocks(const PerigeeUtil::CovarianceMatrix &perigeeCov, const SZUtil::CovarianceMatrix &szCov)
Combine covariance matrices from the xy space and the sz space in their respective blocks.
static PerigeeUtil::CovarianceMatrix getPerigeeCovariance(const CovarianceMatrix &helixCov)
Get perigee covariance matrix related to the xy space.
static HelixUtil::ParameterVector stack(const PerigeeUtil::ParameterVector &perigeePar, const SZUtil::ParameterVector &szPar)
Combine parameters from the xy space and the sz space.
static HelixUtil::ParameterVector reversalSigns()
Getter for the signs which have to be applied to reverse the parameters.
static JacobianMatrix< M, N > identity()
Construct a unit matrix.
static ParameterVector< N1+N2 > stack(const ParameterVector< N1 > &upperPar, const ParameterVector< N2 > &lowerPar)
Combines two parameter vectors by stacking them over each other.
static ParameterVector reversalSigns()
Getter for the signs which have to be applied to reverse the traversal direction.
static ParameterVector reversalSigns()
Getter for the signs which have to be applied to reverse the parameters.
Utility struct to instantiate a couple of helper function related to a set of uncertain parameters.
TrackFindingCDC::CovarianceMatrix< c_N > CovarianceMatrix
TrackFindingCDC::ParameterVector< c_N > ParameterVector
static AParameterVector getSubParameterVector(const ParameterVector &par)
static ACovarianceMatrix getSubCovarianceMatrix(const CovarianceMatrix &cov)