9 #include <boost/test/data/test_case.hpp>
10 #include <boost/test/tools/output_test_stream.hpp>
11 #include <boost/test/unit_test.hpp>
24 using namespace Acts::UnitLiterals;
31 using Propagator = Propagator<EigenStepper<ConstantBField>>;
37 std::uniform_real_distribution<>
d0Dist(-0.01_mm, 0.01_mm);
39 std::uniform_real_distribution<>
z0Dist(-0.2_mm, 0.2_mm);
41 std::uniform_real_distribution<>
pTDist(0.4_GeV, 10._GeV);
47 std::uniform_real_distribution<>
resIPDist(0., 100._um);
49 std::uniform_real_distribution<>
resAngDist(0., 0.1);
51 std::uniform_real_distribution<>
resQoPDist(-0.1, 0.1);
53 std::uniform_real_distribution<>
qDist(-1, 1);
55 std::uniform_real_distribution<>
vXYDist(-0.1_mm, 0.1_mm);
57 std::uniform_real_distribution<>
vZDist(-20_mm, 20_mm);
67 unsigned int nTests = 10;
71 std::mt19937 gen(mySeed);
80 auto propagator = std::make_shared<Propagator>(
stepper);
85 IPEstimator ipEstimator(ipEstCfg);
92 for (
unsigned int i = 0; i < nTests; i++) {
103 covMat << resD0 * resD0, 0., 0., 0., 0., 0., 0., resZ0 * resZ0, 0., 0., 0.,
104 0., 0., 0., resPh * resPh, 0., 0., 0., 0., 0., 0., resTh * resTh, 0.,
105 0., 0., 0., 0., 0., resQp * resQp, 0., 0., 0., 0., 0., 0., 1.;
108 double q =
qDist(gen) < 0 ? -1. : 1.;
114 std::cout <<
"IP: (" << d0 <<
"," << z0 <<
")" << std::endl;
127 std::shared_ptr<PerigeeSurface> perigeeSurface =
128 Surface::makeShared<PerigeeSurface>(refPosition);
134 double transverseDist = std::sqrt(std::pow(d0, 2) + std::pow(z0, 2));
137 auto distanceRes = ipEstimator.calculate3dDistance(
geoContext, myTrack,
139 BOOST_CHECK(distanceRes.ok());
141 double distance = *distanceRes;
143 BOOST_CHECK(distance < transverseDist);
146 std::cout << std::setprecision(10)
147 <<
"Distance in transverse plane: " << transverseDist
149 std::cout << std::setprecision(10) <<
"Distance in 3D: " << distance
153 auto res = ipEstimator.estimate3DImpactParameters(
156 BOOST_CHECK(res.ok());
160 const auto& myTrackParams = myTrack.parameters();
161 const auto& trackIP3dParams = trackAtIP3d.parameters();
165 trackIP3dParams[BoundIndices::eBoundLoc0]);
167 trackIP3dParams[BoundIndices::eBoundLoc1]);
170 trackIP3dParams[BoundIndices::eBoundTheta], 1
e-5);
172 trackIP3dParams[BoundIndices::eBoundQOverP], 1
e-5);
175 std::cout << std::setprecision(10) <<
"Old track parameters: \n"
176 << myTrackParams << std::endl;
177 std::cout << std::setprecision(10) <<
"Parameters at IP3d: \n"
178 << trackIP3dParams << std::endl;
189 unsigned int nTests = 10;
193 std::mt19937 gen(mySeed);
202 auto propagator = std::make_shared<Propagator>(
stepper);
207 IPEstimator ipEstimator(ipEstCfg);
214 std::vector<double> distancesList;
215 std::vector<double> compatibilityList;
227 for (
unsigned int i = 0; i < nTests; i++) {
230 BoundTrackParameters::CovarianceMatrix::Zero();
247 auto perigeeSurface = Surface::makeShared<PerigeeSurface>(refPosition);
252 auto distanceRes = ipEstimator.calculate3dDistance(
geoContext, myTrack,
254 BOOST_CHECK(distanceRes.ok());
256 distancesList.push_back(*distanceRes);
258 auto res = ipEstimator.estimate3DImpactParameters(
261 BOOST_CHECK(res.ok());
266 ipEstimator.get3dVertexCompatibility(
geoContext, ¶ms, refPosition);
268 BOOST_CHECK(compRes.ok());
270 compatibilityList.push_back(*compRes);
277 for (
unsigned int i = 0; i < nTests; i++) {
278 for (
unsigned int j = i + 1; j < nTests; j++) {
280 (compatibilityList[i] - compatibilityList[j]) / compatibilityList[i];
283 (distancesList[i] - distancesList[j]) / distancesList[i];
286 std::cout <<
"Comparing track " << i <<
" with track " << j
288 std::cout <<
"\t" << i <<
": Comp.: " << compatibilityList[i]
289 <<
", dist.: " << distancesList[i] << std::endl;
290 std::cout <<
"\t" << j <<
": Comp.: " << compatibilityList[j]
291 <<
", dist.: " << distancesList[j] << std::endl;
292 std::cout <<
"\t Rel.diff.: Comp(1-2)/1: " << relDiffComp
293 <<
", Dist(1-2)/1: " << relDiffDist << std::endl;
321 auto propagator = std::make_shared<Propagator>(
stepper);
326 IPEstimator ipEstimator(ipEstCfg);
331 Vector3D mom1(400_MeV, 600_MeV, 200_MeV);
332 Vector3D vtxPos(1.2_mm, 0.8_mm, -7_mm);
335 std::shared_ptr<PerigeeSurface> perigeeSurface =
336 Surface::makeShared<PerigeeSurface>(pos1);
340 Covariance::Identity());
343 ipEstimator.calculate3dDistance(
geoContext, params1, vtxPos, state);
344 BOOST_CHECK(res1.ok());
345 double distance = (*res1);
348 const double result = 3.10391_mm;
351 auto res2 = ipEstimator.estimate3DImpactParameters(
353 BOOST_CHECK(res2.ok());
357 BOOST_CHECK_EQUAL(surfaceCenter, vtxPos);
365 unsigned int nTracks = 10;
369 std::mt19937 gen(mySeed);
378 auto propagator = std::make_shared<Propagator>(
stepper);
381 std::shared_ptr<PerigeeSurface> perigeeSurface =
382 Surface::makeShared<PerigeeSurface>(
Vector3D(0., 0., 0.));
389 Vector4D vertexPosition(x, y, z, 0.);
395 myCovMat(0, 0) = 30.;
396 myCovMat(1, 1) = 30.;
397 myCovMat(2, 2) = 30.;
398 myCovMat(3, 3) = 30.;
403 double d0_v = std::sqrt(x * x + y * y);
409 IPEstimator ipEstimator(ipEstCfg);
414 for (
unsigned int iTrack = 0; iTrack < nTracks; iTrack++) {
416 double q =
qDist(gen) < 0 ? -1. : 1.;
432 covMat << resD0 * resD0, 0., 0., 0., 0., 0., 0., resZ0 * resZ0, 0., 0., 0.,
433 0., 0., 0., resPh * resPh, 0., 0., 0., 0., 0., 0., resTh * resTh, 0.,
434 0., 0., 0., 0., 0., resQp * resQp, 0., 0., 0., 0., 0., 0., 1.;
441 .estimateImpactParameters(track, myConstraint,
geoContext,
444 BOOST_CHECK_NE(output.
IPd0, 0.);
445 BOOST_CHECK_NE(output.
IPz0, 0.);