Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-27 07:56:37

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 "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->associatedDetectorElement() != nullptr) {
0032     throw std::logic_error(
0033         "Geant4DetectorElement: Surface already has an associated detector "
0034         "element");
0035   }
0036   m_surface->assignDetectorElement(*this);
0037 }
0038 
0039 const Transform3& Geant4DetectorElement::transform(
0040     const GeometryContext& /*gctx*/) const {
0041   return m_toGlobal;
0042 }
0043 
0044 const Surface& Geant4DetectorElement::surface() const {
0045   return *m_surface;
0046 }
0047 
0048 Surface& Geant4DetectorElement::surface() {
0049   return *m_surface;
0050 }
0051 
0052 double Geant4DetectorElement::thickness() const {
0053   return m_thickness;
0054 }
0055 
0056 const G4VPhysicalVolume& Geant4DetectorElement::g4PhysicalVolume() const {
0057   return *m_g4physVol;
0058 }
0059 
0060 }  // namespace ActsPlugins