File indexing completed on 2025-09-18 08:13:12
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "ActsExamples/Io/HepMC3/HepMC3InputConverter.hpp"
0010 #include "ActsExamples/Io/HepMC3/HepMC3OutputConverter.hpp"
0011 #include "ActsExamples/Io/HepMC3/HepMC3Reader.hpp"
0012 #include "ActsExamples/Io/HepMC3/HepMC3Util.hpp"
0013 #include "ActsExamples/Io/HepMC3/HepMC3Writer.hpp"
0014 #include "ActsPython/Utilities/Helpers.hpp"
0015 #include "ActsPython/Utilities/Macros.hpp"
0016
0017 #include <pybind11/pybind11.h>
0018 #include <pybind11/stl.h>
0019 #include <pybind11/stl/filesystem.h>
0020
0021 namespace py = pybind11;
0022 using namespace pybind11::literals;
0023
0024 using namespace Acts;
0025 using namespace ActsExamples;
0026
0027 namespace ActsPython {
0028 void addHepMC3(Context& ctx) {
0029 auto [m, mex] = ctx.get("main", "examples");
0030
0031 auto hepmc3 = mex.def_submodule("_hepmc3");
0032
0033 ACTS_PYTHON_DECLARE_WRITER(HepMC3Writer, hepmc3, "HepMC3Writer", outputPath,
0034 perEvent, inputEvent, compression,
0035 maxEventsPending, writeEventsInOrder);
0036
0037 ACTS_PYTHON_DECLARE_READER(HepMC3Reader, hepmc3, "HepMC3Reader", inputPath,
0038 inputPaths, outputEvent, printListing, numEvents,
0039 checkEventNumber, maxEventBufferSize,
0040 vertexGenerator, randomNumbers);
0041
0042 ACTS_PYTHON_DECLARE_ALGORITHM(HepMC3OutputConverter, hepmc3,
0043 "HepMC3OutputConverter", inputParticles,
0044 inputVertices, outputEvent);
0045
0046 ACTS_PYTHON_DECLARE_ALGORITHM(
0047 HepMC3InputConverter, hepmc3, "HepMC3InputConverter", inputEvent,
0048 outputParticles, outputVertices, printListing, checkConsistency,
0049 mergePrimaries, primaryVertexSpatialThreshold, vertexSpatialThreshold,
0050 mergeSecondaries);
0051
0052 {
0053 using enum HepMC3Util::Compression;
0054 py::enum_<HepMC3Util::Compression>(hepmc3, "Compression")
0055 .value("none", none)
0056 .value("zlib", zlib)
0057 .value("lzma", lzma)
0058 .value("bzip2", bzip2)
0059 .value("zstd", zstd);
0060 }
0061
0062 hepmc3.def("availableCompressionModes", []() {
0063 auto modes = HepMC3Util::availableCompressionModes();
0064 return std::vector(modes.begin(), modes.end());
0065 });
0066
0067 hepmc3.def("compressionExtension", &HepMC3Util::compressionExtension);
0068 }
0069 }