ATLAS Offline Software
ElementTableCnv_p1.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // ElementTableCnv_p1.cxx, (c) ATLAS Detector software
8 
10 #include "TrkGeometry/Material.h"
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( pMaterial );
37  persObj->names.push_back( transObj->elementName(im) );
38  }
39  }
40 }
ElementTable.h
Trk::ElementTable::elementName
const std::string & elementName(unsigned int Z) const
Get the element name.
Definition: ElementTable.h:73
Trk::Material_p1
Definition: Material_p1.h:32
Trk::ElementTable::contains
bool contains(unsigned int Z) const
quick check
Definition: ElementTable.h:93
python.atlas_oh.im
im
Definition: atlas_oh.py:167
MaterialCnv_p1::persToTrans
virtual void persToTrans(const Trk::Material_p1 *persObj, Trk::Material *transObj, MsgStream &log)
Definition: MaterialCnv_p1.cxx:12
ElementTable_p1.h
Trk::ElementTable::element
const Material * element(unsigned int Z) const
Get the material.
Definition: ElementTable.h:71
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:134
Trk::ElementTable_p1::table
std::vector< Material_p1 > table
Definition: ElementTable_p1.h:32
ElementTableCnv_p1.h
Trk::ElementTable_p1::names
std::vector< std::string > names
Definition: ElementTable_p1.h:33
MaterialCnv_p1.h
Trk::ElementTable
Definition: ElementTable.h:24
ElementTableCnv_p1::m_materialCnv
MaterialCnv_p1 m_materialCnv
Definition: ElementTableCnv_p1.h:33
ElementTableCnv_p1::persToTrans
virtual void persToTrans(const Trk::ElementTable_p1 *persObj, Trk::ElementTable *transObj, MsgStream &log)
Definition: ElementTableCnv_p1.cxx:15
Trk::ElementTable_p1
Definition: ElementTable_p1.h:25
MaterialCnv_p1::transToPers
virtual void transToPers(const Trk::Material *transObj, Trk::Material_p1 *persObj, MsgStream &log)
Definition: MaterialCnv_p1.cxx:34
Material.h
Trk::ElementTable::size
size_t size() const
Print the table size.
Definition: ElementTable.h:96
Trk::ElementTable::addElement
void addElement(const Material &mat, const std::string &mname="")
Add material to the Table - if the elment is already filled ignore.
Definition: ElementTable.h:75