Commit 39fc53c4 authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

Merge branch 'dict2.IOVSvc-20211112' into 'master'

IOVSvc: More dictionary loading fixes.

See merge request atlas/athena!48205
parents a0dfa943 592dcc85
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
# Declare the package name:
atlas_subdir( IOVSvc )
......@@ -14,7 +14,7 @@ atlas_add_library( IOVSvcLib
INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
LINK_LIBRARIES AthenaBaseComps AthenaKernel GaudiKernel SGTools
PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} PersistentDataModel StoreGateLib xAODEventInfo )
PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} PersistentDataModel StoreGateLib xAODEventInfo RootUtils )
atlas_add_component( IOVSvc
src/components/*.cxx
......
......@@ -21,12 +21,15 @@
#include "AthenaKernel/IIOVSvc.h"
#include "StoreGate/CondHandleKey.h"
#include "AthenaKernel/CondContMaker.h"
#include "AthenaKernel/ITPCnvBase.h"
#include "RootUtils/WithRootErrorHandler.h"
#include "xAODEventInfo/EventInfo.h"
#include "AthenaKernel/BaseInfo.h"
#include "ICondSvcSetupDone.h"
#include "TClass.h"
#include "boost/algorithm/string/predicate.hpp"
namespace
......@@ -89,6 +92,7 @@ CondInputLoader::initialize()
ATH_CHECK( m_clidSvc.retrieve() );
ATH_CHECK( m_rcuSvc.retrieve() );
ATH_CHECK( m_dictLoader.retrieve() );
ATH_CHECK( m_tpCnvSvc.retrieve() );
// Trigger read of IOV database
ServiceHandle<IIOVSvc> ivs("IOVSvc",name());
......@@ -127,7 +131,22 @@ CondInputLoader::initialize()
// Loading root dictionaries in a multithreaded environment
// is unreliable.
// So try to be sure all dictionaries are loaded now.
m_dictLoader->load_type (id.clid());
RootType rt = loadDict (id.clid());
// Special case for LArConditionsSubset classes.
if (rt.Class()) {
size_t nbases = rt.BaseSize();
std::string pat = "LArConditionsContainer<";
for (size_t ibase = 0; ibase < nbases; ++ibase) {
std::string basename = rt.BaseAt(ibase).Name();
if (boost::starts_with (basename, pat)) {
std::string subset = "LArConditionsSubset<" + basename.substr (pat.size(), std::string::npos);
loadDict (subset);
loadDict ("LArConditionsSubset_p1");
}
}
}
break; //quit loop over m_load
} // end if CondInputLoader deals with this folder
}//end loop over m_load
......@@ -162,7 +181,7 @@ CondInputLoader::initialize()
StoreID::storeName(StoreID::CONDITION_STORE));
m_load.value().emplace(vhk.fullKey());
// Again, make sure all needed dictionaries are loaded.
m_dictLoader->load_type (clid2);
m_dictLoader->load_type (clid2, true);
}
}
}
......@@ -372,3 +391,30 @@ CondInputLoader::extraDeps_update_handler( Gaudi::Details::PropertyBase& /*Extra
{
// do nothing
}
//-----------------------------------------------------------------------------
RootType CondInputLoader::loadDict (const std::string& name)
{
// First try to load the persistent class dictionary.
std::unique_ptr<ITPCnvBase> tpcnv = m_tpCnvSvc->t2p_cnv_unique (name);
if (tpcnv) {
RootType rtp = m_dictLoader->load_type (tpcnv->persistentTInfo());
if (rtp.Class()) {
return rtp;
}
}
// Otherwise try to load the dictionary for the class itself.
return m_dictLoader->load_type (name);
}
RootType CondInputLoader::loadDict (CLID clid)
{
std::string name;
if (m_clidSvc->getTypeNameOfID (clid, name).isSuccess()) {
return loadDict (name);
}
return RootType();
}
......@@ -17,6 +17,7 @@
#include "AthenaKernel/IIOVSvc.h"
#include "AthenaKernel/IIOVDbSvc.h"
#include "AthenaKernel/IDictLoaderSvc.h"
#include "AthenaKernel/ITPCnvSvc.h"
#include "StoreGate/StoreGateSvc.h"
#include "AthenaBaseComps/AthAlgorithm.h"
#include "PersistentDataModel/AthenaAttributeList.h"
......@@ -47,6 +48,9 @@ class CondInputLoader
// from AthAlgorithm
void extraDeps_update_handler(Gaudi::Details::PropertyBase&);
RootType loadDict (CLID clid);
RootType loadDict (const std::string& name);
/// Containers
Gaudi::Property<DataObjIDColl> m_load{this,"Load",{},
"List of objects to be loaded","OrderedSet<std::vector<std::string> >"};
......@@ -69,6 +73,8 @@ class CondInputLoader
ServiceHandle<Athena::IRCUSvc> m_rcuSvc;
ServiceHandle<IDictLoaderSvc> m_dictLoader
{ this, "DictLoaderSvc", "AthDictLoaderSvc", "" };
ServiceHandle<ITPCnvSvc> m_tpCnvSvc
{ this, "TPCnvSvc", "AthTPCnvSvc", "" };
std::map<std::string,std::string> m_keyFolderMap;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment