** Warning **
Issuing rollback() due to DESTROY without explicit disconnect() of DBD::mysql::db handle dbname=lxr_eic at /usr/local/share/lxr/lxr-2.3.7/lib/LXR/Common.pm line 1161, <GEN192> line 1.
Last-Modified: Thu, 17 Dec 2025 08:01:27 GMT
Content-Type: text/html; charset=utf-8
/master/acts/Python/Plugins/src/Json.cpp
Warning, file /acts/Python/Plugins/src/Json.cpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Acts/Geometry /GeometryContext.hpp "
0010 #include "Acts/Utilities/Logger.hpp "
0011 #include "ActsPlugins/Json/JsonMaterialDecorator.hpp "
0012 #include "ActsPlugins/Json/JsonSurfacesReader.hpp "
0013 #include "ActsPlugins/Json/MaterialMapJsonConverter.hpp "
0014 #include "ActsPython/Utilities/Helpers.hpp "
0015 #include "ActsPython/Utilities/Macros.hpp "
0016
0017 #include <memory>
0018 #include <string>
0019
0020 #include <pybind11/pybind11.h >
0021 #include <pybind11/stl.h >
0022
0023 namespace py = pybind11 ;
0024 using namespace pybind11 ::literals ;
0025
0026 using namespace Acts ;
0027 using namespace ActsPython ;
0028 using namespace ActsExamples ;
0029
0030 PYBIND11_MODULE (ActsPluginsPythonBindingsJson, json ) {
0031 {
0032 py ::class_ <JsonMaterialDecorator , IMaterialDecorator ,
0033 std ::shared_ptr <JsonMaterialDecorator >>(json ,
0034 "JsonMaterialDecorator" )
0035 .def (py ::init <const MaterialMapJsonConverter ::Config &,
0036 const std ::string &, Logging ::Level , bool , bool >(),
0037 py ::arg ("rConfig" ), py ::arg ("jFileName" ), py ::arg ("level" ),
0038 py ::arg ("clearSurfaceMaterial" ) = true ,
0039 py ::arg ("clearVolumeMaterial" ) = true );
0040 }
0041
0042 {
0043 auto cls =
0044 py ::class_ <MaterialMapJsonConverter >(json , "MaterialMapJsonConverter" )
0045 .def (py ::init <const MaterialMapJsonConverter ::Config &,
0046 Logging ::Level >(),
0047 py ::arg ("config" ), py ::arg ("level" ));
0048
0049 auto c = py ::class_ <MaterialMapJsonConverter ::Config >(cls , "Config" )
0050 .def (py ::init <>());
0051 ACTS_PYTHON_STRUCT (c , context , processSensitives , processApproaches ,
0052 processRepresenting , processBoundaries , processVolumes ,
0053 processDenseVolumes , processNonMaterial );
0054 }
0055
0056 {
0057 auto sjOptions =
0058 py ::class_ <JsonSurfacesReader ::Options >(json , "SurfaceJsonOptions" )
0059 .def (py ::init <>());
0060 ACTS_PYTHON_STRUCT (sjOptions , inputFile , jsonEntryPath);
0061
0062 json .def ("readSurfaceHierarchyMapFromJson" ,
0063 JsonSurfacesReader ::readHierarchyMap );
0064
0065 json .def ("readSurfaceVectorFromJson" , JsonSurfacesReader ::readVector );
0066
0067 py ::class_ <JsonDetectorElement , DetectorElementBase ,
0068 std ::shared_ptr <JsonDetectorElement >>(json ,
0069 "JsonDetectorElement" )
0070 .def ("surface" , [](JsonDetectorElement & self ) {
0071 return self .surface ().getSharedPtr ();
0072 });
0073
0074 json .def ("readDetectorElementsFromJson" ,
0075 JsonSurfacesReader ::readDetectorElements );
0076 }
0077 }