Belle II Software development
LineParameters.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#include <tracking/trackFindingCDC/geometry/LineParameters.h>
9
10#include <tracking/trackFindingCDC/geometry/UncertainParameters.icc.h>
11
12#include <tracking/trackFindingCDC/numerics/Angle.h>
13
14using namespace Belle2;
15using namespace TrackFindingCDC;
16
18
19double LineUtil::average(const LineParameters& fromPar,
20 const LineCovariance& fromCov,
21 const LineParameters& toPar,
22 const LineCovariance& toCov,
23 LineParameters& avgPar,
24 LineCovariance& avgCov)
25{
26 using namespace NLineParameterIndices;
27 LineParameters refPar;
28 refPar(c_I) = (fromPar(c_I) + toPar(c_I)) / 2;
29 refPar(c_Phi0) = AngleUtil::average(fromPar(c_Phi0), toPar(c_Phi0));
30
31 LineParameters relFromPar;
32 relFromPar(c_I) = fromPar(c_I) - refPar(c_I);
33 relFromPar(c_Phi0) = AngleUtil::normalised(fromPar(c_Phi0) - refPar(c_Phi0));
34
35 LineParameters relToPar;
36 relToPar(c_I) = toPar(c_I) - refPar(c_I);
37 relToPar(c_Phi0) = AngleUtil::normalised(toPar(c_Phi0) - refPar(c_Phi0));
38
39 LineParameters relAvgPar;
40 double chi2 =
41 CovarianceMatrixUtil::average(relFromPar, fromCov, relToPar, toCov, relAvgPar, avgCov);
42
43 avgPar(c_I) = relAvgPar(c_I) + refPar(c_I);
44 avgPar(c_Phi0) = AngleUtil::normalised(relAvgPar(c_Phi0) + refPar(c_Phi0));
45
46 return chi2;
47}
A matrix implementation to be used as an interface typ through out the track finder.
Definition: PlainMatrix.h:40
Abstract base class for different kinds of events.
static double average(const double angle1, double angle2)
Combines two angluar values to the one that lies half way between them on the short arc.
Definition: Angle.h:27
static double normalised(const double angle)
Normalise an angle to lie in the range from [-pi, pi].
Definition: Angle.h:33
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 LineUtil::ParameterVector &fromPar, const LineUtil::CovarianceMatrix &fromCov, const LineUtil::ParameterVector &toPar, const LineUtil::CovarianceMatrix &toCov, LineUtil::ParameterVector &avgPar, LineUtil::CovarianceMatrix &avgCov)
Calculates the weighted average between two line parameter sets with their respective covariance matr...
Utility struct to instantiate a couple of helper function related to a set of uncertain parameters.