ATLAS Offline Software
Loading...
Searching...
No Matches
INav4MomAssocsCnv_p3.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_p3.cxx
8// Implementation file for class INav4MomAssocsCnv_p3
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
31#define LOG_MSG(log,lvl,msg) \
32 log << lvl; \
33 if( log.level() <= lvl ) log << lvl << msg << endmsg
34
35void
37 INav4MomAssocs* trans,
38 MsgStream& msg ) const
39{
40 LOG_MSG(msg, MSG::DEBUG, "Loading INav4MomAssocs from persistent state..." );
41
42 *trans = INav4MomAssocs();
43
44 // retrieve underlying association stores
45 for ( INav4MomAssocs_p3::INav4MomStores_t::const_iterator
46 i = pers->m_assocStores.begin(),
47 iEnd = pers->m_assocStores.end();
48 i != iEnd;
49 ++i ) {
51 m_assocStoresCnv.persToTrans( &*i, &dlink, msg );
52 trans->addAssocStore (dlink);
53 }
54
55 for ( std::size_t i = 0, iEnd = pers->m_assocs.size(); i != iEnd; ++i ) {
56 const ElementLinkInt_p3& key = pers->m_assocs[i].first;
57 const INav4MomAssocs_p3::ElemLinkVect_t& val = pers->m_assocs[i].second;
58
60 m_inav4MomLinkCnv.persToTrans( &key, &k, msg );
61
62 for ( std::size_t j = 0, jEnd = val.size(); j != jEnd; ++j ) {
63 INav4MomLink_t assocLink;
64 m_inav4MomLinkCnv.persToTrans( &val[j], &assocLink, msg );
65 trans->addAssociation (k, assocLink);
66 }
67 }
68
69 LOG_MSG(msg, MSG::DEBUG, "Loaded INav4MomAssocs from persistent state [OK]" );
70 return;
71}
72
73
74void
76 INav4MomAssocs_p3* pers,
77 MsgStream& msg ) const
78{
79 LOG_MSG(msg, MSG::DEBUG, "Creating persistent state of INav4MomAssocs...");
80
81 // retrieve underlying association stores
82 std::vector<DataLink<INav4MomAssocs> > assocStores = trans->getAssocStores();
83 pers->m_assocStores.resize( assocStores.size() );
84 std::size_t j = 0;
85 for (const DataLink<INav4MomAssocs>& l : assocStores) {
86 m_assocStoresCnv.transToPers( &l, &pers->m_assocStores[j], msg );
87 ++j;
88 }
89
91
92 j = 0;
93 pers->m_assocs.resize( trans->size() );
96 for (; begObj != endObj; ++begObj)
97 {
98 const INav4MomLink_t& key = begObj.getObjectLink();
99 INav4MomAssocs_p3::AssocElem_t& persAssoc = pers->m_assocs[j];
100 m_inav4MomLinkCnv.transToPers( key, persAssoc.first, cache, msg );
101 persAssoc.second.resize( begObj.getNumberOfAssociations() );
102
103 INav4MomAssocs::asso_iterator begAsso = begObj.getFirstAssociation();
104 INav4MomAssocs::asso_iterator endAsso = begObj.getLastAssociation();
105 size_t i = 0;
106 for (; begAsso != endAsso; ++begAsso) {
107 const INav4MomAssocs::asso_link asso = begAsso.getLink();
108 m_inav4MomLinkCnv.transToPers( asso, persAssoc.second[i], cache, msg );
109 ++i;
110 }
111
112 ++j;
113 }
114
115 LOG_MSG(msg, MSG::DEBUG, "Created persistent state of INav4MomAssocs [OK]");
116 return;
117}
INav4MomAssocs
INav4MomAssocs::object_link INav4MomLink_t
#define LOG_MSG(log, lvl, msg)
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
IAssocStoresCnv_t m_assocStoresCnv
converter for DataLink to INav4MomAssocs
virtual void persToTrans(const INav4MomAssocs_p3 *pers, INav4MomAssocs *trans, MsgStream &msg) const override
Method creating the transient representation of INav4MomAssocs from its persistent representation INa...
virtual void transToPers(const INav4MomAssocs *trans, INav4MomAssocs_p3 *pers, MsgStream &msg) const override
Method creating the persistent representation INav4MomAssocs_p3 from its transient representation INa...
INav4MomCnv_t m_inav4MomLinkCnv
converter for ElementLink to INavigable4MomentumCollection
std::pair< ElementLinkInt_p3, ElemLinkVect_t > AssocElem_t
INav4MomStores_t m_assocStores
std::vector< ElementLinkInt_p3 > 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