Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:10:06

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2021 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 #include "Acts/ActsVersion.hpp"
0010 #include "Acts/Geometry/GeometryContext.hpp"
0011 #include "Acts/Geometry/GeometryIdentifier.hpp"
0012 #include "Acts/MagneticField/MagneticFieldContext.hpp"
0013 #include "Acts/Plugins/FpeMonitoring/FpeMonitor.hpp"
0014 #include "Acts/Plugins/Python/Utilities.hpp"
0015 #include "Acts/Utilities/CalibrationContext.hpp"
0016 #include "Acts/Utilities/Logger.hpp"
0017 
0018 #include <array>
0019 #include <cstdint>
0020 #include <cstdlib>
0021 #include <limits>
0022 #include <memory>
0023 #include <optional>
0024 #include <stdexcept>
0025 #include <string>
0026 #include <tuple>
0027 #include <unordered_map>
0028 #include <vector>
0029 
0030 #include <pybind11/detail/common.h>
0031 #include <pybind11/functional.h>
0032 #include <pybind11/operators.h>
0033 #include <pybind11/pybind11.h>
0034 #include <pybind11/pytypes.h>
0035 #include <pybind11/stl.h>
0036 #include <pyerrors.h>
0037 
0038 namespace py = pybind11;
0039 using namespace Acts::Python;
0040 
0041 namespace Acts::Python {
0042 void addUnits(Context& ctx);
0043 void addFramework(Context& ctx);
0044 void addLogging(Context& ctx);
0045 void addPdgParticle(Context& ctx);
0046 void addAlgebra(Context& ctx);
0047 void addBinning(Context& ctx);
0048 void addEventData(Context& ctx);
0049 
0050 void addPropagation(Context& ctx);
0051 
0052 void addGeometry(Context& ctx);
0053 void addExperimentalGeometry(Context& ctx);
0054 
0055 void addMagneticField(Context& ctx);
0056 
0057 void addMaterial(Context& ctx);
0058 void addOutput(Context& ctx);
0059 void addDetector(Context& ctx);
0060 void addExampleAlgorithms(Context& ctx);
0061 void addInput(Context& ctx);
0062 void addGenerators(Context& ctx);
0063 void addTruthTracking(Context& ctx);
0064 void addTrackFitting(Context& ctx);
0065 void addTrackFinding(Context& ctx);
0066 void addVertexing(Context& ctx);
0067 void addAmbiguityResolution(Context& ctx);
0068 
0069 // Plugins
0070 void addDigitization(Context& ctx);
0071 void addPythia8(Context& ctx);
0072 void addJson(Context& ctx);
0073 void addHepMC3(Context& ctx);
0074 void addExaTrkXTrackFinding(Context& ctx);
0075 void addSvg(Context& ctx);
0076 void addObj(Context& ctx);
0077 void addOnnx(Context& ctx);
0078 void addOnnxNeuralCalibrator(Context& ctx);
0079 
0080 }  // namespace Acts::Python
0081 
0082 PYBIND11_MODULE(ActsPythonBindings, m) {
0083   Acts::Python::Context ctx;
0084   ctx.modules["main"] = m;
0085   auto mex = m.def_submodule("_examples");
0086   ctx.modules["examples"] = mex;
0087   auto prop = m.def_submodule("_propagator");
0088   ctx.modules["propagation"] = prop;
0089   m.doc() = "Acts";
0090 
0091   m.attr("__version__") =
0092       std::tuple{Acts::VersionMajor, Acts::VersionMinor, Acts::VersionPatch};
0093 
0094   {
0095     auto mv = m.def_submodule("version");
0096 
0097     mv.attr("major") = Acts::VersionMajor;
0098     mv.attr("minor") = Acts::VersionMinor;
0099     mv.attr("patch") = Acts::VersionPatch;
0100 
0101     mv.attr("commit_hash") = Acts::CommitHash;
0102     mv.attr("commit_hash_short") = Acts::CommitHashShort;
0103   }
0104 
0105   addUnits(ctx);
0106   addFramework(ctx);
0107   addLogging(ctx);
0108   addPdgParticle(ctx);
0109   addAlgebra(ctx);
0110   addBinning(ctx);
0111   addEventData(ctx);
0112 
0113   addPropagation(ctx);
0114   addGeometry(ctx);
0115   addExperimentalGeometry(ctx);
0116 
0117   addMagneticField(ctx);
0118   addMaterial(ctx);
0119   addOutput(ctx);
0120   addDetector(ctx);
0121   addExampleAlgorithms(ctx);
0122   addInput(ctx);
0123   addGenerators(ctx);
0124   addTruthTracking(ctx);
0125   addTrackFitting(ctx);
0126   addTrackFinding(ctx);
0127   addVertexing(ctx);
0128   addAmbiguityResolution(ctx);
0129 
0130   addDigitization(ctx);
0131   addPythia8(ctx);
0132   addJson(ctx);
0133   addHepMC3(ctx);
0134   addExaTrkXTrackFinding(ctx);
0135   addObj(ctx);
0136   addSvg(ctx);
0137   addOnnx(ctx);
0138   addOnnxNeuralCalibrator(ctx);
0139 }