9 #include <tracking/trackFindingCDC/geometry/UncertainPerigeeCircle.h>
10 #include <tracking/trackFindingCDC/geometry/Vector2D.h>
12 #include <gtest/gtest.h>
16 using namespace TrackFindingCDC;
18 TEST(TrackFindingCDCTest, geometry_PerigeeCircle_passiveMoveByJacobian_identity)
20 for (
double curvature : { -1.0, 0.0, 1.0}) {
24 EXPECT_NEAR(1.0, moveByZeroJacobian(0, 0), 10e-7);
25 EXPECT_NEAR(0.0, moveByZeroJacobian(0, 1), 10e-7);
26 EXPECT_NEAR(0.0, moveByZeroJacobian(0, 2), 10e-7);
28 EXPECT_NEAR(0.0, moveByZeroJacobian(1, 0), 10e-7);
29 EXPECT_NEAR(1.0, moveByZeroJacobian(1, 1), 10e-7);
30 EXPECT_NEAR(0.0, moveByZeroJacobian(1, 2), 10e-7);
32 EXPECT_NEAR(0.0, moveByZeroJacobian(2, 0), 10e-7);
33 EXPECT_NEAR(0.0, moveByZeroJacobian(2, 1), 10e-7);
34 EXPECT_NEAR(1.0, moveByZeroJacobian(2, 2), 10e-7);
38 TEST(TrackFindingCDCTest, geometry_PerigeeCircle_passiveMoveByJacobian_roundtrip)
40 for (
double curvature : { -1.0, 0.0, 1.0}) {
46 circle.passiveMoveBy(by);
48 PerigeeJacobian moveOneBackJacobian = circle.passiveMoveByJacobian(-by);
50 PerigeeJacobian moveByZeroJacobian = moveByOneJacobian * moveOneBackJacobian;
52 EXPECT_NEAR(1.0, moveByZeroJacobian(0, 0), 10e-7);
53 EXPECT_NEAR(0.0, moveByZeroJacobian(0, 1), 10e-7);
54 EXPECT_NEAR(0.0, moveByZeroJacobian(0, 2), 10e-7);
56 EXPECT_NEAR(0.0, moveByZeroJacobian(1, 0), 10e-7);
57 EXPECT_NEAR(1.0, moveByZeroJacobian(1, 1), 10e-7);
58 EXPECT_NEAR(0.0, moveByZeroJacobian(1, 2), 10e-7);
60 EXPECT_NEAR(0.0, moveByZeroJacobian(2, 0), 10e-7);
61 EXPECT_NEAR(0.0, moveByZeroJacobian(2, 1), 10e-7);
62 EXPECT_NEAR(1.0, moveByZeroJacobian(2, 2), 10e-7);
65 PerigeeJacobian moveByZeroJacobian = moveOneBackJacobian * moveByOneJacobian;
67 EXPECT_NEAR(1.0, moveByZeroJacobian(0, 0), 10e-7);
68 EXPECT_NEAR(0.0, moveByZeroJacobian(0, 1), 10e-7);
69 EXPECT_NEAR(0.0, moveByZeroJacobian(0, 2), 10e-7);
71 EXPECT_NEAR(0.0, moveByZeroJacobian(1, 0), 10e-7);
72 EXPECT_NEAR(1.0, moveByZeroJacobian(1, 1), 10e-7);
73 EXPECT_NEAR(0.0, moveByZeroJacobian(1, 2), 10e-7);
75 EXPECT_NEAR(0.0, moveByZeroJacobian(2, 0), 10e-7);
76 EXPECT_NEAR(0.0, moveByZeroJacobian(2, 1), 10e-7);
77 EXPECT_NEAR(1.0, moveByZeroJacobian(2, 2), 10e-7);
82 TEST(TrackFindingCDCTest, geometry_PerigeeCircle_passiveMoveByJacobian)
87 EXPECT_NEAR(1.0, moveByOneJacobian(0, 0), 10e-7);
88 EXPECT_NEAR(0.0, moveByOneJacobian(0, 1), 10e-7);
89 EXPECT_NEAR(0.0, moveByOneJacobian(0, 2), 10e-7);
91 EXPECT_NEAR(0.0, moveByOneJacobian(1, 0), 10e-7);
92 EXPECT_NEAR(1.0 / 2.0, moveByOneJacobian(1, 1), 10e-7);
93 EXPECT_NEAR(0.0, moveByOneJacobian(1, 2), 10e-7);
95 EXPECT_NEAR(0.0, moveByOneJacobian(2, 0), 10e-7);
96 EXPECT_NEAR(0.0, moveByOneJacobian(2, 1), 10e-7);
97 EXPECT_NEAR(1.0, moveByOneJacobian(2, 2), 10e-7);
102 double deltaParallel = 2;
108 double lambda = 1.0 / (5.0 + 3.0 *
sqrt(5.0));
109 double mu =
sqrt(5.0) / 10.0;
112 EXPECT_NEAR(1.0, moveByTwoYJacobian(0, 0), 10e-7);
113 EXPECT_NEAR(0.0, moveByTwoYJacobian(0, 1), 10e-7);
114 EXPECT_NEAR(0.0, moveByTwoYJacobian(0, 2), 10e-7);
116 EXPECT_NEAR(2.0 / 5.0, moveByTwoYJacobian(1, 0), 10e-7);
117 EXPECT_NEAR(1.0 / 5.0, moveByTwoYJacobian(1, 1), 10e-7);
118 EXPECT_NEAR(-2.0 / 5.0, moveByTwoYJacobian(1, 2), 10e-7);
120 EXPECT_NEAR(mu * zeta - A * lambda, moveByTwoYJacobian(2, 0), 10e-7);
121 EXPECT_NEAR(2.0 * mu * u * deltaParallel, moveByTwoYJacobian(2, 1), 10e-7);
122 EXPECT_NEAR(2.0 * mu * nu, moveByTwoYJacobian(2, 2), 10e-7);
125 TEST(TrackFindingCDCTest, geometry_PerigeeCircle_passiveMovedCovarianceBy)
128 perigeeVariance(0, 0) = 1.0;
129 perigeeVariance(0, 1) = 0.0;
130 perigeeVariance(0, 2) = 0.0;
132 perigeeVariance(1, 0) = 0.0;
133 perigeeVariance(1, 1) = 0.0;
134 perigeeVariance(1, 2) = 0.0;
136 perigeeVariance(2, 0) = 0.0;
137 perigeeVariance(2, 1) = 0.0;
138 perigeeVariance(2, 2) = 0.0;
145 EXPECT_NEAR(1.0, noMoveVariance(0, 0), 10e-7);
146 EXPECT_NEAR(0.0, noMoveVariance(0, 1), 10e-7);
147 EXPECT_NEAR(0.0, noMoveVariance(0, 2), 10e-7);
149 EXPECT_NEAR(0.0, noMoveVariance(1, 0), 10e-7);
150 EXPECT_NEAR(0.0, noMoveVariance(1, 1), 10e-7);
151 EXPECT_NEAR(0.0, noMoveVariance(1, 2), 10e-7);
153 EXPECT_NEAR(0.0, noMoveVariance(2, 0), 10e-7);
154 EXPECT_NEAR(0.0, noMoveVariance(2, 1), 10e-7);
155 EXPECT_NEAR(0.0, noMoveVariance(2, 2), 10e-7);
161 EXPECT_NEAR(1.0, noChangeMoveVariance(0, 0), 10e-7);
162 EXPECT_NEAR(0.0, noChangeMoveVariance(0, 1), 10e-7);
163 EXPECT_NEAR(0.0, noChangeMoveVariance(0, 2), 10e-7);
165 EXPECT_NEAR(0.0, noChangeMoveVariance(1, 0), 10e-7);
166 EXPECT_NEAR(0.0, noChangeMoveVariance(1, 1), 10e-7);
167 EXPECT_NEAR(0.0, noChangeMoveVariance(1, 2), 10e-7);
169 EXPECT_NEAR(0.0, noChangeMoveVariance(2, 0), 10e-7);
170 EXPECT_NEAR(0.0, noChangeMoveVariance(2, 1), 10e-7);
171 EXPECT_NEAR(0.0, noChangeMoveVariance(2, 2), 10e-7);
177 EXPECT_NEAR(1.0, transformedVariance(0, 0), 10e-7);
179 EXPECT_NEAR(2.0, transformedVariance(2, 0), 10e-7);
180 EXPECT_NEAR(2.0, transformedVariance(0, 2), 10e-7);
181 EXPECT_NEAR(4.0, transformedVariance(2, 2), 10e-7);
184 EXPECT_NEAR(0.0, transformedVariance(1, 1), 10e-7);
186 EXPECT_NEAR(0.0, transformedVariance(0, 1), 10e-7);
187 EXPECT_NEAR(0.0, transformedVariance(1, 0), 10e-7);
189 EXPECT_NEAR(0.0, transformedVariance(1, 2), 10e-7);
190 EXPECT_NEAR(0.0, transformedVariance(2, 1), 10e-7);
197 EXPECT_NEAR(1, transformedVariance(0, 0), 10e-7);
199 EXPECT_NEAR(2, transformedVariance(2, 0), 10e-7);
200 EXPECT_NEAR(2, transformedVariance(0, 2), 10e-7);
201 EXPECT_NEAR(4, transformedVariance(2, 2), 10e-7);
204 EXPECT_NEAR(0, transformedVariance(1, 1), 10e-7);
206 EXPECT_NEAR(0, transformedVariance(0, 1), 10e-7);
207 EXPECT_NEAR(0, transformedVariance(1, 0), 10e-7);
209 EXPECT_NEAR(0, transformedVariance(1, 2), 10e-7);
210 EXPECT_NEAR(0, transformedVariance(2, 1), 10e-7);
214 TEST(TrackFindingCDCTest, geometry_PerigeeCircle_passiveMove)
218 perigeeVariance(0, 0) = 1.0;
219 perigeeVariance(0, 1) = 0.3;
220 perigeeVariance(0, 2) = 0.5;
222 perigeeVariance(1, 0) = 0.3;
223 perigeeVariance(1, 1) = 0.7;
224 perigeeVariance(1, 2) = 0.6;
226 perigeeVariance(2, 0) = 0.5;
227 perigeeVariance(2, 1) = 0.6;
228 perigeeVariance(2, 2) = 1;
235 circle.passiveMoveBy(
Vector2D(0.0, -1.0));
239 circle.passiveMoveBy(
Vector2D(0.0, 1.0));
245 EXPECT_NEAR(perigeeVariance(0, 0), twiceMovedVariance(0, 0), 10e-7);
246 EXPECT_NEAR(perigeeVariance(0, 1), twiceMovedVariance(0, 1), 10e-7);
247 EXPECT_NEAR(perigeeVariance(0, 2), twiceMovedVariance(0, 2), 10e-7);
249 EXPECT_NEAR(perigeeVariance(1, 0), twiceMovedVariance(1, 0), 10e-7);
250 EXPECT_NEAR(perigeeVariance(1, 1), twiceMovedVariance(1, 1), 10e-7);
251 EXPECT_NEAR(perigeeVariance(1, 2), twiceMovedVariance(1, 2), 10e-7);
253 EXPECT_NEAR(perigeeVariance(2, 0), twiceMovedVariance(2, 0), 10e-7);
254 EXPECT_NEAR(perigeeVariance(2, 1), twiceMovedVariance(2, 1), 10e-7);
255 EXPECT_NEAR(perigeeVariance(2, 2), twiceMovedVariance(2, 2), 10e-7);
Extension of the generalized circle also caching the perigee coordinates.
A matrix implementation to be used as an interface typ through out the track finder.
Adds an uncertainty matrix to the circle in perigee parameterisation.
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
TEST(TestgetDetectorRegion, TestgetDetectorRegion)
Test Constructors.
double sqrt(double a)
sqrt for double
Abstract base class for different kinds of events.