Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-11 09:40:22

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 #pragma once
0009 
0010 #include "Acts/Geometry/DetectorElementBase.hpp"
0011 
0012 #include <nlohmann/json.hpp>
0013 
0014 namespace Acts {
0015 
0016 /// A implementation of a detector element, that is constructed from a
0017 /// JSON description of a surface. The idea behind this is that it helps
0018 /// importing whole tracking geometries from JSON files. In some parts of
0019 /// the codebase, the existence of a detector element associated to a surface
0020 /// has a specific meaning (e.g., flags surfaces as sensitive).
0021 class JsonDetectorElement : public DetectorElementBase {
0022  public:
0023   /// Constructor from JSON surface description
0024   /// @param jSurface JSON object describing the surface
0025   /// @param thickness Thickness of the detector element
0026   JsonDetectorElement(const nlohmann::json &jSurface, double thickness);
0027 
0028   /// Return mutable reference to the surface
0029   /// @return Mutable reference to the associated surface
0030   Surface &surface() override;
0031   /// Return const reference to the surface
0032   /// @return Const reference to the associated surface
0033   const Surface &surface() const override;
0034 
0035   /// Return the thickness of the detector element
0036   /// @return Thickness value
0037   double thickness() const override;
0038 
0039   /// Return the transform for this detector element
0040   /// @param gctx Geometry context (unused for this implementation)
0041   /// @return Transform matrix for this detector element
0042   const Transform3 &transform(const GeometryContext &gctx) const override;
0043 
0044  private:
0045   std::shared_ptr<Surface> m_surface;
0046   Transform3 m_transform{};
0047   double m_thickness{};
0048 };
0049 
0050 }  // namespace Acts