ATLAS Offline Software
INav4MomToTrackParticleAssocsCnv_p1.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 // INav4MomToTrackParticleAssocsCnv_p1.cxx
8 // Implementation file for class INav4MomToTrackParticleAssocsCnv_p1
9 // Author: Karsten Koeneke
11 
12 
13 // STL includes
14 
15 // Framework includes
16 #include "GaudiKernel/MsgStream.h"
17 
18 // NavFourMom includes
21 
22 // EventCommonTPCnv includes
24 
25 // some useful typedefs
28 
29 
30 #define LOG_MSG(log,lvl,msg) \
31  log << lvl; \
32  if( log.level() <= lvl ) log << lvl << msg << endmsg
33 
34 void
37  MsgStream& msg ) const
38 {
39  LOG_MSG(msg, MSG::DEBUG, "Loading INav4MomToTrackParticleAssocs from persistent state..." );
40 
42 
43  // retrieve underlying association stores
44  for ( INav4MomToTrackParticleAssocs_p1::TrackParticleStores_t::const_iterator
45  i = pers->m_assocStores.begin(),
46  iEnd = pers->m_assocStores.end();
47  i != iEnd;
48  ++i )
49  {
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  {
57  const ElementLinkInt_p3& key = pers->m_assocs[i].first;
59 
62  //unpack only if valid
63  if(k.isValid())
64  {
65  for ( std::size_t j = 0, jEnd = val.size(); j != jEnd; ++j )
66  {
67  TrackParticleLink_t assocLink;
68  m_TrackParticleLinkCnv.persToTrans( &val[j], &assocLink, msg );
69  trans->addAssociation (k, assocLink);
70  }
71  }
72  }
73  LOG_MSG(msg, MSG::DEBUG, "Loaded INav4MomToTrackParticleAssocs from persistent state [OK]" );
74  return;
75 }
76 
77 
78 void
81  MsgStream& msg ) const
82 {
83  LOG_MSG(msg, MSG::DEBUG, "Creating persistent state of INav4MomToTrackParticleAssocs...");
84 
85  // retrieve underlying association stores
86  std::vector<DataLink<INav4MomToTrackParticleAssocs> > assocStores = trans->getAssocStores();
87  pers->m_assocStores.resize( assocStores.size() );
88  std::size_t j = 0;
89  for (const DataLink<INav4MomToTrackParticleAssocs>& l : assocStores) {
91  ++j;
92  }
93 
94  j = 0;
95  pers->m_assocs.resize( trans->size() );
98  for (; begObj != endObj; ++begObj)
99  {
100  const INav4MomLink_t& key = begObj.getObjectLink();
102  m_inav4MomLinkCnv.transToPers( &key, &persAssoc.first, msg );
103  persAssoc.second.resize( begObj.getNumberOfAssociations() );
104 
105  INav4MomToTrackParticleAssocs::asso_iterator begAsso = begObj.getFirstAssociation();
106  INav4MomToTrackParticleAssocs::asso_iterator endAsso = begObj.getLastAssociation();
107  size_t i = 0;
108  for (; begAsso != endAsso; ++begAsso) {
109  const INav4MomToTrackParticleAssocs::asso_link asso = begAsso.getLink();
110  m_TrackParticleLinkCnv.transToPers( &asso, &persAssoc.second[i], msg );
111  ++i;
112  }
113 
114  ++j;
115  }
116 
117  LOG_MSG(msg, MSG::DEBUG, "Created persistent state of INav4MomToTrackParticleAssocs [OK]");
118  return;
119 }
INav4MomToTrackParticleAssocs
Definition: INav4MomToTrackParticleAssocs.h:35
INav4MomToTrackParticleAssocsCnv_p1.h
INav4MomToTrackParticleAssocs::addAssocStore
void addAssocStore(const DataLink< INav4MomToTrackParticleAssocs > &assocStore)
Definition: INav4MomToTrackParticleAssocs.cxx:176
ElementLinkCnv_p3::persToTrans
void persToTrans(const PersLink_t &pers, Link_t &trans, MsgStream &log) const
INav4MomToTrackParticleAssocsCnv_p1::m_assocStoresCnv
IAssocStoresCnv_t m_assocStoresCnv
converter for DataLink to INav4MomAssocs
Definition: INav4MomToTrackParticleAssocsCnv_p1.h:91
AssociationMap::beginObject
object_iterator beginObject() const
begin iterator for objects
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
DataLinkCnv_p2::transToPers
virtual void transToPers(const DLink_t &trans, PersDLink_t &pers, MsgStream &log) const
ElementLinkCnv_p3::transToPers
void transToPers(const Link_t &trans, PersLink_t &pers, const SG::ThinningCache *cache, MsgStream &log) const
AssociationObjectIterator
object iterator for association maps (internal use only!)
INav4MomToTrackParticleAssocs_p1::m_assocStores
TrackParticleStores_t m_assocStores
Definition: INav4MomToTrackParticleAssocs_p1.h:63
lumiFormat.i
int i
Definition: lumiFormat.py:85
AssociationMap::endObject
object_iterator endObject() const
end iterator for objects
INav4MomToTrackParticleAssocsCnv_p1::transToPers
virtual void transToPers(const INav4MomToTrackParticleAssocs *trans, INav4MomToTrackParticleAssocs_p1 *pers, MsgStream &msg) const override
Method creating the persistent representation INav4MomToTrackParticleAssocs_p1 from its transient rep...
Definition: INav4MomToTrackParticleAssocsCnv_p1.cxx:79
INav4MomToTrackParticleAssocsCnv_p1::persToTrans
virtual void persToTrans(const INav4MomToTrackParticleAssocs_p1 *pers, INav4MomToTrackParticleAssocs *trans, MsgStream &msg) const override
Method creating the transient representation of INav4MomToTrackParticleAssocs from its persistent rep...
Definition: INav4MomToTrackParticleAssocsCnv_p1.cxx:35
INav4MomToTrackParticleAssocs_p1::m_assocs
Assocs_t m_assocs
Definition: INav4MomToTrackParticleAssocs_p1.h:62
LOG_MSG
#define LOG_MSG(log, lvl, msg)
Definition: INav4MomToTrackParticleAssocsCnv_p1.cxx:30
INav4MomToTrackParticleAssocs_p1::AssocElem_t
std::pair< ElementLinkInt_p3, ElemLinkVect_t > AssocElem_t
Definition: INav4MomToTrackParticleAssocs_p1.h:41
INav4MomToTrackParticleAssocs_p1::ElemLinkVect_t
std::vector< ElementLinkInt_p3 > ElemLinkVect_t
Definition: INav4MomToTrackParticleAssocs_p1.h:40
INav4MomLink_t
INav4MomToTrackParticleAssocs::object_link INav4MomLink_t
Definition: INav4MomToTrackParticleAssocsCnv_p1.cxx:26
INav4MomToTrackParticleAssocsCnv_p1::m_TrackParticleLinkCnv
TrackParticleCnv_t m_TrackParticleLinkCnv
converter for ElementLink to TrackParticleCollection
Definition: INav4MomToTrackParticleAssocsCnv_p1.h:88
INav4MomToTrackParticleAssocs::getAssocStores
std::vector< DataLink< INav4MomToTrackParticleAssocs > > getAssocStores() const
Return links to all other association stores.
Definition: INav4MomToTrackParticleAssocs.cxx:203
AssociationMap::addAssociation
void addAssociation(const object_container_type *objectContainer, const object_index_type &objectIndex, const asso_container_type *assoContainer, const asso_index_type &assoIndex)
AssociationMap::size
size_t size()
get number of associations
Definition: AssociationMap.h:188
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
DEBUG
#define DEBUG
Definition: page_access.h:11
TrackParticleLink_t
INav4MomToTrackParticleAssocs::asso_link TrackParticleLink_t
Definition: INav4MomToTrackParticleAssocsCnv_p1.cxx:27
INav4MomToTrackParticleAssocs.h
AssociationMap< INavigable4MomentumCollection, Rec::TrackParticleContainer >::asso_iterator
AssociationVectorIterator asso_iterator
association iterator type
Definition: AssociationMap.h:81
INav4MomToTrackParticleAssocsCnv_p1::m_inav4MomLinkCnv
INav4MomCnv_t m_inav4MomLinkCnv
converter for ElementLink to INavigable4MomentumCollection
Definition: INav4MomToTrackParticleAssocsCnv_p1.h:85
INav4MomToTrackParticleAssocs_p1
Definition: INav4MomToTrackParticleAssocs_p1.h:27
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
fitman.k
k
Definition: fitman.py:528
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
TrackParticleContainer.h