diff --git a/Core/src/Detector/DetectorBuilder.cpp b/Core/src/Detector/DetectorBuilder.cpp index 60d83457f42..14894fff52f 100644 --- a/Core/src/Detector/DetectorBuilder.cpp +++ b/Core/src/Detector/DetectorBuilder.cpp @@ -37,16 +37,6 @@ Acts::Experimental::DetectorBuilder::construct( auto [volumes, portals, roots] = m_cfg.builder->construct(gctx); - // Decorate the volumes with material - Surface material only at this moment - if (m_cfg.materialDecorator != nullptr) { - ACTS_DEBUG("Decorating the detector with material"); - std::for_each(volumes.begin(), volumes.end(), [&](auto& v) { - for (auto& sf : v->surfacePtrs()) { - m_cfg.materialDecorator->decorate(*sf); - } - }); - } - // Assign the geometry ids to the detector - if configured if (m_cfg.geoIdGenerator != nullptr) { ACTS_DEBUG("Assigning geometry ids to the detector"); @@ -57,6 +47,16 @@ Acts::Experimental::DetectorBuilder::construct( }); } + // Decorate the volumes with material - Surface material only at this moment + if (m_cfg.materialDecorator != nullptr) { + ACTS_DEBUG("Decorating the detector with material"); + std::for_each(volumes.begin(), volumes.end(), [&](auto& v) { + for (auto& sf : v->surfacePtrs()) { + m_cfg.materialDecorator->decorate(*sf); + } + }); + } + return Detector::makeShared(m_cfg.name, std::move(roots.volumes), std::move(roots.volumeFinder)); }