diff --git a/Det/LbDD4hep/include/LbDD4hep/IDD4hepSvc.h b/Det/LbDD4hep/include/LbDD4hep/IDD4hepSvc.h index 4cd1f5412f8c79b1b78a87cd17e6e5f54c5440ec..780a7fe157804fd6f02bd3a09854ec6420ef2889 100644 --- a/Det/LbDD4hep/include/LbDD4hep/IDD4hepSvc.h +++ b/Det/LbDD4hep/include/LbDD4hep/IDD4hepSvc.h @@ -21,6 +21,7 @@ #include <DDCond/ConditionsSlice.h> #include <GaudiKernel/IService.h> #include <Kernel/STLExtensions.h> +#include <algorithm> #include <any> #include <boost/callable_traits.hpp> #include <cstdint> @@ -226,7 +227,11 @@ namespace LHCb::Det::LbDD4hep { } return cond.release(); } - void resolve( dd4hep::Condition, dd4hep::cond::ConditionUpdateContext& ) override {} + void resolve( dd4hep::Condition, dd4hep::cond::ConditionUpdateContext& context ) override { + // This is needed to ensure that the IOV of the derived condition is computed correctly + auto& deps = context.dependency->dependencies; + std::for_each( begin( deps ), end( deps ), [&context]( auto key ) { context.condition( key ); } ); + } private: std::function<void( dd4hep::detail::ConditionObject*, dd4hep::cond::ConditionUpdateContext& )> m_fillCondition; @@ -274,7 +279,12 @@ namespace LHCb::Det::LbDD4hep { return cond.release(); } - void resolve( dd4hep::Condition, dd4hep::cond::ConditionUpdateContext& ) override {} + void resolve( dd4hep::Condition, dd4hep::cond::ConditionUpdateContext& context ) override { + // This is needed to ensure that the IOV of the derived condition is computed correctly + auto& deps = context.dependency->dependencies; + std::for_each( begin( deps ), end( deps ), [&context]( auto key ) { context.condition( key ); } ); + } + /* return the value of the function pointer, as int. used to check whether the ConditiuonCall use the same function pointer */ std::uintptr_t id() const { return m_f; }