Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:13:10

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/Plugins/GeoModel/GeoModelDetectorElementITk.hpp"
0012 #include "Acts/Surfaces/PlaneSurface.hpp"
0013 #include "Acts/Surfaces/RectangleBounds.hpp"
0014 #include "Acts/Surfaces/Surface.hpp"
0015 
0016 #include <GeoModelKernel/GeoBox.h>
0017 #include <GeoModelKernel/GeoFullPhysVol.h>
0018 #include <GeoModelKernel/GeoLogVol.h>
0019 #include <GeoModelKernel/GeoMaterial.h>
0020 
0021 BOOST_AUTO_TEST_SUITE(GeoModelPlugin)
0022 
0023 BOOST_AUTO_TEST_CASE(ITkIdentifierTests) {
0024   auto test = [](int hw, int bec, int lw, int em, int pm, int side) {
0025     Acts::ITkIdentifier id(hw, bec, lw, em, pm, side);
0026     BOOST_CHECK_EQUAL(id.hardware(), hw);
0027     BOOST_CHECK_EQUAL(id.barrelEndcap(), bec);
0028     BOOST_CHECK_EQUAL(id.layerWheel(), lw);
0029     BOOST_CHECK_EQUAL(id.etaModule(), em);
0030     BOOST_CHECK_EQUAL(id.phiModule(), pm);
0031     BOOST_CHECK_EQUAL(id.side(), side);
0032   };
0033 
0034   for (int hw : {0, 1}) {
0035     for (int bec : {-2, 0, 2}) {
0036       for (int lw : {0, 10}) {
0037         for (int em : {-10, 0, 10}) {
0038           for (int pm : {10, 0}) {
0039             for (int side : {0, 1}) {
0040               test(hw, bec, lw, em, pm, side);
0041             }
0042           }
0043         }
0044       }
0045     }
0046   }
0047 }
0048 
0049 BOOST_AUTO_TEST_CASE(GeoModelDetectorElementConstruction) {
0050   Acts::GeometryContext gctx{};
0051 
0052   auto material = GeoIntrusivePtr(new GeoMaterial("Material", 1.0));
0053   auto box = GeoIntrusivePtr(new GeoBox(100, 200, 2));
0054   auto log = GeoIntrusivePtr(new GeoLogVol("LogVolumeXY", box, material));
0055   auto fphys = GeoIntrusivePtr(new GeoFullPhysVol(log));
0056   auto rBounds = std::make_shared<Acts::RectangleBounds>(100, 200);
0057 
0058   auto element =
0059       Acts::GeoModelDetectorElement::createDetectorElement<Acts::PlaneSurface>(
0060           fphys, rBounds, Acts::Transform3::Identity(), 2.0);
0061 
0062   const int hardware = 0, barrelEndcap = -2, layerWheel = 100, phiModule = 200,
0063             etaModule = 300, side = 1;
0064 
0065   auto [itkElement, _] = Acts::GeoModelDetectorElementITk::convertFromGeomodel(
0066       element, element->surface().getSharedPtr(), gctx, hardware, barrelEndcap,
0067       layerWheel, etaModule, phiModule, side);
0068 
0069   BOOST_CHECK_EQUAL(element->surface().type(), itkElement->surface().type());
0070   BOOST_CHECK_EQUAL(element->surface().bounds().type(),
0071                     itkElement->surface().bounds().type());
0072   BOOST_CHECK_NE(element->surface().associatedDetectorElement(),
0073                  itkElement->surface().associatedDetectorElement());
0074   BOOST_CHECK_EQUAL(itkElement->identifier().barrelEndcap(), barrelEndcap);
0075   BOOST_CHECK_EQUAL(itkElement->identifier().hardware(), hardware);
0076   BOOST_CHECK_EQUAL(itkElement->identifier().layerWheel(), layerWheel);
0077   BOOST_CHECK_EQUAL(itkElement->identifier().phiModule(), phiModule);
0078   BOOST_CHECK_EQUAL(itkElement->identifier().etaModule(), etaModule);
0079   BOOST_CHECK_EQUAL(itkElement->identifier().side(), side);
0080 }
0081 
0082 BOOST_AUTO_TEST_SUITE_END()