Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-23 08:24: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/tools/old/interface.hpp>
0010 #include <boost/test/unit_test.hpp>
0011 
0012 #include "Acts/Definitions/Algebra.hpp"
0013 #include "Acts/Geometry/CylinderLayer.hpp"
0014 #include "Acts/Geometry/DiscLayer.hpp"
0015 #include "Acts/Geometry/Extent.hpp"
0016 #include "Acts/Geometry/GeometryContext.hpp"
0017 #include "Acts/Geometry/LayerCreator.hpp"
0018 #include "Acts/Geometry/ProtoLayer.hpp"
0019 #include "Acts/Geometry/SurfaceArrayCreator.hpp"
0020 #include "Acts/Surfaces/CylinderBounds.hpp"
0021 #include "Acts/Surfaces/PlanarBounds.hpp"
0022 #include "Acts/Surfaces/PlaneSurface.hpp"
0023 #include "Acts/Surfaces/RadialBounds.hpp"
0024 #include "Acts/Surfaces/RectangleBounds.hpp"
0025 #include "Acts/Surfaces/Surface.hpp"
0026 #include "Acts/Surfaces/SurfaceArray.hpp"
0027 #include "Acts/Utilities/BinningType.hpp"
0028 #include "Acts/Utilities/IAxis.hpp"
0029 #include "Acts/Utilities/Logger.hpp"
0030 #include "ActsTests/CommonHelpers/FloatComparisons.hpp"
0031 
0032 #include <cstddef>
0033 #include <fstream>
0034 #include <iomanip>
0035 #include <iostream>
0036 #include <memory>
0037 #include <numbers>
0038 #include <set>
0039 #include <string>
0040 #include <utility>
0041 #include <vector>
0042 
0043 #include <boost/format.hpp>
0044 
0045 using namespace Acts;
0046 
0047 namespace ActsTests {
0048 
0049 // Create a test context
0050 GeometryContext tgContext = GeometryContext();
0051 
0052 using SrfVec = std::vector<std::shared_ptr<const Surface>>;
0053 
0054 void draw_surfaces(const SrfVec& surfaces, const std::string& fname) {
0055   std::ofstream os;
0056   os.open(fname);
0057 
0058   os << std::fixed << std::setprecision(4);
0059 
0060   std::size_t nVtx = 0;
0061   for (const auto& srfx : surfaces) {
0062     std::shared_ptr<const PlaneSurface> srf =
0063         std::dynamic_pointer_cast<const PlaneSurface>(srfx);
0064     const PlanarBounds* bounds =
0065         dynamic_cast<const PlanarBounds*>(&srf->bounds());
0066 
0067     for (const auto& vtxloc : bounds->vertices()) {
0068       Vector3 vtx =
0069           srf->transform(tgContext) * Vector3(vtxloc.x(), vtxloc.y(), 0);
0070       os << "v " << vtx.x() << " " << vtx.y() << " " << vtx.z() << "\n";
0071     }
0072 
0073     // connect them
0074     os << "f";
0075     for (std::size_t i = 1; i <= bounds->vertices().size(); ++i) {
0076       os << " " << nVtx + i;
0077     }
0078     os << "\n";
0079 
0080     nVtx += bounds->vertices().size();
0081   }
0082 
0083   os.close();
0084 }
0085 
0086 struct LayerCreatorFixture {
0087   std::shared_ptr<const SurfaceArrayCreator> p_SAC;
0088   std::shared_ptr<LayerCreator> p_LC;
0089 
0090   std::vector<std::shared_ptr<const Surface>> m_surfaces;
0091 
0092   LayerCreatorFixture() {
0093     p_SAC = std::make_shared<const SurfaceArrayCreator>(
0094         SurfaceArrayCreator::Config(),
0095         getDefaultLogger("SurfaceArrayCreator", Logging::VERBOSE));
0096     LayerCreator::Config cfg;
0097     cfg.surfaceArrayCreator = p_SAC;
0098     p_LC = std::make_shared<LayerCreator>(
0099         cfg, getDefaultLogger("LayerCreator", Logging::VERBOSE));
0100   }
0101 
0102   template <typename... Args>
0103   bool checkBinning(Args&&... args) {
0104     return p_LC->checkBinning(std::forward<Args>(args)...);
0105   }
0106 
0107   bool checkBinContentSize(const SurfaceArray* sArray, std::size_t n) {
0108     std::size_t nBins = sArray->size();
0109     bool result = true;
0110     for (std::size_t i = 0; i < nBins; ++i) {
0111       if (!sArray->isValidBin(i)) {
0112         continue;
0113       }
0114       std::vector<const Surface*> binContent = sArray->at(i);
0115       BOOST_TEST_INFO("Bin: " << i);
0116       BOOST_CHECK_EQUAL(binContent.size(), n);
0117       result = result && binContent.size() == n;
0118     }
0119 
0120     return result;
0121   }
0122 
0123   SrfVec fullPhiTestSurfacesEC(std::size_t n = 10, double shift = 0,
0124                                double zbase = 0, double r = 10) {
0125     SrfVec res;
0126 
0127     double phiStep = 2 * std::numbers::pi / n;
0128     for (std::size_t i = 0; i < n; ++i) {
0129       double z = zbase + ((i % 2 == 0) ? 1 : -1) * 0.2;
0130 
0131       Transform3 trans;
0132       trans.setIdentity();
0133       trans.rotate(Eigen::AngleAxisd(i * phiStep + shift, Vector3(0, 0, 1)));
0134       trans.translate(Vector3(r, 0, z));
0135 
0136       auto bounds = std::make_shared<const RectangleBounds>(2, 1);
0137       std::shared_ptr<PlaneSurface> srf =
0138           Surface::makeShared<PlaneSurface>(trans, bounds);
0139 
0140       res.push_back(srf);
0141       m_surfaces.push_back(
0142           std::move(srf));  // keep shared, will get destroyed at the end
0143     }
0144 
0145     return res;
0146   }
0147 
0148   SrfVec fullPhiTestSurfacesBRL(int n = 10, double shift = 0, double zbase = 0,
0149                                 double incl = std::numbers::pi / 9.,
0150                                 double w = 2, double h = 1.5) {
0151     SrfVec res;
0152 
0153     double phiStep = 2 * std::numbers::pi / n;
0154     for (int i = 0; i < n; ++i) {
0155       double z = zbase;
0156 
0157       Transform3 trans;
0158       trans.setIdentity();
0159       trans.rotate(Eigen::AngleAxisd(i * phiStep + shift, Vector3(0, 0, 1)));
0160       trans.translate(Vector3(10, 0, z));
0161       trans.rotate(Eigen::AngleAxisd(incl, Vector3(0, 0, 1)));
0162       trans.rotate(Eigen::AngleAxisd(std::numbers::pi / 2., Vector3(0, 1, 0)));
0163 
0164       auto bounds = std::make_shared<const RectangleBounds>(w, h);
0165       std::shared_ptr<PlaneSurface> srf =
0166           Surface::makeShared<PlaneSurface>(trans, bounds);
0167 
0168       res.push_back(srf);
0169       m_surfaces.push_back(
0170           std::move(srf));  // keep shared, will get destroyed at the end
0171     }
0172 
0173     return res;
0174   }
0175 
0176   SrfVec makeBarrel(int nPhi, int nZ, double w, double h) {
0177     double z0 = -(nZ - 1) * w;
0178     SrfVec res;
0179 
0180     for (int i = 0; i < nZ; i++) {
0181       double z = i * w * 2 + z0;
0182       std::cout << "z=" << z << std::endl;
0183       SrfVec ring =
0184           fullPhiTestSurfacesBRL(nPhi, 0, z, std::numbers::pi / 9., w, h);
0185       res.insert(res.end(), ring.begin(), ring.end());
0186     }
0187 
0188     return res;
0189   }
0190 
0191   std::pair<SrfVec, std::vector<std::pair<const Surface*, const Surface*>>>
0192   makeBarrelStagger(int nPhi, int nZ, double shift = 0,
0193                     double incl = std::numbers::pi / 9., double w = 2,
0194                     double h = 1.5) {
0195     double z0 = -(nZ - 1) * w;
0196     SrfVec res;
0197 
0198     std::vector<std::pair<const Surface*, const Surface*>> pairs;
0199 
0200     for (int i = 0; i < nZ; i++) {
0201       double z = i * w * 2 + z0;
0202 
0203       double phiStep = 2 * std::numbers::pi / nPhi;
0204       for (int j = 0; j < nPhi; ++j) {
0205         Transform3 trans;
0206         trans.setIdentity();
0207         trans.rotate(Eigen::AngleAxisd(j * phiStep + shift, Vector3(0, 0, 1)));
0208         trans.translate(Vector3(10, 0, z));
0209         trans.rotate(Eigen::AngleAxisd(incl, Vector3(0, 0, 1)));
0210         trans.rotate(
0211             Eigen::AngleAxisd(std::numbers::pi / 2., Vector3(0, 1, 0)));
0212 
0213         auto bounds = std::make_shared<const RectangleBounds>(w, h);
0214         std::shared_ptr<PlaneSurface> srfA =
0215             Surface::makeShared<PlaneSurface>(trans, bounds);
0216 
0217         Vector3 nrm = srfA->normal(tgContext);
0218         Transform3 transB = trans;
0219         transB.pretranslate(nrm * 0.1);
0220         std::shared_ptr<PlaneSurface> srfB =
0221             Surface::makeShared<PlaneSurface>(transB, bounds);
0222 
0223         pairs.push_back(std::make_pair(srfA.get(), srfB.get()));
0224 
0225         res.push_back(srfA);
0226         res.push_back(srfB);
0227         m_surfaces.push_back(std::move(srfA));
0228         m_surfaces.push_back(std::move(srfB));
0229       }
0230     }
0231 
0232     return {res, pairs};
0233   }
0234 };
0235 
0236 BOOST_AUTO_TEST_SUITE(GeometrySuite)
0237 
0238 BOOST_FIXTURE_TEST_CASE(LayerCreator_createCylinderLayer, LayerCreatorFixture) {
0239   std::vector<std::shared_ptr<const Surface>> srf;
0240 
0241   srf = makeBarrel(30, 7, 2, 1.5);
0242   draw_surfaces(srf, "LayerCreator_createCylinderLayer_BRL_1.obj");
0243 
0244   // CASE I
0245   double envR = 0.1, envZ = 0.5;
0246   ProtoLayer pl(tgContext, srf);
0247   pl.envelope[AxisDirection::AxisR] = {envR, envR};
0248   pl.envelope[AxisDirection::AxisZ] = {envZ, envZ};
0249   std::shared_ptr<CylinderLayer> layer =
0250       std::dynamic_pointer_cast<CylinderLayer>(
0251           p_LC->cylinderLayer(tgContext, srf, equidistant, equidistant, pl));
0252 
0253   //
0254   double rMax = 10.6071, rMin = 9.59111;  // empirical - w/o envelopes
0255   CHECK_CLOSE_REL(layer->thickness(), (rMax - rMin) + 2. * envR, 1e-3);
0256 
0257   const CylinderBounds* bounds = &layer->bounds();
0258   CHECK_CLOSE_REL(bounds->get(CylinderBounds::eR), (rMax + rMin) / 2., 1e-3);
0259   CHECK_CLOSE_REL(bounds->get(CylinderBounds::eHalfLengthZ), 14 + envZ, 1e-3);
0260   BOOST_CHECK(checkBinning(tgContext, *layer->surfaceArray()));
0261   auto axes = layer->surfaceArray()->getAxes();
0262   BOOST_CHECK_EQUAL(axes.at(0)->getNBins(), 30u);
0263   BOOST_CHECK_EQUAL(axes.at(1)->getNBins(), 7u);
0264   CHECK_CLOSE_REL(axes.at(0)->getMin(), -std::numbers::pi, 1e-3);
0265   CHECK_CLOSE_REL(axes.at(0)->getMax(), std::numbers::pi, 1e-3);
0266   CHECK_CLOSE_REL(axes.at(1)->getMin(), -14, 1e-3);
0267   CHECK_CLOSE_REL(axes.at(1)->getMax(), 14, 1e-3);
0268 
0269   // CASE II
0270 
0271   ProtoLayer pl2(tgContext, srf);
0272   pl2.envelope[AxisDirection::AxisR] = {envR, envR};
0273   pl2.envelope[AxisDirection::AxisZ] = {envZ, envZ};
0274   layer = std::dynamic_pointer_cast<CylinderLayer>(
0275       p_LC->cylinderLayer(tgContext, srf, 30, 7, pl2));
0276   CHECK_CLOSE_REL(layer->thickness(), (rMax - rMin) + 2 * envR, 1e-3);
0277   bounds = &layer->bounds();
0278   CHECK_CLOSE_REL(bounds->get(CylinderBounds::eR), (rMax + rMin) / 2., 1e-3);
0279   CHECK_CLOSE_REL(bounds->get(CylinderBounds::eHalfLengthZ), 14 + envZ, 1e-3);
0280   BOOST_CHECK(checkBinning(tgContext, *layer->surfaceArray()));
0281   axes = layer->surfaceArray()->getAxes();
0282   BOOST_CHECK_EQUAL(axes.at(0)->getNBins(), 30u);
0283   BOOST_CHECK_EQUAL(axes.at(1)->getNBins(), 7u);
0284   CHECK_CLOSE_REL(axes.at(0)->getMin(), -std::numbers::pi, 1e-3);
0285   CHECK_CLOSE_REL(axes.at(0)->getMax(), std::numbers::pi, 1e-3);
0286   CHECK_CLOSE_REL(axes.at(1)->getMin(), -14, 1e-3);
0287   CHECK_CLOSE_REL(axes.at(1)->getMax(), 14, 1e-3);
0288 
0289   layer = std::dynamic_pointer_cast<CylinderLayer>(
0290       p_LC->cylinderLayer(tgContext, srf, 13, 3, pl2));
0291   CHECK_CLOSE_REL(layer->thickness(), (rMax - rMin) + 2 * envR, 1e-3);
0292   bounds = &layer->bounds();
0293   CHECK_CLOSE_REL(bounds->get(CylinderBounds::eR), (rMax + rMin) / 2., 1e-3);
0294   CHECK_CLOSE_REL(bounds->get(CylinderBounds::eHalfLengthZ), 14 + envZ, 1e-3);
0295   // this succeeds despite sub-optimal binning
0296   // since we now have multientry bins
0297   BOOST_CHECK(checkBinning(tgContext, *layer->surfaceArray()));
0298   axes = layer->surfaceArray()->getAxes();
0299   BOOST_CHECK_EQUAL(axes.at(0)->getNBins(), 13u);
0300   BOOST_CHECK_EQUAL(axes.at(1)->getNBins(), 3u);
0301   CHECK_CLOSE_REL(axes.at(0)->getMin(), -std::numbers::pi, 1e-3);
0302   CHECK_CLOSE_REL(axes.at(0)->getMax(), std::numbers::pi, 1e-3);
0303   CHECK_CLOSE_REL(axes.at(1)->getMin(), -14, 1e-3);
0304   CHECK_CLOSE_REL(axes.at(1)->getMax(), 14, 1e-3);
0305 
0306   // CASE III
0307   ProtoLayer pl3;
0308   pl3.extent.range(AxisDirection::AxisR).set(1, 20);
0309   pl3.extent.range(AxisDirection::AxisZ).set(-25, 25);
0310   layer = std::dynamic_pointer_cast<CylinderLayer>(
0311       p_LC->cylinderLayer(tgContext, srf, equidistant, equidistant, pl3));
0312   CHECK_CLOSE_REL(layer->thickness(), 19, 1e-3);
0313   bounds = &layer->bounds();
0314   CHECK_CLOSE_REL(bounds->get(CylinderBounds::eR), 10.5, 1e-3);
0315   CHECK_CLOSE_REL(bounds->get(CylinderBounds::eHalfLengthZ), 25, 1e-3);
0316 
0317   // this should fail, b/c it's a completely inconvenient binning
0318   // but it succeeds despite sub-optimal binning
0319   // since we now have multientry bins
0320   BOOST_CHECK(checkBinning(tgContext, *layer->surfaceArray()));
0321 
0322   axes = layer->surfaceArray()->getAxes();
0323   BOOST_CHECK_EQUAL(axes.at(0)->getNBins(), 30u);
0324   BOOST_CHECK_EQUAL(axes.at(1)->getNBins(), 7u);
0325   CHECK_CLOSE_REL(axes.at(0)->getMin(), -std::numbers::pi, 1e-3);
0326   CHECK_CLOSE_REL(axes.at(0)->getMax(), std::numbers::pi, 1e-3);
0327   CHECK_CLOSE_REL(axes.at(1)->getMin(), -25, 1e-3);
0328   CHECK_CLOSE_REL(axes.at(1)->getMax(), 25, 1e-3);
0329 }
0330 
0331 BOOST_FIXTURE_TEST_CASE(LayerCreator_createDiscLayer, LayerCreatorFixture) {
0332   std::vector<std::shared_ptr<const Surface>> surfaces;
0333   auto ringa = fullPhiTestSurfacesEC(30, 0, 0, 10);
0334   surfaces.insert(surfaces.end(), ringa.begin(), ringa.end());
0335   auto ringb = fullPhiTestSurfacesEC(30, 0, 0, 15);
0336   surfaces.insert(surfaces.end(), ringb.begin(), ringb.end());
0337   auto ringc = fullPhiTestSurfacesEC(30, 0, 0, 20);
0338   surfaces.insert(surfaces.end(), ringc.begin(), ringc.end());
0339   draw_surfaces(surfaces, "LayerCreator_createDiscLayer_EC_1.obj");
0340 
0341   ProtoLayer pl(tgContext, surfaces);
0342   pl.extent.range(AxisDirection::AxisZ).set(-10, 10);
0343   pl.extent.range(AxisDirection::AxisR).set(5., 25.);
0344   std::shared_ptr<DiscLayer> layer = std::dynamic_pointer_cast<DiscLayer>(
0345       p_LC->discLayer(tgContext, surfaces, equidistant, equidistant, pl));
0346   CHECK_CLOSE_REL(layer->thickness(), 20, 1e-3);
0347   const RadialBounds* bounds =
0348       dynamic_cast<const RadialBounds*>(&layer->bounds());
0349   CHECK_CLOSE_REL(bounds->rMin(), 5, 1e-3);
0350   CHECK_CLOSE_REL(bounds->rMax(), 25, 1e-3);
0351   BOOST_CHECK(checkBinning(tgContext, *layer->surfaceArray()));
0352   auto axes = layer->surfaceArray()->getAxes();
0353   BOOST_CHECK_EQUAL(axes.at(0)->getNBins(), 3u);
0354   BOOST_CHECK_EQUAL(axes.at(1)->getNBins(), 30u);
0355   CHECK_CLOSE_REL(axes.at(0)->getMin(), 5, 1e-3);
0356   CHECK_CLOSE_REL(axes.at(0)->getMax(), 25, 1e-3);
0357   CHECK_CLOSE_REL(axes.at(1)->getMin(), -std::numbers::pi, 1e-3);
0358   CHECK_CLOSE_REL(axes.at(1)->getMax(), std::numbers::pi, 1e-3);
0359   checkBinContentSize(layer->surfaceArray(), 1);
0360 
0361   // check that it's applying a rotation transform to improve phi binning
0362   // BOOST_CHECK_NE(bu->transform(), nullptr);
0363   // double actAngle = ((*bu->transform()) * Vector3(1, 0, 0)).phi();
0364   // double expAngle = -2 * std::numbers::pi / 30 / 2.;
0365   // CHECK_CLOSE_REL(actAngle, expAngle, 1e-3);
0366 
0367   double envMinR = 1, envMaxR = 1, envZ = 5;
0368   std::size_t nBinsR = 3, nBinsPhi = 30;
0369   ProtoLayer pl2(tgContext, surfaces);
0370   pl2.envelope[AxisDirection::AxisR] = {envMinR, envMaxR};
0371   pl2.envelope[AxisDirection::AxisZ] = {envZ, envZ};
0372   layer = std::dynamic_pointer_cast<DiscLayer>(
0373       p_LC->discLayer(tgContext, surfaces, nBinsR, nBinsPhi, pl2));
0374 
0375   double rMin = 8, rMax = 22.0227;
0376   CHECK_CLOSE_REL(layer->thickness(), 0.4 + 2 * envZ, 1e-3);
0377   bounds = dynamic_cast<const RadialBounds*>(&layer->bounds());
0378   CHECK_CLOSE_REL(bounds->rMin(), rMin - envMinR, 1e-3);
0379   CHECK_CLOSE_REL(bounds->rMax(), rMax + envMaxR, 1e-3);
0380   BOOST_CHECK(checkBinning(tgContext, *layer->surfaceArray()));
0381   axes = layer->surfaceArray()->getAxes();
0382   BOOST_CHECK_EQUAL(axes.at(0)->getNBins(), nBinsR);
0383   BOOST_CHECK_EQUAL(axes.at(1)->getNBins(), nBinsPhi);
0384   CHECK_CLOSE_REL(axes.at(0)->getMin(), rMin, 1e-3);
0385   CHECK_CLOSE_REL(axes.at(0)->getMax(), rMax, 1e-3);
0386   CHECK_CLOSE_REL(axes.at(1)->getMin(), -std::numbers::pi, 1e-3);
0387   CHECK_CLOSE_REL(axes.at(1)->getMax(), std::numbers::pi, 1e-3);
0388   checkBinContentSize(layer->surfaceArray(), 1);
0389 
0390   // check that it's applying a rotation transform to improve phi binning
0391   // BOOST_CHECK_NE(bu->transform(), nullptr);
0392   // actAngle = ((*bu->transform()) * Vector3(1, 0, 0)).phi();
0393   // expAngle = -2 * std::numbers::pi / 30 / 2.;
0394   // CHECK_CLOSE_REL(actAngle, expAngle, 1e-3);
0395 
0396   layer = std::dynamic_pointer_cast<DiscLayer>(
0397       p_LC->discLayer(tgContext, surfaces, equidistant, equidistant, pl2));
0398   CHECK_CLOSE_REL(layer->thickness(), 0.4 + 2 * envZ, 1e-3);
0399   bounds = dynamic_cast<const RadialBounds*>(&layer->bounds());
0400   CHECK_CLOSE_REL(bounds->rMin(), rMin - envMinR, 1e-3);
0401   CHECK_CLOSE_REL(bounds->rMax(), rMax + envMaxR, 1e-3);
0402   BOOST_CHECK(checkBinning(tgContext, *layer->surfaceArray()));
0403   axes = layer->surfaceArray()->getAxes();
0404   BOOST_CHECK_EQUAL(axes.at(0)->getNBins(), nBinsR);
0405   BOOST_CHECK_EQUAL(axes.at(1)->getNBins(), nBinsPhi);
0406   CHECK_CLOSE_REL(axes.at(0)->getMin(), rMin, 1e-3);
0407   CHECK_CLOSE_REL(axes.at(0)->getMax(), rMax, 1e-3);
0408   CHECK_CLOSE_REL(axes.at(1)->getMin(), -std::numbers::pi, 1e-3);
0409   CHECK_CLOSE_REL(axes.at(1)->getMax(), std::numbers::pi, 1e-3);
0410   checkBinContentSize(layer->surfaceArray(), 1);
0411 
0412   // check that it's applying a rotation transform to improve phi binning
0413   // BOOST_CHECK_NE(bu->transform(), nullptr);
0414   // actAngle = ((*bu->transform()) * Vector3(1, 0, 0)).phi();
0415   // expAngle = -2 * std::numbers::pi / 30 / 2.;
0416   // CHECK_CLOSE_REL(actAngle, expAngle, 1e-3);
0417 }
0418 
0419 BOOST_FIXTURE_TEST_CASE(LayerCreator_barrelStagger, LayerCreatorFixture) {
0420   auto barrel = makeBarrelStagger(30, 7, 0, std::numbers::pi / 9.);
0421   auto brl = barrel.first;
0422   draw_surfaces(brl, "LayerCreator_barrelStagger.obj");
0423 
0424   double envR = 0, envZ = 0;
0425   ProtoLayer pl(tgContext, brl);
0426   pl.envelope[AxisDirection::AxisR] = {envR, envR};
0427   pl.envelope[AxisDirection::AxisZ] = {envZ, envZ};
0428   std::shared_ptr<CylinderLayer> layer =
0429       std::dynamic_pointer_cast<CylinderLayer>(
0430           p_LC->cylinderLayer(tgContext, brl, equidistant, equidistant, pl));
0431 
0432   auto axes = layer->surfaceArray()->getAxes();
0433   BOOST_CHECK_EQUAL(axes.at(0)->getNBins(), 30u);
0434   BOOST_CHECK_EQUAL(axes.at(1)->getNBins(), 7u);
0435 
0436   // check if binning is good!
0437   for (const auto& pr : barrel.second) {
0438     auto A = pr.first;
0439     auto B = pr.second;
0440 
0441     // std::cout << A->center().phi() << " ";
0442     // std::cout << B->center().phi() << std::endl;
0443     // std::cout << "dPHi = " << A->center().phi() - B->center().phi() <<
0444     // std::endl;
0445 
0446     Vector3 ctr = A->referencePosition(tgContext, AxisDirection::AxisR);
0447     auto binContent = layer->surfaceArray()->at(ctr, ctr.normalized());
0448     BOOST_CHECK_EQUAL(binContent.size(), 2u);
0449     std::set<const Surface*> act(binContent.begin(), binContent.end());
0450 
0451     std::set<const Surface*> exp({A, B});
0452     BOOST_CHECK(std::ranges::includes(act, exp));
0453   }
0454 
0455   // checkBinning should also report everything is fine
0456   checkBinning(tgContext, *layer->surfaceArray());
0457 }
0458 
0459 BOOST_AUTO_TEST_SUITE_END()
0460 
0461 }  // namespace ActsTests