diff --git a/GeoModelCore/GeoModelHelpers/GeoModelHelpers/getChildNodesWithTrf.h b/GeoModelCore/GeoModelHelpers/GeoModelHelpers/getChildNodesWithTrf.h index 413646006e68886b5cc40319345182e1acc43f4a..6c9fa930a9834d5c66875d29aa182fe5a77f17f8 100644 --- a/GeoModelCore/GeoModelHelpers/GeoModelHelpers/getChildNodesWithTrf.h +++ b/GeoModelCore/GeoModelHelpers/GeoModelHelpers/getChildNodesWithTrf.h @@ -7,6 +7,7 @@ #include "GeoModelKernel/GeoVPhysVol.h" #include "GeoModelKernel/GeoDefinitions.h" +#include <optional> class GeoVolumeCursor; @@ -27,9 +28,10 @@ struct GeoChildNodeWithTrf { bool isAlignable{false}; /// @brief tag whether the physical volume is a full physVol bool isSensitive{false}; - + /// @brief Identifier of the volume. If there's any and no copies are active + std::optional<int> volumeId{std::nullopt}; GeoChildNodeWithTrf() = default; - GeoChildNodeWithTrf(GeoVolumeCursor& curs); + GeoChildNodeWithTrf(GeoVolumeCursor& curs); }; /*** @brief Returns all direct children of a volume with their transform. Equicalent volumes can be summarized. diff --git a/GeoModelCore/GeoModelHelpers/src/getChildNodesWithTrf.cxx b/GeoModelCore/GeoModelHelpers/src/getChildNodesWithTrf.cxx index cdfdce072f7fa3e53539f1631d22b9c2980790e1..f1d8fec4b97f47e3b5367a6fe4c1b1c5a1026980 100644 --- a/GeoModelCore/GeoModelHelpers/src/getChildNodesWithTrf.cxx +++ b/GeoModelCore/GeoModelHelpers/src/getChildNodesWithTrf.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration */ #include <utility> @@ -20,11 +20,11 @@ namespace { volume{curs.getVolume()}, nodeName{curs.getName()}, isAlignable{curs.hasAlignableTransform()}, - isSensitive{typeid(*volume) == typeid(GeoFullPhysVol)} { + isSensitive{typeid(*volume) == typeid(GeoFullPhysVol)}, + volumeId{static_cast<const std::optional<int>&>(curs.getId())} { //// Do not specify a node name if it's a dummy one if (nodeName == dummyNodeName) { nodeName = volume->getLogVol()->getName(); - } } @@ -53,6 +53,7 @@ std::vector <GeoChildNodeWithTrf> getChildrenWithRef(PVConstLink physVol, children.emplace_back(std::move(currentChild)); } else if (prevChild.nCopies == 1) { ++prevChild.nCopies; + prevChild.volumeId = std::nullopt; prevChild.inductionRule = prevChild.transform.inverse() * currentChild.transform; } else if (!transSort.compare(prevChild.inductionRule,