From 4a8ab5be8cd182058a2a2efcc70be004fb578214 Mon Sep 17 00:00:00 2001 From: ssdetlab <113530373+ssdetlab@users.noreply.github.com> Date: Wed, 8 May 2024 11:16:51 +0300 Subject: [PATCH] fix: Order of geometry Id/material assignment in the DetectorBuilder (#3176) Putting the `IMaterialDecorator` call after the geometry Id assignment, as the decorators (e.g. `JsonMaterialDecorator`) rely on the Id already being present in the hierarchy map. --- Core/src/Detector/DetectorBuilder.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) 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)); }