File indexing completed on 2025-11-14 09:17:24
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Acts/Geometry/TrackingGeometry.hpp"
0010 #include "Acts/Utilities/Logger.hpp"
0011 #include "ActsExamples/EventData/GeometryContainers.hpp"
0012 #include "ActsExamples/EventData/SimHit.hpp"
0013 #include "ActsExamples/EventData/SimSpacePoint.hpp"
0014 #include "ActsExamples/Io/Svg/SvgPointWriter.hpp"
0015 #include "ActsExamples/Io/Svg/SvgTrackingGeometryWriter.hpp"
0016 #include "ActsPython/Utilities/Helpers.hpp"
0017 #include "ActsPython/Utilities/Macros.hpp"
0018 #include <actsvg/core/draw.hpp>
0019
0020 #include <algorithm>
0021 #include <memory>
0022 #include <ranges>
0023 #include <sstream>
0024 #include <string>
0025 #include <tuple>
0026 #include <vector>
0027
0028 #include <pybind11/pybind11.h>
0029 #include <pybind11/stl.h>
0030
0031 namespace py = pybind11;
0032 using namespace pybind11::literals;
0033
0034 using namespace Acts;
0035 using namespace Acts::Experimental;
0036 using namespace ActsExamples;
0037 using namespace ActsPlugins;
0038
0039 namespace ActsPython {
0040 void addSvg(Context& ctx) {
0041 auto& mex = ctx.get("examples");
0042
0043
0044
0045 {
0046 using Writer = SvgTrackingGeometryWriter;
0047 auto w =
0048 py::class_<Writer, std::shared_ptr<Writer>>(mex,
0049 "SvgTrackingGeometryWriter")
0050 .def(py::init<const Writer::Config&, Logging::Level>(),
0051 py::arg("config"), py::arg("level"))
0052 .def("write",
0053 py::overload_cast<const AlgorithmContext&,
0054 const TrackingGeometry&>(&Writer::write));
0055
0056 auto c = py::class_<Writer::Config>(w, "Config").def(py::init<>());
0057 ACTS_PYTHON_STRUCT(c, outputDir, converterOptions);
0058 }
0059 {
0060 using Writer = SvgPointWriter<SimSpacePoint>;
0061 auto w =
0062 py::class_<Writer, IWriter, std::shared_ptr<Writer>>(
0063 mex, "SvgSimSpacePointWriter")
0064 .def(py::init<const Writer::Config&, Logging::Level>(),
0065 py::arg("config"), py::arg("level"))
0066 .def("write",
0067 py::overload_cast<const AlgorithmContext&>(&Writer::write));
0068
0069 auto c = py::class_<Writer::Config>(w, "Config").def(py::init<>());
0070 ACTS_PYTHON_STRUCT(c, writerName, trackingGeometry, inputCollection,
0071 infoBoxTitle, outputDir);
0072 }
0073
0074 {
0075 using Writer = SvgPointWriter<SimHit, AccessorPositionXYZ>;
0076 auto w =
0077 py::class_<Writer, IWriter, std::shared_ptr<Writer>>(mex,
0078 "SvgSimHitWriter")
0079 .def(py::init<const Writer::Config&, Logging::Level>(),
0080 py::arg("config"), py::arg("level"))
0081 .def("write",
0082 py::overload_cast<const AlgorithmContext&>(&Writer::write));
0083
0084 auto c = py::class_<Writer::Config>(w, "Config").def(py::init<>());
0085 ACTS_PYTHON_STRUCT(c, writerName, trackingGeometry, inputCollection,
0086 infoBoxTitle, outputDir);
0087 }
0088 }
0089 }