From 13557bfccd7a6192df26cb3f1d11bfa9c432a642 Mon Sep 17 00:00:00 2001 From: "Alexander J. Pfleger" <70842573+AJPfleger@users.noreply.github.com> Date: Wed, 21 Jun 2023 13:59:47 +0200 Subject: [PATCH 01/11] Update EventDataView3D.hpp --- .../Acts/Visualization/EventDataView3D.hpp | 31 +++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/Core/include/Acts/Visualization/EventDataView3D.hpp b/Core/include/Acts/Visualization/EventDataView3D.hpp index b81c63f1323..13e0603f260 100644 --- a/Core/include/Acts/Visualization/EventDataView3D.hpp +++ b/Core/include/Acts/Visualization/EventDataView3D.hpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2020 CERN for the benefit of the Acts project +// Copyright (C) 2020-2023 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -39,7 +39,7 @@ static ViewConfig s_viewFiltered = ViewConfig({255, 255, 0}); static ViewConfig s_viewSmoothed = ViewConfig({0, 102, 255}); struct EventDataView3D { - /// Helper to find the egen values and corr angle + /// Helper to find the eigen values and corr angle /// /// @param covariance The covariance matrix static inline std::array decomposeCovariance( @@ -178,6 +178,25 @@ struct EventDataView3D { } } + /// Helper method to draw a single measurement + /// + /// @param helper [in, out] The visualization helper + /// @param lposition calibrated measurement + /// @param covariance calibrated covariance + /// @param transform reference surface transformed with the geometry context + /// @param locErrorScale The scale of the local error + /// @param measurementConfig The visualization options for the measurement + /// + /// TODO: Expand to 1D measurements + static void drawMeasurement( + IVisualization3D& helper, const Vector2& lposition, + const SymMatrix2& covariance, const Transform3& transform, + const double locErrorScale = 1., const ViewConfig& viewConfig = s_viewMeasurement) { + + drawCovarianceCartesian(helper, lposition, covariance, + transform, locErrorScale, viewConfig); + } + /// Helper method to draw one trajectory stored in a MultiTrajectory object /// /// @param helper [in, out] The visualization helper @@ -186,7 +205,7 @@ struct EventDataView3D { /// @param gctx The geometry context for which it is drawn /// @param momentumScale The scale of the momentum /// @param locErrorScale The scale of the local error - /// @param angularErrorScale The sclae of the angular error + /// @param angularErrorScale The scale of the angular error /// @param surfaceConfig The visualization options for the surface /// @param measurementConfig The visualization options for the measurement /// @param predictedConfig The visualization options for the predicted @@ -235,9 +254,9 @@ struct EventDataView3D { state.calibratedSize() == 2) { const Vector2& lposition = state.template calibrated<2>(); const SymMatrix2 covariance = state.template calibratedCovariance<2>(); - drawCovarianceCartesian(helper, lposition, covariance, - state.referenceSurface().transform(gctx), - locErrorScale, measurementConfig); + drawMeasurement(helper, lposition, + covariance, state.referenceSurface().transform(gctx), + locErrorScale, measurementConfig); } // Last, if necessary and present, draw the track parameters From b9afc2298a698faf98f57644b69c08e4c5785c6e Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Wed, 21 Jun 2023 14:04:46 +0200 Subject: [PATCH 02/11] clang-format --- .../include/Acts/Visualization/EventDataView3D.hpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Core/include/Acts/Visualization/EventDataView3D.hpp b/Core/include/Acts/Visualization/EventDataView3D.hpp index 13e0603f260..16ba8088301 100644 --- a/Core/include/Acts/Visualization/EventDataView3D.hpp +++ b/Core/include/Acts/Visualization/EventDataView3D.hpp @@ -191,10 +191,10 @@ struct EventDataView3D { static void drawMeasurement( IVisualization3D& helper, const Vector2& lposition, const SymMatrix2& covariance, const Transform3& transform, - const double locErrorScale = 1., const ViewConfig& viewConfig = s_viewMeasurement) { - - drawCovarianceCartesian(helper, lposition, covariance, - transform, locErrorScale, viewConfig); + const double locErrorScale = 1., + const ViewConfig& viewConfig = s_viewMeasurement) { + drawCovarianceCartesian(helper, lposition, covariance, transform, + locErrorScale, viewConfig); } /// Helper method to draw one trajectory stored in a MultiTrajectory object @@ -254,9 +254,9 @@ struct EventDataView3D { state.calibratedSize() == 2) { const Vector2& lposition = state.template calibrated<2>(); const SymMatrix2 covariance = state.template calibratedCovariance<2>(); - drawMeasurement(helper, lposition, - covariance, state.referenceSurface().transform(gctx), - locErrorScale, measurementConfig); + drawMeasurement(helper, lposition, covariance, + state.referenceSurface().transform(gctx), locErrorScale, + measurementConfig); } // Last, if necessary and present, draw the track parameters From 7edc90b94150bf0125b252e36f7ad849260c886e Mon Sep 17 00:00:00 2001 From: "Alexander J. Pfleger" <70842573+AJPfleger@users.noreply.github.com> Date: Wed, 21 Jun 2023 14:19:26 +0200 Subject: [PATCH 03/11] arror->arrow --- Core/include/Acts/Visualization/EventDataView3D.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/include/Acts/Visualization/EventDataView3D.hpp b/Core/include/Acts/Visualization/EventDataView3D.hpp index 16ba8088301..ca8ff2b6670 100644 --- a/Core/include/Acts/Visualization/EventDataView3D.hpp +++ b/Core/include/Acts/Visualization/EventDataView3D.hpp @@ -112,7 +112,7 @@ struct EventDataView3D { /// @param position Where the cone originates from /// @param direction The direction parameters /// @param covariance The 2x2 covariance matrix for phi/theta - /// @param directionScale The direction arror length + /// @param directionScale The direction arrow length /// @param angularErrorScale The local Error scale /// @param viewConfig The visualization parameters static void drawCovarianceAngular( From 2503605f5831efff47ccfdb544830b928e4bdc2f Mon Sep 17 00:00:00 2001 From: "Alexander J. Pfleger" <70842573+AJPfleger@users.noreply.github.com> Date: Wed, 21 Jun 2023 14:23:04 +0200 Subject: [PATCH 04/11] fix docs --- Core/include/Acts/Visualization/EventDataView3D.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Core/include/Acts/Visualization/EventDataView3D.hpp b/Core/include/Acts/Visualization/EventDataView3D.hpp index ca8ff2b6670..d401fe2226e 100644 --- a/Core/include/Acts/Visualization/EventDataView3D.hpp +++ b/Core/include/Acts/Visualization/EventDataView3D.hpp @@ -192,9 +192,9 @@ struct EventDataView3D { IVisualization3D& helper, const Vector2& lposition, const SymMatrix2& covariance, const Transform3& transform, const double locErrorScale = 1., - const ViewConfig& viewConfig = s_viewMeasurement) { + const ViewConfig& measurementConfig = s_viewMeasurement) { drawCovarianceCartesian(helper, lposition, covariance, transform, - locErrorScale, viewConfig); + locErrorScale, measurementConfig); } /// Helper method to draw one trajectory stored in a MultiTrajectory object From bc25f57479f8401fa67718b81e98661af8f228fb Mon Sep 17 00:00:00 2001 From: "Alexander J. Pfleger" <70842573+AJPfleger@users.noreply.github.com> Date: Wed, 21 Jun 2023 16:59:48 +0200 Subject: [PATCH 05/11] locErrorScale exception, visible-check --- .../Acts/Visualization/EventDataView3D.hpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Core/include/Acts/Visualization/EventDataView3D.hpp b/Core/include/Acts/Visualization/EventDataView3D.hpp index d401fe2226e..b72d654016d 100644 --- a/Core/include/Acts/Visualization/EventDataView3D.hpp +++ b/Core/include/Acts/Visualization/EventDataView3D.hpp @@ -191,10 +191,14 @@ struct EventDataView3D { static void drawMeasurement( IVisualization3D& helper, const Vector2& lposition, const SymMatrix2& covariance, const Transform3& transform, - const double locErrorScale = 1., - const ViewConfig& measurementConfig = s_viewMeasurement) { - drawCovarianceCartesian(helper, lposition, covariance, transform, - locErrorScale, measurementConfig); + const double locErrorScale = 1., const ViewConfig& measurementConfig = s_viewMeasurement) { + if (locErrorScale <= 0) { + throw std::invalid_argument("locErrorScale must be > 0"); + } + if (viewConfig.visible) { + drawCovarianceCartesian(helper, lposition, covariance, transform, + locErrorScale, measurementConfig); + } } /// Helper method to draw one trajectory stored in a MultiTrajectory object @@ -250,8 +254,7 @@ struct EventDataView3D { // Second, if necessary and present, draw the calibrated measurement (only // draw 2D measurement here) // @Todo: how to draw 1D measurement? - if (measurementConfig.visible and state.hasCalibrated() and - state.calibratedSize() == 2) { + if (state.hasCalibrated() and state.calibratedSize() == 2) { const Vector2& lposition = state.template calibrated<2>(); const SymMatrix2 covariance = state.template calibratedCovariance<2>(); drawMeasurement(helper, lposition, covariance, From 367b76d4d01e593d3bfe149efec8b30908fd5726 Mon Sep 17 00:00:00 2001 From: "Alexander J. Pfleger" <70842573+AJPfleger@users.noreply.github.com> Date: Wed, 21 Jun 2023 17:01:09 +0200 Subject: [PATCH 06/11] change variablename --- Core/include/Acts/Visualization/EventDataView3D.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/include/Acts/Visualization/EventDataView3D.hpp b/Core/include/Acts/Visualization/EventDataView3D.hpp index b72d654016d..9bb448ff05b 100644 --- a/Core/include/Acts/Visualization/EventDataView3D.hpp +++ b/Core/include/Acts/Visualization/EventDataView3D.hpp @@ -195,7 +195,7 @@ struct EventDataView3D { if (locErrorScale <= 0) { throw std::invalid_argument("locErrorScale must be > 0"); } - if (viewConfig.visible) { + if (measurementConfig.visible) { drawCovarianceCartesian(helper, lposition, covariance, transform, locErrorScale, measurementConfig); } From 5b621e50a9710201c4b425f33b94496f48213a7d Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Wed, 21 Jun 2023 17:04:03 +0200 Subject: [PATCH 07/11] clang-format --- Core/include/Acts/Visualization/EventDataView3D.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Core/include/Acts/Visualization/EventDataView3D.hpp b/Core/include/Acts/Visualization/EventDataView3D.hpp index 9bb448ff05b..924d1eaf1ca 100644 --- a/Core/include/Acts/Visualization/EventDataView3D.hpp +++ b/Core/include/Acts/Visualization/EventDataView3D.hpp @@ -191,7 +191,8 @@ struct EventDataView3D { static void drawMeasurement( IVisualization3D& helper, const Vector2& lposition, const SymMatrix2& covariance, const Transform3& transform, - const double locErrorScale = 1., const ViewConfig& measurementConfig = s_viewMeasurement) { + const double locErrorScale = 1., + const ViewConfig& measurementConfig = s_viewMeasurement) { if (locErrorScale <= 0) { throw std::invalid_argument("locErrorScale must be > 0"); } From b7c85ca344f7f8349cc65f5c47964d5ac2e8d115 Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Thu, 22 Jun 2023 14:25:25 +0200 Subject: [PATCH 08/11] add: unittests --- .../Visualization/EventDataView3DBase.hpp | 217 ++++++++++++------ .../Visualization/EventDataView3DTests.cpp | 25 +- 2 files changed, 171 insertions(+), 71 deletions(-) diff --git a/Tests/UnitTests/Core/Visualization/EventDataView3DBase.hpp b/Tests/UnitTests/Core/Visualization/EventDataView3DBase.hpp index 80af3740d88..b3aa683bc75 100644 --- a/Tests/UnitTests/Core/Visualization/EventDataView3DBase.hpp +++ b/Tests/UnitTests/Core/Visualization/EventDataView3DBase.hpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2020-2021 CERN for the benefit of the Acts project +// Copyright (C) 2020-2023 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -51,69 +51,28 @@ namespace Acts { namespace EventDataView3DTest { using Covariance = BoundSymMatrix; -template -using MeasurementType = Measurement; std::normal_distribution gauss(0., 1.); std::default_random_engine generator(42); -/// Helper method to visualize all types of surfaces +/// A function that creates a simple telescope detector with surfaces for the +/// EventDataView3D tests /// /// @param helper The visualization helper +/// @param surfaces Reference to the surfaces, because we need them outside +/// @param detector The tracking geometry that will be filled +/// @param nSurfaces Number of surfaces to generate /// /// @return an overall string including all written output -static inline std::string testBoundTrackParameters(IVisualization3D& helper) { - std::stringstream ss; - - ViewConfig pcolor({20, 120, 20}); - ViewConfig scolor({235, 198, 52}); - - auto gctx = GeometryContext(); - auto identity = Transform3::Identity(); - - // rectangle and plane - auto rectangle = std::make_shared(15., 15.); - auto plane = Surface::makeShared(identity, rectangle); - - double momentumScale = 0.005; - double localErrorScale = 10.; - double directionErrorScale = 1000.; - - // now create parameters on this surface - // l_x, l_y, phi, theta, q/p (1/p), t - std::array pars_array = { - {-0.1234, 4.8765, 0.45, 0.128, 0.001, 21.}}; - - BoundTrackParameters::ParametersVector pars = - BoundTrackParameters::ParametersVector::Zero(); - pars << pars_array[0], pars_array[1], pars_array[2], pars_array[3], - pars_array[4], pars_array[5]; - - BoundSymMatrix cov = BoundSymMatrix::Zero(); - cov << 0.25, 0.0042, -0.00076, 6.156e-06, -2.11e-07, 0, 0.0042, 0.859, - -0.000173, 0.000916, -4.017e-08, 0, -0.00076, -0.000173, 2.36e-04, - -2.76e-07, 1.12e-08, 0, 6.15e-06, 0.000916, -2.76e-07, 8.84e-04, - -2.85e-11, 0, -2.11 - 07, -4.017e-08, 1.123e-08, -2.85 - 11, 1.26e-10, 0, - 0, 0, 0, 0, 0, 1; - - EventDataView3D::drawBoundTrackParameters( - helper, BoundTrackParameters(plane, pars, std::move(cov)), gctx, - momentumScale, localErrorScale, directionErrorScale, pcolor, scolor); - - helper.write("EventData_BoundAtPlaneParameters"); - helper.write(ss); - - return ss.str(); -} - -static inline std::string testMultiTrajectory(IVisualization3D& helper) { +void createDetector(GeometryContext& tgContext, + std::vector& surfaces, + std::shared_ptr& detector, + const size_t nSurfaces = 7) { using namespace UnitLiterals; - std::stringstream ss; - // Create a test context - GeometryContext tgContext = GeometryContext(); - MagneticFieldContext mfContext = MagneticFieldContext(); - CalibrationContext calContext = CalibrationContext(); + if (nSurfaces < 1) { + throw std::invalid_argument("At least 1 surfaces needs to be created."); + } // Construct the rotation RotationMatrix3 rotation = RotationMatrix3::Identity(); @@ -136,17 +95,14 @@ static inline std::string testMultiTrajectory(IVisualization3D& helper) { // Set translation vectors std::vector translations; - translations.reserve(6); - translations.push_back({-300_mm, 0., 0.}); - translations.push_back({-200_mm, 0., 0.}); - translations.push_back({-100_mm, 0., 0.}); - translations.push_back({100_mm, 0., 0.}); - translations.push_back({200_mm, 0., 0.}); - translations.push_back({300_mm, 0., 0.}); + translations.reserve(nSurfaces); + for (unsigned int i = 0; i < nSurfaces; i++) { + translations.push_back({i * 100_mm - 300_mm, 0., 0.}); + } // Construct layer configs std::vector lConfs; - lConfs.reserve(6); + lConfs.reserve(nSurfaces); for (unsigned int i = 0; i < translations.size(); i++) { CuboidVolumeBuilder::SurfaceConfig sConf; sConf.position = translations[i]; @@ -189,12 +145,10 @@ static inline std::string testMultiTrajectory(IVisualization3D& helper) { return cvb.trackingVolume(context, inner, vb); }); TrackingGeometryBuilder tgb(tgbCfg); - std::shared_ptr detector = - tgb.trackingGeometry(tgContext); + detector = tgb.trackingGeometry(tgContext); // Get the surfaces; - std::vector surfaces; - surfaces.reserve(6); + surfaces.reserve(nSurfaces); detector->visitSurfaces([&](const Surface* surface) { if (surface != nullptr && surface->associatedDetectorElement() != nullptr) { std::cout << "surface " << surface->geometryId() << " placed at: (" @@ -203,12 +157,141 @@ static inline std::string testMultiTrajectory(IVisualization3D& helper) { } }); std::cout << "There are " << surfaces.size() << " surfaces" << std::endl; +}; + +/// Helper method to visualize all types of surfaces +/// +/// @param helper The visualization helper +/// +/// @return an overall string including all written output +static inline std::string testBoundTrackParameters(IVisualization3D& helper) { + std::stringstream ss; + + ViewConfig pcolor({20, 120, 20}); + ViewConfig scolor({235, 198, 52}); + + auto gctx = GeometryContext(); + auto identity = Transform3::Identity(); + + // rectangle and plane + auto rectangle = std::make_shared(15., 15.); + auto plane = Surface::makeShared(identity, rectangle); + + double momentumScale = 0.005; + double localErrorScale = 10.; + double directionErrorScale = 1000.; + + // now create parameters on this surface + // l_x, l_y, phi, theta, q/p (1/p), t + std::array pars_array = { + {-0.1234, 4.8765, 0.45, 0.128, 0.001, 21.}}; + + BoundTrackParameters::ParametersVector pars = + BoundTrackParameters::ParametersVector::Zero(); + pars << pars_array[0], pars_array[1], pars_array[2], pars_array[3], + pars_array[4], pars_array[5]; + + Covariance cov = Covariance::Zero(); + cov << 0.25, 0.0042, -0.00076, 6.156e-06, -2.11e-07, 0, 0.0042, 0.859, + -0.000173, 0.000916, -4.017e-08, 0, -0.00076, -0.000173, 2.36e-04, + -2.76e-07, 1.12e-08, 0, 6.15e-06, 0.000916, -2.76e-07, 8.84e-04, + -2.85e-11, 0, -2.11 - 07, -4.017e-08, 1.123e-08, -2.85 - 11, 1.26e-10, 0, + 0, 0, 0, 0, 0, 1; + + EventDataView3D::drawBoundTrackParameters( + helper, BoundTrackParameters(plane, pars, std::move(cov)), gctx, + momentumScale, localErrorScale, directionErrorScale, pcolor, scolor); + + helper.write("EventData_BoundAtPlaneParameters"); + helper.write(ss); + + return ss.str(); +} + +/// Helper method to visualize measurements +/// +/// @param helper The visualization helper +/// +/// @return an overall string including all written output +static inline std::string testMeasurement(IVisualization3D& helper) { + using namespace UnitLiterals; + std::stringstream ss; + + // Create a test context + GeometryContext tgContext = GeometryContext(); + + // Create a detector + const size_t nSurfaces = 7; + std::vector surfaces; + std::shared_ptr detector; + createDetector(tgContext, surfaces, detector, nSurfaces); + + // Create measurements (assuming they are for a linear track parallel to + // global x-axis) + std::cout << "Creating measurements:" << std::endl; + std::vector sourcelinks; + sourcelinks.reserve(nSurfaces); + Vector2 lPosCenter{5_mm, 5_mm}; + Vector2 resolution{200_um, 150_um}; + SymMatrix2 cov2D = resolution.cwiseProduct(resolution).asDiagonal(); + for (const auto& surface : surfaces) { + // 2D measurements + Vector2 loc = lPosCenter; + loc[0] += resolution[0] * gauss(generator); + loc[1] += resolution[1] * gauss(generator); + sourcelinks.emplace_back(Test::TestSourceLink{ + eBoundLoc0, eBoundLoc1, loc, cov2D, surface->geometryId()}); + } + + double localErrorScale = 100.; + ViewConfig mcolor({255, 145, 48}); + mcolor.offset = 0.01; + + // Draw the measurements + std::cout << "Draw the measurements" << std::endl; + // auto singleMeasurement = sourcelinks[0]; + for (auto& singleMeasurement : sourcelinks) { + auto cov = singleMeasurement.covariance; + auto lposition = singleMeasurement.parameters; + + auto surf = detector->findSurface(singleMeasurement.m_geometryId); + auto transf = surf->transform(tgContext); + + EventDataView3D::drawMeasurement(helper, lposition, cov, transf, + localErrorScale, mcolor); + } + + helper.write("EventData_Measurement"); + helper.write(ss); + + return ss.str(); +} + +/// Helper method to visualize a MultiTrajectory +/// +/// @param helper The visualization helper +/// +/// @return an overall string including all written output +static inline std::string testMultiTrajectory(IVisualization3D& helper) { + using namespace UnitLiterals; + std::stringstream ss; + + // Create a test context + GeometryContext tgContext = GeometryContext(); + MagneticFieldContext mfContext = MagneticFieldContext(); + CalibrationContext calContext = CalibrationContext(); + + // Create a detector + const size_t nSurfaces = 7; + std::vector surfaces; + std::shared_ptr detector; + createDetector(tgContext, surfaces, detector, nSurfaces); // Create measurements (assuming they are for a linear track parallel to // global x-axis) std::cout << "Creating measurements:" << std::endl; std::vector sourcelinks; - sourcelinks.reserve(6); + sourcelinks.reserve(nSurfaces); Vector2 lPosCenter{5_mm, 5_mm}; Vector2 resolution{200_um, 150_um}; SymMatrix2 cov2D = resolution.cwiseProduct(resolution).asDiagonal(); diff --git a/Tests/UnitTests/Core/Visualization/EventDataView3DTests.cpp b/Tests/UnitTests/Core/Visualization/EventDataView3DTests.cpp index 7891a38f2b4..6490dcf287a 100644 --- a/Tests/UnitTests/Core/Visualization/EventDataView3DTests.cpp +++ b/Tests/UnitTests/Core/Visualization/EventDataView3DTests.cpp @@ -1,6 +1,6 @@ // This file is part of the Acts project. // -// Copyright (C) 2020 CERN for the benefit of the Acts project +// Copyright (C) 2020-2023 CERN for the benefit of the Acts project // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -13,14 +13,11 @@ #include "Acts/Visualization/PlyVisualization3D.hpp" #include -#include -#include #include "EventDataView3DBase.hpp" #include "Visualization3DTester.hpp" namespace Acts { - namespace Test { BOOST_AUTO_TEST_SUITE(Visualization) @@ -45,6 +42,26 @@ BOOST_AUTO_TEST_CASE(BoundTrackParametersVisualizationPly) { } } +BOOST_AUTO_TEST_CASE(MeasurementVisualizationObj) { + ObjVisualization3D obj; + auto objTest = EventDataView3DTest::testMeasurement(obj); + auto objErrors = testObjString(objTest); + BOOST_CHECK(objErrors.empty()); + for (const auto& objerr : objErrors) { + std::cout << objerr << std::endl; + } +} + +BOOST_AUTO_TEST_CASE(MeasurementVisualizationPly) { + PlyVisualization3D ply; + auto plyTest = EventDataView3DTest::testMeasurement(ply); + auto plyErrors = testPlyString(plyTest); + BOOST_CHECK(plyErrors.empty()); + for (const auto& plyerr : plyErrors) { + std::cout << plyerr << std::endl; + } +} + BOOST_AUTO_TEST_CASE(MultiTrajectoryVisualizationObj) { ObjVisualization3D obj; auto objTest = EventDataView3DTest::testMultiTrajectory(obj); From 4e950dc344ddbfc0f97acc46bf910c8439815ce6 Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Thu, 22 Jun 2023 14:54:30 +0200 Subject: [PATCH 09/11] add mooore unittests --- Tests/UnitTests/Core/Visualization/EventDataView3DTests.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Tests/UnitTests/Core/Visualization/EventDataView3DTests.cpp b/Tests/UnitTests/Core/Visualization/EventDataView3DTests.cpp index 6490dcf287a..162d41781c0 100644 --- a/Tests/UnitTests/Core/Visualization/EventDataView3DTests.cpp +++ b/Tests/UnitTests/Core/Visualization/EventDataView3DTests.cpp @@ -30,6 +30,7 @@ BOOST_AUTO_TEST_CASE(BoundTrackParametersVisualizationObj) { for (const auto& objerr : objErrors) { std::cout << objerr << std::endl; } + BOOST_CHECK_EQUAL(objTest.length(), 28630); } BOOST_AUTO_TEST_CASE(BoundTrackParametersVisualizationPly) { @@ -40,6 +41,7 @@ BOOST_AUTO_TEST_CASE(BoundTrackParametersVisualizationPly) { for (const auto& plyerr : plyErrors) { std::cout << plyerr << std::endl; } + BOOST_CHECK_EQUAL(plyTest.length(), 37136); } BOOST_AUTO_TEST_CASE(MeasurementVisualizationObj) { @@ -50,6 +52,7 @@ BOOST_AUTO_TEST_CASE(MeasurementVisualizationObj) { for (const auto& objerr : objErrors) { std::cout << objerr << std::endl; } + BOOST_CHECK_EQUAL(objTest.length(), 11533); } BOOST_AUTO_TEST_CASE(MeasurementVisualizationPly) { @@ -60,6 +63,7 @@ BOOST_AUTO_TEST_CASE(MeasurementVisualizationPly) { for (const auto& plyerr : plyErrors) { std::cout << plyerr << std::endl; } + BOOST_CHECK_EQUAL(plyTest.length(), 19657); } BOOST_AUTO_TEST_CASE(MultiTrajectoryVisualizationObj) { @@ -70,6 +74,7 @@ BOOST_AUTO_TEST_CASE(MultiTrajectoryVisualizationObj) { for (const auto& objerr : objErrors) { std::cout << objerr << std::endl; } + BOOST_CHECK_EQUAL(objTest.length(), 648023); } BOOST_AUTO_TEST_CASE(MultiTrajectoryVisualizationPly) { @@ -80,6 +85,7 @@ BOOST_AUTO_TEST_CASE(MultiTrajectoryVisualizationPly) { for (const auto& plyerr : plyErrors) { std::cout << plyerr << std::endl; } + BOOST_CHECK_EQUAL(plyTest.length(), 803016); } BOOST_AUTO_TEST_SUITE_END() From 4d4e7a137e4f2c745175e1953aa22458d61bab35 Mon Sep 17 00:00:00 2001 From: AJPfleger Date: Thu, 22 Jun 2023 15:51:07 +0200 Subject: [PATCH 10/11] change condition --- .../Core/Visualization/EventDataView3DTests.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Tests/UnitTests/Core/Visualization/EventDataView3DTests.cpp b/Tests/UnitTests/Core/Visualization/EventDataView3DTests.cpp index 162d41781c0..afa89bb6e30 100644 --- a/Tests/UnitTests/Core/Visualization/EventDataView3DTests.cpp +++ b/Tests/UnitTests/Core/Visualization/EventDataView3DTests.cpp @@ -12,6 +12,7 @@ #include "Acts/Visualization/ObjVisualization3D.hpp" #include "Acts/Visualization/PlyVisualization3D.hpp" +#include #include #include "EventDataView3DBase.hpp" @@ -30,7 +31,7 @@ BOOST_AUTO_TEST_CASE(BoundTrackParametersVisualizationObj) { for (const auto& objerr : objErrors) { std::cout << objerr << std::endl; } - BOOST_CHECK_EQUAL(objTest.length(), 28630); + BOOST_CHECK_EQUAL(std::count(objTest.begin(), objTest.end(), '\n'), 1458); } BOOST_AUTO_TEST_CASE(BoundTrackParametersVisualizationPly) { @@ -41,7 +42,7 @@ BOOST_AUTO_TEST_CASE(BoundTrackParametersVisualizationPly) { for (const auto& plyerr : plyErrors) { std::cout << plyerr << std::endl; } - BOOST_CHECK_EQUAL(plyTest.length(), 37136); + BOOST_CHECK_EQUAL(std::count(plyTest.begin(), plyTest.end(), '\n'), 973); } BOOST_AUTO_TEST_CASE(MeasurementVisualizationObj) { @@ -52,7 +53,7 @@ BOOST_AUTO_TEST_CASE(MeasurementVisualizationObj) { for (const auto& objerr : objErrors) { std::cout << objerr << std::endl; } - BOOST_CHECK_EQUAL(objTest.length(), 11533); + BOOST_CHECK_EQUAL(std::count(objTest.begin(), objTest.end(), '\n'), 520); } BOOST_AUTO_TEST_CASE(MeasurementVisualizationPly) { @@ -63,7 +64,7 @@ BOOST_AUTO_TEST_CASE(MeasurementVisualizationPly) { for (const auto& plyerr : plyErrors) { std::cout << plyerr << std::endl; } - BOOST_CHECK_EQUAL(plyTest.length(), 19657); + BOOST_CHECK_EQUAL(std::count(plyTest.begin(), plyTest.end(), '\n'), 536); } BOOST_AUTO_TEST_CASE(MultiTrajectoryVisualizationObj) { @@ -74,7 +75,7 @@ BOOST_AUTO_TEST_CASE(MultiTrajectoryVisualizationObj) { for (const auto& objerr : objErrors) { std::cout << objerr << std::endl; } - BOOST_CHECK_EQUAL(objTest.length(), 648023); + BOOST_CHECK_EQUAL(std::count(objTest.begin(), objTest.end(), '\n'), 31010); } BOOST_AUTO_TEST_CASE(MultiTrajectoryVisualizationPly) { @@ -85,7 +86,7 @@ BOOST_AUTO_TEST_CASE(MultiTrajectoryVisualizationPly) { for (const auto& plyerr : plyErrors) { std::cout << plyerr << std::endl; } - BOOST_CHECK_EQUAL(plyTest.length(), 803016); + BOOST_CHECK_EQUAL(std::count(plyTest.begin(), plyTest.end(), '\n'), 20521); } BOOST_AUTO_TEST_SUITE_END() From a9ef000ce01d1f40752ec9f231a5000464abbbbd Mon Sep 17 00:00:00 2001 From: "Alexander J. Pfleger" <70842573+AJPfleger@users.noreply.github.com> Date: Thu, 22 Jun 2023 17:27:47 +0200 Subject: [PATCH 11/11] remove semicolon --- Tests/UnitTests/Core/Visualization/EventDataView3DBase.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/UnitTests/Core/Visualization/EventDataView3DBase.hpp b/Tests/UnitTests/Core/Visualization/EventDataView3DBase.hpp index b3aa683bc75..0a40f532921 100644 --- a/Tests/UnitTests/Core/Visualization/EventDataView3DBase.hpp +++ b/Tests/UnitTests/Core/Visualization/EventDataView3DBase.hpp @@ -157,7 +157,7 @@ void createDetector(GeometryContext& tgContext, } }); std::cout << "There are " << surfaces.size() << " surfaces" << std::endl; -}; +} /// Helper method to visualize all types of surfaces ///