ATLAS Offline Software
Loading...
Searching...
No Matches
LayerMaterialMapCnv_p1.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025:$ 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
19
20#include <memory>
21class MsgStream;
22
23class 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
39 m_eTableCnv.persToTrans((&persMap->elementTable), eTable, mlog);
40 std::shared_ptr<const Trk::ElementTable> soeTable(eTable);
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
TPConverterBase< TRANS, PERS > T_AthenaPoolTPCnvBase
Common base class for all TP converters, specialized for a given transient type.
Definition TPConverter.h:37
CNV::Trans_t * createTransFromPStore(CNV **cnv, const TPObjRef &ref, MsgStream &log) const
TPObjRef toPersistent(CNV **cnv, const typename CNV::TransBase_t *transObj, MsgStream &log) const
LayerMaterialMapCnv_p1()
Standard constructor.
~LayerMaterialMapCnv_p1()
Destructor constructor.
virtual void transToPers(const Trk::LayerMaterialMap *transMap, Trk::LayerMaterialMap_p1 *persMap, MsgStream &mlog)
transient to persistent
virtual void persToTrans(const Trk::LayerMaterialMap_p1 *persMap, Trk::LayerMaterialMap *transMap, MsgStream &mlog)
persistent to transient
LayerIndex for the identification of layers in a simplified detector geometry of Cylinders and Discs.
Definition LayerIndex.h:37
std::vector< TPObjRef > lmVector
This class extends the DataVector<Trk::LayerMaterialProperties> by an elementTable;.
const ElementTable * elementTable() const
retrieval method
void updateElementTable(const std::shared_ptr< const ElementTable > &eTable)
update method
This virtual base class encapsulates the logics to build pre/post/full update material for Layer stru...
void updateElementTable(const std::shared_ptr< const ElementTable > &) const
Update the ElementTable.