16#include "GaudiKernel/MsgStream.h"
29 MsgStream &log )
const
34 <<
"Loading INav4MomAssocs from persistent state..."
38 <<
"NULL pointer to StoreGateSvc !!" <<
endmsg
39 <<
"Cannot do anything !!" <<
endmsg;
40 throw std::runtime_error(
"NULL pointer to StoreGateSvc !!");
44 for ( std::vector<std::string>::const_iterator itr = persObj->
m_assocStores.begin();
50 <<
"Could not build DataLink<INav4MomAssocs> from ["
59 std::map<std::string,const INavigable4MomentumCollection*> collections;
61 for ( INav4MomAssocs_p1::ElemLinkVect_t::const_iterator asso = persObj->
m_assocs.begin();
65 const std::pair<std::string,unsigned int>& objLink = asso->first;
66 const std::pair<std::string,unsigned int>& assLink = asso->second;
68 const std::string& objKey = objLink.first;
69 const std::string& assKey = assLink.first;
71 log << MSG::DEBUG <<
"\tobjLink=" << objKey <<
", " << objLink.second <<
endmsg;
72 log << MSG::DEBUG <<
"\tassLink=" << assKey <<
", " << assLink.second <<
endmsg;
74 if ( collections.find(objKey) == collections.end() ) {
76 collections[objKey] = 0;
77 if (
m_storeGate->retrieve( coll, objKey ).isFailure() ||
80 <<
"Could not retrieve INavigable4MomentumCollection at : "
83 throw std::runtime_error(
"Could not retrieve an INavigable4MomentumCollection");
86 <<
"Successfully retrieve INav4MomCollection at : "
90 collections[objKey] = coll;
93 if ( collections.find(assKey) == collections.end() ) {
95 if (
m_storeGate->retrieve( coll, assKey ).isFailure() ||
98 <<
"Could not retrieve INavigable4MomentumCollection at : "
101 throw std::runtime_error(
"Could not retrieve an INavigable4MomentumCollection");
104 <<
"Successfully retrieve INav4MomCollection at : "
108 collections[assKey] = coll;
112 collections[assKey], assLink.second );
117 <<
"Loaded INav4MomAssocs from persistent state [OK]"
125 MsgStream &log )
const
128 <<
"Creating persistent state of INav4MomAssocs..."
138 for (; begObj != endObj; ++begObj)
144 for (; begAsso != endAsso; ++begAsso) {
148 persObj->
m_assocs.emplace_back( keyElem, assoElem );
153 <<
"Created persistent state of INav4MomAssocs [OK]"
DataVector< INavigable4Momentum > INavigable4MomentumCollection
AssociationObjectIterator object_iterator
ElementLink< asso_container_type > asso_link
object_iterator endObject() const
end iterator for objects
AssociationVectorIterator asso_iterator
ElementLink< object_container_type > object_link
void addAssociation(const object_container_type *objectContainer, const object_index_type &objectIndex, const asso_container_type *assoContainer, const asso_index_type &assoIndex)
object_iterator beginObject() const
begin iterator for objects
Object reference supporting deferred reading from StoreGate.
bool isValid() const
Test to see if the link is dereferencable.
const ID_type & dataID() const
Get the key that we reference, as a string.
index_type index() const
Get the index of the element inside of its container.
virtual void transToPers(const INav4MomAssocs *transObj, INav4MomAssocs_p1 *persObj, MsgStream &log) const override
Method creating the persistent representation INav4MomAssocs_p1 from its transient representation INa...
StoreGateSvc * m_storeGate
Pointer to the StoreGateSvc: we need this as we'll have to fetch the INav4MomAssocs which is the pare...
virtual void persToTrans(const INav4MomAssocs_p1 *persObj, INav4MomAssocs *transObj, MsgStream &log) const override
Method creating the transient representation of INav4MomAssocs from its persistent representation INa...
std::pair< Elem_t, Elem_t > ElemLink_t
INav4MomStores_t m_assocStores
std::pair< std::string, unsigned int > Elem_t
void addAssocStore(const DataLink< INav4MomAssocs > &assocStore)
Retrieve all the associated-to objects which have been associated to the given.
std::vector< DataLink< INav4MomAssocs > > getAssocStores() const
Return links to all other association stores.