ATLAS Offline Software
LayerMaterialMapCnv_p1.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // LayerMaterialMapCnv_p1.h, (c) ATLAS Detector software
8 
9 #ifndef LAYERMATERIALMAP_CNV_P1_TRK_H
10 #define LAYERMATERIALMAP_CNV_P1_TRK_H
11 
13 
20 
21 class MsgStream;
22 
23 class LayerMaterialMapCnv_p1 : public T_AthenaPoolTPCnvBase< Trk::LayerMaterialMap, Trk::LayerMaterialMap_p1 >
24 {
25  public:
26 
29 
32 
34  virtual void persToTrans(const Trk::LayerMaterialMap_p1* persMap, Trk::LayerMaterialMap* transMap, MsgStream &mlog) {
35  transMap->clear();
36 
37  // update the element table
38  Trk::ElementTable* eTable = new Trk::ElementTable();
39  m_eTableCnv.persToTrans((&persMap->elementTable), eTable, mlog);
41  transMap->updateElementTable(soeTable);
42 
43  // convert vector entries one by one
44  std::vector<TPObjRef>::const_iterator it = persMap->lmVector.begin();
45  std::vector<TPObjRef>::const_iterator iEnd = persMap->lmVector.end();
46  for (size_t iidx=0 ; it != iEnd; ++it, ++iidx ) {
47  int layIdex = persMap->idxVector[iidx];
49  tProperties->updateElementTable(soeTable);
50  (*transMap)[Trk::LayerIndex(layIdex)] = tProperties;
51  }
52  }
53 
55  virtual void transToPers(const Trk::LayerMaterialMap* transMap, Trk::LayerMaterialMap_p1* persMap, MsgStream &mlog) {
56  persMap->lmVector.clear();
57  persMap->lmVector.reserve( transMap->size() );
58  persMap->idxVector.clear();
59  persMap->idxVector.reserve( transMap->size() );
60  // write out the ElementTable
61  if (transMap->elementTable())
62  m_eTableCnv.transToPers((transMap->elementTable()), &persMap->elementTable,mlog);
63  // convert vector entries one by one
64  for(auto& it : (*transMap) ) {
65  persMap->idxVector.push_back( it.first.value() );
66  persMap->lmVector.push_back( toPersistent( (ITPConverterFor<Trk::LayerMaterialProperties>**)0, it.second, mlog ) );
67  }
68  }
69 
70  protected:
72 
73 };
74 
75 #endif // MATERIAKSTEPCOLLECTION_CNV_P1_TRK_H
LayerMaterialMap_p1.h
LayerMaterialMapCnv_p1::LayerMaterialMapCnv_p1
LayerMaterialMapCnv_p1()
Standard constructor.
Definition: LayerMaterialMapCnv_p1.h:28
ITPConverterFor
Definition: TPConverter.h:37
LayerMaterialMapCnv_p1
Definition: LayerMaterialMapCnv_p1.h:24
Trk::LayerMaterialMap_p1
Definition: LayerMaterialMap_p1.h:20
skel.it
it
Definition: skel.GENtoEVGEN.py:396
TPConverterBase
Definition: TPConverter.h:738
Trk::LayerMaterialMap::updateElementTable
void updateElementTable(const SharedObject< const ElementTable > &eTable)
update method
Definition: LayerMaterialMap.h:66
Trk::LayerMaterialMap
Definition: LayerMaterialMap.h:32
Trk::LayerMaterialMap_p1::elementTable
ElementTable_p1 elementTable
Definition: LayerMaterialMap_p1.h:25
LayerMaterialMapCnv_p1::m_eTableCnv
ElementTableCnv_p1 m_eTableCnv
Definition: LayerMaterialMapCnv_p1.h:71
Trk::LayerMaterialMap::elementTable
const ElementTable * elementTable() const
retrieval method
Definition: LayerMaterialMap.h:63
ElementTableCnv_p1
Definition: ElementTableCnv_p1.h:22
ElementTableCnv_p1::transToPers
virtual void transToPers(const Trk::ElementTable *transObj, Trk::ElementTable_p1 *persObj, MsgStream &log)
Definition: ElementTableCnv_p1.cxx:27
python.InDetPriVxFinderConfig.mlog
mlog
Definition: InDetPriVxFinderConfig.py:139
Trk::LayerIndex
Definition: LayerIndex.h:37
T_AthenaPoolTPConverter.h
Trk::LayerMaterialProperties
Definition: LayerMaterialProperties.h:62
Trk::LayerMaterialProperties::updateElementTable
void updateElementTable(const SharedObject< const ElementTable > &) const
Update the ElementTable.
Definition: LayerMaterialProperties.h:87
SharedObject.h
LayerIndex.h
ElementTableCnv_p1.h
ITPConverterFor::toPersistent
TPObjRef toPersistent(CNV **cnv, const typename CNV::TransBase_t *transObj, MsgStream &log) const
Persistify an object and store the persistent represenation in the storage vector of the top-level pe...
Definition: TPConverter.h:119
LayerMaterialMapCnv_p1::~LayerMaterialMapCnv_p1
~LayerMaterialMapCnv_p1()
Destructor constructor.
Definition: LayerMaterialMapCnv_p1.h:31
Trk::LayerMaterialMap_p1::idxVector
std::vector< int > idxVector
Definition: LayerMaterialMap_p1.h:23
Trk::LayerMaterialMap_p1::lmVector
std::vector< TPObjRef > lmVector
Definition: LayerMaterialMap_p1.h:22
LayerMaterialMap.h
Trk::SharedObject
std::shared_ptr< T > SharedObject
Definition: SharedObject.h:24
Trk::ElementTable
Definition: ElementTable.h:24
LayerMaterialMapCnv_p1::persToTrans
virtual void persToTrans(const Trk::LayerMaterialMap_p1 *persMap, Trk::LayerMaterialMap *transMap, MsgStream &mlog)
persistent to transient
Definition: LayerMaterialMapCnv_p1.h:34
ElementTableCnv_p1::persToTrans
virtual void persToTrans(const Trk::ElementTable_p1 *persObj, Trk::ElementTable *transObj, MsgStream &log)
Definition: ElementTableCnv_p1.cxx:15
LayerMaterialProperties.h
ITPConverterFor::createTransFromPStore
CNV::Trans_t * createTransFromPStore(CNV **cnv, const TPObjRef &ref, MsgStream &log) const
Create transient representation of a persistent object, stored in the the top-level persistent object...
Definition: TPConverter.h:172
LayerMaterialMapCnv_p1::transToPers
virtual void transToPers(const Trk::LayerMaterialMap *transMap, Trk::LayerMaterialMap_p1 *persMap, MsgStream &mlog)
transient to persistent
Definition: LayerMaterialMapCnv_p1.h:55