Skip to content

Commit

Permalink
fix: Order of geometry Id/material assignment in the DetectorBuilder (a…
Browse files Browse the repository at this point in the history
…cts-project#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 authored 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
Original file line number Diff line number Diff line change
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.