ATLAS Offline Software
MaterialPropertiesCnv_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 // MaterialPropertiesCnv_p1.cxx, (c) ATLAS Detector software
8 
9 #include "TrkGeometry/Material.h"
12 
14  Trk::MaterialProperties *transObj,
15  MsgStream&)
16 {
17  transObj->m_material.X0 = persObj->materialData[0];
18  transObj->m_material.L0 = persObj->materialData[1];
19  transObj->m_material.A = persObj->materialData[2];
20  transObj->m_material.Z = persObj->materialData[3];
21  transObj->m_material.rho = persObj->materialData[4];
22 
23  transObj->m_material.zOaTr = transObj->m_material.A *transObj->m_material.A > 10e-10 ?
24  (transObj->m_material.Z/transObj->m_material.A*transObj->m_material.rho) : 0.;
25 
26  if ( persObj->materialData.size() > 6 )
27  transObj->m_material.dEdX = persObj->materialData[6];
28 
29  // recreate the composition vector if possible
30  if ( !persObj->elements.empty() && !persObj->fractions.empty() ) {
31  transObj->m_material.composition = new Trk::MaterialComposition(persObj->elements, persObj->fractions);
32  }
33 
34  // the derived quantities - to be recreated
35  float d = ( persObj->materialData.size()>5 ) ? persObj->materialData[5] : 1.;
36  transObj->m_dInX0 = transObj->m_material.X0*transObj->m_material.X0 > 10e-10 ? (d/transObj->m_material.X0) : 0.;
37  transObj->m_dInL0 = transObj->m_material.L0*transObj->m_material.L0 > 10e-10 ? (d/transObj->m_material.L0) : 0.;
38  transObj->m_zOaTrTd = transObj->m_material.A *transObj->m_material.A > 10e-10 ? (d*transObj->m_material.Z
39  /transObj->m_material.A*transObj->m_material.rho) : 0.;
40 
41 }
42 
45  MsgStream& )
46 {
47  if ( transObj->m_material.dEdX != 0. ){
48  persObj->materialData.resize(7);
49  persObj->materialData[6] = transObj->m_material.dEdX;
50  }
51 
52  persObj->materialData[0] = transObj->m_material.X0 ;
53  persObj->materialData[1] = transObj->m_material.L0 ;
54  persObj->materialData[2] = transObj->m_material.A ;
55  persObj->materialData[3] = transObj->m_material.Z ;
56  persObj->materialData[4] = transObj->m_material.rho;
57  persObj->materialData[5] = transObj->m_dInX0*transObj->m_material.X0;
58 
59  // write the composition vector if present, decompose ElementFraction object
60  if ( transObj->m_material.composition ){
61  persObj->elements.reserve(transObj->m_material.composition->size());
62  persObj->fractions.reserve(transObj->m_material.composition->size());
63  for (auto& iel: (*transObj->m_material.composition)){
64  persObj->elements.push_back(iel.first);
65  persObj->fractions.push_back(iel.second);
66  }
67  }
68 }
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
Trk::MaterialProperties::m_material
Material m_material
Definition: MaterialProperties.h:121
Trk::MaterialProperties::m_dInL0
float m_dInL0
thickness in units of nuclear interaction length
Definition: MaterialProperties.h:123
Trk::Material::L0
float L0
Definition: Material.h:120
MaterialProperties.h
hist_file_dump.d
d
Definition: hist_file_dump.py:137
Trk::Material::Z
float Z
Definition: Material.h:122
Trk::MaterialProperties::m_dInX0
float m_dInX0
thickness in units of radiation length
Definition: MaterialProperties.h:122
Trk::MaterialComposition
Definition: Material.h:60
MaterialPropertiesCnv_p1::transToPers
virtual void transToPers(const Trk::MaterialProperties *transObj, Trk::MaterialProperties_p1 *persObj, MsgStream &log)
Definition: MaterialPropertiesCnv_p1.cxx:43
Trk::MaterialProperties_p1
Definition: MaterialProperties_p1.h:33
Trk::Material::A
float A
Definition: Material.h:121
Trk::MaterialProperties::m_zOaTrTd
float m_zOaTrTd
- in ATLAS units
Definition: MaterialProperties.h:124
MaterialPropertiesCnv_p1.h
MaterialPropertiesCnv_p1::persToTrans
virtual void persToTrans(const Trk::MaterialProperties_p1 *persObj, Trk::MaterialProperties *transObj, MsgStream &log)
Definition: MaterialPropertiesCnv_p1.cxx:13
Trk::Material::X0
float X0
Definition: Material.h:119
Trk::Material::rho
float rho
Definition: Material.h:123
Trk::MaterialProperties_p1::fractions
std::vector< unsigned char > fractions
Definition: MaterialProperties_p1.h:43
Trk::MaterialProperties
Definition: MaterialProperties.h:40
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:567
Trk::Material::composition
MaterialComposition * composition
Definition: Material.h:126
Trk::Material::dEdX
float dEdX
Definition: Material.h:124
Trk::Material::zOaTr
float zOaTr
Definition: Material.h:125
Trk::MaterialProperties_p1::elements
std::vector< unsigned char > elements
Definition: MaterialProperties_p1.h:42
Material.h
Trk::MaterialProperties_p1::materialData
std::vector< float > materialData
Definition: MaterialProperties_p1.h:41