Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-17 07:47:15

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 "ActsPlugins/DD4hep/GeometryModuleHelper.hpp"
0010 
0011 #include "Acts/Utilities/Logger.hpp"
0012 
0013 #include <memory>
0014 
0015 namespace ActsPlugins::DD4hep::detail {
0016 
0017 const ActsGeometryModuleV1* getGeometryModule(const char* module_abi_tag,
0018                                               BuildFunction buildFunc) {
0019   static BuildFunction s_buildFunc = buildFunc;
0020 
0021   return Acts::detail::getGeometryModuleFromRaw(
0022       module_abi_tag, "dd4hep::Detector",
0023       [](const void* userData, const void* loggerPtr) noexcept -> void* {
0024         if (loggerPtr == nullptr) {
0025           return nullptr;
0026         }
0027         const auto& logger = *static_cast<const Acts::Logger*>(loggerPtr);
0028         try {
0029           if (userData == nullptr) {
0030             throw std::invalid_argument("DD4hep detector is null");
0031           }
0032           const auto& detector =
0033               *static_cast<const dd4hep::Detector*>(userData);
0034           return s_buildFunc(detector, logger).release();
0035         } catch (const std::exception& e) {
0036           ACTS_ERROR("Failed to build geometry module: " << e.what());
0037           return nullptr;
0038         } catch (...) {
0039           ACTS_ERROR("Failed to build geometry module");
0040           return nullptr;
0041         }
0042       });
0043 }
0044 
0045 }  // namespace ActsPlugins::DD4hep::detail