1818
1919#include < algorithm>
2020#include < ostream>
21+ #include < ranges>
2122#include < stdexcept>
2223#include < utility>
2324
@@ -128,17 +129,16 @@ Acts::Experimental::CuboidalContainerBuilder::construct(
128129 std::vector<DetectorComponent::PortalContainer> containers;
129130 std::vector<std::shared_ptr<DetectorVolume>> rootVolumes;
130131 // Run through the builders
131- std::for_each (
132- m_cfg.builders .begin (), m_cfg.builders .end (), [&](const auto & builder) {
133- auto [cVolumes, cContainer, cRoots] = builder->construct (gctx);
134- atNavigationLevel = (atNavigationLevel && cVolumes.size () == 1u );
135- ACTS_VERBOSE (" Number of volumes: " << cVolumes.size ());
136- // Collect individual components, volumes, containers, roots
137- volumes.insert (volumes.end (), cVolumes.begin (), cVolumes.end ());
138- containers.push_back (cContainer);
139- rootVolumes.insert (rootVolumes.end (), cRoots.volumes .begin (),
140- cRoots.volumes .end ());
141- });
132+ std::ranges::for_each (m_cfg.builders , [&](const auto & builder) {
133+ auto [cVolumes, cContainer, cRoots] = builder->construct (gctx);
134+ atNavigationLevel = (atNavigationLevel && cVolumes.size () == 1u );
135+ ACTS_VERBOSE (" Number of volumes: " << cVolumes.size ());
136+ // Collect individual components, volumes, containers, roots
137+ volumes.insert (volumes.end (), cVolumes.begin (), cVolumes.end ());
138+ containers.push_back (cContainer);
139+ rootVolumes.insert (rootVolumes.end (), cRoots.volumes .begin (),
140+ cRoots.volumes .end ());
141+ });
142142 // Navigation level detected, connect volumes (cleaner and faster than
143143 // connect containers)
144144 if (atNavigationLevel) {
@@ -161,12 +161,12 @@ Acts::Experimental::CuboidalContainerBuilder::construct(
161161 ACTS_DEBUG (" Assigning geometry ids to the detector" );
162162 auto cache = m_cfg.geoIdGenerator ->generateCache ();
163163 if (m_cfg.geoIdReverseGen ) {
164- std::for_each (rootVolumes. rbegin (), rootVolumes. rend () , [&](auto & v) {
164+ std::ranges:: for_each (rootVolumes, [&](auto & v) {
165165 m_cfg.geoIdGenerator ->assignGeometryId (cache, *v);
166166 ACTS_VERBOSE (" -> Assigning geometry id to volume " << v->name ());
167167 });
168168 } else {
169- std::for_each (rootVolumes. begin (), rootVolumes. end () , [&](auto & v) {
169+ std::ranges:: for_each (rootVolumes, [&](auto & v) {
170170 m_cfg.geoIdGenerator ->assignGeometryId (cache, *v);
171171 ACTS_VERBOSE (" -> Assigning geometry id to volume " << v->name ());
172172 });
0 commit comments