File indexing completed on 2026-09-23 08:21:03
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "ActsPlugins/Geant4/Geant4DetectorElement.hpp"
0010
0011 #include "Acts/Surfaces/Surface.hpp"
0012
0013 #include <utility>
0014
0015 using namespace Acts;
0016
0017 namespace ActsPlugins {
0018
0019 Geant4DetectorElement::Geant4DetectorElement(std::shared_ptr<Surface> surface,
0020 const G4VPhysicalVolume& g4physVol,
0021 const Transform3& toGlobal,
0022 double thickness)
0023 : m_surface(std::move(surface)),
0024 m_g4physVol(&g4physVol),
0025 m_toGlobal(toGlobal),
0026 m_thickness(thickness) {
0027 if (m_surface == nullptr) {
0028 throw std::invalid_argument(
0029 "Geant4DetectorElement: Surface cannot be nullptr");
0030 }
0031 if (m_surface->isSensitive()) {
0032 throw std::logic_error(
0033 "Geant4DetectorElement: Surface already has an associated detector "
0034 "element");
0035 }
0036 if (thickness > 0.) {
0037 m_surface->assignThickness(m_thickness);
0038 }
0039 m_surface->assignSurfacePlacement(*this);
0040 }
0041
0042 const Transform3& Geant4DetectorElement::localToGlobalTransform(
0043 const GeometryContext& ) const {
0044 return m_toGlobal;
0045 }
0046
0047 const Surface& Geant4DetectorElement::surface() const {
0048 return *m_surface;
0049 }
0050
0051 Surface& Geant4DetectorElement::surface() {
0052 return *m_surface;
0053 }
0054
0055 double Geant4DetectorElement::thickness() const {
0056 return m_thickness;
0057 }
0058
0059 const G4VPhysicalVolume& Geant4DetectorElement::g4PhysicalVolume() const {
0060 return *m_g4physVol;
0061 }
0062
0063 }