Belle II Software development
UncertainHelix.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/UncertainHelix.h>
9
10#include <tracking/trackFindingCDC/geometry/UncertainPerigeeCircle.h>
11
12#include <tracking/trackFindingCDC/geometry/Helix.h>
13
14#include <tracking/trackFindingCDC/geometry/HelixParameters.h>
15#include <tracking/trackFindingCDC/geometry/PerigeeParameters.h>
16#include <tracking/trackFindingCDC/geometry/SZParameters.h>
17
18#include <ostream>
19
20using namespace Belle2;
21using namespace TrackFindingCDC;
22
24 const UncertainHelix& toHelix)
25{
26 HelixParameters fromPar = fromHelix.helixParameters();
27 HelixCovariance fromCov = fromHelix.helixCovariance();
28
29 HelixParameters toPar = toHelix.helixParameters();
30 HelixCovariance toCov = toHelix.helixCovariance();
31
32 HelixParameters avgPar;
33 HelixCovariance avgCov;
34
35 double chi2 = HelixUtil::average(fromPar, fromCov, toPar, toCov, avgPar, avgCov);
36
37 // Calculating 5 parameters from 10 input parameters. 5 NDF remaining.
38 size_t ndf = 5;
39
40 return UncertainHelix(avgPar, avgCov, chi2, ndf);
41}
42
44 const PerigeeHelixAmbiguity& fromAmbiguity,
45 const UncertainHelix& toHelix)
46{
47 PerigeeParameters fromPar = fromPerigeeCircle.perigeeParameters();
48 PerigeeCovariance fromCov = fromPerigeeCircle.perigeeCovariance();
49
50 HelixParameters toPar = toHelix.helixParameters();
51 HelixCovariance toCov = toHelix.helixCovariance();
52
53 HelixParameters avgPar;
54 HelixCovariance avgCov;
55
56 double chi2 = HelixUtil::average(fromPar, fromCov, fromAmbiguity, toPar, toCov, avgPar, avgCov);
57
58 // Calculating 5 parameters from 8 input parameters. 3 NDF remaining.
59 size_t ndf = 3;
60
61 return UncertainHelix(avgPar, avgCov, chi2, ndf);
62}
63
65 const PerigeeHelixAmbiguity& fromAmbiguity,
66 const UncertainPerigeeCircle& toPerigeeCircle,
67 const PerigeeHelixAmbiguity& toAmbiguity,
68 const SZParameters& szParameters)
69{
70 const PerigeeParameters& fromPar = fromPerigeeCircle.perigeeParameters();
71 const PerigeeCovariance& fromCov = fromPerigeeCircle.perigeeCovariance();
72
73 const PerigeeParameters& toPar = toPerigeeCircle.perigeeParameters();
74 const PerigeeCovariance& toCov = toPerigeeCircle.perigeeCovariance();
75
76 HelixParameters avgPar;
77 HelixCovariance avgCov;
78
79 double chi2 = HelixUtil::average(fromPar,
80 fromCov,
81 fromAmbiguity,
82 toPar,
83 toCov,
84 toAmbiguity,
85 szParameters,
86 avgPar,
87 avgCov);
88
89 // Calculating 5 parameters from 6 input parameters. 1 NDF remaining.
90 size_t ndf = 1;
91
92 return UncertainHelix(avgPar, avgCov, chi2, ndf);
93}
94
95std::ostream& TrackFindingCDC::operator<<(std::ostream& output, const UncertainHelix& uncertainHelix)
96{
97 return output << "Uncertain" << uncertainHelix.helix();
98}
A matrix implementation to be used as an interface typ through out the track finder.
Definition: PlainMatrix.h:40
A general helix class including a covariance matrix.
const HelixCovariance & helixCovariance() const
Getter for the whole covariance matrix of the perigee parameters.
static UncertainHelix average(const UncertainHelix &fromHelix, const UncertainHelix &toHelix)
Construct the averages of the two given helices by properly considering their covariance matrix.
HelixParameters helixParameters() const
Getter for the perigee parameters in the order defined by EPerigeeParameter.h.
const Helix & helix() const
Getter for the underlying helix.
Adds an uncertainty matrix to the circle in perigee parameterisation.
PerigeeParameters perigeeParameters() const
Getter for the perigee parameters in the order defined by EPerigeeParameter.h.
const PerigeeCovariance & perigeeCovariance() const
Getter for the whole covariance matrix of the perigee parameters.
UncertainHelix()
Default constuctor initialising all members to zero.
Abstract base class for different kinds of events.
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...