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/Material/GridSurfaceMaterial.hpp"
0012 #include "Acts/Material/Material.hpp"
0013 #include "Acts/Material/MaterialSlab.hpp"
0014 #include "Acts/Utilities/GridAxisGenerators.hpp"
0015 #include "Acts/Utilities/VectorHelpers.hpp"
0016 
0017 #include <numbers>
0018 #include <vector>
0019 
0020 // this is a global access to the x coordinate
0021 class GlobalAccessX final : public Acts::GridAccess::IGlobalToGridLocal {
0022  public:
0023   std::array<double, 1u> g2X(const Acts::Vector3& global) const {
0024     return {global.x()};
0025   }
0026 };
0027 
0028 class LocalAccessX final : public Acts::GridAccess::IBoundToGridLocal {
0029  public:
0030   std::array<double, 1u> l2X(const Acts::Vector2& local) const {
0031     return {local.x()};
0032   }
0033 };
0034 
0035 class GlobalToZPhi final : public Acts::GridAccess::IGlobalToGridLocal {
0036  public:
0037   double zShift = 0.;
0038 
0039   GlobalToZPhi(double shift) : zShift(shift) {}
0040 
0041   std::array<double, 2u> g2ZPhi(const Acts::Vector3& global) const {
0042     return {global.z() + zShift, Acts::VectorHelpers::phi(global)};
0043   }
0044 };
0045 
0046 // Local on cylinder surface is rPhi, z
0047 class LocalToZPhi final : public Acts::GridAccess::IBoundToGridLocal {
0048  public:
0049   double radius = 1.;
0050 
0051   LocalToZPhi(double r) : radius(r) {}
0052 
0053   std::array<double, 2u> l2ZPhi(const Acts::Vector2& local) const {
0054     return {local[1u], local[0u] / radius};
0055   }
0056 };
0057 
0058 BOOST_AUTO_TEST_SUITE(Material)
0059 
0060 // This test covers some wrongly configured cases
0061 BOOST_AUTO_TEST_CASE(GridIndexedMaterial_invalid_bound2Grid_Unconnected) {
0062   std::vector<Acts::MaterialSlab> material;
0063 
0064   using EqBound = Acts::GridAxisGenerators::EqBound;
0065   using EqGrid = EqBound::grid_type<std::size_t>;
0066 
0067   EqBound eqBound{{0., 5.}, 5};
0068   EqGrid eqGrid{eqBound()};
0069 
0070   Acts::IndexedSurfaceMaterial<EqGrid>::BoundToGridLocalDelegate bToX;
0071 
0072   auto globalX = std::make_unique<const GlobalAccessX>();
0073   Acts::IndexedSurfaceMaterial<EqGrid>::GlobalToGridLocalDelegate gToX;
0074   gToX.connect<&GlobalAccessX::g2X>(std::move(globalX));
0075 
0076   BOOST_CHECK_THROW(
0077       auto ism = Acts::IndexedSurfaceMaterial<EqGrid>(
0078           std::move(eqGrid), Acts::IndexedMaterialAccessor{std::move(material)},
0079           std::move(bToX), std::move(gToX)),
0080       std::invalid_argument);
0081 }
0082 
0083 // This test covers some wrongly configured cases
0084 BOOST_AUTO_TEST_CASE(GridIndexedMaterial_invalid_global2Grid_Unconnected) {
0085   std::vector<Acts::MaterialSlab> material;
0086 
0087   using EqBound = Acts::GridAxisGenerators::EqBound;
0088   using EqGrid = EqBound::grid_type<std::size_t>;
0089 
0090   EqBound eqBound{{0., 5.}, 5};
0091   EqGrid eqGrid{eqBound()};
0092 
0093   auto localX = std::make_unique<const LocalAccessX>();
0094   Acts::IndexedSurfaceMaterial<EqGrid>::BoundToGridLocalDelegate bToX;
0095   bToX.connect<&LocalAccessX::l2X>(std::move(localX));
0096 
0097   Acts::IndexedSurfaceMaterial<EqGrid>::GlobalToGridLocalDelegate gToX;
0098 
0099   BOOST_CHECK_THROW(
0100       auto ism = Acts::IndexedSurfaceMaterial<EqGrid>(
0101           std::move(eqGrid), Acts::IndexedMaterialAccessor{std::move(material)},
0102           std::move(bToX), std::move(gToX)),
0103       std::invalid_argument);
0104 }
0105 
0106 // This test covers the locally indexed grid material in 1D
0107 BOOST_AUTO_TEST_CASE(GridIndexedMaterial1D) {
0108   std::vector<Acts::MaterialSlab> material;
0109   material.emplace_back(Acts::Material(), 0.0);  // vacuum
0110   material.emplace_back(
0111       Acts::Material::fromMolarDensity(1.0, 2.0, 3.0, 4.0, 5.0), 1.0);
0112   material.emplace_back(
0113       Acts::Material::fromMolarDensity(11.0, 12.0, 13.0, 14.0, 15.0), 2.0);
0114   material.emplace_back(
0115       Acts::Material::fromMolarDensity(21.0, 22.0, 23.0, 24.0, 25.0), 3.0);
0116 
0117   using EqBound = Acts::GridAxisGenerators::EqBound;
0118   using EqGrid = EqBound::grid_type<std::size_t>;
0119   using Point = EqGrid::point_t;
0120 
0121   EqBound eqBound{{0., 5.}, 5};
0122   EqGrid eqGrid{eqBound()};
0123 
0124   eqGrid.atPosition(Point{0.5}) = 1u;  // material 1
0125   eqGrid.atPosition(Point{1.5}) = 0u;  // vacuum
0126   eqGrid.atPosition(Point{2.5}) = 2u;  // material 2
0127   eqGrid.atPosition(Point{3.5}) = 2u;  // material 2
0128   eqGrid.atPosition(Point{4.5}) = 3u;  // material 3
0129 
0130   auto localX = std::make_unique<const LocalAccessX>();
0131   Acts::IndexedSurfaceMaterial<EqGrid>::BoundToGridLocalDelegate bToX;
0132   bToX.connect<&LocalAccessX::l2X>(std::move(localX));
0133 
0134   auto globalX = std::make_unique<const GlobalAccessX>();
0135   Acts::IndexedSurfaceMaterial<EqGrid>::GlobalToGridLocalDelegate gToX;
0136   gToX.connect<&GlobalAccessX::g2X>(std::move(globalX));
0137 
0138   Acts::IndexedSurfaceMaterial<EqGrid> ism(
0139       std::move(eqGrid), Acts::IndexedMaterialAccessor{std::move(material)},
0140       std::move(bToX), std::move(gToX));
0141 
0142   // Global access test
0143   Acts::Vector3 g0(0.5, 0., 0.);
0144   Acts::Vector3 g1(1.5, 0., 0.);
0145   Acts::Vector3 g2(2.5, 0., 0.);
0146   Acts::Vector3 g3(3.5, 0., 0.);
0147   Acts::Vector3 g4(4.5, 0., 0.);
0148 
0149   const Acts::MaterialSlab& mg0 = ism.materialSlab(g0);
0150   const Acts::MaterialSlab& mg1 = ism.materialSlab(g1);
0151   const Acts::MaterialSlab& mg2 = ism.materialSlab(g2);
0152   const Acts::MaterialSlab& mg3 = ism.materialSlab(g3);
0153   const Acts::MaterialSlab& mg4 = ism.materialSlab(g4);
0154 
0155   BOOST_CHECK_EQUAL(mg0.material().X0(), 1.);
0156   BOOST_CHECK(!mg1.material().isValid());
0157   BOOST_CHECK_EQUAL(mg2.material().X0(), 11.);
0158   BOOST_CHECK_EQUAL(mg3.material().X0(), 11.);
0159   BOOST_CHECK_EQUAL(mg4.material().X0(), 21.);
0160 
0161   // Local access test
0162   Acts::Vector2 l0(0.5, 0.);
0163   Acts::Vector2 l1(1.5, 0.);
0164   Acts::Vector2 l2(2.5, 0.);
0165   Acts::Vector2 l3(3.5, 0.);
0166   Acts::Vector2 l4(4.5, 0.);
0167 
0168   const Acts::MaterialSlab& ml0 = ism.materialSlab(l0);
0169   const Acts::MaterialSlab& ml1 = ism.materialSlab(l1);
0170   const Acts::MaterialSlab& ml2 = ism.materialSlab(l2);
0171   const Acts::MaterialSlab& ml3 = ism.materialSlab(l3);
0172   const Acts::MaterialSlab& ml4 = ism.materialSlab(l4);
0173 
0174   BOOST_CHECK_EQUAL(ml0.material().X0(), 1.);
0175   BOOST_CHECK(!ml1.material().isValid());
0176   BOOST_CHECK_EQUAL(ml2.material().X0(), 11.);
0177   BOOST_CHECK_EQUAL(ml3.material().X0(), 11.);
0178   BOOST_CHECK_EQUAL(ml4.material().X0(), 21.);
0179 
0180   // Now scale it - and access again
0181   ism.scale(2.);
0182   const Acts::MaterialSlab& sml0 = ism.materialSlab(l0);
0183   const Acts::MaterialSlab& sml1 = ism.materialSlab(l1);
0184   const Acts::MaterialSlab& sml2 = ism.materialSlab(l2);
0185   const Acts::MaterialSlab& sml3 = ism.materialSlab(l3);
0186   const Acts::MaterialSlab& sml4 = ism.materialSlab(l4);
0187 
0188   BOOST_CHECK_EQUAL(sml0.thickness(), 2.);
0189   BOOST_CHECK(!sml1.material().isValid());
0190   BOOST_CHECK_EQUAL(sml2.thickness(), 4.);
0191   BOOST_CHECK_EQUAL(sml3.thickness(), 4.);
0192   BOOST_CHECK_EQUAL(sml4.thickness(), 6.);
0193 }
0194 
0195 // This test covers the locally indexed grid material in 2D
0196 BOOST_AUTO_TEST_CASE(GridIndexedMaterial2D) {
0197   std::vector<Acts::MaterialSlab> material;
0198   material.emplace_back(Acts::Material(), 1.0);  // vacuum
0199   material.emplace_back(
0200       Acts::Material::fromMolarDensity(1.0, 2.0, 3.0, 4.0, 5.0), 1.0);
0201   material.emplace_back(
0202       Acts::Material::fromMolarDensity(11.0, 12.0, 13.0, 14.0, 15.0), 1.0);
0203   material.emplace_back(
0204       Acts::Material::fromMolarDensity(21.0, 22.0, 23.0, 24.0, 25.0), 1.0);
0205 
0206   using EqBoundEqClosed = Acts::GridAxisGenerators::EqBoundEqClosed;
0207   using EqEqGrid = EqBoundEqClosed::grid_type<std::size_t>;
0208   using Point = EqEqGrid::point_t;
0209 
0210   EqBoundEqClosed eqeqBound{
0211       {-1., 1.}, 2, {-std::numbers::pi, std::numbers::pi}, 4};
0212   EqEqGrid eqeqGrid{eqeqBound()};
0213 
0214   eqeqGrid.atPosition(Point{-0.5, -std::numbers::pi * 0.75}) =
0215       1u;                                                          // material 1
0216   eqeqGrid.atPosition(Point{-0.5, -std::numbers::pi / 4.}) = 1u;   // material 1
0217   eqeqGrid.atPosition(Point{-0.5, std::numbers::pi / 4.}) = 0u;    // vacuum
0218   eqeqGrid.atPosition(Point{-0.5, std::numbers::pi * 0.75}) = 2u;  // material 2
0219 
0220   eqeqGrid.atPosition(Point{0.5, -std::numbers::pi * 0.75}) = 0u;  // vacuum
0221   eqeqGrid.atPosition(Point{0.5, -std::numbers::pi / 4.}) = 3u;    // material 3
0222   eqeqGrid.atPosition(Point{0.5, std::numbers::pi / 4.}) = 3u;     // material 3
0223   eqeqGrid.atPosition(Point{0.5, std::numbers::pi * 0.75}) = 0u;   // vacuum
0224 
0225   // With radius 20
0226   auto boundToGrid = std::make_unique<const LocalToZPhi>(20.);
0227   Acts::IndexedSurfaceMaterial<EqEqGrid>::BoundToGridLocalDelegate bToZPhi;
0228   bToZPhi.connect<&LocalToZPhi::l2ZPhi>(std::move(boundToGrid));
0229 
0230   // With z shift 10
0231   auto globalToGrid = std::make_unique<const GlobalToZPhi>(10.);
0232   Acts::IndexedSurfaceMaterial<EqEqGrid>::GlobalToGridLocalDelegate gToZphi;
0233   gToZphi.connect<&GlobalToZPhi::g2ZPhi>(std::move(globalToGrid));
0234 
0235   // Create the indexed material grid
0236   Acts::IndexedSurfaceMaterial<EqEqGrid> ism(
0237       std::move(eqeqGrid), Acts::IndexedMaterialAccessor{std::move(material)},
0238       std::move(bToZPhi), std::move(gToZphi));
0239 
0240   // Global access test, both should give material 1
0241   Acts::Vector3 g0(-0.5, -0.5, -10.5);
0242   const Acts::MaterialSlab& mg0 = ism.materialSlab(g0);
0243   BOOST_CHECK_EQUAL(mg0.material().X0(), 1.);
0244 
0245   Acts::Vector3 g1(0.5, -0.5, -11.5);  // checking out of bound access
0246   const Acts::MaterialSlab& mg1 = ism.materialSlab(g1);
0247   BOOST_CHECK_EQUAL(mg1.material().X0(), 1.);
0248 
0249   Acts::Vector3 g2(0.5, 0.5, -10.5);
0250   const Acts::MaterialSlab& mg2 = ism.materialSlab(g2);
0251   BOOST_CHECK(!mg2.material().isValid());  // vacuum
0252 
0253   Acts::Vector3 g3(0.5, 0.5,
0254                    -9.5);  // should be material 3, same phi but different z
0255   const Acts::MaterialSlab& mg3 = ism.materialSlab(g3);
0256   BOOST_CHECK_EQUAL(mg3.material().X0(), 21.);
0257 }
0258 
0259 // This test covers the globally indexed grid material with non-shared material
0260 BOOST_AUTO_TEST_CASE(GridGloballyIndexedMaterialNonShared) {
0261   auto material = std::make_shared<std::vector<Acts::MaterialSlab>>();
0262 
0263   material->emplace_back(Acts::Material(), 0.0);  // vacuum
0264   material->emplace_back(
0265       Acts::Material::fromMolarDensity(1.0, 2.0, 3.0, 4.0, 5.0), 1.0);
0266   material->emplace_back(
0267       Acts::Material::fromMolarDensity(11.0, 12.0, 13.0, 14.0, 15.0), 2.0);
0268   material->emplace_back(
0269       Acts::Material::fromMolarDensity(21.0, 22.0, 23.0, 24.0, 25.0), 3.0);
0270   material->emplace_back(
0271       Acts::Material::fromMolarDensity(31.0, 22.0, 23.0, 24.0, 25.0), 4.0);
0272 
0273   using EqBound = Acts::GridAxisGenerators::EqBound;
0274   using EqGrid = EqBound::grid_type<std::size_t>;
0275   using Point = EqGrid::point_t;
0276 
0277   EqBound eqBound{{0., 5.}, 5};
0278   EqGrid eqGrid{eqBound()};
0279 
0280   eqGrid.atPosition(Point{0.5}) = 1u;  // material 1
0281   eqGrid.atPosition(Point{1.5}) = 0u;  // vacuum
0282   eqGrid.atPosition(Point{2.5}) = 2u;  // material 2
0283   eqGrid.atPosition(Point{3.5}) = 2u;  // material 2
0284   eqGrid.atPosition(Point{4.5}) = 3u;  // material 3
0285 
0286   auto localX = std::make_unique<const LocalAccessX>();
0287   Acts::IndexedSurfaceMaterial<EqGrid>::BoundToGridLocalDelegate bToX;
0288   bToX.connect<&LocalAccessX::l2X>(std::move(localX));
0289 
0290   auto globalX = std::make_unique<const GlobalAccessX>();
0291   Acts::IndexedSurfaceMaterial<EqGrid>::GlobalToGridLocalDelegate gToX;
0292   gToX.connect<&GlobalAccessX::g2X>(std::move(globalX));
0293 
0294   Acts::GloballyIndexedSurfaceMaterial<EqGrid> ism(
0295       std::move(eqGrid), Acts::GloballyIndexedMaterialAccessor{material, false},
0296       std::move(bToX), std::move(gToX));
0297 
0298   // Local access test
0299   Acts::Vector2 l0(0.5, 0.);
0300   Acts::Vector2 l1(1.5, 0.);
0301   Acts::Vector2 l2(2.5, 0.);
0302   Acts::Vector2 l3(3.5, 0.);
0303   Acts::Vector2 l4(4.5, 0.);
0304 
0305   const Acts::MaterialSlab& ml0 = ism.materialSlab(l0);
0306   const Acts::MaterialSlab& ml1 = ism.materialSlab(l1);
0307   const Acts::MaterialSlab& ml2 = ism.materialSlab(l2);
0308   const Acts::MaterialSlab& ml3 = ism.materialSlab(l3);
0309   const Acts::MaterialSlab& ml4 = ism.materialSlab(l4);
0310 
0311   BOOST_CHECK_EQUAL(ml0.material().X0(), 1.);
0312   BOOST_CHECK(!ml1.material().isValid());
0313   BOOST_CHECK_EQUAL(ml2.material().X0(), 11.);
0314   BOOST_CHECK_EQUAL(ml3.material().X0(), 11.);
0315   BOOST_CHECK_EQUAL(ml4.material().X0(), 21.);
0316 
0317   EqBound eqBound1{{0., 5.}, 1};
0318   EqGrid eqGrid1{eqBound1()};
0319 
0320   auto localX1 = std::make_unique<const LocalAccessX>();
0321   Acts::IndexedSurfaceMaterial<EqGrid>::BoundToGridLocalDelegate bToX1;
0322   bToX1.connect<&LocalAccessX::l2X>(std::move(localX1));
0323 
0324   auto globalX1 = std::make_unique<const GlobalAccessX>();
0325   Acts::IndexedSurfaceMaterial<EqGrid>::GlobalToGridLocalDelegate gToX1;
0326   gToX1.connect<&GlobalAccessX::g2X>(std::move(globalX1));
0327 
0328   eqGrid1.atPosition(Point{2.5}) = 4u;  // material 4
0329 
0330   Acts::GloballyIndexedSurfaceMaterial<EqGrid> ism1(
0331       std::move(eqGrid1),
0332       Acts::GloballyIndexedMaterialAccessor{material, false}, std::move(bToX1),
0333       std::move(gToX1));
0334 
0335   Acts::Vector2 l0g1(2.5, 0.);
0336   const Acts::MaterialSlab& ml0g1 = ism1.materialSlab(l0g1);
0337   BOOST_CHECK_EQUAL(ml0g1.material().X0(), 31.);
0338 
0339   // Scale
0340   ism1.scale(2.);
0341   const Acts::MaterialSlab& sml0g1 = ism1.materialSlab(l0g1);
0342   BOOST_CHECK_EQUAL(sml0g1.thickness(), 8.);
0343 
0344   // First one stays unscaled
0345   const Acts::MaterialSlab& sml0 = ism.materialSlab(l0);
0346   BOOST_CHECK_EQUAL(sml0.thickness(), 1.);
0347 }
0348 
0349 // This test covers the globally indexed grid material with shared
0350 BOOST_AUTO_TEST_CASE(GridGloballyIndexedMaterialShared) {
0351   auto material = std::make_shared<std::vector<Acts::MaterialSlab>>();
0352 
0353   material->emplace_back(Acts::Material(), 0.0);  // vacuum
0354   material->emplace_back(
0355       Acts::Material::fromMolarDensity(1.0, 2.0, 3.0, 4.0, 5.0), 1.0);
0356 
0357   using EqBound = Acts::GridAxisGenerators::EqBound;
0358   using EqGrid = EqBound::grid_type<std::size_t>;
0359   using Point = EqGrid::point_t;
0360 
0361   EqBound eqBound0{{0., 5.}, 1};
0362   EqGrid eqGrid0{eqBound0()};
0363 
0364   eqGrid0.atPosition(Point{2.5}) = 1u;  // material 1
0365   auto localX0 = std::make_unique<const LocalAccessX>();
0366   Acts::IndexedSurfaceMaterial<EqGrid>::BoundToGridLocalDelegate bToX0;
0367   bToX0.connect<&LocalAccessX::l2X>(std::move(localX0));
0368 
0369   auto globalX0 = std::make_unique<const GlobalAccessX>();
0370   Acts::IndexedSurfaceMaterial<EqGrid>::GlobalToGridLocalDelegate gToX0;
0371   gToX0.connect<&GlobalAccessX::g2X>(std::move(globalX0));
0372 
0373   Acts::GloballyIndexedSurfaceMaterial<EqGrid> ism0(
0374       std::move(eqGrid0), Acts::GloballyIndexedMaterialAccessor{material, true},
0375       std::move(bToX0), std::move(gToX0));
0376 
0377   EqBound eqBound1{{0., 5.}, 1};
0378   EqGrid eqGrid1{eqBound1()};
0379 
0380   eqGrid1.atPosition(Point{2.5}) = 1u;  // material 1
0381   auto localX1 = std::make_unique<const LocalAccessX>();
0382   Acts::IndexedSurfaceMaterial<EqGrid>::BoundToGridLocalDelegate bToX1;
0383   bToX1.connect<&LocalAccessX::l2X>(std::move(localX1));
0384 
0385   auto globalX1 = std::make_unique<const GlobalAccessX>();
0386   Acts::IndexedSurfaceMaterial<EqGrid>::GlobalToGridLocalDelegate gToX1;
0387   gToX1.connect<&GlobalAccessX::g2X>(std::move(globalX1));
0388 
0389   Acts::GloballyIndexedSurfaceMaterial<EqGrid> ism1(
0390       std::move(eqGrid1), Acts::GloballyIndexedMaterialAccessor{material, true},
0391       std::move(bToX1), std::move(gToX1));
0392 
0393   Acts::Vector2 l0(2.5, 0.);
0394 
0395   // check grid material 0
0396   const Acts::MaterialSlab& ml0 = ism0.materialSlab(l0);
0397   BOOST_CHECK_EQUAL(ml0.material().X0(), 1.);
0398 
0399   const Acts::MaterialSlab& ml0g1 = ism1.materialSlab(l0);
0400   BOOST_CHECK_EQUAL(ml0g1.material().X0(), 1.);
0401 
0402   // scaling shared material should throw a std::invalid_argument
0403   BOOST_CHECK_THROW(ism1.scale(2.), std::invalid_argument);
0404 }
0405 
0406 // This test covers the grid material (non-indexed accessor)
0407 //
0408 // In this setup, the material is not indexed, but filled directly
0409 // into the grid structure.
0410 BOOST_AUTO_TEST_CASE(GridSurfaceMaterialTests) {
0411   using EqBound = Acts::GridAxisGenerators::EqBound;
0412   using EqGrid = EqBound::grid_type<Acts::MaterialSlab>;
0413   using Point = EqGrid::point_t;
0414 
0415   EqBound eqBound{{0., 5.}, 5};
0416   EqGrid eqGrid{eqBound()};
0417 
0418   eqGrid.atPosition(Point{0.5}) = Acts::MaterialSlab(Acts::Material(), 0.0);
0419   eqGrid.atPosition(Point{1.5}) = Acts::MaterialSlab(Acts::Material(), 1.0);
0420   eqGrid.atPosition(Point{2.5}) = Acts::MaterialSlab(Acts::Material(), 2.0);
0421   eqGrid.atPosition(Point{3.5}) = Acts::MaterialSlab(Acts::Material(), 3.0);
0422   eqGrid.atPosition(Point{4.5}) = Acts::MaterialSlab(Acts::Material(), 4.0);
0423 
0424   auto localX = std::make_unique<const LocalAccessX>();
0425   Acts::IndexedSurfaceMaterial<EqGrid>::BoundToGridLocalDelegate bToX;
0426   bToX.connect<&LocalAccessX::l2X>(std::move(localX));
0427 
0428   auto globalX = std::make_unique<const GlobalAccessX>();
0429   Acts::IndexedSurfaceMaterial<EqGrid>::GlobalToGridLocalDelegate gToX;
0430   gToX.connect<&GlobalAccessX::g2X>(std::move(globalX));
0431 
0432   Acts::GridSurfaceMaterial<EqGrid> gsm(std::move(eqGrid),
0433                                         Acts::GridMaterialAccessor{},
0434                                         std::move(bToX), std::move(gToX));
0435 
0436   // Global access test
0437   Acts::Vector3 g0(0.5, 0., 0.);
0438   Acts::Vector3 g1(1.5, 0., 0.);
0439   Acts::Vector3 g2(2.5, 0., 0.);
0440   Acts::Vector3 g3(3.5, 0., 0.);
0441   Acts::Vector3 g4(4.5, 0., 0.);
0442 
0443   const Acts::MaterialSlab& mg0 = gsm.materialSlab(g0);
0444   const Acts::MaterialSlab& mg1 = gsm.materialSlab(g1);
0445   const Acts::MaterialSlab& mg2 = gsm.materialSlab(g2);
0446   const Acts::MaterialSlab& mg3 = gsm.materialSlab(g3);
0447   const Acts::MaterialSlab& mg4 = gsm.materialSlab(g4);
0448 
0449   BOOST_CHECK_EQUAL(mg0.thickness(), 0.);
0450   BOOST_CHECK_EQUAL(mg1.thickness(), 1.);
0451   BOOST_CHECK_EQUAL(mg2.thickness(), 2.);
0452   BOOST_CHECK_EQUAL(mg3.thickness(), 3.);
0453   BOOST_CHECK_EQUAL(mg4.thickness(), 4.);
0454 
0455   // Local access test
0456   Acts::Vector2 l0(0.5, 0.);
0457   Acts::Vector2 l1(1.5, 0.);
0458   Acts::Vector2 l2(2.5, 0.);
0459   Acts::Vector2 l3(3.5, 0.);
0460   Acts::Vector2 l4(4.5, 0.);
0461 
0462   const Acts::MaterialSlab& ml0 = gsm.materialSlab(l0);
0463   const Acts::MaterialSlab& ml1 = gsm.materialSlab(l1);
0464   const Acts::MaterialSlab& ml2 = gsm.materialSlab(l2);
0465   const Acts::MaterialSlab& ml3 = gsm.materialSlab(l3);
0466   const Acts::MaterialSlab& ml4 = gsm.materialSlab(l4);
0467 
0468   BOOST_CHECK_EQUAL(ml0.thickness(), 0.);
0469   BOOST_CHECK_EQUAL(ml1.thickness(), 1.);
0470   BOOST_CHECK_EQUAL(ml2.thickness(), 2.);
0471   BOOST_CHECK_EQUAL(ml3.thickness(), 3.);
0472   BOOST_CHECK_EQUAL(ml4.thickness(), 4.);
0473 
0474   // Now scale it - and access again
0475   gsm.scale(2.);
0476 
0477   const Acts::MaterialSlab& sml0 = gsm.materialSlab(l0);
0478   const Acts::MaterialSlab& sml1 = gsm.materialSlab(l1);
0479   const Acts::MaterialSlab& sml2 = gsm.materialSlab(l2);
0480   const Acts::MaterialSlab& sml3 = gsm.materialSlab(l3);
0481   const Acts::MaterialSlab& sml4 = gsm.materialSlab(l4);
0482 
0483   BOOST_CHECK_EQUAL(sml0.thickness(), 0.);
0484   BOOST_CHECK_EQUAL(sml1.thickness(), 2.);
0485   BOOST_CHECK_EQUAL(sml2.thickness(), 4.);
0486   BOOST_CHECK_EQUAL(sml3.thickness(), 6.);
0487   BOOST_CHECK_EQUAL(sml4.thickness(), 8.);
0488 }
0489 
0490 BOOST_AUTO_TEST_SUITE_END()