9 #include <boost/test/data/test_case.hpp>
10 #include <boost/test/tools/output_test_stream.hpp>
11 #include <boost/test/unit_test.hpp>
44 using namespace Acts::UnitLiterals;
65 std::uniform_real_distribution<>
vXYDist(-0.1_mm, 0.1_mm);
67 std::uniform_real_distribution<>
vZDist(-20_mm, 20_mm);
69 std::uniform_real_distribution<>
vTDist(-1_ns, 1_ns);
71 std::uniform_real_distribution<>
d0Dist(-0.01_mm, 0.01_mm);
73 std::uniform_real_distribution<>
z0Dist(-0.2_mm, 0.2_mm);
75 std::uniform_real_distribution<>
pTDist(0.4_GeV, 10_GeV);
77 std::uniform_real_distribution<>
phiDist(-M_PI, M_PI);
79 std::uniform_real_distribution<>
thetaDist(1.0, M_PI - 1.0);
81 std::uniform_real_distribution<>
qDist(-1, 1);
83 std::uniform_real_distribution<>
tDist(-0.002_ns, 0.002_ns);
85 std::uniform_real_distribution<>
resIPDist(0., 100_um);
87 std::uniform_real_distribution<>
resAngDist(0., 0.1);
89 std::uniform_real_distribution<>
resQoPDist(0.0, 0.1);
91 std::uniform_real_distribution<>
resTDist(0.1_ns, 0.2_ns);
102 unsigned int nTracks = 100;
106 std::mt19937
gen(seed);
109 auto constField = std::make_shared<ConstantBField>(
Vector3{0.0, 0.0, 2_T});
110 auto zeroField = std::make_shared<NullBField>();
114 auto propagator = std::make_shared<HelicalPropagator>(
stepper);
118 auto straightPropagator =
119 std::make_shared<StraightPropagator>(straightStepper);
122 std::shared_ptr<PerigeeSurface> perigeeSurface{
123 Surface::makeShared<PerigeeSurface>(
Vector3{0., 0., 0.})};
135 d0v = std::hypot(x, y);
138 vtxPos <<
x,
y,
z,
t;
142 std::vector<BoundTrackParameters>
tracks;
145 for (
unsigned int iTrack = 0; iTrack < nTracks; iTrack++) {
147 double q =
qDist(gen) < 0 ? -1. : 1.;
165 covMat << resD0 * resD0, 0., 0., 0., 0., 0., 0., resZ0 * resZ0, 0., 0., 0.,
166 0., 0., 0., resPh * resPh, 0., 0., 0., 0., 0., 0., resTh * resTh, 0.,
167 0., 0., 0., 0., 0., resQp * resQp, 0., 0., 0., 0., 0., 0., resT * resT;
168 tracks.emplace_back(perigeeSurface, paramVec,
std::move(covMat),
195 auto checkLinearizers = [](
auto& lin1,
auto& linState1,
auto& lin2,
198 const auto& geometryContext,
199 const auto& fieldContext) {
213 double relTol = 5
e-4;
216 std::shared_ptr<PerigeeSurface> perigee =
220 lin1.linearizeTrack(track, linPoint[3], *perigee, geometryContext,
221 fieldContext, linState1)
224 lin2.linearizeTrack(track, linPoint[3], *perigee, geometryContext,
225 fieldContext, linState2)
232 BOOST_CHECK_NE(linTrack1.parametersAtPCA, vecBoundZero);
238 BOOST_CHECK_NE(linTrack1.positionJacobian, matBound2SPZero);
244 BOOST_CHECK_NE(linTrack1.momentumJacobian, matBound2MomZero);
251 BOOST_CHECK_NE(linTrack1.covarianceAtPCA, matBoundZero);
256 BOOST_CHECK_EQUAL(linTrack1.linearizationPoint, linPoint);
261 BOOST_CHECK_NE(linTrack1.constantTerm, vecBoundZero);
267 BOOST_TEST_CONTEXT(
"Linearization in constant magnetic field") {
268 checkLinearizers(linFactory, linState, numLinFactory, numLinState, trk,
271 BOOST_TEST_CONTEXT(
"Linearization without magnetic field") {
272 checkLinearizers(straightLinFactory, straightLinState,
273 numStraightLinFactory, numStraightLinState, trk, vtxPos,