|
||||
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/Geometry/VolumeBounds.hpp" 0013 #include "Acts/Navigation/PortalNavigation.hpp" 0014 #include "Acts/Plugins/Json/ActsJson.hpp" 0015 #include "Acts/Plugins/Json/SurfaceJsonConverter.hpp" 0016 #include "Acts/Utilities/Logger.hpp" 0017 0018 #include <memory> 0019 #include <tuple> 0020 #include <vector> 0021 0022 // Custom Json encoder/decoders 0023 0024 namespace Acts { 0025 0026 class Surface; 0027 0028 namespace Experimental { 0029 class DetectorVolume; 0030 class Portal; 0031 } // namespace Experimental 0032 0033 namespace PortalJsonConverter { 0034 0035 struct Options { 0036 /// Options how to write the surface out 0037 SurfaceJsonConverter::Options surfaceOptions = 0038 SurfaceJsonConverter::Options{}; 0039 }; 0040 0041 /// @brief Convert to json format 0042 /// 0043 /// @param gctx the geometry context 0044 /// @param portal the portal instance 0045 /// @param detectorVolumes is the list of all detector voluems for portal pointing 0046 /// @param options how to write this thing out 0047 /// 0048 /// @return a json object 0049 nlohmann::json toJson( 0050 const GeometryContext& gctx, const Experimental::Portal& portal, 0051 const std::vector<const Experimental::DetectorVolume*>& detectorVolumes, 0052 const Options& options = Options{}); 0053 0054 /// @brief Convert to json format - dedicated Detray function 0055 /// 0056 /// @param gctx the geometry context 0057 /// @param portal the portal instance 0058 /// @param ip is the portal index that could be used to pick the oriented surface 0059 /// @param volume is the detector volume to which these surfaces belong to 0060 /// @param orientedSurfaces are the bounding surfaces (may still need to be split) 0061 /// @param detectorVolumes is the list of all detector voluems for portal pointing 0062 /// @param options how to write this thing out 0063 /// 0064 /// @note that detray relies on singly connected masks, hence a portal from ACTS 0065 /// with multi volume link needs to be split into the multiple volumes 0066 /// 0067 /// @note detray also only has outside pointing links 0068 /// 0069 /// @return a tuple of json object 0070 std::tuple<std::vector<nlohmann::json>, std::vector<std::shared_ptr<Surface>>> 0071 toJsonDetray( 0072 const GeometryContext& gctx, const Experimental::Portal& portal, 0073 std::size_t ip, const Experimental::DetectorVolume& volume, 0074 const std::vector<OrientedSurface>& orientedSurfaces, 0075 const std::vector<const Experimental::DetectorVolume*>& detectorVolumes, 0076 const Options& options = Options{}); 0077 0078 /// @brief convert to json format 0079 /// @param updator the detector volume updator 0080 /// @param detectorVolumes the list of all detector volumes 0081 /// 0082 /// @return a json object 0083 nlohmann::json toJson( 0084 const Experimental::ExternalNavigationDelegate& updator, 0085 const std::vector<const Experimental::DetectorVolume*>& detectorVolumes); 0086 0087 /// @brief convert from json format 0088 /// 0089 /// @param gctx the geometry context 0090 /// @param jPortal is the json portal description 0091 /// @param detectorVolumes is the list of already created detector volumes 0092 /// 0093 /// @return a Portal 0094 std::shared_ptr<Experimental::Portal> fromJson( 0095 const GeometryContext& gctx, const nlohmann::json& jPortal, 0096 const std::vector<std::shared_ptr<Experimental::DetectorVolume>>& 0097 detectorVolumes); 0098 0099 } // namespace PortalJsonConverter 0100 } // 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 |