Skip to content

Commit

Permalink
fix: Order of geometry Id/material assignment in the DetectorBuilder (#…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
ssdetlab committed May 8, 2024
1 parent 91e7033 commit 4a8ab5b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions Core/src/Detector/DetectorBuilder.cpp
Expand Up @@ -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");
Expand All @@ -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));
}

0 comments on commit 4a8ab5b

Please sign in to comment.