Back to home page

EIC code displayed by LXR

 
 

    


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

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 "ActsExamples/DetectorCommons/AlignmentDecorator.hpp"
0010 #include "ActsExamples/DetectorCommons/AlignmentGenerator.hpp"
0011 #include "ActsExamples/Framework/IContextDecorator.hpp"
0012 #include "ActsPython/Utilities/Helpers.hpp"
0013 #include "ActsPython/Utilities/Macros.hpp"
0014 
0015 #include <pybind11/functional.h>
0016 #include <pybind11/pybind11.h>
0017 #include <pybind11/pytypes.h>
0018 #include <pybind11/stl.h>
0019 
0020 namespace py = pybind11;
0021 
0022 using namespace Acts;
0023 using namespace ActsExamples;
0024 using namespace ActsPython;
0025 
0026 PYBIND11_MODULE(ActsExamplesPythonBindingsAlignment, m) {
0027   {
0028     auto ad =
0029         py::class_<AlignmentDecorator, IContextDecorator,
0030                    std::shared_ptr<AlignmentDecorator>>(m, "AlignmentDecorator")
0031             .def(py::init<const AlignmentDecorator::Config&, Logging::Level>())
0032             .def("decorate", &AlignmentDecorator::decorate)
0033             .def("name", &AlignmentDecorator::name);
0034 
0035     auto c =
0036         py::class_<AlignmentDecorator::Config>(ad, "Config").def(py::init<>());
0037 
0038     ACTS_PYTHON_STRUCT(c, iovStores, nominalStore, garbageCollection,
0039                        gcInterval, iovGenerators);
0040   }
0041 
0042   {
0043     py::class_<IAlignmentStore, std::shared_ptr<IAlignmentStore>>(
0044         m, "IAlignmentStore");
0045   }
0046 
0047   {
0048     py::class_<GeoIdAlignmentStore, IAlignmentStore,
0049                std::shared_ptr<GeoIdAlignmentStore>>(m, "GeoIdAlignmentStore")
0050         .def(py::init<
0051              const std::unordered_map<GeometryIdentifier, Transform3>&>());
0052   }
0053 
0054   {
0055     py::class_<AlignmentGenerator::Nominal>(m, "AlignmentGeneratorNominal")
0056         .def(py::init<>())
0057         .def("__call__", &AlignmentGenerator::Nominal::operator());
0058   }
0059 
0060   {
0061     py::class_<AlignmentGenerator::GlobalShift>(m,
0062                                                 "AlignmentGeneratorGlobalShift")
0063         .def(py::init<>())
0064         .def_readwrite("shift", &AlignmentGenerator::GlobalShift::shift)
0065         .def_readwrite("randomize", &AlignmentGenerator::GlobalShift::randomize)
0066         .def("__call__", &AlignmentGenerator::GlobalShift::operator());
0067   }
0068 
0069   {
0070     py::class_<AlignmentGenerator::GlobalRotation>(
0071         m, "AlignmentGeneratorGlobalRotation")
0072         .def(py::init<>())
0073         .def_readwrite("axis", &AlignmentGenerator::GlobalRotation::axis)
0074         .def_readwrite("angle", &AlignmentGenerator::GlobalRotation::angle)
0075         .def_readwrite("randomize",
0076                        &AlignmentGenerator::GlobalRotation::randomize)
0077         .def("__call__", &AlignmentGenerator::GlobalRotation::operator());
0078   }
0079 
0080   {
0081     py::class_<AlignmentGenerator::LocalRotation>(
0082         m, "AlignmentGeneratorLocalRotation")
0083         .def(py::init<>())
0084         .def_readwrite("axis", &AlignmentGenerator::LocalRotation::axis)
0085         .def_readwrite("angle", &AlignmentGenerator::LocalRotation::angle)
0086         .def_readwrite("randomize",
0087                        &AlignmentGenerator::LocalRotation::randomize)
0088         .def("__call__", &AlignmentGenerator::LocalRotation::operator());
0089   }
0090 
0091   {
0092     py::class_<AlignmentGenerator::LocalShift>(m,
0093                                                "AlignmentGeneratorLocalShift")
0094         .def(py::init<>())
0095         .def_readwrite("axisDirection",
0096                        &AlignmentGenerator::LocalShift::axisDirection)
0097         .def_readwrite("shift", &AlignmentGenerator::LocalShift::shift)
0098         .def_readwrite("randomize", &AlignmentGenerator::LocalShift::randomize)
0099         .def("__call__", &AlignmentGenerator::LocalShift::operator());
0100   }
0101 }