From 04c97f269fc732127c4c7e526b4952b312e62f16 Mon Sep 17 00:00:00 2001 From: Andreas Salzburger Date: Tue, 19 Nov 2024 15:41:31 +0100 Subject: [PATCH] make DD4hepGeometryContext not inhert from GeometryContext --- .../Plugins/DD4hep/DD4hepDetectorElement.hpp | 8 +++++++- .../Plugins/DD4hep/DD4hepGeometryContext.hpp | 7 +------ Plugins/DD4hep/src/DD4hepDetectorElement.cpp | 16 +++++++++++----- Plugins/DD4hep/src/DD4hepGeometryContext.cpp | 2 +- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepDetectorElement.hpp b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepDetectorElement.hpp index 94bd844c1a2..2b3ade4098e 100644 --- a/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepDetectorElement.hpp +++ b/Plugins/DD4hep/include/Acts/Plugins/DD4hep/DD4hepDetectorElement.hpp @@ -9,6 +9,7 @@ #pragma once #include "Acts/Geometry/GeometryContext.hpp" +#include "Acts/Plugins/DD4hep/DD4hepGeometryContext.hpp" #include "Acts/Plugins/TGeo/TGeoDetectorElement.hpp" #include "Acts/Utilities/ThrowAssert.hpp" @@ -42,7 +43,7 @@ class DD4hepDetectorElement : public TGeoDetectorElement { using DD4hepVolumeID = dd4hep::DDSegmentation::VolumeID; /// Broadcast the context type - using ContextType = GeometryContext; + using ContextType = DD4hepGeometryContext; /// Define a string based story using Store = std::map(); - if (dd4hepGtx != nullptr && dd4hepGtx->isActive()) { - return dd4hepGtx->contextualTransform(*this); + if (gctx.hasValue()) { + const DD4hepGeometryContext* dd4hepContext = + gctx.maybeGet(); + if (dd4hepContext != nullptr && dd4hepContext->isActive()) { + return dd4hepContext->contextualTransform(*this); + } } - return TGeoDetectorElement::m_transform; + return nominalTransform(); } + +const Acts::Transform3& Acts::DD4hepDetectorElement::nominalTransform() const { + return TGeoDetectorElement::m_transform; +}; diff --git a/Plugins/DD4hep/src/DD4hepGeometryContext.cpp b/Plugins/DD4hep/src/DD4hepGeometryContext.cpp index a91a4030b7f..c052a8916c6 100644 --- a/Plugins/DD4hep/src/DD4hepGeometryContext.cpp +++ b/Plugins/DD4hep/src/DD4hepGeometryContext.cpp @@ -13,5 +13,5 @@ const Acts::Transform3& Acts::DD4hepGeometryContext::contextualTransform( const Acts::DD4hepDetectorElement& dElement) const { // Use inactive context as the base transformation state - return dElement.transform(DD4hepGeometryContext::inactive()); + return dElement.nominalTransform(); }