Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:25:33

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/Definitions/Algebra.hpp"
0012 #include "Acts/Geometry/GeometryContext.hpp"
0013 #include "Acts/Surfaces/PlaneSurface.hpp"
0014 #include "Acts/Surfaces/RectangleBounds.hpp"
0015 #include "Acts/Surfaces/Surface.hpp"
0016 #include "ActsPlugins/Geant4/Geant4DetectorElement.hpp"
0017 
0018 #include <memory>
0019 #include <utility>
0020 
0021 using namespace Acts;
0022 using namespace ActsPlugins;
0023 
0024 /// Mockup class
0025 class G4VPhysicalVolume {};
0026 
0027 GeometryContext tContext;
0028 
0029 namespace ActsTests {
0030 
0031 BOOST_AUTO_TEST_SUITE(Geant4Suite)
0032 
0033 BOOST_AUTO_TEST_CASE(Geant4DetectorElement_construction) {
0034   // G4 phys volume
0035   auto g4physVol = std::make_shared<G4VPhysicalVolume>();
0036 
0037   // A surface
0038   auto rBounds = std::make_shared<RectangleBounds>(10., 10.);
0039   auto rTransform = Transform3::Identity();
0040   rTransform.pretranslate(Vector3(0., 0., 10));
0041   auto rSurface =
0042       Surface::makeShared<PlaneSurface>(rTransform, std::move(rBounds));
0043   // A detector element
0044   Geant4DetectorElement g4DetElement(rSurface, *g4physVol, rTransform, 0.1);
0045 
0046   BOOST_CHECK_EQUAL(g4DetElement.thickness(), 0.1);
0047   BOOST_CHECK_EQUAL(&g4DetElement.surface(), rSurface.get());
0048   BOOST_CHECK_EQUAL(&g4DetElement.g4PhysicalVolume(), g4physVol.get());
0049   BOOST_CHECK(
0050       g4DetElement.transform(tContext).isApprox(rSurface->transform(tContext)));
0051 }
0052 
0053 BOOST_AUTO_TEST_SUITE_END()
0054 
0055 }  // namespace ActsTests