|
||||
File indexing completed on 2025-01-18 09:27:42
0001 // This file is part of the Acts project. 0002 // 0003 // Copyright (C) 2023 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 http://mozilla.org/MPL/2.0/. 0008 0009 #pragma once 0010 0011 #include "Acts/Geometry/GeometryContext.hpp" 0012 #include "Acts/Plugins/Json/ActsJson.hpp" 0013 #include "Acts/Plugins/Json/AlgebraJsonConverter.hpp" 0014 #include "Acts/Plugins/Json/PortalJsonConverter.hpp" 0015 #include "Acts/Plugins/Json/SurfaceJsonConverter.hpp" 0016 0017 #include <map> 0018 #include <memory> 0019 #include <vector> 0020 0021 // Custom Json encoder/decoders 0022 0023 namespace Acts { 0024 0025 class Surface; 0026 0027 namespace Experimental { 0028 class DetectorVolume; 0029 class Portal; 0030 } // namespace Experimental 0031 0032 namespace DetectorVolumeJsonConverter { 0033 0034 struct Options { 0035 // The options how surfaces are written out 0036 SurfaceJsonConverter::Options surfaceOptions; 0037 // The options how portals are written out 0038 PortalJsonConverter::Options portalOptions; 0039 // The options how transforms are written out 0040 Transform3JsonConverter::Options transformOptions; 0041 }; 0042 0043 /// @brief Convert to json format 0044 /// 0045 /// @param gctx the geometry context 0046 /// @param volume the detector volume instance 0047 /// @param detectorVolumes the list of other detector volumes 0048 /// @param portals the list of portals for saving the portal links 0049 /// @param options the options for the conversion 0050 /// 0051 /// @return a json object representing the detector volume 0052 nlohmann::json toJson( 0053 const GeometryContext& gctx, const Experimental::DetectorVolume& volume, 0054 const std::vector<const Experimental::DetectorVolume*>& detectorVolumes, 0055 const std::vector<const Experimental::Portal*>& portals = {}, 0056 const Options& options = Options{}); 0057 0058 /// @brief convert from json format 0059 /// 0060 /// @param gctx the geometry context 0061 /// @param jVolume the json object representing the detector volume 0062 /// 0063 /// @note this only creates a volume in a stand-alone context, not in a detector 0064 /// context. For the latter, use the DetectorJsonConverter that will patch 0065 /// the portals accordingly 0066 std::shared_ptr<Experimental::DetectorVolume> fromJson( 0067 const GeometryContext& gctx, const nlohmann::json& jVolume); 0068 0069 } // namespace DetectorVolumeJsonConverter 0070 } // namespace Acts
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |