diff --git a/Event/xAOD/xAODEgamma/Root/EgammaTruthxAODHelpers.cxx b/Event/xAOD/xAODEgamma/Root/EgammaTruthxAODHelpers.cxx
index 0d3506586a3d243b5d929ff76638815ee8f646de..7bafae29c31145972105cc4d174998e6ade3db44 100644
--- a/Event/xAOD/xAODEgamma/Root/EgammaTruthxAODHelpers.cxx
+++ b/Event/xAOD/xAODEgamma/Root/EgammaTruthxAODHelpers.cxx
@@ -15,12 +15,50 @@
 
 // ==================================================================
 
-const xAOD::Electron* xAOD::EgammaHelpers::getRecoElectron(const xAOD::TruthParticle* particle){
-  return getLink<xAOD::Electron>(particle, "recoElectronLink");
+/// Accessor for the "recoElectronLink" dynamic variable
+///
+/// It is declared outside of the @c xAOD::EgammaHelpers::getRecoElectron(...)
+/// call to make sure that the auxiliary ID registry would know about this type
+/// as soon as the library holding this code is loaded.
+///
+static const SG::AuxElement::Accessor< ElementLink< xAOD::ElectronContainer > >
+   recoElectronLinkAcc( "recoElectronLink" );
+
+const xAOD::Electron*
+xAOD::EgammaHelpers::getRecoElectron( const xAOD::TruthParticle* particle ) {
+
+   if( ! recoElectronLinkAcc.isAvailable( *particle ) ) {
+      return nullptr;
+   }
+   const ElementLink< xAOD::ElectronContainer >& link =
+      recoElectronLinkAcc( *particle );
+   if( ! link.isValid() ) {
+      return nullptr;
+   }
+   return *link;
 }
 
-const xAOD::Photon* xAOD::EgammaHelpers::getRecoPhoton(const xAOD::TruthParticle* particle){
-  return getLink<xAOD::Photon>(particle, "recoPhotonLink");
+/// Accessor for the "recoPhotonLink" dynamic variable
+///
+/// It is declared outside of the @c xAOD::EgammaHelpers::getRecoPhoton(...)
+/// call to make sure that the auxiliary ID registry would know about this type
+/// as soon as the library holding this code is loaded.
+///
+static const SG::AuxElement::Accessor< ElementLink< xAOD::PhotonContainer > >
+   recoPhotonLinkAcc( "recoPhotonLink" );
+
+const xAOD::Photon*
+xAOD::EgammaHelpers::getRecoPhoton( const xAOD::TruthParticle* particle ) {
+
+   if( ! recoPhotonLinkAcc.isAvailable( *particle ) ) {
+      return nullptr;
+   }
+   const ElementLink< xAOD::PhotonContainer >& link =
+      recoPhotonLinkAcc( *particle );
+   if( ! link.isValid() ) {
+      return nullptr;
+   }
+   return *link;
 }
 // ==================================================================
 
diff --git a/Event/xAOD/xAODEgamma/Root/Egamma_v1.cxx b/Event/xAOD/xAODEgamma/Root/Egamma_v1.cxx
index 32ef4d44e6252e30783f2ca3e805401e63dd98cb..9f5c2e0304077bd374354b6e98220d7dbe734bbe 100644
--- a/Event/xAOD/xAODEgamma/Root/Egamma_v1.cxx
+++ b/Event/xAOD/xAODEgamma/Root/Egamma_v1.cxx
@@ -2,8 +2,6 @@
   Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 */
 
-// $Id: Egamma_v1$
-
 // EDM include(s):
 #include "xAODCore/AuxStoreAccessorMacros.h"
 // Local include(s):
@@ -183,13 +181,26 @@ void Egamma_v1::setAuthor(uint16_t newAuthor) {
   acc(*this) = newAuthor;
 }
 
+/// Accessor for the "ambiguityLink" dynamic variable
+///
+/// It is declared outside of the @c xAOD::Egamma_v1::ambiguousObject() call to
+/// make sure that the auxiliary ID registry would know about this type as soon
+/// as the library holding this code is loaded.
+///
+static const SG::AuxElement::Accessor< ElementLink< xAOD::EgammaContainer > >
+   ambiguityLinkAcc( "ambiguityLink" );
+
 /// ambiguous
-const Egamma_v1* Egamma_v1::ambiguousObject() const{
-  static const SG::AuxElement::Accessor<ElementLink<xAOD::EgammaContainer> > acc("ambiguityLink");
-  if(acc.isAvailable(*this) && acc(*this).isValid()){
-    return (*acc(*this));
-  }
-  return nullptr;
+const Egamma_v1* Egamma_v1::ambiguousObject() const {
+
+   if( ! ambiguityLinkAcc.isAvailable( *this ) ) {
+      return nullptr;
+   }
+   const ElementLink< xAOD::EgammaContainer >& link = ambiguityLinkAcc( *this );
+   if( ! link.isValid() ) {
+      return nullptr;
+   }
+   return *link;
 }