Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-01-09 09:26:47

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 
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 
0019 #include <algorithm>
0020 #include <memory>
0021 #include <ranges>
0022 #include <sstream>
0023 #include <string>
0024 #include <tuple>
0025 #include <vector>
0026 
0027 #include <pybind11/pybind11.h>
0028 #include <pybind11/stl.h>
0029 
0030 namespace py = pybind11;
0031 using namespace pybind11::literals;
0032 
0033 using namespace Acts;
0034 using namespace ActsExamples;
0035 using namespace ActsPlugins;
0036 using namespace ActsPython;
0037 
0038 PYBIND11_MODULE(ActsExamplesPythonBindingsSvg, svg) {
0039   // Components from the ActsExamples - part of acts.examples
0040   {
0041     using Writer = SvgTrackingGeometryWriter;
0042     auto w =
0043         py::class_<Writer, std::shared_ptr<Writer>>(svg,
0044                                                     "SvgTrackingGeometryWriter")
0045             .def(py::init<const Writer::Config&, Logging::Level>(),
0046                  py::arg("config"), py::arg("level"))
0047             .def("write",
0048                  py::overload_cast<const AlgorithmContext&,
0049                                    const TrackingGeometry&>(&Writer::write));
0050 
0051     auto c = py::class_<Writer::Config>(w, "Config").def(py::init<>());
0052     ACTS_PYTHON_STRUCT(c, outputDir, converterOptions);
0053   }
0054   {
0055     using Writer = SvgPointWriter<SimSpacePoint>;
0056     auto w =
0057         py::class_<Writer, IWriter, std::shared_ptr<Writer>>(
0058             svg, "SvgSimSpacePointWriter")
0059             .def(py::init<const Writer::Config&, Logging::Level>(),
0060                  py::arg("config"), py::arg("level"))
0061             .def("write",
0062                  py::overload_cast<const AlgorithmContext&>(&Writer::write));
0063 
0064     auto c = py::class_<Writer::Config>(w, "Config").def(py::init<>());
0065     ACTS_PYTHON_STRUCT(c, writerName, trackingGeometry, inputCollection,
0066                        infoBoxTitle, outputDir);
0067   }
0068 
0069   {
0070     using Writer = SvgPointWriter<SimHit, AccessorPositionXYZ>;
0071     auto w =
0072         py::class_<Writer, IWriter, std::shared_ptr<Writer>>(svg,
0073                                                              "SvgSimHitWriter")
0074             .def(py::init<const Writer::Config&, Logging::Level>(),
0075                  py::arg("config"), py::arg("level"))
0076             .def("write",
0077                  py::overload_cast<const AlgorithmContext&>(&Writer::write));
0078 
0079     auto c = py::class_<Writer::Config>(w, "Config").def(py::init<>());
0080     ACTS_PYTHON_STRUCT(c, writerName, trackingGeometry, inputCollection,
0081                        infoBoxTitle, outputDir);
0082   }
0083 }