1 #include <gtest/gtest.h>
6 #include <RKTrackRep.h>
20 const double bFieldZ = 20;
33 EXPECT_EQ(0, myRKStep.
state7_[0]);
34 EXPECT_EQ(0, myRKStep.
state7_[1]);
35 EXPECT_EQ(0, myRKStep.
state7_[2]);
36 EXPECT_EQ(0, myRKStep.
state7_[3]);
37 EXPECT_EQ(0, myRKStep.
state7_[4]);
38 EXPECT_EQ(0, myRKStep.
state7_[5]);
39 EXPECT_EQ(0, myRKStep.
state7_[6]);
45 EXPECT_EQ(0, myExtrapStep.
jac7_(0, 0));
46 EXPECT_EQ(0, myExtrapStep.
jac7_(0, 1));
47 EXPECT_EQ(0, myExtrapStep.
jac7_(0, 2));
48 EXPECT_EQ(0, myExtrapStep.
jac7_(0, 3));
49 EXPECT_EQ(0, myExtrapStep.
jac7_(0, 4));
50 EXPECT_EQ(0, myExtrapStep.
jac7_(0, 5));
51 EXPECT_EQ(0, myExtrapStep.
jac7_(0, 6));
53 EXPECT_EQ(0, myExtrapStep.
jac7_(1, 0));
54 EXPECT_EQ(0, myExtrapStep.
jac7_(1, 1));
55 EXPECT_EQ(0, myExtrapStep.
jac7_(1, 2));
56 EXPECT_EQ(0, myExtrapStep.
jac7_(1, 3));
57 EXPECT_EQ(0, myExtrapStep.
jac7_(1, 4));
58 EXPECT_EQ(0, myExtrapStep.
jac7_(1, 5));
59 EXPECT_EQ(0, myExtrapStep.
jac7_(1, 6));
61 EXPECT_EQ(0, myExtrapStep.
jac7_(2, 0));
62 EXPECT_EQ(0, myExtrapStep.
jac7_(2, 1));
63 EXPECT_EQ(0, myExtrapStep.
jac7_(2, 2));
64 EXPECT_EQ(0, myExtrapStep.
jac7_(2, 3));
65 EXPECT_EQ(0, myExtrapStep.
jac7_(2, 4));
66 EXPECT_EQ(0, myExtrapStep.
jac7_(2, 5));
67 EXPECT_EQ(0, myExtrapStep.
jac7_(2, 6));
69 EXPECT_EQ(0, myExtrapStep.
jac7_(3, 0));
70 EXPECT_EQ(0, myExtrapStep.
jac7_(3, 1));
71 EXPECT_EQ(0, myExtrapStep.
jac7_(3, 2));
72 EXPECT_EQ(0, myExtrapStep.
jac7_(3, 3));
73 EXPECT_EQ(0, myExtrapStep.
jac7_(3, 4));
74 EXPECT_EQ(0, myExtrapStep.
jac7_(3, 5));
75 EXPECT_EQ(0, myExtrapStep.
jac7_(3, 6));
77 EXPECT_EQ(0, myExtrapStep.
jac7_(4, 0));
78 EXPECT_EQ(0, myExtrapStep.
jac7_(4, 1));
79 EXPECT_EQ(0, myExtrapStep.
jac7_(4, 2));
80 EXPECT_EQ(0, myExtrapStep.
jac7_(4, 3));
81 EXPECT_EQ(0, myExtrapStep.
jac7_(4, 4));
82 EXPECT_EQ(0, myExtrapStep.
jac7_(4, 5));
83 EXPECT_EQ(0, myExtrapStep.
jac7_(4, 6));
85 EXPECT_EQ(0, myExtrapStep.
jac7_(5, 0));
86 EXPECT_EQ(0, myExtrapStep.
jac7_(5, 1));
87 EXPECT_EQ(0, myExtrapStep.
jac7_(5, 2));
88 EXPECT_EQ(0, myExtrapStep.
jac7_(5, 3));
89 EXPECT_EQ(0, myExtrapStep.
jac7_(5, 4));
90 EXPECT_EQ(0, myExtrapStep.
jac7_(5, 5));
91 EXPECT_EQ(0, myExtrapStep.
jac7_(5, 6));
93 EXPECT_EQ(0, myExtrapStep.
jac7_(6, 0));
94 EXPECT_EQ(0, myExtrapStep.
jac7_(6, 1));
95 EXPECT_EQ(0, myExtrapStep.
jac7_(6, 2));
96 EXPECT_EQ(0, myExtrapStep.
jac7_(6, 3));
97 EXPECT_EQ(0, myExtrapStep.
jac7_(6, 4));
98 EXPECT_EQ(0, myExtrapStep.
jac7_(6, 5));
99 EXPECT_EQ(0, myExtrapStep.
jac7_(6, 6));
101 EXPECT_EQ(0, myExtrapStep.
noise7_(0, 0));
102 EXPECT_EQ(0, myExtrapStep.
noise7_(0, 1));
103 EXPECT_EQ(0, myExtrapStep.
noise7_(0, 2));
104 EXPECT_EQ(0, myExtrapStep.
noise7_(0, 3));
105 EXPECT_EQ(0, myExtrapStep.
noise7_(0, 4));
106 EXPECT_EQ(0, myExtrapStep.
noise7_(0, 5));
107 EXPECT_EQ(0, myExtrapStep.
noise7_(0, 6));
109 EXPECT_EQ(0, myExtrapStep.
noise7_(1, 0));
110 EXPECT_EQ(0, myExtrapStep.
noise7_(1, 1));
111 EXPECT_EQ(0, myExtrapStep.
noise7_(1, 2));
112 EXPECT_EQ(0, myExtrapStep.
noise7_(1, 3));
113 EXPECT_EQ(0, myExtrapStep.
noise7_(1, 4));
114 EXPECT_EQ(0, myExtrapStep.
noise7_(1, 5));
115 EXPECT_EQ(0, myExtrapStep.
noise7_(1, 6));
117 EXPECT_EQ(0, myExtrapStep.
noise7_(2, 0));
118 EXPECT_EQ(0, myExtrapStep.
noise7_(2, 1));
119 EXPECT_EQ(0, myExtrapStep.
noise7_(2, 2));
120 EXPECT_EQ(0, myExtrapStep.
noise7_(2, 3));
121 EXPECT_EQ(0, myExtrapStep.
noise7_(2, 4));
122 EXPECT_EQ(0, myExtrapStep.
noise7_(2, 5));
123 EXPECT_EQ(0, myExtrapStep.
noise7_(2, 6));
125 EXPECT_EQ(0, myExtrapStep.
noise7_(3, 0));
126 EXPECT_EQ(0, myExtrapStep.
noise7_(3, 1));
127 EXPECT_EQ(0, myExtrapStep.
noise7_(3, 2));
128 EXPECT_EQ(0, myExtrapStep.
noise7_(3, 3));
129 EXPECT_EQ(0, myExtrapStep.
noise7_(3, 4));
130 EXPECT_EQ(0, myExtrapStep.
noise7_(3, 5));
131 EXPECT_EQ(0, myExtrapStep.
noise7_(3, 6));
133 EXPECT_EQ(0, myExtrapStep.
noise7_(4, 0));
134 EXPECT_EQ(0, myExtrapStep.
noise7_(4, 1));
135 EXPECT_EQ(0, myExtrapStep.
noise7_(4, 2));
136 EXPECT_EQ(0, myExtrapStep.
noise7_(4, 3));
137 EXPECT_EQ(0, myExtrapStep.
noise7_(4, 4));
138 EXPECT_EQ(0, myExtrapStep.
noise7_(4, 5));
139 EXPECT_EQ(0, myExtrapStep.
noise7_(4, 6));
141 EXPECT_EQ(0, myExtrapStep.
noise7_(5, 0));
142 EXPECT_EQ(0, myExtrapStep.
noise7_(5, 1));
143 EXPECT_EQ(0, myExtrapStep.
noise7_(5, 2));
144 EXPECT_EQ(0, myExtrapStep.
noise7_(5, 3));
145 EXPECT_EQ(0, myExtrapStep.
noise7_(5, 4));
146 EXPECT_EQ(0, myExtrapStep.
noise7_(5, 5));
147 EXPECT_EQ(0, myExtrapStep.
noise7_(5, 6));
149 EXPECT_EQ(0, myExtrapStep.
noise7_(6, 0));
150 EXPECT_EQ(0, myExtrapStep.
noise7_(6, 1));
151 EXPECT_EQ(0, myExtrapStep.
noise7_(6, 2));
152 EXPECT_EQ(0, myExtrapStep.
noise7_(6, 3));
153 EXPECT_EQ(0, myExtrapStep.
noise7_(6, 4));
154 EXPECT_EQ(0, myExtrapStep.
noise7_(6, 5));
155 EXPECT_EQ(0, myExtrapStep.
noise7_(6, 6));
161 myState7.
vals[0] = 0;
162 myState7.
vals[1] = 0;
163 myState7.
vals[2] = 0;
164 myState7.
vals[3] = 0;
165 myState7.
vals[4] = 0;
166 myState7.
vals[5] = 1;
167 myState7.
vals[6] = 1;
171 const bool varField =
false;
172 const bool calcOnlyLastRowOfJ =
false;
175 EXPECT_EQ(10, myRKTrackRep.
RKPropagate(myState7, myJacobian, mySA, myS, varField, calcOnlyLastRowOfJ));
176 EXPECT_EQ(0, myState7[0]);
177 EXPECT_EQ(0, myState7[1]);
178 EXPECT_EQ(0.5, myState7[2]);
179 EXPECT_EQ(0, myState7[3]);
180 EXPECT_EQ(0, myState7[4]);
181 EXPECT_EQ(1, myState7[5]);
182 EXPECT_EQ(1, myState7[6]);
183 EXPECT_EQ(0, mySA[0]);
184 EXPECT_EQ(0, mySA[1]);
185 EXPECT_EQ(0, mySA[2]);
191 myState7.
vals[0] = 1;
192 myState7.
vals[1] = 1;
193 myState7.
vals[2] = 1;
194 myState7.
vals[3] = 1;
195 myState7.
vals[4] = 1;
196 myState7.
vals[5] = 1;
197 myState7.
vals[6] = 1;
201 const bool varField =
false;
202 const bool calcOnlyLastRowOfJ =
false;
205 EXPECT_FLOAT_EQ(10, myRKTrackRep.
RKPropagate(myState7, myJacobian, mySA, myS, varField, calcOnlyLastRowOfJ));
206 EXPECT_FLOAT_EQ(1.1000299732532006, myState7[0]);
207 EXPECT_FLOAT_EQ(1.0999700147633968, myState7[1]);
208 EXPECT_FLOAT_EQ(1.1, myState7[2]);
209 EXPECT_FLOAT_EQ(0.5776963359022331, myState7[3]);
210 EXPECT_FLOAT_EQ(0.5770039949184069, myState7[4]);
211 EXPECT_FLOAT_EQ(0.5773502691896258, myState7[5]);
212 EXPECT_FLOAT_EQ(1, myState7[6]);
213 EXPECT_FLOAT_EQ(0.000599405129044106, mySA[0]);
214 EXPECT_FLOAT_EQ(-0.0005997646311051152, mySA[1]);
215 EXPECT_FLOAT_EQ(0., mySA[2]);
222 myState7.
vals[0] = 0;
223 myState7.
vals[1] = 0;
224 myState7.
vals[2] = 0;
225 myState7.
vals[3] = 0;
226 myState7.
vals[4] = 0;
227 myState7.
vals[5] = 0;
228 myState7.
vals[6] = 0;
232 EXPECT_EQ(0, myState7[0]);
233 EXPECT_EQ(0, myState7[1]);
234 EXPECT_EQ(0, myState7[2]);
235 EXPECT_EQ(0, myState7[3]);
236 EXPECT_EQ(0, myState7[4]);
237 EXPECT_EQ(0, myState7[5]);
238 EXPECT_EQ(0, myState7[6]);
240 TVectorD myState5(5);
248 EXPECT_NO_THROW(myRKTrackRep.
getState7(myStateOnPlane, myState7));
249 EXPECT_FLOAT_EQ(-0.1, myState7[0]);
250 EXPECT_FLOAT_EQ(-0.1, myState7[1]);
251 EXPECT_FLOAT_EQ(1, myState7[2]);
252 EXPECT_FLOAT_EQ(-0.57735, myState7[3]);
253 EXPECT_FLOAT_EQ(-0.57735, myState7[4]);
254 EXPECT_FLOAT_EQ(0.57735, myState7[5]);
255 EXPECT_FLOAT_EQ(-1, myState7[6]);
268 myState7[3] = -0.57735;
269 myState7[4] = -0.57735;
270 myState7[5] = 0.57735;
272 TVectorD myState5(5);
275 EXPECT_NO_THROW(myRKTrackRep.
getState5(myStateOnPlane, myState7));
276 EXPECT_FLOAT_EQ(-0.1, myState7[0]);
277 EXPECT_FLOAT_EQ(-0.1, myState7[1]);
278 EXPECT_FLOAT_EQ(1, myState7[2]);
279 EXPECT_FLOAT_EQ(-0.57735, myState7[3]);
280 EXPECT_FLOAT_EQ(-0.57735, myState7[4]);
281 EXPECT_FLOAT_EQ(0.57735, myState7[5]);
282 EXPECT_FLOAT_EQ(-1, myState7[6]);
284 EXPECT_EQ(-1, myStateOnPlane.
getState()[0]);
285 EXPECT_EQ(1, myStateOnPlane.
getState()[1]);
286 EXPECT_EQ(1, myStateOnPlane.
getState()[2]);
287 EXPECT_EQ(0.1, myStateOnPlane.
getState()[3]);
288 EXPECT_EQ(0.1, myStateOnPlane.
getState()[4]);
308 const TVector3 startPlaneO(0, 0, 1);
309 const TVector3 startPlaneN(0, 0, 1);
310 const TVector3 destPlaneO(0, 0, -1);
311 const TVector3 destPlaneN(0, 0, 1);
348 EXPECT_EQ(std::numeric_limits<double>::infinity(), myRKTrackRep.
momMag(myState7));
349 myState7 = {0, 0, 0, 0, 0, 0, 1};
350 EXPECT_EQ(1.0, myRKTrackRep.
momMag(myState7));
351 myState7 = {0, 0, 0, 0, 0, 0, -1};
352 EXPECT_EQ(1.0, myRKTrackRep.
momMag(myState7));