Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-15 09:25:10

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #include "ActsPlugins/Json/MaterialMapJsonConverter.hpp"
0010 
0011 #include "Acts/Definitions/Tolerance.hpp"
0012 #include "Acts/Geometry/ApproachDescriptor.hpp"
0013 #include "Acts/Geometry/BoundarySurfaceT.hpp"
0014 #include "Acts/Geometry/CuboidVolumeBounds.hpp"
0015 #include "Acts/Geometry/CutoutCylinderVolumeBounds.hpp"
0016 #include "Acts/Geometry/CylinderVolumeBounds.hpp"
0017 #include "Acts/Geometry/GeometryHierarchyMap.hpp"
0018 #include "Acts/Geometry/GeometryIdentifier.hpp"
0019 #include "Acts/Geometry/Layer.hpp"
0020 #include "Acts/Geometry/TrackingGeometry.hpp"
0021 #include "Acts/Geometry/TrackingVolume.hpp"
0022 #include "Acts/Geometry/VolumeBounds.hpp"
0023 #include "Acts/Material/ISurfaceMaterial.hpp"
0024 #include "Acts/Material/IVolumeMaterial.hpp"
0025 #include "Acts/Material/ProtoSurfaceMaterial.hpp"
0026 #include "Acts/Material/ProtoVolumeMaterial.hpp"
0027 #include "Acts/Surfaces/AnnulusBounds.hpp"
0028 #include "Acts/Surfaces/CylinderBounds.hpp"
0029 #include "Acts/Surfaces/RadialBounds.hpp"
0030 #include "Acts/Surfaces/RectangleBounds.hpp"
0031 #include "Acts/Surfaces/Surface.hpp"
0032 #include "Acts/Surfaces/SurfaceArray.hpp"
0033 #include "Acts/Surfaces/SurfaceBounds.hpp"
0034 #include "Acts/Surfaces/TrapezoidBounds.hpp"
0035 #include "Acts/Utilities/BinUtility.hpp"
0036 #include "Acts/Utilities/BinningType.hpp"
0037 #include "Acts/Utilities/Diagnostics.hpp"
0038 #include "ActsPlugins/Json/ITrackingGeometryJsonDecorator.hpp"
0039 #include "ActsPlugins/Json/IVolumeMaterialJsonDecorator.hpp"
0040 #include "ActsPlugins/Json/MaterialJsonConverter.hpp"
0041 #include "ActsPlugins/Json/SurfaceJsonConverter.hpp"
0042 #include "ActsPlugins/Json/SurfaceMaterialJsonConverter.hpp"
0043 #include "ActsPlugins/Json/UtilitiesJsonConverter.hpp"
0044 #include "ActsPlugins/Json/VolumeJsonConverter.hpp"
0045 
0046 #include <algorithm>
0047 #include <cstddef>
0048 #include <map>
0049 #include <numbers>
0050 
0051 // Legacy implementations intentionally call the deprecated material APIs.
0052 ACTS_PUSH_IGNORE_DEPRECATED()
0053 
0054 namespace {
0055 void to_json(nlohmann::json& entry,
0056              const Acts::KeyedSurfaceMaterial& assignment) {
0057   if (assignment.material == nullptr) {
0058     throw std::invalid_argument("Keyed material needs a payload");
0059   }
0060   entry = {{"geometry_id", assignment.geometryId.value()},
0061            {"material",
0062             Acts::SurfaceMaterialJsonConverter::toJson(*assignment.material)}};
0063 }
0064 
0065 void from_json(const nlohmann::json& entry,
0066                Acts::KeyedSurfaceMaterial& assignment) {
0067   assignment.geometryId =
0068       Acts::GeometryIdentifier(entry.at("geometry_id").get<std::uint64_t>());
0069   assignment.material =
0070       Acts::SurfaceMaterialJsonConverter::fromJson(entry.at("material"));
0071   if (!assignment.material) {
0072     throw std::invalid_argument("Keyed material needs a payload");
0073   }
0074 }
0075 }  // namespace
0076 
0077 namespace Acts {
0078 // specialisations of decoration helper function
0079 // to pick correct objects from the container object
0080 template <>
0081 inline void decorateJson<Acts::SurfaceAndMaterialWithContext>(
0082     const ITrackingGeometryJsonDecorator* decorator,
0083     const Acts::SurfaceAndMaterialWithContext& src, nlohmann::json& dest) {
0084   if (decorator != nullptr && std::get<0>(src) != nullptr) {
0085     decorator->decorate(*std::get<0>(src), dest);
0086   }
0087 }
0088 template <>
0089 inline void decorateJson<Acts::TrackingVolumeAndMaterial>(
0090     const ITrackingGeometryJsonDecorator* decorator,
0091     const Acts::TrackingVolumeAndMaterial& src, nlohmann::json& dest) {
0092   if (decorator != nullptr && src.first != nullptr) {
0093     decorator->decorate(*src.first, dest);
0094   }
0095 }
0096 
0097 template <>
0098 inline void decorateJson<Acts::IVolumeMaterial>(
0099     const IVolumeMaterialJsonDecorator* decorator,
0100     const Acts::IVolumeMaterial* src, nlohmann::json& dest) {
0101   if (decorator != nullptr && src != nullptr) {
0102     decorator->decorate(*src, dest);
0103   }
0104 }
0105 }  // namespace Acts
0106 
0107 namespace {
0108 
0109 Acts::SurfaceAndMaterialWithContext defaultSurfaceMaterial(
0110     const std::shared_ptr<const Acts::Surface>& surface,
0111     const Acts::GeometryContext& context) {
0112   if (surface->surfaceMaterialSharedPtr() != nullptr) {
0113     return {surface, surface->surfaceMaterialSharedPtr(), context};
0114   }
0115   Acts::BinUtility bUtility;
0116   // Check which type of bounds is associated to the surface
0117   const Acts::SurfaceBounds& surfaceBounds = surface->bounds();
0118   const Acts::RadialBounds* radialBounds =
0119       dynamic_cast<const Acts::RadialBounds*>(&surfaceBounds);
0120   const Acts::CylinderBounds* cylinderBounds =
0121       dynamic_cast<const Acts::CylinderBounds*>(&surfaceBounds);
0122   const Acts::AnnulusBounds* annulusBounds =
0123       dynamic_cast<const Acts::AnnulusBounds*>(&surfaceBounds);
0124   const Acts::RectangleBounds* rectangleBounds =
0125       dynamic_cast<const Acts::RectangleBounds*>(&surfaceBounds);
0126   const Acts::TrapezoidBounds* trapezoidBounds =
0127       dynamic_cast<const Acts::TrapezoidBounds*>(&surfaceBounds);
0128 
0129   if (radialBounds != nullptr) {
0130     bUtility += Acts::BinUtility(
0131         1,
0132         radialBounds->get(Acts::RadialBounds::eAveragePhi) -
0133             radialBounds->get(Acts::RadialBounds::eHalfPhiSector),
0134         radialBounds->get(Acts::RadialBounds::eAveragePhi) +
0135             radialBounds->get(Acts::RadialBounds::eHalfPhiSector),
0136         (radialBounds->get(Acts::RadialBounds::eHalfPhiSector) -
0137          std::numbers::pi) < Acts::s_epsilon
0138             ? Acts::closed
0139             : Acts::open,
0140         Acts::AxisDirection::AxisPhi);
0141     bUtility += Acts::BinUtility(1, radialBounds->rMin(), radialBounds->rMax(),
0142                                  Acts::open, Acts::AxisDirection::AxisR);
0143   }
0144   if (cylinderBounds != nullptr) {
0145     bUtility += Acts::BinUtility(
0146         1,
0147         cylinderBounds->get(Acts::CylinderBounds::eAveragePhi) -
0148             cylinderBounds->get(Acts::CylinderBounds::eHalfPhiSector),
0149         cylinderBounds->get(Acts::CylinderBounds::eAveragePhi) +
0150             cylinderBounds->get(Acts::CylinderBounds::eHalfPhiSector),
0151         (cylinderBounds->get(Acts::CylinderBounds::eHalfPhiSector) -
0152          std::numbers::pi) < Acts::s_epsilon
0153             ? Acts::closed
0154             : Acts::open,
0155         Acts::AxisDirection::AxisPhi);
0156     bUtility += Acts::BinUtility(
0157         1, -1 * cylinderBounds->get(Acts::CylinderBounds::eHalfLengthZ),
0158         cylinderBounds->get(Acts::CylinderBounds::eHalfLengthZ), Acts::open,
0159         Acts::AxisDirection::AxisZ);
0160   }
0161   if (annulusBounds != nullptr) {
0162     bUtility +=
0163         Acts::BinUtility(1, annulusBounds->get(Acts::AnnulusBounds::eMinPhiRel),
0164                          annulusBounds->get(Acts::AnnulusBounds::eMaxPhiRel),
0165                          Acts::open, Acts::AxisDirection::AxisPhi);
0166     bUtility += Acts::BinUtility(1, static_cast<float>(annulusBounds->rMin()),
0167                                  static_cast<float>(annulusBounds->rMax()),
0168                                  Acts::open, Acts::AxisDirection::AxisR);
0169   }
0170   if (rectangleBounds != nullptr) {
0171     bUtility +=
0172         Acts::BinUtility(1, rectangleBounds->get(Acts::RectangleBounds::eMinX),
0173                          rectangleBounds->get(Acts::RectangleBounds::eMaxX),
0174                          Acts::open, Acts::AxisDirection::AxisX);
0175     bUtility +=
0176         Acts::BinUtility(1, rectangleBounds->get(Acts::RectangleBounds::eMinY),
0177                          rectangleBounds->get(Acts::RectangleBounds::eMaxY),
0178                          Acts::open, Acts::AxisDirection::AxisY);
0179   }
0180   if (trapezoidBounds != nullptr) {
0181     double halfLengthX =
0182         std::max(trapezoidBounds->get(Acts::TrapezoidBounds::eHalfLengthXnegY),
0183                  trapezoidBounds->get(Acts::TrapezoidBounds::eHalfLengthXposY));
0184     bUtility += Acts::BinUtility(1, -1 * halfLengthX, halfLengthX, Acts::open,
0185                                  Acts::AxisDirection::AxisX);
0186     bUtility += Acts::BinUtility(
0187         1, -1 * trapezoidBounds->get(Acts::TrapezoidBounds::eHalfLengthY),
0188         trapezoidBounds->get(Acts::TrapezoidBounds::eHalfLengthY), Acts::open,
0189         Acts::AxisDirection::AxisY);
0190   }
0191   return {surface, std::make_shared<Acts::ProtoSurfaceMaterial>(bUtility),
0192           context};
0193 }
0194 
0195 Acts::TrackingVolumeAndMaterial defaultVolumeMaterial(
0196     const Acts::TrackingVolume* volume) {
0197   Acts::BinUtility bUtility;
0198   if (volume->volumeMaterialPtr() != nullptr) {
0199     return {volume, volume->volumeMaterialPtr()};
0200   }
0201   // Check which type of bound is associated to the volume
0202   auto cyBounds = dynamic_cast<const Acts::CylinderVolumeBounds*>(
0203       &(volume->volumeBounds()));
0204   auto cutcylBounds = dynamic_cast<const Acts::CutoutCylinderVolumeBounds*>(
0205       &(volume->volumeBounds()));
0206   auto cuBounds =
0207       dynamic_cast<const Acts::CuboidVolumeBounds*>(&(volume->volumeBounds()));
0208 
0209   if (cyBounds != nullptr) {
0210     bUtility +=
0211         Acts::BinUtility(1, cyBounds->get(Acts::CylinderVolumeBounds::eMinR),
0212                          cyBounds->get(Acts::CylinderVolumeBounds::eMaxR),
0213                          Acts::open, Acts::AxisDirection::AxisR);
0214     bUtility += Acts::BinUtility(
0215         1, -cyBounds->get(Acts::CylinderVolumeBounds::eHalfPhiSector),
0216         cyBounds->get(Acts::CylinderVolumeBounds::eHalfPhiSector),
0217         (cyBounds->get(Acts::CylinderVolumeBounds::eHalfPhiSector) -
0218          std::numbers::pi) < Acts::s_epsilon
0219             ? Acts::closed
0220             : Acts::open,
0221         Acts::AxisDirection::AxisPhi);
0222     bUtility += Acts::BinUtility(
0223         1, -cyBounds->get(Acts::CylinderVolumeBounds::eHalfLengthZ),
0224         cyBounds->get(Acts::CylinderVolumeBounds::eHalfLengthZ), Acts::open,
0225         Acts::AxisDirection::AxisZ);
0226   }
0227   if (cutcylBounds != nullptr) {
0228     bUtility += Acts::BinUtility(
0229         1, cutcylBounds->get(Acts::CutoutCylinderVolumeBounds::eMinR),
0230         cutcylBounds->get(Acts::CutoutCylinderVolumeBounds::eMaxR), Acts::open,
0231         Acts::AxisDirection::AxisR);
0232     bUtility += Acts::BinUtility(1, -std::numbers::pi_v<float>,
0233                                  std::numbers::pi_v<float>, Acts::closed,
0234                                  Acts::AxisDirection::AxisPhi);
0235     bUtility += Acts::BinUtility(
0236         1, -cutcylBounds->get(Acts::CutoutCylinderVolumeBounds::eHalfLengthZ),
0237         cutcylBounds->get(Acts::CutoutCylinderVolumeBounds::eHalfLengthZ),
0238         Acts::open, Acts::AxisDirection::AxisZ);
0239   } else if (cuBounds != nullptr) {
0240     bUtility += Acts::BinUtility(
0241         1, -cuBounds->get(Acts::CuboidVolumeBounds::eHalfLengthX),
0242         cuBounds->get(Acts::CuboidVolumeBounds::eHalfLengthX), Acts::open,
0243         Acts::AxisDirection::AxisX);
0244     bUtility += Acts::BinUtility(
0245         1, -cuBounds->get(Acts::CuboidVolumeBounds::eHalfLengthY),
0246         cuBounds->get(Acts::CuboidVolumeBounds::eHalfLengthY), Acts::open,
0247         Acts::AxisDirection::AxisY);
0248     bUtility += Acts::BinUtility(
0249         1, -cuBounds->get(Acts::CuboidVolumeBounds::eHalfLengthZ),
0250         cuBounds->get(Acts::CuboidVolumeBounds::eHalfLengthZ), Acts::open,
0251         Acts::AxisDirection::AxisZ);
0252   }
0253   return {volume, std::make_shared<Acts::ProtoVolumeMaterial>(bUtility)};
0254 }
0255 }  // namespace
0256 
0257 Acts::MaterialMapJsonConverter::MaterialMapJsonConverter(
0258     const Acts::MaterialMapJsonConverter::Config& config,
0259     Acts::Logging::Level level)
0260     : m_cfg(config),
0261       m_logger{getDefaultLogger("MaterialMapJsonConverter", level)},
0262       m_volumeMaterialConverter(m_volumeName),
0263       m_volumeConverter(m_volumeName),
0264       m_surfaceMaterialConverter(m_surfaceName),
0265       m_surfaceConverter(m_surfaceName) {}
0266 
0267 /// Convert method
0268 ///
0269 nlohmann::json Acts::MaterialMapJsonConverter::materialMapsToJson(
0270     const TrackingGeometryMaterial& maps,
0271     const IVolumeMaterialJsonDecorator* decorator) {
0272   VolumeMaterialMaps volumeMap = maps.volumeMaterials;
0273   std::vector<std::pair<GeometryIdentifier, const IVolumeMaterial*>>
0274       mapVolumeInit;
0275   for (const auto& [key, value] : volumeMap) {
0276     mapVolumeInit.emplace_back(key, value.get());
0277   }
0278   GeometryHierarchyMap<const IVolumeMaterial*> hierarchyVolumeMap(
0279       mapVolumeInit);
0280   nlohmann::json materialVolume =
0281       m_volumeMaterialConverter.toJson(hierarchyVolumeMap, decorator);
0282   std::vector<std::pair<GeometryIdentifier, nlohmann::json>> surfaceEntries;
0283   for (const auto& [geoId, material] : maps.surfaceMaterials) {
0284     nlohmann::json jEntry;
0285     if (material != nullptr) {
0286       jEntry[jsonKey().materialkey] =
0287           SurfaceMaterialJsonConverter::toJson(*material);
0288       if (decorator != nullptr) {
0289         decorator->decorate(*material, jEntry);
0290       }
0291     }
0292     surfaceEntries.emplace_back(geoId, std::move(jEntry));
0293   }
0294   nlohmann::json materialSurface = m_surfaceMaterialConverter.toJson(
0295       GeometryHierarchyMap<nlohmann::json>(std::move(surfaceEntries)), nullptr);
0296   nlohmann::json materialMap;
0297   materialMap["Volumes"] = materialVolume;
0298   materialMap["Surfaces"] = materialSurface;
0299   if (!maps.keyedSurfaces.empty()) {
0300     nlohmann::json entries = nlohmann::json::array();
0301     for (const auto& [key, assignment] : maps.keyedSurfaces) {
0302       if (key.empty()) {
0303         throw std::invalid_argument("Material key must not be empty");
0304       }
0305       nlohmann::json entry;
0306       ::to_json(entry, assignment);
0307       entry["key"] = key;
0308       if (decorator != nullptr) {
0309         decorator->decorate(*assignment.material, entry);
0310       }
0311       entries.push_back(std::move(entry));
0312     }
0313     materialMap["KeyedSurfaces"] = std::move(entries);
0314   }
0315   return materialMap;
0316 }
0317 
0318 Acts::TrackingGeometryMaterial
0319 Acts::MaterialMapJsonConverter::jsonToMaterialMaps(
0320     const nlohmann::json& materialmap) {
0321   nlohmann::json materialVolume = materialmap["Volumes"];
0322   GeometryHierarchyMap<const IVolumeMaterial*> hierarchyVolumeMap =
0323       m_volumeMaterialConverter.fromJson(materialVolume);
0324   VolumeMaterialMaps volumeMap;
0325   for (std::size_t i = 0; i < hierarchyVolumeMap.size(); i++) {
0326     std::shared_ptr<const IVolumeMaterial> volumePointer(
0327         hierarchyVolumeMap.valueAt(i));
0328     volumeMap.try_emplace(hierarchyVolumeMap.idAt(i), std::move(volumePointer));
0329   }
0330   GeometryHierarchyMap<nlohmann::json> hierarchySurfaceMap =
0331       m_surfaceMaterialConverter.fromJson(materialmap["Surfaces"]);
0332   SurfaceMaterialMaps surfaceMap;
0333   for (std::size_t i = 0; i < hierarchySurfaceMap.size(); i++) {
0334     const nlohmann::json& jEntry = hierarchySurfaceMap.valueAt(i);
0335     if (!jEntry.contains(jsonKey().materialkey) ||
0336         jEntry.at(jsonKey().materialkey).is_null()) {
0337       continue;
0338     }
0339     surfaceMap.try_emplace(hierarchySurfaceMap.idAt(i),
0340                            SurfaceMaterialJsonConverter::fromJson(
0341                                jEntry.at(jsonKey().materialkey)));
0342   }
0343 
0344   Acts::TrackingGeometryMaterial maps = {surfaceMap, volumeMap};
0345 
0346   if (materialmap.contains("KeyedSurfaces")) {
0347     const auto& keyed = materialmap.at("KeyedSurfaces");
0348     if (!keyed.is_array()) {
0349       throw std::invalid_argument("KeyedSurfaces must be an array");
0350     }
0351     for (const auto& entry : keyed) {
0352       const auto key = entry.at("key").get<std::string>();
0353       if (key.empty()) {
0354         throw std::invalid_argument("Material key must not be empty");
0355       }
0356       KeyedSurfaceMaterial assignment;
0357       ::from_json(entry, assignment);
0358       if (!maps.keyedSurfaces.try_emplace(key, std::move(assignment)).second) {
0359         throw std::invalid_argument("Duplicate material key '" + key + "'");
0360       }
0361     }
0362   }
0363   // Return the filled maps
0364   return maps;
0365 }
0366 
0367 nlohmann::json Acts::MaterialMapJsonConverter::trackingGeometryToJson(
0368     const Acts::TrackingGeometry& tGeometry,
0369     const ITrackingGeometryJsonDecorator* decorator) {
0370   std::vector<std::pair<GeometryIdentifier, Acts::TrackingVolumeAndMaterial>>
0371       volumeHierarchy;
0372   std::vector<
0373       std::pair<GeometryIdentifier, Acts::SurfaceAndMaterialWithContext>>
0374       surfaceHierarchy;
0375   convertToHierarchy(volumeHierarchy, surfaceHierarchy,
0376                      tGeometry.highestTrackingVolume());
0377   GeometryHierarchyMap<Acts::TrackingVolumeAndMaterial> hierarchyVolumeMap(
0378       volumeHierarchy);
0379   nlohmann::json jsonVolumes =
0380       m_volumeConverter.toJson(hierarchyVolumeMap, decorator);
0381   GeometryHierarchyMap<Acts::SurfaceAndMaterialWithContext> hierarchySurfaceMap(
0382       surfaceHierarchy);
0383   nlohmann::json jsonSurfaces =
0384       m_surfaceConverter.toJson(hierarchySurfaceMap, decorator);
0385   nlohmann::json hierarchyMap;
0386   hierarchyMap["Volumes"] = jsonVolumes;
0387   hierarchyMap["Surfaces"] = jsonSurfaces;
0388   return hierarchyMap;
0389 }
0390 
0391 void Acts::MaterialMapJsonConverter::convertToHierarchy(
0392     std::vector<std::pair<GeometryIdentifier, Acts::TrackingVolumeAndMaterial>>&
0393         volumeHierarchy,
0394     std::vector<
0395         std::pair<GeometryIdentifier, Acts::SurfaceAndMaterialWithContext>>&
0396         surfaceHierarchy,
0397     const Acts::TrackingVolume* tVolume) {
0398   auto sameId = [tVolume](const auto& pair) {
0399     return (tVolume->geometryId() == pair.first);
0400   };
0401   if (std::ranges::any_of(volumeHierarchy, sameId)) {
0402     // this volume was already visited
0403     return;
0404   }
0405   if ((tVolume->hasMaterial() || m_cfg.processNonMaterial == true) &&
0406       m_cfg.processVolumes == true) {
0407     volumeHierarchy.push_back(
0408         {tVolume->geometryId(), defaultVolumeMaterial(tVolume)});
0409   }
0410   // there are confined volumes
0411   if (tVolume->confinedVolumes() != nullptr) {
0412     // get through the volumes
0413     auto& volumes = tVolume->confinedVolumes()->arrayObjects();
0414     // loop over the volumes
0415     for (auto& vol : volumes) {
0416       // recursive call
0417       convertToHierarchy(volumeHierarchy, surfaceHierarchy, vol.get());
0418     }
0419   }
0420   // there are dense volumes
0421   if (m_cfg.processDenseVolumes && !tVolume->denseVolumes().empty()) {
0422     // loop over the volumes
0423     for (auto& vol : tVolume->denseVolumes()) {
0424       // recursive call
0425       convertToHierarchy(volumeHierarchy, surfaceHierarchy, vol.get());
0426     }
0427   }
0428   if (tVolume->confinedLayers() != nullptr) {
0429     // get the layers
0430     auto& layers = tVolume->confinedLayers()->arrayObjects();
0431     // loop over the layers
0432     for (auto& lay : layers) {
0433       if (m_cfg.processRepresenting == true) {
0434         auto& layRep = lay->surfaceRepresentation();
0435         if ((layRep.hasMaterial() || m_cfg.processNonMaterial == true) &&
0436             layRep.geometryId() != GeometryIdentifier()) {
0437           surfaceHierarchy.push_back(
0438               {layRep.geometryId(),
0439                defaultSurfaceMaterial(layRep.getSharedPtr(), m_cfg.context)});
0440         }
0441       }
0442       if (lay->approachDescriptor() != nullptr &&
0443           m_cfg.processApproaches == true) {
0444         for (auto& asf : lay->approachDescriptor()->containedSurfaces()) {
0445           if (asf->hasMaterial() || m_cfg.processNonMaterial == true) {
0446             surfaceHierarchy.push_back(
0447                 {asf->geometryId(),
0448                  defaultSurfaceMaterial(asf->getSharedPtr(), m_cfg.context)});
0449           }
0450         }
0451       }
0452       if (lay->surfaceArray() != nullptr && m_cfg.processSensitives == true) {
0453         for (auto& ssf : lay->surfaceArray()->surfaces()) {
0454           if (ssf->hasMaterial() || m_cfg.processNonMaterial == true) {
0455             auto sp = ssf->getSharedPtr();
0456             auto sm = defaultSurfaceMaterial(sp, m_cfg.context);
0457             auto id = ssf->geometryId();
0458 
0459             std::pair p{id, sm};
0460             surfaceHierarchy.push_back(p);
0461           }
0462         }
0463       }
0464     }
0465   }
0466   // Let's finally check the boundaries
0467   for (auto& bsurf : tVolume->boundarySurfaces()) {
0468     // the surface representation
0469     auto& bssfRep = bsurf->surfaceRepresentation();
0470     if (bssfRep.geometryId().volume() == tVolume->geometryId().volume() &&
0471         m_cfg.processBoundaries == true) {
0472       if (bssfRep.hasMaterial() || m_cfg.processNonMaterial == true) {
0473         surfaceHierarchy.push_back(
0474             {bssfRep.geometryId(),
0475              defaultSurfaceMaterial(bssfRep.getSharedPtr(), m_cfg.context)});
0476       }
0477     }
0478   }
0479 }
0480 
0481 ACTS_POP_IGNORE_DEPRECATED()