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