Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-12 07:52:51

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 "Acts/Plugins/Geant4/Geant4DetectorElement.hpp"
0010 
0011 #include "Acts/Surfaces/Surface.hpp"
0012 
0013 #include <utility>
0014 
0015 namespace Acts {
0016 
0017 Geant4DetectorElement::Geant4DetectorElement(std::shared_ptr<Surface> surface,
0018                                              const G4VPhysicalVolume& g4physVol,
0019                                              const Transform3& toGlobal,
0020                                              double thickness)
0021     : m_surface(std::move(surface)),
0022       m_g4physVol(&g4physVol),
0023       m_toGlobal(toGlobal),
0024       m_thickness(thickness) {
0025   if (m_surface == nullptr) {
0026     throw std::invalid_argument(
0027         "Geant4DetectorElement: Surface cannot be nullptr");
0028   }
0029   if (m_surface->associatedDetectorElement() != nullptr) {
0030     throw std::logic_error(
0031         "Geant4DetectorElement: Surface already has an associated detector "
0032         "element");
0033   }
0034   m_surface->assignDetectorElement(*this);
0035 }
0036 
0037 const Transform3& Geant4DetectorElement::transform(
0038     const GeometryContext& /*gctx*/) const {
0039   return m_toGlobal;
0040 }
0041 
0042 const Surface& Geant4DetectorElement::surface() const {
0043   return *m_surface;
0044 }
0045 
0046 Surface& Geant4DetectorElement::surface() {
0047   return *m_surface;
0048 }
0049 
0050 double Geant4DetectorElement::thickness() const {
0051   return m_thickness;
0052 }
0053 
0054 const G4VPhysicalVolume& Geant4DetectorElement::g4PhysicalVolume() const {
0055   return *m_g4physVol;
0056 }
0057 
0058 }  // namespace Acts