Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-10 08:21:26

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  public:
0025   using ISurfaceMaterial::ISurfaceMaterial;
0026 
0027   ISurfaceMaterial& scale(double /*factor*/) override { return *this; };
0028 
0029   const MaterialSlab& materialSlab(const Vector2& /*lp*/) const override {
0030     return m_fullMaterial;
0031   }
0032 
0033   const MaterialSlab& materialSlab(const Vector3& /*gp*/) const override {
0034     return m_fullMaterial;
0035   }
0036 
0037   using ISurfaceMaterial::materialSlab;
0038 
0039   std::ostream& toStream(std::ostream& sl) const override {
0040     sl << "SurfaceMaterialStub";
0041     return sl;
0042   };
0043 
0044   std::vector<AxisDirection> localAxisDirections() const override { return {}; }
0045 
0046   MaterialSlab m_fullMaterial = MaterialSlab::Nothing();
0047 };
0048 
0049 BOOST_AUTO_TEST_SUITE(MaterialSuite)
0050 
0051 /// Test the constructors
0052 BOOST_AUTO_TEST_CASE(ISurfaceMaterial_factor_test) {
0053   double splitFactor = 42.0;
0054   SurfaceMaterialStub stub{splitFactor};
0055 
0056   BOOST_CHECK_EQUAL(
0057       stub.factor(Direction::Backward(), MaterialUpdateMode::NoUpdate), 0);
0058 
0059   BOOST_CHECK_EQUAL(
0060       stub.factor(Direction::Forward(), MaterialUpdateMode::NoUpdate), 0);
0061 
0062   BOOST_CHECK_EQUAL(
0063       stub.factor(Direction::Backward(), MaterialUpdateMode::PreUpdate),
0064       splitFactor);
0065 
0066   BOOST_CHECK_EQUAL(
0067       stub.factor(Direction::Forward(), MaterialUpdateMode::PreUpdate),
0068       1 - splitFactor);
0069 
0070   BOOST_CHECK_EQUAL(
0071       stub.factor(Direction::Forward(), MaterialUpdateMode::PostUpdate),
0072       splitFactor);
0073 
0074   BOOST_CHECK_EQUAL(
0075       stub.factor(Direction::Backward(), MaterialUpdateMode::PostUpdate),
0076       1 - splitFactor);
0077 
0078   BOOST_CHECK_EQUAL(
0079       stub.factor(Direction::Forward(), MaterialUpdateMode::FullUpdate), 1.0);
0080 
0081   BOOST_CHECK_EQUAL(
0082       stub.factor(Direction::Backward(), MaterialUpdateMode::FullUpdate), 1.0);
0083 }
0084 
0085 BOOST_AUTO_TEST_SUITE_END()
0086 
0087 }  // namespace ActsTests