Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-21 08:04:06

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/EventData/Seed.hpp"
0012 
0013 #include <vector>
0014 
0015 using namespace Acts;
0016 
0017 namespace ActsTests {
0018 
0019 struct SpacePoint {};
0020 
0021 BOOST_AUTO_TEST_SUITE(EventDataSuite)
0022 
0023 BOOST_AUTO_TEST_CASE(seed_edm_constructors) {
0024   std::array<SpacePoint, 5> storage{};
0025   Seed<SpacePoint, 5> seed(storage[0], storage[1], storage[2], storage[3],
0026                            storage[4]);
0027   const std::array<const SpacePoint*, 5>& sps = seed.sp();
0028   for (std::size_t i(0ul); i < 5ul; ++i) {
0029     BOOST_CHECK_NE(sps[i], nullptr);
0030     BOOST_CHECK_EQUAL(sps[i], &storage[i]);
0031   }
0032 
0033   // Copy 1
0034   Seed<SpacePoint, 5> seedCopy1(seed);
0035   const std::array<const SpacePoint*, 5>& spsCopy1 = seedCopy1.sp();
0036   for (std::size_t i(0ul); i < 5ul; ++i) {
0037     BOOST_CHECK_NE(spsCopy1[i], nullptr);
0038     BOOST_CHECK_EQUAL(spsCopy1[i], sps[i]);
0039   }
0040 
0041   // Copy 2
0042   Seed<SpacePoint, 5> seedCopy2{seed};
0043   const std::array<const SpacePoint*, 5>& spsCopy2 = seedCopy2.sp();
0044   for (std::size_t i(0ul); i < 5ul; ++i) {
0045     BOOST_CHECK_NE(spsCopy2[i], nullptr);
0046     BOOST_CHECK_EQUAL(spsCopy2[i], sps[i]);
0047   }
0048 
0049   // Collection
0050   std::vector<Seed<SpacePoint, 5>> seeds{seed};
0051   // Copy 1
0052   std::vector<Seed<SpacePoint, 5>> seedsCopy1(seeds);
0053   BOOST_CHECK_EQUAL(seedsCopy1.size(), seeds.size());
0054   // Copy 2
0055   std::vector<Seed<SpacePoint, 5>> seedsCopy2{seeds};
0056   BOOST_CHECK_EQUAL(seedsCopy2.size(), seeds.size());
0057 }
0058 
0059 BOOST_AUTO_TEST_CASE(seed_edm_default) {
0060   std::array<SpacePoint, 3> storage{};
0061   Seed<SpacePoint> seed(storage[0], storage[1], storage[2]);
0062   const std::array<const SpacePoint*, 3>& sps = seed.sp();
0063   for (std::size_t i(0ul); i < 3ul; ++i) {
0064     BOOST_CHECK_NE(sps[i], nullptr);
0065     BOOST_CHECK_EQUAL(sps[i], &storage[i]);
0066   }
0067 
0068   seed.setVertexZ(-1.2f);
0069   BOOST_CHECK_EQUAL(seed.z(), -1.2f);
0070 
0071   seed.setQuality(345.23f);
0072   BOOST_CHECK_EQUAL(seed.seedQuality(), 345.23f);
0073 }
0074 
0075 BOOST_AUTO_TEST_CASE(seed_edm_3d) {
0076   std::array<SpacePoint, 3> storage{};
0077   Seed<SpacePoint, 3> seed(storage[0], storage[1], storage[2]);
0078   const std::array<const SpacePoint*, 3>& sps = seed.sp();
0079   for (std::size_t i(0ul); i < 3ul; ++i) {
0080     BOOST_CHECK_NE(sps[i], nullptr);
0081     BOOST_CHECK_EQUAL(sps[i], &storage[i]);
0082   }
0083 
0084   seed.setVertexZ(-1.2f);
0085   BOOST_CHECK_EQUAL(seed.z(), -1.2f);
0086 
0087   seed.setQuality(345.23f);
0088   BOOST_CHECK_EQUAL(seed.seedQuality(), 345.23f);
0089 }
0090 
0091 BOOST_AUTO_TEST_CASE(seed_edm_4d) {
0092   std::array<SpacePoint, 4> storage{};
0093   Seed<SpacePoint, 4> seed(storage[0], storage[1], storage[2], storage[3]);
0094   const std::array<const SpacePoint*, 4>& sps = seed.sp();
0095   for (std::size_t i(0ul); i < 4ul; ++i) {
0096     BOOST_CHECK_NE(sps[i], nullptr);
0097     BOOST_CHECK_EQUAL(sps[i], &storage[i]);
0098   }
0099 
0100   seed.setVertexZ(-1.2f);
0101   BOOST_CHECK_EQUAL(seed.z(), -1.2f);
0102 
0103   seed.setQuality(345.23f);
0104   BOOST_CHECK_EQUAL(seed.seedQuality(), 345.23f);
0105 }
0106 
0107 BOOST_AUTO_TEST_SUITE_END()
0108 
0109 }  // namespace ActsTests