Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /acts/Tests/UnitTests/Plugins/GeoModel/GeoModelDetectorElementITkTests.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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/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{};
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 = GeoModelDetectorElement::createDetectorElement<PlaneSurface>(
0064       fphys, rBounds, Transform3::Identity(), 2.0);
0065 
0066   const int hardware = 0, barrelEndcap = -2, layerWheel = 100, phiModule = 200,
0067             etaModule = 300, side = 1;
0068 
0069   auto [itkElement, _] = GeoModelDetectorElementITk::convertFromGeomodel(
0070       element, element->surface().getSharedPtr(), gctx, hardware, barrelEndcap,
0071       layerWheel, etaModule, phiModule, side);
0072 
0073   BOOST_CHECK_EQUAL(element->surface().type(), itkElement->surface().type());
0074   BOOST_CHECK_EQUAL(element->surface().bounds().type(),
0075                     itkElement->surface().bounds().type());
0076   BOOST_CHECK_NE(element->surface().associatedDetectorElement(),
0077                  itkElement->surface().associatedDetectorElement());
0078   BOOST_CHECK_EQUAL(itkElement->identifier().barrelEndcap(), barrelEndcap);
0079   BOOST_CHECK_EQUAL(itkElement->identifier().hardware(), hardware);
0080   BOOST_CHECK_EQUAL(itkElement->identifier().layerWheel(), layerWheel);
0081   BOOST_CHECK_EQUAL(itkElement->identifier().phiModule(), phiModule);
0082   BOOST_CHECK_EQUAL(itkElement->identifier().etaModule(), etaModule);
0083   BOOST_CHECK_EQUAL(itkElement->identifier().side(), side);
0084 }
0085 
0086 BOOST_AUTO_TEST_SUITE_END()
0087 
0088 }  // namespace ActsTests