Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Geant4DetectorElementTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Geant4DetectorElementTests.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2022 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #include <boost/test/unit_test.hpp>
10 
17 
18 #include <memory>
19 #include <utility>
20 
23 
25 
26 BOOST_AUTO_TEST_SUITE(Geant4Plugin)
27 
28 BOOST_AUTO_TEST_CASE(Geant4DetectorElement_construction) {
29  // G4 phys volume
30  auto g4physVol = std::make_shared<G4VPhysicalVolume>();
31 
32  // A surface
33  auto rBounds = std::make_shared<Acts::RectangleBounds>(10., 10.);
34  auto rTransform = Acts::Transform3::Identity();
35  rTransform.pretranslate(Acts::Vector3(0., 0., 10));
36  auto rSurface = Acts::Surface::makeShared<Acts::PlaneSurface>(
37  rTransform, std::move(rBounds));
38  // A detector element
39  Acts::Geant4DetectorElement g4DetElement(rSurface, *g4physVol.get(),
40  rTransform, 0.1);
41 
42  BOOST_CHECK(g4DetElement.thickness() == 0.1);
43  BOOST_CHECK(&g4DetElement.surface() == rSurface.get());
44  BOOST_CHECK(&g4DetElement.g4PhysicalVolume() == g4physVol.get());
45  BOOST_CHECK(
46  g4DetElement.transform(tContext).isApprox(rSurface->transform(tContext)));
47 }
48 
49 BOOST_AUTO_TEST_SUITE_END()