9 #include <boost/test/data/test_case.hpp>
10 #include <boost/test/tools/output_test_stream.hpp>
11 #include <boost/test/unit_test.hpp>
41 #include <system_error>
45 using namespace Acts::UnitLiterals;
60 std::normal_distribution<double>
xdist(1_mm, 0.1_mm);
62 std::normal_distribution<double>
ydist(-0.7_mm, 0.1_mm);
68 std::uniform_real_distribution<double>
pTDist(0.1_GeV, 100_GeV);
70 std::uniform_real_distribution<double>
phiDist(-M_PI, M_PI);
72 std::uniform_real_distribution<double>
etaDist(-4., 4.);
91 const int mainGridSize = 3001;
92 const int trkGridSize = 35;
98 std::shared_ptr<PerigeeSurface> perigeeSurface =
99 Surface::makeShared<PerigeeSurface>(pos0);
106 cfg1.cacheGridStateForTrackRemoval =
false;
107 Finder1 finder1(cfg1);
108 Finder1::State state1;
113 AdaptiveGridDensity adaptiveDensity(adaptiveDensityConfig);
117 cfg2.cacheGridStateForTrackRemoval =
false;
118 Finder2 finder2(cfg2);
119 Finder2::State state2;
122 std::mt19937
gen(mySeed);
123 unsigned int nTracks = 200;
125 std::vector<BoundTrackParameters> trackVec;
126 trackVec.reserve(nTracks);
129 for (
unsigned int i = 0;
i < nTracks;
i++) {
142 perigeeSurface->intersect(
geoContext, pos, direction).closest();
143 pos = intersection.position();
151 direction, charge / pt, covMat,
156 std::vector<const BoundTrackParameters*> trackPtrVec;
157 for (
const auto& trk : trackVec) {
158 trackPtrVec.push_back(&trk);
161 auto res1 = finder1.find(trackPtrVec, vertexingOptions, state1);
163 std::cout << res1.error().message() << std::endl;
166 auto res2 = finder2.find(trackPtrVec, vertexingOptions, state2);
168 std::cout << res2.error().message() << std::endl;
173 BOOST_CHECK(!(*res1).empty());
174 Vector3 result1 = (*res1).back().position();
176 std::cout <<
"Vertex position result 1: " << result1 << std::endl;
179 zResult1 = result1[
eZ];
184 BOOST_CHECK(!(*res2).empty());
185 Vector3 result2 = (*res2).back().position();
187 std::cout <<
"Vertex position result 2: " << result2 << std::endl;
190 zResult2 = result2[
eZ];
194 BOOST_CHECK(zResult1 == zResult2);
200 const int mainGridSize = 3001;
201 const int trkGridSize = 35;
207 std::shared_ptr<PerigeeSurface> perigeeSurface =
208 Surface::makeShared<PerigeeSurface>(pos0);
218 densityConfig.useHighestSumZPosition =
true;
219 GridDensity density(densityConfig);
222 cfg.cacheGridStateForTrackRemoval =
true;
223 Finder1 finder1(cfg);
228 adaptiveDensityConfig.useHighestSumZPosition =
true;
229 AdaptiveGridDensity adaptiveDensity(adaptiveDensityConfig);
233 cfg2.cacheGridStateForTrackRemoval =
true;
234 Finder2 finder2(cfg2);
237 std::mt19937
gen(mySeed);
238 unsigned int nTracks = 200;
240 std::vector<BoundTrackParameters> trackVec;
241 trackVec.reserve(nTracks);
244 for (
unsigned int i = 0;
i < nTracks;
i++) {
257 perigeeSurface->intersect(
geoContext, pos, direction).closest();
258 pos = intersection.position();
266 direction, charge / pt, covMat,
271 std::vector<const BoundTrackParameters*> trackPtrVec;
272 for (
const auto& trk : trackVec) {
273 trackPtrVec.push_back(&trk);
276 Finder1::State state1;
277 Finder2::State state2;
282 auto res1 = finder1.find(trackPtrVec, vertexingOptions, state1);
284 std::cout << res1.error().message() << std::endl;
287 BOOST_CHECK(!(*res1).empty());
288 Vector3 result = (*res1).back().position();
290 std::cout <<
"Vertex position after first fill 1: " << result
294 zResult1 = result[
eZ];
297 auto res2 = finder2.find(trackPtrVec, vertexingOptions, state2);
299 std::cout << res2.error().message() << std::endl;
302 BOOST_CHECK(!(*res2).empty());
303 Vector3 result = (*res2).back().position();
305 std::cout <<
"Vertex position after first fill 2: " << result
309 zResult2 = result[
eZ];
312 BOOST_CHECK(zResult1 == zResult2);
315 std::vector<const BoundTrackParameters*> removedTracks;
316 for (
const auto& trk : trackVec) {
317 if ((trkCount % 4) != 0) {
318 removedTracks.push_back(&trk);
323 state1.tracksToRemove = removedTracks;
324 state2.tracksToRemove = removedTracks;
326 auto res3 = finder1.find(trackPtrVec, vertexingOptions, state1);
328 std::cout << res3.error().message() << std::endl;
331 BOOST_CHECK(!(*res3).empty());
332 Vector3 result = (*res3).back().position();
335 <<
"Vertex position after removing tracks near first density peak 1: "
336 << result << std::endl;
339 zResult1 = result[
eZ];
342 auto res4 = finder2.find(trackPtrVec, vertexingOptions, state2);
344 std::cout << res4.error().message() << std::endl;
347 BOOST_CHECK(!(*res4).empty());
348 Vector3 result = (*res4).back().position();
351 <<
"Vertex position after removing tracks near first density peak 2: "
352 << result << std::endl;
355 zResult2 = result[
eZ];
358 BOOST_CHECK(zResult1 == zResult2);
367 const int mainGridSize = 3001;
368 const int trkGridSize = 35;
374 std::shared_ptr<PerigeeSurface> perigeeSurface =
375 Surface::makeShared<PerigeeSurface>(pos0);
381 vertexingOptions.constraint = constraintVtx;
385 cfg1.cacheGridStateForTrackRemoval =
false;
386 cfg1.estimateSeedWidth =
true;
387 Finder1 finder1(cfg1);
388 Finder1::State state1;
393 AdaptiveGridDensity adaptiveDensity(adaptiveDensityConfig);
397 cfg2.cacheGridStateForTrackRemoval =
false;
398 cfg2.estimateSeedWidth =
true;
399 Finder2 finder2(cfg2);
400 Finder2::State state2;
403 std::mt19937
gen(mySeed);
404 unsigned int nTracks = 20;
406 std::vector<BoundTrackParameters> trackVec;
407 trackVec.reserve(nTracks);
410 for (
unsigned int i = 0;
i < nTracks;
i++) {
423 perigeeSurface->intersect(
geoContext, pos, direction).closest();
424 pos = intersection.position();
430 direction, charge / pt, covMat,
435 std::vector<const BoundTrackParameters*> trackPtrVec;
436 for (
const auto& trk : trackVec) {
437 trackPtrVec.push_back(&trk);
441 auto res1 = finder1.find(trackPtrVec, vertexingOptions, state1);
443 std::cout << res1.error().message() << std::endl;
448 BOOST_CHECK(!(*res1).empty());
451 BOOST_CHECK(
cov(
eZ,
eZ) != 0.);
454 std::cout <<
"Estimated z-seed width 1: " <<
cov(
eZ,
eZ) << std::endl;
459 auto res2 = finder2.find(trackPtrVec, vertexingOptions, state2);
461 std::cout << res2.error().message() << std::endl;
466 BOOST_CHECK(!(*res2).empty());
469 BOOST_CHECK(
cov(
eZ,
eZ) != 0.);
472 std::cout <<
"Estimated z-seed width 2: " <<
cov(
eZ,
eZ) << std::endl;