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/Utilities/Logger.hpp"
0010 #include "ActsExamples/Digitization/DigitizationAlgorithm.hpp"
0011 #include "ActsExamples/Digitization/DigitizationConfig.hpp"
0012 #include "ActsExamples/Digitization/DigitizationConfigurator.hpp"
0013 #include "ActsExamples/Digitization/DigitizationCoordinatesConverter.hpp"
0014 #include "ActsExamples/Digitization/MuonSpacePointDigitizer.hpp"
0015 #include "ActsPython/Utilities/Helpers.hpp"
0016 #include "ActsPython/Utilities/Macros.hpp"
0017 
0018 #include <array>
0019 #include <memory>
0020 #include <tuple>
0021 #include <utility>
0022 
0023 #include <pybind11/pybind11.h>
0024 #include <pybind11/stl.h>
0025 
0026 namespace py = pybind11;
0027 
0028 using namespace ActsExamples;
0029 using namespace Acts;
0030 
0031 namespace ActsPython {
0032 
0033 void addDigitization(py::module& mex) {
0034   {
0035     using Config = DigitizationAlgorithm::Config;
0036 
0037     auto a =
0038         py::class_<DigitizationAlgorithm, IAlgorithm,
0039                    std::shared_ptr<DigitizationAlgorithm>>(
0040             mex, "DigitizationAlgorithm")
0041             .def(py::init<Config&, Logging::Level>(), py::arg("config"),
0042                  py::arg("level"))
0043             .def_property_readonly("config", &DigitizationAlgorithm::config);
0044 
0045     auto c = py::class_<Config>(a, "Config").def(py::init<>());
0046 
0047     ACTS_PYTHON_STRUCT(
0048         c, inputSimHits, outputMeasurements, outputClusters,
0049         outputMeasurementParticlesMap, outputMeasurementSimHitsMap,
0050         outputParticleMeasurementsMap, outputSimHitMeasurementsMap,
0051         surfaceByIdentifier, randomNumbers, doOutputCells, doClusterization,
0052         doMerge, mergeCommonCorner, minEnergyDeposit, digitizationConfigs,
0053         minMaxRetries);
0054 
0055     c.def_readonly("mergeNsigma", &Config::mergeNsigma);
0056 
0057     patchKwargsConstructor(c);
0058 
0059     auto cc = py::class_<DigiComponentsConfig>(mex, "DigiComponentsConfig")
0060                   .def(py::init<>());
0061 
0062     ACTS_PYTHON_STRUCT(cc, geometricDigiConfig, smearingDigiConfig);
0063 
0064     py::class_<DigiConfigContainer>(mex, "DigiConfigContainer")
0065         .def(py::init<std::vector<
0066                  std::pair<GeometryIdentifier, DigiComponentsConfig>>>());
0067   }
0068 
0069   ACTS_PYTHON_DECLARE_ALGORITHM(
0070       MuonSpacePointDigitizer, mex, "MuonSpacePointDigitizer", inputSimHits,
0071       inputParticles, outputSpacePoints, randomNumbers,
0072       /// @todo: Expose <calibrator> to python bindings
0073       trackingGeometry, digitizeTime, dumpVisualization, strawDeadTime
0074 
0075   );
0076 
0077   {
0078     using DC = DigitizationConfigurator;
0079     auto dc = py::class_<DC>(mex, "DigitizationConfigurator").def(py::init<>());
0080 
0081     dc.def("__call__", &DC::operator());
0082 
0083     ACTS_PYTHON_STRUCT(dc, inputDigiComponents, compactify,
0084                        volumeLayerComponents, outputDigiComponents);
0085   }
0086 
0087   {
0088     py::class_<DigitizationCoordinatesConverter,
0089                std::shared_ptr<DigitizationCoordinatesConverter>>(
0090         mex, "DigitizationCoordinatesConverter")
0091         .def(py::init<DigitizationAlgorithm::Config&>(), py::arg("config"))
0092         .def_property_readonly("config",
0093                                &DigitizationCoordinatesConverter::config)
0094         .def("globalToLocal", &DigitizationCoordinatesConverter::globalToLocal)
0095         .def("localToGlobal", &DigitizationCoordinatesConverter::localToGlobal);
0096   }
0097 }
0098 
0099 }  // namespace ActsPython