Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:12:35

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