ATLAS Offline Software
Loading...
Searching...
No Matches
ElementTableCnv_p1.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6// ElementTableCnv_p1.cxx, (c) ATLAS Detector software
8
14
16 Trk::ElementTable *transObj,
17 MsgStream& mlog)
18{
19 // create the transient representation of the element table
20 for (size_t im = 0; im < persObj->table.size(); ++im){
21 auto tMaterial = std::make_unique<Trk::Material>();
22 m_materialCnv.persToTrans( &persObj->table[im], tMaterial.get(), mlog );
23 transObj->addElement (std::move (tMaterial), persObj->names[im]);
24 }
25}
26
28 Trk::ElementTable_p1 *persObj,
29 MsgStream& mlog)
30{
31 // create the persistent representation of the element table - only write out what you have
32 for (size_t im = 0; im < transObj->size(); ++im){
33 if (transObj->contains(im)){
34 Trk::Material_p1 pMaterial;
35 m_materialCnv.transToPers( transObj->element(im), &pMaterial, mlog );
36 persObj->table.push_back( std::move(pMaterial) );
37 persObj->names.push_back( transObj->elementName(im) );
38 }
39 }
40}
virtual void persToTrans(const Trk::ElementTable_p1 *persObj, Trk::ElementTable *transObj, MsgStream &log)
MaterialCnv_p1 m_materialCnv
virtual void transToPers(const Trk::ElementTable *transObj, Trk::ElementTable_p1 *persObj, MsgStream &log)
elements & fractions as unsigned char - if filled
std::vector< Material_p1 > table
std::vector< std::string > names
bool contains(unsigned int Z) const
quick check
void addElement(const Material &mat, const std::string &mname="")
Add material to the Table - if the elment is already filled ignore.
size_t size() const
Print the table size.
const Material * element(unsigned int Z) const
Get the material.
const std::string & elementName(unsigned int Z) const
Get the element name.
the persistent object is simply a std::vector<float> where
Definition Material_p1.h:32