Back to home page

EIC code displayed by LXR

 
 

    


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

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/Definitions/Algebra.hpp"
0012 #include "Acts/Geometry/Extent.hpp"
0013 #include "Acts/Plugins/Json/ExtentJsonConverter.hpp"
0014 #include "Acts/Tests/CommonHelpers/FloatComparisons.hpp"
0015 #include "Acts/Utilities/BinningType.hpp"
0016 
0017 #include <nlohmann/json.hpp>
0018 
0019 using namespace Acts;
0020 
0021 BOOST_AUTO_TEST_SUITE(ExtentJsonConverter)
0022 
0023 BOOST_AUTO_TEST_CASE(ExtentRoundtripTests) {
0024   Extent e;
0025   e.set(AxisDirection::AxisR, 0, 200);
0026   e.set(AxisDirection::AxisZ, -50, 50);
0027 
0028   nlohmann::json j;
0029   j["extent"] = e;
0030 
0031   std::cout << j.dump(2) << std::endl;
0032 
0033   Extent eIn = j["extent"];
0034 
0035   CHECK_CLOSE_ABS(eIn.min(AxisDirection::AxisR), e.min(AxisDirection::AxisR),
0036                   10e-5);
0037   CHECK_CLOSE_ABS(eIn.max(AxisDirection::AxisR), e.max(AxisDirection::AxisR),
0038                   10e-5);
0039   CHECK_CLOSE_ABS(eIn.min(AxisDirection::AxisZ), e.min(AxisDirection::AxisZ),
0040                   10e-5);
0041   CHECK_CLOSE_ABS(eIn.max(AxisDirection::AxisZ), e.max(AxisDirection::AxisZ),
0042                   10e-5);
0043 }
0044 
0045 BOOST_AUTO_TEST_SUITE_END()