ATLAS Offline Software
Loading...
Searching...
No Matches
INav4MomAssocsCnv_p2.cxx
Go to the documentation of this file.
1
2
3/*
4 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
5*/
6
7// INav4MomAssocsCnv_p2.cxx
8// Implementation file for class INav4MomAssocsCnv_p2
9// Author: S.Binet<binet@cern.ch>
11
12
13// STL includes
14
15// Framework includes
16#include "GaudiKernel/MsgStream.h"
17
18// NavFourMom includes
21
22// EventCommonTPCnv includes
24
26
27// some useful typedefs
29
30
31void
33 INav4MomAssocs* trans,
34 MsgStream& msg ) const
35{
36 msg << MSG::DEBUG
37 << "Loading INav4MomAssocs from persistent state..."
38 << endmsg;
39
40 *trans = INav4MomAssocs();
41
42 // retrieve underlying association stores
43 for ( INav4MomAssocs_p2::INav4MomStores_t::const_iterator
44 i = pers->m_assocStores.begin(),
45 iEnd = pers->m_assocStores.end();
46 i != iEnd;
47 ++i )
48 {
50 m_assocStoresCnv.persToTrans( &*i, &dlink, msg );
51 trans->addAssocStore (dlink);
52 }
53
54 // reset element link converters, and provide container name lookup table
55 INav4MomCnv_t::State state (pers->m_contNames);
56
57 for ( std::size_t i = 0, iEnd = pers->m_assocs.size(); i != iEnd; ++i ) {
58 const ElementLinkInt_p2& key = pers->m_assocs[i].first;
59 const INav4MomAssocs_p2::ElemLinkVect_t& val = pers->m_assocs[i].second;
60
62 m_inav4MomLinkCnv.persToTrans( state, key, k, msg );
63
64 for ( std::size_t j = 0, jEnd = val.size(); j != jEnd; ++j ) {
65 INav4MomLink_t assocLink;
66 m_inav4MomLinkCnv.persToTrans( state, val[j], assocLink, msg );
67 trans->addAssociation (k, assocLink);
68 }
69 }
70
71 msg << MSG::DEBUG
72 << "Loaded INav4MomAssocs from persistent state [OK]"
73 << endmsg;
74 return;
75}
76
77void
79 INav4MomAssocs_p2* pers,
80 MsgStream& msg ) const
81{
82 msg << MSG::DEBUG
83 << "Creating persistent state of INav4MomAssocs..."
84 << endmsg;
85
86 // retrieve underlying association stores
87 std::vector<DataLink<INav4MomAssocs> > assocStores = trans->getAssocStores();
88 pers->m_assocStores.resize( assocStores.size() );
89 std::size_t j = 0;
90 for (const DataLink<INav4MomAssocs>& l : assocStores) {
91 m_assocStoresCnv.transToPers( &l, &pers->m_assocStores[j], msg );
92 ++j;
93 }
94
95 // reset element link converters, and provide container name lookup table
96 INav4MomCnv_t::State state (pers->m_contNames);
98
99 j = 0;
100 pers->m_assocs.resize( trans->size() );
103 for (; begObj != endObj; ++begObj)
104 {
105 const INav4MomLink_t& key = begObj.getObjectLink();
106 INav4MomAssocs_p2::AssocElem_t& persAssoc = pers->m_assocs[j];
107 m_inav4MomLinkCnv.transToPers( state, key, persAssoc.first, cache, msg );
108 persAssoc.second.resize( begObj.getNumberOfAssociations() );
109
110 INav4MomAssocs::asso_iterator begAsso = begObj.getFirstAssociation();
111 INav4MomAssocs::asso_iterator endAsso = begObj.getLastAssociation();
112 size_t i = 0;
113 for (; begAsso != endAsso; ++begAsso) {
114 const INav4MomAssocs::asso_link asso = begAsso.getLink();
115 m_inav4MomLinkCnv.transToPers( state, asso, persAssoc.second[i], cache, msg );
116 ++i;
117 }
118
119 ++j;
120 }
121
122 msg << MSG::DEBUG
123 << "Created persistent state of INav4MomAssocs [OK]"
124 << endmsg;
125 return;
126}
127
129// Non-const methods:
131
133// Protected methods:
135
137// Const methods:
139
141// Non-const methods:
#define endmsg
INav4MomAssocs
INav4MomAssocs::object_link INav4MomLink_t
size_t size()
get number of associations
object_iterator endObject() const
end iterator for objects
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
virtual void transToPers(const INav4MomAssocs *trans, INav4MomAssocs_p2 *pers, MsgStream &msg) const override
Method creating the persistent representation INav4MomAssocs_p2 from its transient representation INa...
virtual void persToTrans(const INav4MomAssocs_p2 *pers, INav4MomAssocs *trans, MsgStream &msg) const override
Method creating the transient representation of INav4MomAssocs from its persistent representation INa...
INav4MomCnv_t m_inav4MomLinkCnv
converter for ElementLink to INavigable4MomentumCollection
IAssocStoresCnv_t m_assocStoresCnv
converter for DataLink to INav4MomAssocs
ElementLinkContNames_p2 m_contNames
container names
std::pair< ElementLinkInt_p2, ElemLinkVect_t > AssocElem_t
INav4MomStores_t m_assocStores
std::vector< ElementLinkInt_p2 > ElemLinkVect_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.
Cache thinning decisions for converters.
Helpers to retrieve the current thinning cache from the event context.
const SG::ThinningCache * getThinningCache()
Retrieve the current thinning cache from the current event context.
MsgStream & msg
Definition testRead.cxx:32