ATLAS Offline Software
CompoundLayerMaterialCnv_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 // CompoundLayerMaterialCnv_p1.cxx, (c) ATLAS Detector software
11 #include "TrkGeometry/Material.h"
14 
15 
18  MsgStream &mlog )
19 {
20 
21  // create the transient BinUtility
22  transObj->updateBinning (new Trk::BinUtility);
24 
25  // the minimum values
26  transObj->m_thicknessBins.valueMin = persObj->valueMins[0];
27  transObj->m_x0Bins.valueMin = persObj->valueMins[1];
28  transObj->m_l0Bins.valueMin = persObj->valueMins[2];
29  transObj->m_aBins.valueMin = persObj->valueMins[3];
30  transObj->m_zBins.valueMin = persObj->valueMins[4];
31  transObj->m_rhoBins.valueMin = persObj->valueMins[5];
32 
33  // the step values
34  transObj->m_thicknessBins.valueStep = persObj->valueSteps[0];
35  transObj->m_x0Bins.valueStep = persObj->valueSteps[1];
36  transObj->m_l0Bins.valueStep = persObj->valueSteps[2];
37  transObj->m_aBins.valueStep = persObj->valueSteps[3];
38  transObj->m_zBins.valueStep = persObj->valueSteps[4];
39  transObj->m_rhoBins.valueStep = persObj->valueSteps[5];
40 
41  // the matrix values
42  transObj->m_thicknessBins.valueBinMatrix = persObj->valueMatrices[0];
43  transObj->m_x0Bins.valueBinMatrix = persObj->valueMatrices[1];
44  transObj->m_l0Bins.valueBinMatrix = persObj->valueMatrices[2];
45  transObj->m_aBins.valueBinMatrix = persObj->valueMatrices[3];
46  transObj->m_zBins.valueBinMatrix = persObj->valueMatrices[4];
47  transObj->m_rhoBins.valueBinMatrix = persObj->valueMatrices[5];
48 
49  // composition matrix
50  size_t ocBins = persObj->composition.size();
51  if (ocBins){
52  size_t icBins = persObj->composition[0].size();
53  // reserve the right amount
54  transObj->m_composition.reserve(ocBins);
55  for (size_t ioc = 0; ioc < ocBins; ++ioc){
56  transObj->m_composition.emplace_back( );
57  transObj->m_composition[ioc].reserve(icBins);
58  for (size_t iic = 0; iic < icBins; ++iic){
59  const std::vector< std::pair<unsigned char, unsigned char> >& cEntry = persObj->composition[ioc][iic];
60  transObj->m_composition[ioc].emplace_back(cEntry );
61  }
62  }
63  }
64 
65  transObj->resizeMaterialProperties();
66 }
67 
70  MsgStream &mlog )
71 {
72 
73  // create the persistent BinUtility
75 
76  // the minimum values
77  persObj->valueMins.push_back(transObj->m_thicknessBins.valueMin);
78  persObj->valueMins.push_back(transObj->m_x0Bins.valueMin);
79  persObj->valueMins.push_back(transObj->m_l0Bins.valueMin);
80  persObj->valueMins.push_back(transObj->m_aBins.valueMin);
81  persObj->valueMins.push_back(transObj->m_zBins.valueMin);
82  persObj->valueMins.push_back(transObj->m_rhoBins.valueMin);
83 
84  // the step values
85  persObj->valueSteps.push_back(transObj->m_thicknessBins.valueStep);
86  persObj->valueSteps.push_back(transObj->m_x0Bins.valueStep);
87  persObj->valueSteps.push_back(transObj->m_l0Bins.valueStep);
88  persObj->valueSteps.push_back(transObj->m_aBins.valueStep);
89  persObj->valueSteps.push_back(transObj->m_zBins.valueStep);
90  persObj->valueSteps.push_back(transObj->m_rhoBins.valueStep);
91 
92  // the matrix values
93  persObj->valueMatrices.push_back(transObj->m_thicknessBins.valueBinMatrix);
94  persObj->valueMatrices.push_back(transObj->m_x0Bins.valueBinMatrix);
95  persObj->valueMatrices.push_back(transObj->m_l0Bins.valueBinMatrix);
96  persObj->valueMatrices.push_back(transObj->m_aBins.valueBinMatrix);
97  persObj->valueMatrices.push_back(transObj->m_zBins.valueBinMatrix);
98  persObj->valueMatrices.push_back(transObj->m_rhoBins.valueBinMatrix);
99 
100  using CVector = std::vector<std::pair<unsigned char, unsigned char>>;
101  // composition matrix
102  size_t ocBins = transObj->m_composition.size();
103  if (ocBins){
104  size_t icBins = transObj->m_composition[0].size();
105  // reserve the right amoung
106  persObj->composition = std::vector< std::vector < CVector > >(ocBins, std::vector < CVector >(icBins, CVector()) );
107  for (size_t ioc = 0; ioc < ocBins; ++ioc)
108  for (size_t iic=0; iic < icBins; ++iic){
109  persObj->composition[ioc][iic] = CVector();
110  persObj->composition[ioc][iic].reserve(transObj->m_composition[ioc][iic].size());
111  for (const auto& ic : transObj->m_composition[ioc][iic]){
112  persObj->composition[ioc][iic].push_back(ic);
113  }
114 
115  }
116  }
117 }
Trk::CompoundLayerMaterial::m_aBins
ValueStore m_aBins
A parameters (averaged)
Definition: CompoundLayerMaterial.h:129
Trk::CompoundLayerMaterial::m_x0Bins
ValueStore m_x0Bins
x0 parameter
Definition: CompoundLayerMaterial.h:127
Trk::CompoundLayerMaterial::resizeMaterialProperties
void resizeMaterialProperties()
Definition: CompoundLayerMaterial.cxx:162
Trk::ValueStore::valueStep
float valueStep
Definition: CompoundLayerMaterial.h:34
BinUtilityCnv_p1::persToTrans
virtual void persToTrans(const Trk::BinUtility_p1 *persObj, Trk::BinUtility *transObj, MsgStream &log)
Definition: BinUtilityCnv_p1.cxx:10
MaterialProperties.h
Trk::CompoundLayerMaterial_p1::composition
std::vector< std::vector< std::vector< std::pair< unsigned char, unsigned char > > > > composition
Definition: CompoundLayerMaterial_p1.h:40
Trk::CompoundLayerMaterial_p1
Definition: CompoundLayerMaterial_p1.h:24
BinUtility.h
CompoundLayerMaterialCnv_p1::persToTrans
void persToTrans(const Trk::CompoundLayerMaterial_p1 *, Trk::CompoundLayerMaterial *, MsgStream &)
Definition: CompoundLayerMaterialCnv_p1.cxx:16
CompoundLayerMaterialCnv_p1.h
Trk::CompoundLayerMaterial
Definition: CompoundLayerMaterial.h:60
Trk::CompoundLayerMaterial::m_l0Bins
ValueStore m_l0Bins
l0 parameter
Definition: CompoundLayerMaterial.h:128
Trk::CompoundLayerMaterial::updateBinning
virtual void updateBinning(BinUtility *bu) override final
Update the BinUtility if necessary - passing ownership of the utility class.
Definition: CompoundLayerMaterial.h:148
CompoundLayerMaterial.h
Trk::ValueStore::valueBinMatrix
ValueMatrix valueBinMatrix
Definition: CompoundLayerMaterial.h:35
python.InDetPriVxFinderConfig.mlog
mlog
Definition: InDetPriVxFinderConfig.py:134
Trk::BinUtility
Definition: BinUtility.h:39
grepfile.ic
int ic
Definition: grepfile.py:33
Trk::CompoundLayerMaterial::m_binUtility
BinUtility * m_binUtility
the helper for the bin finding
Definition: CompoundLayerMaterial.h:125
CompoundLayerMaterialCnv_p1::transToPers
void transToPers(const Trk::CompoundLayerMaterial *, Trk::CompoundLayerMaterial_p1 *, MsgStream &)
Definition: CompoundLayerMaterialCnv_p1.cxx:68
Trk::CompoundLayerMaterial_p1::valueMatrices
std::vector< ValueMatrix > valueMatrices
Definition: CompoundLayerMaterial_p1.h:38
Trk::CompoundLayerMaterial_p1::binUtility
BinUtility_p1 binUtility
Definition: CompoundLayerMaterial_p1.h:34
Trk::CompoundLayerMaterial_p1::valueSteps
std::vector< float > valueSteps
Definition: CompoundLayerMaterial_p1.h:37
Trk::CompoundLayerMaterial::m_composition
std::vector< std::vector< MaterialComposition > > m_composition
composition matrix
Definition: CompoundLayerMaterial.h:133
Trk::CompoundLayerMaterial::m_thicknessBins
ValueStore m_thicknessBins
thickness parameter
Definition: CompoundLayerMaterial.h:126
Trk::CompoundLayerMaterial::m_rhoBins
ValueStore m_rhoBins
rho parameter (averaged)
Definition: CompoundLayerMaterial.h:131
Trk::CompoundLayerMaterial_p1::valueMins
std::vector< float > valueMins
Definition: CompoundLayerMaterial_p1.h:36
BinUtility_p1.h
Trk::CompoundLayerMaterial::m_zBins
ValueStore m_zBins
Z parameter (averaged)
Definition: CompoundLayerMaterial.h:130
Trk::ValueStore::valueMin
float valueMin
Definition: CompoundLayerMaterial.h:33
BinUtilityCnv_p1::transToPers
virtual void transToPers(const Trk::BinUtility *transObj, Trk::BinUtility_p1 *persObj, MsgStream &log)
Definition: BinUtilityCnv_p1.cxx:52
CompoundLayerMaterialCnv_p1::m_gBinUtilityCnv
BinUtilityCnv_p1 m_gBinUtilityCnv
Definition: CompoundLayerMaterialCnv_p1.h:32
Material.h