Back to home page

EIC code displayed by LXR

 
 

    


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

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 namespace Acts::Test {
0020 
0021 class SurfaceMaterialStub : public ISurfaceMaterial {
0022   using ISurfaceMaterial::ISurfaceMaterial;
0023 
0024   ISurfaceMaterial& scale(double /*factor*/) override { return *this; };
0025 
0026   const MaterialSlab& materialSlab(const Vector2& /*lp*/) const override {
0027     return m_fullMaterial;
0028   }
0029 
0030   const MaterialSlab& materialSlab(const Vector3& /*gp*/) const override {
0031     return m_fullMaterial;
0032   }
0033 
0034   std::ostream& toStream(std::ostream& sl) const override {
0035     sl << "SurfaceMaterialStub";
0036     return sl;
0037   };
0038 
0039   MaterialSlab m_fullMaterial{};
0040 };
0041 
0042 /// Test the constructors
0043 BOOST_AUTO_TEST_CASE(ISurfaceMaterial_factor_test) {
0044   double splitFactor = 42.0;
0045   SurfaceMaterialStub stub{splitFactor};
0046 
0047   BOOST_CHECK_EQUAL(
0048       stub.factor(Direction::Forward(), MaterialUpdateStage::FullUpdate), 1.0);
0049 
0050   BOOST_CHECK_EQUAL(
0051       stub.factor(Direction::Backward(), MaterialUpdateStage::FullUpdate), 1.0);
0052 
0053   BOOST_CHECK_EQUAL(
0054       stub.factor(Direction::Forward(), MaterialUpdateStage::PostUpdate),
0055       splitFactor);
0056 
0057   BOOST_CHECK_EQUAL(
0058       stub.factor(Direction::Backward(), MaterialUpdateStage::PreUpdate),
0059       splitFactor);
0060 
0061   BOOST_CHECK_EQUAL(
0062       stub.factor(Direction::Forward(), MaterialUpdateStage::PreUpdate),
0063       1 - splitFactor);
0064 
0065   BOOST_CHECK_EQUAL(
0066       stub.factor(Direction::Backward(), MaterialUpdateStage::PostUpdate),
0067       1 - splitFactor);
0068 }
0069 
0070 }  // namespace Acts::Test