8#include <tracking/trackFindingCDC/fitting/EigenObservationMatrix.h>
10#include <tracking/trackFindingCDC/fitting/CDCObservations2D.h>
11#include <tracking/trackFindingCDC/fitting/CDCSZObservations.h>
16using namespace TrackFindingCDC;
18TrackFindingCDC::EigenObservationMatrix
21 std::size_t nObservations = observations2D->
size();
22 double* rawObservations = observations2D->
data();
23 EigenObservationMatrix eigenObservations(rawObservations, nObservations, 4);
24 return eigenObservations;
27TrackFindingCDC::EigenObservationMatrix
30 std::size_t nObservations = szObservations->
size();
31 double* rawObservations = szObservations->
data();
32 EigenObservationMatrix eigenObservations(rawObservations, nObservations, 3);
33 return eigenObservations;
36Eigen::Matrix<double, 5, 5> TrackFindingCDC::getWXYRLSumMatrix(
CDCObservations2D& observations2D)
38 EigenObservationMatrix eigenObservations = getEigenObservationMatrix(&observations2D);
39 assert(eigenObservations.cols() == 4);
40 std::size_t nObservations = eigenObservations.rows();
44 Eigen::Matrix<double, Eigen::Dynamic, 5> projectedPoints(nObservations, 5);
46 const std::size_t iW = 0;
47 const std::size_t iX = 1;
48 const std::size_t iY = 2;
49 const std::size_t iR2 = 3;
50 const std::size_t iL = 4;
52 projectedPoints.col(iW) =
53 Eigen::Matrix<double, Eigen::Dynamic, 1>::Constant(nObservations, 1.0);
54 projectedPoints.col(iX) = eigenObservations.col(0);
55 projectedPoints.col(iY) = eigenObservations.col(1);
56 projectedPoints.col(iR2) = eigenObservations.leftCols<2>().rowwise().squaredNorm() -
57 eigenObservations.col(2).rowwise().squaredNorm();
58 projectedPoints.col(iL) = eigenObservations.col(2);
60 Eigen::Array<double, Eigen::Dynamic, 1> weights = eigenObservations.col(3);
61 Eigen::Matrix<double, Eigen::Dynamic, 5> weightedProjectedPoints =
62 projectedPoints.array().colwise() * weights;
63 Eigen::Matrix<double, 5, 5> sumMatrix = weightedProjectedPoints.transpose() * projectedPoints;
70Eigen::Matrix<double, 4, 4> TrackFindingCDC::getWXYLSumMatrix(
CDCObservations2D& observations2D)
72 EigenObservationMatrix eigenObservations = getEigenObservationMatrix(&observations2D);
73 assert(eigenObservations.cols() == 4);
74 std::size_t nObservations = eigenObservations.rows();
76 Eigen::Matrix<double, Eigen::Dynamic, 4> projectedPoints(nObservations, 4);
78 const std::size_t iW = 0;
79 const std::size_t iX = 1;
80 const std::size_t iY = 2;
81 const std::size_t iL = 3;
83 projectedPoints.col(iW) =
84 Eigen::Matrix<double, Eigen::Dynamic, 1>::Constant(nObservations, 1.0);
85 projectedPoints.col(iX) = eigenObservations.col(0);
86 projectedPoints.col(iY) = eigenObservations.col(1);
87 projectedPoints.col(iL) = eigenObservations.col(2);
89 Eigen::Array<double, Eigen::Dynamic, 1> weights = eigenObservations.col(3);
90 Eigen::Matrix<double, Eigen::Dynamic, 4> weightedProjectedPoints =
91 projectedPoints.array().colwise() * weights;
92 Eigen::Matrix<double, 4, 4> sumMatrix = weightedProjectedPoints.transpose() * projectedPoints;
97Eigen::Matrix<double, 4, 4> TrackFindingCDC::getWXYRSumMatrix(
CDCObservations2D& observations2D)
99 EigenObservationMatrix eigenObservations = getEigenObservationMatrix(&observations2D);
100 assert(eigenObservations.cols() == 4);
101 std::size_t nObservations = eigenObservations.rows();
103 Eigen::Matrix<double, Eigen::Dynamic, 4> projectedPoints(nObservations, 4);
105 const std::size_t iW = 0;
106 const std::size_t iX = 1;
107 const std::size_t iY = 2;
108 const std::size_t iR2 = 3;
110 projectedPoints.col(iW) =
111 Eigen::Matrix<double, Eigen::Dynamic, 1>::Constant(nObservations, 1.0);
112 projectedPoints.col(iX) = eigenObservations.col(0);
113 projectedPoints.col(iY) = eigenObservations.col(1);
114 projectedPoints.col(iR2) = eigenObservations.leftCols<2>().rowwise().squaredNorm() -
115 eigenObservations.col(2).rowwise().squaredNorm();
117 Eigen::Array<double, Eigen::Dynamic, 1> weights = eigenObservations.col(3);
118 Eigen::Matrix<double, Eigen::Dynamic, 4> weightedProjectedPoints =
119 projectedPoints.array().colwise() * weights;
120 Eigen::Matrix<double, 4, 4> sumMatrix = weightedProjectedPoints.transpose() * projectedPoints;
124Eigen::Matrix<double, 3, 3> TrackFindingCDC::getWXYSumMatrix(
CDCObservations2D& observations2D)
126 EigenObservationMatrix eigenObservations = getEigenObservationMatrix(&observations2D);
127 assert(eigenObservations.cols() == 4);
128 std::size_t nObservations = eigenObservations.rows();
130 Eigen::Matrix<double, Eigen::Dynamic, 3> projectedPoints(nObservations, 3);
132 const std::size_t iW = 0;
133 const std::size_t iX = 1;
134 const std::size_t iY = 2;
136 projectedPoints.col(iW) =
137 Eigen::Matrix<double, Eigen::Dynamic, 1>::Constant(nObservations, 1.0);
138 projectedPoints.col(iX) = eigenObservations.col(0);
139 projectedPoints.col(iY) = eigenObservations.col(1);
141 Eigen::Array<double, Eigen::Dynamic, 1> weights = eigenObservations.col(3);
142 Eigen::Matrix<double, Eigen::Dynamic, 3> weightedProjectedPoints =
143 projectedPoints.array().colwise() * weights;
144 Eigen::Matrix<double, 3, 3> sumMatrix = weightedProjectedPoints.transpose() * projectedPoints;
149Eigen::Matrix<double, 3, 3> TrackFindingCDC::getWSZSumMatrix(
CDCSZObservations& szObservations)
151 EigenObservationMatrix eigenObservations = getEigenObservationMatrix(&szObservations);
152 assert(eigenObservations.cols() == 3);
153 std::size_t nObservations = eigenObservations.rows();
155 Eigen::Matrix<double, Eigen::Dynamic, 3> projectedPoints(nObservations, 3);
157 const std::size_t iW = 0;
158 const std::size_t iS = 1;
159 const std::size_t iZ = 2;
161 projectedPoints.col(iW) = Eigen::Matrix<double, Eigen::Dynamic, 1>::Constant(nObservations, 1.0);
162 projectedPoints.col(iS) = eigenObservations.col(0);
163 projectedPoints.col(iZ) = eigenObservations.col(1);
165 Eigen::Array<double, Eigen::Dynamic, 1> weights = eigenObservations.col(2);
166 Eigen::Matrix<double, Eigen::Dynamic, 3> weightedProjectedPoints = projectedPoints.array().colwise() * weights;
167 Eigen::Matrix<double, 3, 3> sumMatrix = weightedProjectedPoints.transpose() * projectedPoints;
Class serving as a storage of observed drift circles to present to the Riemann fitter.
double * data()
Return the pointer to the number buffer.
std::size_t size() const
Returns the number of observations stored.
Class serving as a storage of observed sz positions to present to the sz line fitters.
double * data()
Return the pointer to the number buffer.
std::size_t size() const
Returns the number of observations stored.
Abstract base class for different kinds of events.