Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-14 08:02: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/Definitions/Common.hpp"
0013 #include "Acts/Definitions/Direction.hpp"
0014 #include "Acts/Material/ISurfaceMaterial.hpp"
0015 #include "Acts/Material/MaterialSlab.hpp"
0016 
0017 #include <ostream>
0018 
0019 using namespace Acts;
0020 
0021 namespace ActsTests {
0022 
0023 class SurfaceMaterialStub : public ISurfaceMaterial {
0024   using ISurfaceMaterial::ISurfaceMaterial;
0025 
0026   ISurfaceMaterial& scale(double /*factor*/) override { return *this; };
0027 
0028   const MaterialSlab& materialSlab(const Vector2& /*lp*/) const override {
0029     return m_fullMaterial;
0030   }
0031 
0032   const MaterialSlab& materialSlab(const Vector3& /*gp*/) const override {
0033     return m_fullMaterial;
0034   }
0035 
0036   std::ostream& toStream(std::ostream& sl) const override {
0037     sl << "SurfaceMaterialStub";
0038     return sl;
0039   };
0040 
0041   MaterialSlab m_fullMaterial = MaterialSlab::Nothing();
0042 };
0043 
0044 BOOST_AUTO_TEST_SUITE(MaterialSuite)
0045 
0046 /// Test the constructors
0047 BOOST_AUTO_TEST_CASE(ISurfaceMaterial_factor_test) {
0048   double splitFactor = 42.0;
0049   SurfaceMaterialStub stub{splitFactor};
0050 
0051   BOOST_CHECK_EQUAL(
0052       stub.factor(Direction::Forward(), MaterialUpdateStage::FullUpdate), 1.0);
0053 
0054   BOOST_CHECK_EQUAL(
0055       stub.factor(Direction::Backward(), MaterialUpdateStage::FullUpdate), 1.0);
0056 
0057   BOOST_CHECK_EQUAL(
0058       stub.factor(Direction::Forward(), MaterialUpdateStage::PostUpdate),
0059       splitFactor);
0060 
0061   BOOST_CHECK_EQUAL(
0062       stub.factor(Direction::Backward(), MaterialUpdateStage::PreUpdate),
0063       splitFactor);
0064 
0065   BOOST_CHECK_EQUAL(
0066       stub.factor(Direction::Forward(), MaterialUpdateStage::PreUpdate),
0067       1 - splitFactor);
0068 
0069   BOOST_CHECK_EQUAL(
0070       stub.factor(Direction::Backward(), MaterialUpdateStage::PostUpdate),
0071       1 - splitFactor);
0072 }
0073 
0074 BOOST_AUTO_TEST_SUITE_END()
0075 
0076 }  // namespace ActsTests