ATLAS Offline Software
INav4MomAssocsCnv_p3.cxx
Go to the documentation of this file.
1 
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 
35 void
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 
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 
74 void
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) {
87  ++j;
88  }
89 
90  const SG::ThinningCache* cache = SG::getThinningCache();
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 }
INav4MomAssocsCnv_p3.h
INav4MomAssocs
INav4MomAssocs
Definition: EventCommonTPCnv.cxx:32
ElementLinkCnv_p3::persToTrans
void persToTrans(const PersLink_t &pers, Link_t &trans, MsgStream &log) const
AssociationMap::beginObject
object_iterator beginObject() const
begin iterator for objects
INav4MomAssocsCnv_p3::m_assocStoresCnv
IAssocStoresCnv_t m_assocStoresCnv
converter for DataLink to INav4MomAssocs
Definition: INav4MomAssocsCnv_p3.h:81
INav4MomAssocsCnv_p3::m_inav4MomLinkCnv
INav4MomCnv_t m_inav4MomLinkCnv
converter for ElementLink to INavigable4MomentumCollection
Definition: INav4MomAssocsCnv_p3.h:78
DataLinkCnv_p2::persToTrans
virtual void persToTrans(const PersDLink_t &pers, DLink_t &trans, MsgStream &log) const
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
INav4MomAssocs_p3::m_assocs
Assocs_t m_assocs
Definition: INav4MomAssocs_p3.h:71
DataLinkCnv_p2::transToPers
virtual void transToPers(const DLink_t &trans, PersDLink_t &pers, MsgStream &log) const
INav4MomAssocs_p3
Definition: INav4MomAssocs_p3.h:27
ElementLinkCnv_p3::transToPers
void transToPers(const Link_t &trans, PersLink_t &pers, const SG::ThinningCache *cache, MsgStream &log) const
INav4MomAssocs_p3::AssocElem_t
std::pair< ElementLinkInt_p3, ElemLinkVect_t > AssocElem_t
Definition: INav4MomAssocs_p3.h:42
INav4MomAssocs.h
AssociationObjectIterator
object iterator for association maps (internal use only!)
lumiFormat.i
int i
Definition: lumiFormat.py:85
AssociationMap::endObject
object_iterator endObject() const
end iterator for objects
INavigable4MomentumCollection.h
getThinningCache.h
Helpers to retrieve the current thinning cache from the event context.
INav4MomAssocs
Definition: INav4MomAssocs.h:33
SG::getThinningCache
const SG::ThinningCache * getThinningCache(const EventContext &ctx)
Retrieve the current thinning cache from the event context.
Definition: getThinningCache.cxx:28
INav4MomAssocs::addAssocStore
void addAssocStore(const DataLink< INav4MomAssocs > &assocStore)
Retrieve all the associated-to objects which have been associated to the given.
Definition: INav4MomAssocs.cxx:178
INav4MomAssocs::getAssocStores
std::vector< DataLink< INav4MomAssocs > > getAssocStores() const
Return links to all other association stores.
Definition: INav4MomAssocs.cxx:188
AssociationMap::addAssociation
void addAssociation(const object_container_type *objectContainer, const object_index_type &objectIndex, const asso_container_type *assoContainer, const asso_index_type &assoIndex)
INav4MomAssocsCnv_p3::transToPers
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...
Definition: INav4MomAssocsCnv_p3.cxx:75
INav4MomAssocs_p3::m_assocStores
INav4MomStores_t m_assocStores
Definition: INav4MomAssocs_p3.h:72
AssociationMap::size
size_t size()
get number of associations
Definition: AssociationMap.h:189
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
DEBUG
#define DEBUG
Definition: page_access.h:11
INav4MomAssocs_p3::ElemLinkVect_t
std::vector< ElementLinkInt_p3 > ElemLinkVect_t
Definition: INav4MomAssocs_p3.h:40
LOG_MSG
#define LOG_MSG(log, lvl, msg)
Definition: INav4MomAssocsCnv_p3.cxx:31
INav4MomLink_t
INav4MomAssocs::object_link INav4MomLink_t
Definition: INav4MomAssocsCnv_p3.cxx:28
INav4MomAssocsCnv_p3::persToTrans
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...
Definition: INav4MomAssocsCnv_p3.cxx:36
AssociationMap< INavigable4MomentumCollection, INavigable4MomentumCollection >::asso_iterator
AssociationVectorIterator asso_iterator
association iterator type
Definition: AssociationMap.h:81
SG::ThinningCache
Cache thinning decisions for converters.
Definition: ThinningCache.h:48
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
fitman.k
k
Definition: fitman.py:528
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37