Skip to content
Snippets Groups Projects
Commit 6ba77936 authored by Charles Leggett's avatar Charles Leggett
Browse files

Updates for registering Condition Objects

parent 6626597e
No related branches found
No related tags found
No related merge requests found
......@@ -307,6 +307,6 @@ CLASS_DEF(CaloLocalHadCoeff, 29079131, 1)
#include "AthenaKernel/CondCont.h"
CLASS_DEF( CondCont<CaloLocalHadCoeff> , 82862607 , 1 )
REGISTER_CC( CaloLocalHadCoeff )
REGISTER_CC( CaloLocalHadCoeff );
#endif
......@@ -432,7 +432,12 @@ private:
#include "AthenaKernel/CondCont.icc"
#include "AthenaKernel/CondContMaker.h"
#define REGISTER_CC(T) static CondContainer::CondContMaker<T> maker_ ## T{};
#define CONCATUNF_(x,y) x##y
#define CONCATUNF(x,y) CONCATUNF_(x,y)
#define UNIQUEVARNAME CONCATUNF(CONCATUNF(REGCCM_,__COUNTER__),__LINE__)
#define REGISTER_CC(T) static CondContainer::CondContMaker<T> UNIQUEVARNAME {}
#endif // not ATHENAKERNEL_CONDCONT_H
......@@ -32,7 +32,6 @@ public:
// from ICondSvc
public:
virtual StatusCode regHandle(IAlgorithm* alg, const Gaudi::DataHandle& id);
// const std::string& key);
virtual bool getInvalidIDs(const EventContext&, DataObjIDColl& ids);
virtual bool getValidIDs(const EventContext&, DataObjIDColl& ids);
......@@ -86,6 +85,8 @@ private:
};
StatusCode regHandle_i(IAlgorithm* alg, const Gaudi::DataHandle& id);
ServiceHandle<StoreGateSvc> m_sgs;
typedef std::set<IAlgorithm*, iAlgHasher> IAlgHashSet;
......@@ -99,7 +100,8 @@ private:
DataObjIDColl m_condIDs;
mutable std::mutex m_lock;
typedef std::mutex mutex_t;
mutable mutex_t m_lock;
};
......
......@@ -25,6 +25,8 @@
#include "xAODEventInfo/EventInfo.h"
#include "SGTools/BaseInfo.h"
#include "TClass.h"
///////////////////////////////////////////////////////////////////
// Public methods:
///////////////////////////////////////////////////////////////////
......@@ -258,6 +260,12 @@ CondInputLoader::start()
}
CondContBase* cb =
CondContainer::CondContFactory::Instance().Create( ditr->clid(), ditr->key() );
if (cb == 0) {
// try to force a load of libraries using ROOT
TClass::GetClass (tp.c_str());
cb =
CondContainer::CondContFactory::Instance().Create( ditr->clid(), ditr->key() );
}
if (cb == 0) {
ATH_MSG_ERROR("failed to create CondCont<" << tp
<< "> clid=" << ditr->clid()
......
......@@ -6,6 +6,8 @@
#include "GaudiKernel/EventIDBase.h"
#include "GaudiKernel/SvcFactory.h"
#include "AthenaKernel/StoreID.h"
#include "SGTools/BaseInfo.h"
//---------------------------------------------------------------------------
......@@ -60,7 +62,7 @@ CondSvc::initialize() {
void
CondSvc::dump(std::ostream& ost) const {
std::lock_guard<std::mutex> lock(m_lock);
std::lock_guard<mutex_t> lock(m_lock);
ost << "CondSvc::dump()";
......@@ -124,7 +126,16 @@ CondSvc::stop() {
StatusCode
CondSvc::regHandle(IAlgorithm* alg, const Gaudi::DataHandle& dh) {
std::lock_guard<std::mutex> lock(m_lock);
std::lock_guard<mutex_t> lock(m_lock);
return regHandle_i(alg, dh);
}
//---------------------------------------------------------------------------
// separate implementation to avoid the use of a recursive mutex
StatusCode
CondSvc::regHandle_i(IAlgorithm* alg, const Gaudi::DataHandle& dh) {
ATH_MSG_DEBUG( "regHandle: alg: " << alg->name() << " id: "
<< dh.fullKey() );
......@@ -168,7 +179,25 @@ CondSvc::regHandle(IAlgorithm* alg, const Gaudi::DataHandle& dh) {
m_algMap[alg] = DataObjIDColl { dh.fullKey() };
}
return StatusCode::SUCCESS;
StatusCode sc(StatusCode::SUCCESS);
CLID clid = dh.fullKey().clid();
const SG::BaseInfoBase* bib = SG::BaseInfoBase::find( clid );
if ( bib ) {
for (CLID clid2 : bib->get_bases()) {
if (clid2 != clid) {
SG::VarHandleKey vhk(clid2,dh.objKey(),Gaudi::DataHandle::Writer,
StoreID::storeName(StoreID::CONDITION_STORE));
if (regHandle_i(alg, vhk).isFailure()) {
sc = StatusCode::FAILURE;
}
}
}
}
return sc;
}
......@@ -176,7 +205,7 @@ CondSvc::regHandle(IAlgorithm* alg, const Gaudi::DataHandle& dh) {
bool
CondSvc::getInvalidIDs(const EventContext& ctx, DataObjIDColl& invalidIDs) {
std::lock_guard<std::mutex> lock(m_lock);
std::lock_guard<mutex_t> lock(m_lock);
EventIDBase now(ctx.eventID().run_number(), ctx.eventID().event_number());
......@@ -213,7 +242,7 @@ CondSvc::getInvalidIDs(const EventContext& ctx, DataObjIDColl& invalidIDs) {
bool
CondSvc::getIDValidity(const EventContext& ctx, DataObjIDColl& validIDs,
DataObjIDColl& invalidIDs) {
std::lock_guard<std::mutex> lock(m_lock);
std::lock_guard<mutex_t> lock(m_lock);
EventIDBase now(ctx.eventID());
......@@ -252,7 +281,7 @@ CondSvc::getIDValidity(const EventContext& ctx, DataObjIDColl& validIDs,
bool
CondSvc::getValidIDs(const EventContext& ctx, DataObjIDColl& validIDs) {
std::lock_guard<std::mutex> lock(m_lock);
std::lock_guard<mutex_t> lock(m_lock);
EventIDBase now(ctx.eventID());
......@@ -288,7 +317,7 @@ CondSvc::getValidIDs(const EventContext& ctx, DataObjIDColl& validIDs) {
bool
CondSvc::isValidID(const EventContext& ctx, const DataObjID& id) const {
std::lock_guard<std::mutex> lock(m_lock);
std::lock_guard<mutex_t> lock(m_lock);
EventIDBase now(ctx.eventID());
......@@ -301,10 +330,14 @@ CondSvc::isValidID(const EventContext& ctx, const DataObjID& id) const {
if (m_sgs->contains<CondContBase>( sk ) ) {
CondContBase *cib;
if (m_sgs->retrieve(cib, sk).isSuccess()) {
ATH_MSG_DEBUG("CondSvc::isValidID: now: " << ctx.eventID() << " id : "
<< id << ": T");
return cib->valid(now);
}
}
ATH_MSG_DEBUG("CondSvc::isValidID: now: " << ctx.eventID() << " id: "
<< id << " : F");
return false;
}
......
......@@ -198,7 +198,7 @@ CLASS_DEF(CondAttrListCollection, 1238547719, 0)
#include "AthenaKernel/CondCont.h"
CLASS_DEF( CondCont<CondAttrListCollection>, 1223307417 , 1 )
REGISTER_CC( CondAttrListCollection )
REGISTER_CC( CondAttrListCollection );
//<<<<<< INLINE PUBLIC FUNCTIONS >>>>>>
//<<<<<< INLINE MEMBER FUNCTIONS >>>>>>
......
......@@ -69,5 +69,6 @@ CLASS_DEF(AthenaAttributeList, 40774348, 0)
#include "AthenaKernel/CondCont.h"
CLASS_DEF( CondCont<AthenaAttributeList>, 211215482 , 0)
REGISTER_CC( AthenaAttributeList );
#endif // PERSISTENTDATAMODEL_ATHENAATTRIBUTELIST_H
......@@ -74,8 +74,7 @@ class DetCondCFloat {
CLASS_DEF(DetCondCFloat,247459965,1)
CLASS_DEF( CondCont<DetCondCFloat> , 85257013 , 1 )
REGISTER_CC( DetCondCFloat )
REGISTER_CC( DetCondCFloat );
// inline functions for DetCondCFloat
......
......@@ -38,6 +38,6 @@ class LArHVScaleCorrComplete: public ILArHVScaleCorr ,
CONDCONT_BASE(LArHVScaleCorrComplete,ILArHVScaleCorr);
CLASS_DEF( LArHVScaleCorrComplete, 220593802,1)
CLASS_DEF( CondCont<LArHVScaleCorrComplete> , 84955454 , 1 )
REGISTER_CC( LArHVScaleCorrComplete )
REGISTER_CC( LArHVScaleCorrComplete );
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment