ATLAS Offline Software
Loading...
Searching...
No Matches
CompressedLayerMaterialCnv_p1.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
6// CompressedLayerMaterialCnv_p1.cxx, (c) ATLAS Detector software
13
14
17 MsgStream &mlog )
18{
19 // create the transient BinUtility
20 auto binUtility = std::make_unique<Trk::BinUtility>();
21 m_gBinUtilityCnv.persToTrans(&persObj->binUtility, binUtility.get(), mlog);
22
23 // create the persistent material properties
24 // pointer to converter (will be auto-retrieved)
25 ITPConverterFor<Trk::MaterialProperties> *materialCnv = nullptr;
27 mvec.reserve (persObj->materialVector.size());
28 for (const TPObjRef& ref : persObj->materialVector)
29 mvec.push_back (createTransFromPStore( &materialCnv, ref, mlog ));
30
31 Trk::CompressedLayerMaterial mat (std::move(binUtility),
32 std::move(mvec),
33 persObj->materialBins,
34 persObj->splitFactor);
35 *transObj = mat;
36}
37
40 MsgStream &mlog )
41{
42
43 // create the persistent BinUtility
44 m_gBinUtilityCnv.transToPers(transObj->binUtility(), &persObj->binUtility, mlog);
45
46 // assign the material bins
47 persObj->materialBins = transObj->materialBins();
48
49 // create the persistent material properties
50 // pointer to converter (will be auto-retrieved)
51 ITPConverterFor<Trk::MaterialProperties> *materialCnv = nullptr;
52 const Trk::MaterialPropertiesVector& fullMaterial = transObj->fullMaterial();
53 size_t sz = fullMaterial.size();
54 persObj->materialVector = std::vector< TPObjRef >(sz, TPObjRef());
55 for (size_t im = 0; im < sz; im++) {
56 persObj->materialVector[im] = toPersistent( &materialCnv, fullMaterial[im], mlog );
57 }
58 persObj->splitFactor = transObj->alongPostFactor();
59
60
61}
const boost::regex ref(r_ef)
static Double_t sz
void persToTrans(const Trk::CompressedLayerMaterial_p1 *, Trk::CompressedLayerMaterial *, MsgStream &)
void transToPers(const Trk::CompressedLayerMaterial *, Trk::CompressedLayerMaterial_p1 *, MsgStream &)
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
This class is an object reference used in Athena persistent data model.
Definition TPObjRef.h:20
std::vector< unsigned short int > materialBins
It extends the LayerMaterialProperties base class.
const std::vector< unsigned short int > & materialBins() const
Return method for index vector, needs BinUtility to interpret this.
const MaterialPropertiesVector & fullMaterial() const
Return method for full material description of the Layer - for all bins.
virtual const BinUtility * binUtility() const override final
Return the BinUtility.
double alongPostFactor() const
Return method for post update material description of the Layer along normalvector.
std::vector< const MaterialProperties * > MaterialPropertiesVector
Useful typedefs.