File indexing completed on 2026-09-14 08:21:23
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/unit_test.hpp>
0010
0011 #include "Acts/Surfaces/PlaneSurface.hpp"
0012 #include "Acts/Surfaces/RectangleBounds.hpp"
0013 #include "Acts/Surfaces/Surface.hpp"
0014 #include "ActsPlugins/GeoModel/GeoModelDetectorElementITk.hpp"
0015
0016 #include <GeoModelKernel/GeoBox.h>
0017 #include <GeoModelKernel/GeoFullPhysVol.h>
0018 #include <GeoModelKernel/GeoLogVol.h>
0019 #include <GeoModelKernel/GeoMaterial.h>
0020
0021 using namespace Acts;
0022 using namespace ActsPlugins;
0023
0024 namespace ActsTests {
0025
0026 BOOST_AUTO_TEST_SUITE(GeoModelSuite)
0027
0028 BOOST_AUTO_TEST_CASE(ITkIdentifierTests) {
0029 auto test = [](int hw, int bec, int lw, int em, int pm, int side) {
0030 ITkIdentifier id(hw, bec, lw, em, pm, side);
0031 BOOST_CHECK_EQUAL(id.hardware(), hw);
0032 BOOST_CHECK_EQUAL(id.barrelEndcap(), bec);
0033 BOOST_CHECK_EQUAL(id.layerWheel(), lw);
0034 BOOST_CHECK_EQUAL(id.etaModule(), em);
0035 BOOST_CHECK_EQUAL(id.phiModule(), pm);
0036 BOOST_CHECK_EQUAL(id.side(), side);
0037 };
0038
0039 for (int hw : {0, 1}) {
0040 for (int bec : {-2, 0, 2}) {
0041 for (int lw : {0, 10}) {
0042 for (int em : {-10, 0, 10}) {
0043 for (int pm : {10, 0}) {
0044 for (int side : {0, 1}) {
0045 test(hw, bec, lw, em, pm, side);
0046 }
0047 }
0048 }
0049 }
0050 }
0051 }
0052 }
0053
0054 BOOST_AUTO_TEST_CASE(GeoModelDetectorElementConstruction) {
0055 GeometryContext gctx = GeometryContext::dangerouslyDefaultConstruct();
0056
0057 auto material = make_intrusive<GeoMaterial>("Material", 1.0);
0058 auto box = make_intrusive<GeoBox>(100, 200, 2);
0059 auto log = make_intrusive<GeoLogVol>("LogVolumeXY", box, material);
0060 auto fphys = make_intrusive<GeoFullPhysVol>(log);
0061 auto rBounds = std::make_shared<RectangleBounds>(100, 200);
0062
0063 auto element =
0064 GeoModelDetectorElement::createDetectorElement<PlaneSurface,
0065 RectangleBounds>(
0066 fphys, rBounds, Transform3::Identity(), 2.0);
0067
0068 const int hardware = 0, barrelEndcap = -2, layerWheel = 100, phiModule = 200,
0069 etaModule = 300, side = 1;
0070
0071 auto [itkElement, _] = GeoModelDetectorElementITk::convertFromGeomodel(
0072 element, element->surface().getSharedPtr(), gctx, hardware, barrelEndcap,
0073 layerWheel, etaModule, phiModule, side);
0074
0075 BOOST_CHECK_EQUAL(element->surface().type(), itkElement->surface().type());
0076 BOOST_CHECK_EQUAL(element->surface().bounds().type(),
0077 itkElement->surface().bounds().type());
0078 BOOST_CHECK_NE(element->surface().surfacePlacement(),
0079 itkElement->surface().surfacePlacement());
0080 BOOST_CHECK_EQUAL(itkElement->identifier().barrelEndcap(), barrelEndcap);
0081 BOOST_CHECK_EQUAL(itkElement->identifier().hardware(), hardware);
0082 BOOST_CHECK_EQUAL(itkElement->identifier().layerWheel(), layerWheel);
0083 BOOST_CHECK_EQUAL(itkElement->identifier().phiModule(), phiModule);
0084 BOOST_CHECK_EQUAL(itkElement->identifier().etaModule(), etaModule);
0085 BOOST_CHECK_EQUAL(itkElement->identifier().side(), side);
0086 }
0087
0088 BOOST_AUTO_TEST_SUITE_END()
0089
0090 }