9 #include <boost/test/data/test_case.hpp>
10 #include <boost/test/tools/output_test_stream.hpp>
11 #include <boost/test/unit_test.hpp>
23 using namespace Acts::UnitLiterals;
29 using Propagator = Propagator<EigenStepper<ConstantBField>>;
35 std::uniform_real_distribution<>
d0Dist(-0.01
_mm, 0.01
_mm);
37 std::uniform_real_distribution<>
z0Dist(-0.2
_mm, 0.2
_mm);
47 std::uniform_real_distribution<>
resAngDist(0., 0.1);
49 std::uniform_real_distribution<>
resQoPDist(-0.1, 0.1);
51 std::uniform_real_distribution<>
qDist(-1, 1);
65 unsigned int nTests = 10;
69 std::mt19937 gen(mySeed);
78 auto propagator = std::make_shared<Propagator>(
stepper);
90 for (
unsigned int i = 0; i < nTests; i++) {
101 covMat << resD0 * resD0, 0., 0., 0., 0., 0., 0., resZ0 * resZ0, 0., 0., 0.,
102 0., 0., 0., resPh * resPh, 0., 0., 0., 0., 0., 0., resTh * resTh, 0.,
103 0., 0., 0., 0., 0., resQp * resQp, 0., 0., 0., 0., 0., 0., 1.;
106 double q =
qDist(gen) < 0 ? -1. : 1.;
113 std::cout <<
"IP: (" << d0 <<
"," << z0 <<
")" << std::endl;
121 std::shared_ptr<PerigeeSurface> perigeeSurface =
122 Surface::makeShared<PerigeeSurface>(refPosition);
129 double transverseDist = std::sqrt(std::pow(d0, 2) + std::pow(z0, 2));
134 BOOST_CHECK(distanceRes.ok());
136 double distance = *distanceRes;
138 BOOST_CHECK(distance < transverseDist);
141 std::cout << std::setprecision(10)
142 <<
"Distance in transverse plane: " << transverseDist
144 std::cout << std::setprecision(10) <<
"Distance in 3D: " << distance
151 BOOST_CHECK(res.ok());
155 const auto& myTrackParams = myTrack.parameters();
156 const auto& trackIP3dParams = trackAtIP3d.parameters();
160 trackIP3dParams[ParID_t::eLOC_D0]);
162 trackIP3dParams[ParID_t::eLOC_Z0]);
165 trackIP3dParams[ParID_t::eTHETA], 1
e-5);
167 trackIP3dParams[ParID_t::eQOP], 1
e-5);
170 std::cout << std::setprecision(10) <<
"Old track parameters: \n"
171 << myTrackParams << std::endl;
172 std::cout << std::setprecision(10) <<
"Parameters at IP3d: \n"
173 << trackIP3dParams << std::endl;
184 unsigned int nTests = 10;
188 std::mt19937 gen(mySeed);
197 auto propagator = std::make_shared<Propagator>(
stepper);
209 std::vector<double> distancesList;
210 std::vector<double> compatibilityList;
222 for (
unsigned int i = 0; i < nTests; i++) {
227 covMat << resD0 * resD0, 0., 0., 0., 0., 0., 0., resZ0 * resZ0, 0., 0., 0.,
228 0., 0., 0., resPh * resPh, 0., 0., 0., 0., 0., 0., resTh * resTh, 0.,
229 0., 0., 0., 0., 0., resQp * resQp, 0., 0., 0., 0., 0., 0., 1.;
232 double q =
qDist(gen) < 0 ? -1. : 1.;
243 std::shared_ptr<PerigeeSurface> perigeeSurface =
244 Surface::makeShared<PerigeeSurface>(refPosition);
253 BOOST_CHECK(distanceRes.ok());
255 distancesList.push_back(*distanceRes);
260 BOOST_CHECK(res.ok());
267 BOOST_CHECK(compRes.ok());
269 compatibilityList.push_back(*compRes);
276 for (
unsigned int i = 0; i < nTests; i++) {
277 for (
unsigned int j = i + 1; j < nTests; j++) {
279 (compatibilityList[i] - compatibilityList[j]) / compatibilityList[i];
282 (distancesList[i] - distancesList[j]) / distancesList[i];
285 std::cout <<
"Comparing track " << i <<
" with track " << j
287 std::cout <<
"\t" << i <<
": Comp.: " << compatibilityList[i]
288 <<
", dist.: " << distancesList[i] << std::endl;
289 std::cout <<
"\t" << j <<
": Comp.: " << compatibilityList[j]
290 <<
", dist.: " << distancesList[j] << std::endl;
291 std::cout <<
"\t Rel.diff.: Comp(1-2)/1: " << relDiffComp
292 <<
", Dist(1-2)/1: " << relDiffDist << std::endl;
298 double res = relDiffComp * relDiffDist;
300 BOOST_CHECK(res > 0.);
316 auto propagator = std::make_shared<Propagator>(
stepper);
331 std::shared_ptr<PerigeeSurface> perigeeSurface =
332 Surface::makeShared<PerigeeSurface>(pos1);
338 BOOST_CHECK(res1.ok());
339 double distance = (*res1);
342 const double result = 3.10391_mm;
347 BOOST_CHECK(res2.ok());
351 BOOST_CHECK_EQUAL(surfaceCenter, vtxPos);
359 unsigned int nTracks = 10;
363 std::mt19937 gen(mySeed);
372 auto propagator = std::make_shared<Propagator>(
stepper);
375 std::shared_ptr<PerigeeSurface> perigeeSurface =
376 Surface::makeShared<PerigeeSurface>(
Vector3D(0., 0., 0.));
389 myCovMat(0, 0) = 30.;
390 myCovMat(1, 1) = 30.;
391 myCovMat(2, 2) = 30.;
392 myCovMat(3, 3) = 30.;
397 double d0_v = std::sqrt(x * x + y * y);
407 for (
unsigned int iTrack = 0; iTrack < nTracks; iTrack++) {
409 double q =
qDist(gen) < 0 ? -1. : 1.;
425 covMat << resD0 * resD0, 0., 0., 0., 0., 0., 0., resZ0 * resZ0, 0., 0., 0.,
426 0., 0., 0., resPh * resPh, 0., 0., 0., 0., 0., 0., resTh * resTh, 0.,
427 0., 0., 0., 0., 0., resQp * resQp, 0., 0., 0., 0., 0., 0., 1.;
430 paramVec, perigeeSurface);
438 BOOST_CHECK_NE(output.
IPd0, 0.);
439 BOOST_CHECK_NE(output.
IPz0, 0.);