File indexing completed on 2025-08-02 07:47:49
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Acts/Plugins/Python/Utilities.hpp"
0010 #include "ActsExamples/DetectorCommons/AlignmentDecorator.hpp"
0011 #include "ActsExamples/DetectorCommons/AlignmentGenerator.hpp"
0012 #include "ActsExamples/Framework/IContextDecorator.hpp"
0013
0014 #include <pybind11/functional.h>
0015 #include <pybind11/pybind11.h>
0016 #include <pybind11/pytypes.h>
0017 #include <pybind11/stl.h>
0018
0019 namespace py = pybind11;
0020 using namespace ActsExamples;
0021
0022 namespace Acts::Python {
0023
0024 void addAlignment(Context& ctx) {
0025 auto [m, mex] = ctx.get("main", "examples");
0026
0027 {
0028 auto ad = py::class_<AlignmentDecorator, IContextDecorator,
0029 std::shared_ptr<AlignmentDecorator>>(
0030 mex, "AlignmentDecorator")
0031 .def(py::init<const AlignmentDecorator::Config&,
0032 Acts::Logging::Level>())
0033 .def("decorate", &AlignmentDecorator::decorate)
0034 .def("name", &AlignmentDecorator::name);
0035
0036 auto c =
0037 py::class_<AlignmentDecorator::Config>(ad, "Config").def(py::init<>());
0038
0039 ACTS_PYTHON_STRUCT(c, iovStores, nominalStore, garbageCollection,
0040 gcInterval, iovGenerators);
0041 }
0042
0043 {
0044 py::class_<IAlignmentStore, std::shared_ptr<IAlignmentStore>>(
0045 mex, "IAlignmentStore");
0046 }
0047
0048 {
0049 py::class_<GeoIdAlignmentStore, IAlignmentStore,
0050 std::shared_ptr<GeoIdAlignmentStore>>(mex, "GeoIdAlignmentStore")
0051 .def(py::init<const std::unordered_map<Acts::GeometryIdentifier,
0052 Acts::Transform3>&>());
0053 }
0054
0055 {
0056 py::class_<AlignmentGenerator::Nominal>(mex, "AlignmentGeneratorNominal")
0057 .def(py::init<>())
0058 .def("__call__", &AlignmentGenerator::Nominal::operator());
0059 }
0060
0061 {
0062 py::class_<AlignmentGenerator::GlobalShift>(mex,
0063 "AlignmentGeneratorGlobalShift")
0064 .def(py::init<>())
0065 .def_readwrite("shift", &AlignmentGenerator::GlobalShift::shift)
0066 .def_readwrite("randomize", &AlignmentGenerator::GlobalShift::randomize)
0067 .def("__call__", &AlignmentGenerator::GlobalShift::operator());
0068 }
0069
0070 {
0071 py::class_<AlignmentGenerator::GlobalRotation>(
0072 mex, "AlignmentGeneratorGlobalRotation")
0073 .def(py::init<>())
0074 .def_readwrite("axis", &AlignmentGenerator::GlobalRotation::axis)
0075 .def_readwrite("angle", &AlignmentGenerator::GlobalRotation::angle)
0076 .def_readwrite("randomize",
0077 &AlignmentGenerator::GlobalRotation::randomize)
0078 .def("__call__", &AlignmentGenerator::GlobalRotation::operator());
0079 }
0080
0081 {
0082 py::class_<AlignmentGenerator::LocalRotation>(
0083 mex, "AlignmentGeneratorLocalRotation")
0084 .def(py::init<>())
0085 .def_readwrite("axis", &AlignmentGenerator::LocalRotation::axis)
0086 .def_readwrite("angle", &AlignmentGenerator::LocalRotation::angle)
0087 .def_readwrite("randomize",
0088 &AlignmentGenerator::LocalRotation::randomize)
0089 .def("__call__", &AlignmentGenerator::LocalRotation::operator());
0090 }
0091
0092 {
0093 py::class_<AlignmentGenerator::LocalShift>(mex,
0094 "AlignmentGeneratorLocalShift")
0095 .def(py::init<>())
0096 .def_readwrite("axisDirection",
0097 &AlignmentGenerator::LocalShift::axisDirection)
0098 .def_readwrite("shift", &AlignmentGenerator::LocalShift::shift)
0099 .def_readwrite("randomize", &AlignmentGenerator::LocalShift::randomize)
0100 .def("__call__", &AlignmentGenerator::LocalShift::operator());
0101 }
0102 }
0103
0104 }