9 #include <boost/test/data/test_case.hpp>
10 #include <boost/test/tools/output_test_stream.hpp>
11 #include <boost/test/unit_test.hpp>
34 using namespace Acts::UnitLiterals;
58 auto propagator = std::make_shared<Propagator>(
stepper);
64 IPEstimator ipEstimator(ipEstimatorCfg);
66 std::vector<double> temperatures{8.0, 4.0, 2.0, 1.4142136, 1.2247449, 1.0};
74 fitterCfg.annealingTool = annealingUtility;
81 fitterCfg.doSmoothing =
true;
83 Fitter fitter(fitterCfg);
89 SeedFinder seedFinder;
93 Finder::Config finderConfig(std::move(fitter), seedFinder, ipEstimator,
99 Finder finder(finderConfig);
103 auto tracks = std::get<TracksData>(csvData);
106 std::cout <<
"Number of tracks in event: " << tracks.size() << std::endl;
109 for (
const auto& trk : tracks) {
110 std::cout << count <<
". track: " << std::endl;
111 std::cout <<
"params: " << trk << std::endl;
113 if (count == maxCout) {
119 std::vector<const BoundTrackParameters*> tracksPtr;
120 for (
const auto& trk : tracks) {
121 tracksPtr.push_back(&trk);
129 auto t1 = std::chrono::system_clock::now();
130 auto findResult = finder.find(tracksPtr, vertexingOptions, state);
131 auto t2 = std::chrono::system_clock::now();
134 std::chrono::duration_cast<std::chrono::milliseconds>(
t2 -
t1).count();
136 if (!findResult.ok()) {
137 std::cout << findResult.error().message() << std::endl;
140 BOOST_CHECK(findResult.ok());
142 std::vector<Vertex<BoundTrackParameters>> allVertices = *findResult;
145 std::cout <<
"Time needed: " << timediff <<
" ms." << std::endl;
146 std::cout <<
"Number of vertices reconstructed: " << allVertices.size()
150 for (
const auto&
vtx : allVertices) {
152 std::cout << count <<
". Vertex at position: " <<
vtx.position()[0]
153 <<
", " <<
vtx.position()[1] <<
", " <<
vtx.position()[2]
155 std::cout << count <<
". Vertex with cov: " <<
vtx.covariance()
157 std::cout <<
"\t with n tracks: " <<
vtx.tracks().size() << std::endl;
163 auto verticesInfo = std::get<VerticesData>(csvData);
164 const int expNRecoVertices = verticesInfo.size();
166 BOOST_CHECK_EQUAL(allVertices.size(), expNRecoVertices);
168 for (
int i = 0; i < expNRecoVertices; i++) {
169 auto recoVtx = allVertices[i];
170 auto expVtx = verticesInfo[i];
173 BOOST_CHECK_EQUAL(recoVtx.tracks().size(), expVtx.nTracks);
174 CHECK_CLOSE_ABS(recoVtx.tracks()[0].trackWeight, expVtx.trk1Weight, 0.003);
175 CHECK_CLOSE_ABS(recoVtx.tracks()[0].vertexCompatibility, expVtx.trk1Comp,
183 : m_parameters(params), m_id(id) {}
188 int id()
const {
return m_id; }
209 auto propagator = std::make_shared<Propagator>(
stepper);
213 std::function<BoundTrackParameters(InputTrack)> extractParameters =
214 [](
InputTrack params) {
return params.parameters(); };
220 IPEstimator ipEstimator(ipEstimatorCfg);
222 std::vector<double> temperatures{8.0, 4.0, 2.0, 1.4142136, 1.2247449, 1.0};
230 fitterCfg.annealingTool = annealingUtility;
237 fitterCfg.doSmoothing =
true;
239 Fitter fitter(fitterCfg, extractParameters);
244 SeedFinder seedFinder(extractParameters);
248 Finder::Config finderConfig(std::move(fitter), seedFinder, ipEstimator,
252 Finder finder(finderConfig, extractParameters);
255 auto tracks = std::get<TracksData>(csvData);
257 std::vector<InputTrack> userTracks;
259 for (
const auto& trk : tracks) {
260 userTracks.push_back(
InputTrack(trk, idCount));
265 std::cout <<
"Number of tracks in event: " << tracks.size() << std::endl;
268 for (
const auto& trk : tracks) {
269 std::cout << count <<
". track: " << std::endl;
270 std::cout <<
"params: " << trk << std::endl;
272 if (count == maxCout) {
278 std::vector<const InputTrack*> userTracksPtr;
279 for (
const auto& trk : userTracks) {
280 userTracksPtr.push_back(&trk);
287 constraintVtx.
setCovariance(std::get<BeamSpotData>(csvData).covariance());
291 auto findResult = finder.find(userTracksPtr, vertexingOptions, state);
293 if (!findResult.ok()) {
294 std::cout << findResult.error().message() << std::endl;
297 BOOST_CHECK(findResult.ok());
299 std::vector<Vertex<InputTrack>> allVertices = *findResult;
302 std::cout <<
"Number of vertices reconstructed: " << allVertices.size()
306 for (
const auto&
vtx : allVertices) {
308 std::cout << count <<
". Vertex at position: " <<
vtx.position()[0]
309 <<
", " <<
vtx.position()[1] <<
", " <<
vtx.position()[2]
311 std::cout << count <<
". Vertex with cov: " <<
vtx.covariance()
313 std::cout <<
"\t with n tracks: " <<
vtx.tracks().size() << std::endl;
315 for (
auto& trk : allVertices[0].tracks()) {
316 std::cout <<
"Track ID at first vertex: " << trk.originalParams->id()
321 auto verticesInfo = std::get<VerticesData>(csvData);
322 const int expNRecoVertices = verticesInfo.size();
324 BOOST_CHECK_EQUAL(allVertices.size(), expNRecoVertices);
326 for (
int i = 0; i < expNRecoVertices; i++) {
327 auto recoVtx = allVertices[i];
328 auto expVtx = verticesInfo[i];
331 BOOST_CHECK_EQUAL(recoVtx.tracks().size(), expVtx.nTracks);
332 CHECK_CLOSE_ABS(recoVtx.tracks()[0].trackWeight, expVtx.trk1Weight, 0.003);
333 CHECK_CLOSE_ABS(recoVtx.tracks()[0].vertexCompatibility, expVtx.trk1Comp,
343 std::cout <<
"Starting AMVF test with grid seed finder..." << std::endl;
353 auto propagator = std::make_shared<Propagator>(
stepper);
359 IPEstimator ipEst(ipEstCfg);
361 std::vector<double> temperatures{8.0, 4.0, 2.0, 1.4142136, 1.2247449, 1.0};
369 fitterCfg.annealingTool = annealingUtility;
376 fitterCfg.doSmoothing =
true;
378 Fitter fitter(fitterCfg);
382 seedFinderCfg.cacheGridStateForTrackRemoval =
true;
384 SeedFinder seedFinder(seedFinderCfg);
388 Finder::Config finderConfig(std::move(fitter), seedFinder, ipEst, linearizer);
393 Finder finder(finderConfig);
397 auto tracks = std::get<TracksData>(csvData);
400 std::cout <<
"Number of tracks in event: " << tracks.size() << std::endl;
403 for (
const auto& trk : tracks) {
404 std::cout << count <<
". track: " << std::endl;
405 std::cout <<
"params: " << trk << std::endl;
407 if (count == maxCout) {
413 std::vector<const BoundTrackParameters*> tracksPtr;
414 for (
const auto& trk : tracks) {
415 tracksPtr.push_back(&trk);
423 auto t1 = std::chrono::system_clock::now();
424 auto findResult = finder.find(tracksPtr, vertexingOptions, state);
425 auto t2 = std::chrono::system_clock::now();
428 std::chrono::duration_cast<std::chrono::milliseconds>(
t2 -
t1).count();
430 if (!findResult.ok()) {
431 std::cout << findResult.error().message() << std::endl;
434 BOOST_CHECK(findResult.ok());
436 std::vector<Vertex<BoundTrackParameters>> allVertices = *findResult;
439 std::cout <<
"Time needed: " << timediff <<
" ms." << std::endl;
440 std::cout <<
"Number of vertices reconstructed: " << allVertices.size()
444 for (
const auto&
vtx : allVertices) {
446 std::cout << count <<
". Vertex at position: " <<
vtx.position()[0]
447 <<
", " <<
vtx.position()[1] <<
", " <<
vtx.position()[2]
449 std::cout << count <<
". Vertex with cov: " <<
vtx.covariance()
451 std::cout <<
"\t with n tracks: " <<
vtx.tracks().size() << std::endl;
456 auto verticesInfo = std::get<VerticesData>(csvData);
457 const int expNRecoVertices = verticesInfo.size();
459 BOOST_CHECK_EQUAL(allVertices.size(), expNRecoVertices);
460 std::vector<bool> vtxFound(expNRecoVertices,
false);
462 for (
auto vtx : allVertices) {
463 double vtxZ =
vtx.position()[2];
465 int foundVtxIdx = -1;
466 for (
int i = 0; i < expNRecoVertices; i++) {
467 if (not vtxFound[i]) {
469 diffZ =
std::abs(vtxZ - verticesInfo[i].position[2]);
474 if (diffZ < 0.5_mm) {
475 vtxFound[foundVtxIdx] =
true;
480 for (
bool found : vtxFound) {
481 BOOST_CHECK_EQUAL(found,
true);