Belle II Software  release-08-01-10
PerigeeParameters.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/PerigeeParameters.h>
9 
10 #include <tracking/trackFindingCDC/geometry/UncertainParameters.icc.h>
11 
12 #include <tracking/trackFindingCDC/numerics/Angle.h>
13 
14 using namespace Belle2;
15 using namespace TrackFindingCDC;
16 
18 
20  const PerigeeCovariance& fromCov,
21  const PerigeeParameters& toPar,
22  const PerigeeCovariance& toCov,
23  PerigeeParameters& avgPar,
24  PerigeeCovariance& avgCov)
25 {
26  using namespace NPerigeeParameterIndices;
27  PerigeeParameters refPar = (fromPar + toPar) / 2.0;
28  refPar(c_Phi0) = AngleUtil::average(fromPar(c_Phi0), toPar(c_Phi0));
29 
30  PerigeeParameters relFromPar = fromPar - refPar;
31  AngleUtil::normalise(relFromPar(c_Phi0));
32 
33  PerigeeParameters relToPar = toPar - refPar;
34  AngleUtil::normalise(relToPar(c_Phi0));
35 
36  PerigeeParameters relAvgPar;
37 
38  double chi2 =
39  CovarianceMatrixUtil::average(relFromPar, fromCov, relToPar, toCov, relAvgPar, avgCov);
40 
41  avgPar = relAvgPar + refPar;
42  AngleUtil::normalise(avgPar(c_Phi0));
43 
44  return chi2;
45 }
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 void normalise(double &angle)
Normalise an angle inplace to lie in the range from [-pi, pi].
Definition: Angle.h:41
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 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 PerigeeUtil::ParameterVector &fromPar, const PerigeeUtil::CovarianceMatrix &fromCov, const PerigeeUtil::ParameterVector &toPar, const PerigeeUtil::CovarianceMatrix &toCov, PerigeeUtil::ParameterVector &avgPar, PerigeeUtil::CovarianceMatrix &avgCov)
Calculates the weighted average between two perigee parameter sets with their respective covariance m...