ATLAS Offline Software
INav4MomAssocsCnv_p2.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_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 
31 void
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 
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 
77 void
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) {
92  ++j;
93  }
94 
95  // reset element link converters, and provide container name lookup table
96  INav4MomCnv_t::State state (pers->m_contNames);
97  const SG::ThinningCache* cache = SG::getThinningCache();
98 
99  j = 0;
100  pers->m_assocs.resize( trans->size() );
102  INav4MomAssocs::object_iterator endObj = trans->endObject();
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:
INav4MomAssocs
INav4MomAssocs
Definition: EventCommonTPCnv.cxx:32
INav4MomAssocs_p2::ElemLinkVect_t
std::vector< ElementLinkInt_p2 > ElemLinkVect_t
Definition: INav4MomAssocs_p2.h:43
INav4MomAssocs_p2::m_contNames
ElementLinkContNames_p2 m_contNames
container names
Definition: INav4MomAssocs_p2.h:76
AssociationMap::beginObject
object_iterator beginObject() const
begin iterator for objects
ElementLinkCnv_p2::transToPers
void transToPers(State &state, const Link_t &trans, PersLink_t &pers, const SG::ThinningCache *cache, MsgStream &log) const
INav4MomLink_t
INav4MomAssocs::object_link INav4MomLink_t
Definition: INav4MomAssocsCnv_p2.cxx:28
INav4MomAssocs_p2
Definition: INav4MomAssocs_p2.h:29
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
INav4MomAssocsCnv_p2::m_assocStoresCnv
IAssocStoresCnv_t m_assocStoresCnv
converter for DataLink to INav4MomAssocs
Definition: INav4MomAssocsCnv_p2.h:84
INav4MomAssocsCnv_p2::m_inav4MomLinkCnv
INav4MomCnv_t m_inav4MomLinkCnv
converter for ElementLink to INavigable4MomentumCollection
Definition: INav4MomAssocsCnv_p2.h:81
INav4MomAssocs.h
AssociationObjectIterator
object iterator for association maps (internal use only!)
DataLinkCnv_p1::transToPers
virtual void transToPers(const DLink_t *trans, PersDLink_t *pers, MsgStream &log) const override
lumiFormat.i
int i
Definition: lumiFormat.py:85
AssociationMap::endObject
object_iterator endObject() const
end iterator for objects
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
INavigable4MomentumCollection.h
MuonR4::State
CalibratedSpacePoint::State State
Definition: SpacePointCalibrator.cxx:24
DataLinkCnv_p1::persToTrans
virtual void persToTrans(const PersDLink_t *pers, DLink_t *trans, MsgStream &log) const override
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
ElementLinkCnv_p2::persToTrans
void persToTrans(State &state, const PersLink_t &pers, Link_t &trans, MsgStream &log) const
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_p2::AssocElem_t
std::pair< ElementLinkInt_p2, ElemLinkVect_t > AssocElem_t
Definition: INav4MomAssocs_p2.h:45
INav4MomAssocsCnv_p2::persToTrans
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...
Definition: INav4MomAssocsCnv_p2.cxx:32
INav4MomAssocs_p2::m_assocStores
INav4MomStores_t m_assocStores
Definition: INav4MomAssocs_p2.h:78
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_p2::transToPers
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...
Definition: INav4MomAssocsCnv_p2.cxx:78
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
AssociationMap< INavigable4MomentumCollection, INavigable4MomentumCollection >::asso_iterator
AssociationVectorIterator asso_iterator
association iterator type
Definition: AssociationMap.h:81
INav4MomAssocsCnv_p2.h
SG::ThinningCache
Cache thinning decisions for converters.
Definition: ThinningCache.h:48
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
INav4MomAssocs_p2::m_assocs
Assocs_t m_assocs
Definition: INav4MomAssocs_p2.h:77
fitman.k
k
Definition: fitman.py:528
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37