Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:13:03

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #include <boost/test/unit_test.hpp>
0010 
0011 #include "Acts/Visualization/ObjVisualization3D.hpp"
0012 #include "Acts/Visualization/PlyVisualization3D.hpp"
0013 
0014 #include <algorithm>
0015 #include <iostream>
0016 
0017 #include "EventDataView3DBase.hpp"
0018 #include "Visualization3DTester.hpp"
0019 
0020 namespace Acts::Test {
0021 
0022 BOOST_AUTO_TEST_SUITE(Visualization)
0023 
0024 BOOST_AUTO_TEST_CASE(BoundTrackParametersVisualizationObj) {
0025   ObjVisualization3D obj;
0026   auto objTest = EventDataView3DTest::testBoundTrackParameters(obj);
0027   auto objErrors = testObjString(objTest);
0028   BOOST_CHECK(objErrors.empty());
0029   for (const auto& objerr : objErrors) {
0030     std::cout << objerr << std::endl;
0031   }
0032   BOOST_CHECK_EQUAL(std::count(objTest.begin(), objTest.end(), '\n'), 4924);
0033 }
0034 
0035 BOOST_AUTO_TEST_CASE(BoundTrackParametersVisualizationPly) {
0036   PlyVisualization3D ply;
0037   auto plyTest = EventDataView3DTest::testBoundTrackParameters(ply);
0038   auto plyErrors = testPlyString(plyTest);
0039   BOOST_CHECK(plyErrors.empty());
0040   for (const auto& plyerr : plyErrors) {
0041     std::cout << plyerr << std::endl;
0042   }
0043   BOOST_CHECK_EQUAL(std::count(plyTest.begin(), plyTest.end(), '\n'), 3143);
0044 }
0045 
0046 BOOST_AUTO_TEST_CASE(MeasurementVisualizationObj) {
0047   ObjVisualization3D obj;
0048   auto objTest = EventDataView3DTest::testMeasurement(obj);
0049   auto objErrors = testObjString(objTest);
0050   BOOST_CHECK(objErrors.empty());
0051   for (const auto& objerr : objErrors) {
0052     std::cout << objerr << std::endl;
0053   }
0054   BOOST_CHECK_EQUAL(std::count(objTest.begin(), objTest.end(), '\n'), 520);
0055 }
0056 
0057 BOOST_AUTO_TEST_CASE(MeasurementVisualizationPly) {
0058   PlyVisualization3D ply;
0059   auto plyTest = EventDataView3DTest::testMeasurement(ply);
0060   auto plyErrors = testPlyString(plyTest);
0061   BOOST_CHECK(plyErrors.empty());
0062   for (const auto& plyerr : plyErrors) {
0063     std::cout << plyerr << std::endl;
0064   }
0065   BOOST_CHECK_EQUAL(std::count(plyTest.begin(), plyTest.end(), '\n'), 536);
0066 }
0067 
0068 BOOST_AUTO_TEST_CASE(MeasurementVisualizationFaultySettings) {
0069   ObjVisualization3D obj;
0070 
0071   double localErrorScale = 0.;
0072   BOOST_CHECK_THROW(EventDataView3DTest::testMeasurement(obj, localErrorScale),
0073                     std::invalid_argument);
0074 
0075   localErrorScale = -1.;
0076   BOOST_CHECK_THROW(EventDataView3DTest::testMeasurement(obj, localErrorScale),
0077                     std::invalid_argument);
0078 }
0079 
0080 BOOST_AUTO_TEST_CASE(MultiTrajectoryVisualizationObj) {
0081   ObjVisualization3D obj;
0082   auto objTest = EventDataView3DTest::testMultiTrajectory(obj);
0083   auto objErrors = testObjString(objTest);
0084   BOOST_CHECK(objErrors.empty());
0085   for (const auto& objerr : objErrors) {
0086     std::cout << objerr << std::endl;
0087   }
0088   BOOST_CHECK_EQUAL(std::count(objTest.begin(), objTest.end(), '\n'), 103796);
0089 }
0090 
0091 BOOST_AUTO_TEST_CASE(MultiTrajectoryVisualizationPly) {
0092   PlyVisualization3D ply;
0093   auto plyTest = EventDataView3DTest::testMultiTrajectory(ply);
0094   auto plyErrors = testPlyString(plyTest);
0095   BOOST_CHECK(plyErrors.empty());
0096   for (const auto& plyerr : plyErrors) {
0097     std::cout << plyerr << std::endl;
0098   }
0099   BOOST_CHECK_EQUAL(std::count(plyTest.begin(), plyTest.end(), '\n'), 66091);
0100 }
0101 
0102 BOOST_AUTO_TEST_SUITE_END()
0103 
0104 }  // namespace Acts::Test