ATLAS Offline Software
Tracking
TrkDetDescr
TrkDetDescrTPCnv
src
TrkGeometry
MaterialStepCnv_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
// MaterialStepCnv_p1.cxx, (c) ATLAS Detector software
8
9
#include <cmath>
10
11
12
13
#include "
TrkGeometry/Material.h
"
14
#include "
TrkGeometry/MaterialStep.h
"
15
#include "
TrkDetDescrTPCnv/TrkGeometry/MaterialStepCnv_p1.h
"
16
17
void
MaterialStepCnv_p1::persToTrans
(
const
Trk::MaterialStep_p1
*persObj,
18
Trk::MaterialStep
*transObj,
19
MsgStream&)
20
{
21
transObj->
m_steplength
= persObj->
materialData
[0];
22
transObj->
m_hitX
= persObj->
materialData
[1];
23
transObj->
m_hitY
= persObj->
materialData
[2];
24
transObj->
m_hitZ
= persObj->
materialData
[3];
25
transObj->
m_hitR
= std::sqrt(transObj->
m_hitX
*transObj->
m_hitX
+transObj->
m_hitY
*transObj->
m_hitY
);
26
transObj->
m_material
.
X0
= persObj->
materialData
[4];
27
transObj->
m_material
.
L0
= persObj->
materialData
[5];
28
transObj->
m_material
.
A
= persObj->
materialData
[6];
29
transObj->
m_material
.
Z
= persObj->
materialData
[7];
30
transObj->
m_material
.
rho
= persObj->
materialData
[8];
31
32
// recreate the composition vector if possible
33
if
( !persObj->
elements
.empty() && !persObj->
fractions
.empty() ) {
34
transObj->
m_material
.
composition
=
new
Trk::MaterialComposition
(persObj->
elements
, persObj->
fractions
);
35
}
36
37
}
38
39
void
MaterialStepCnv_p1::transToPers
(
const
Trk::MaterialStep
*transObj,
40
Trk::MaterialStep_p1
*persObj,
41
MsgStream& )
42
{
43
persObj->
materialData
[0] = transObj->
m_steplength
;
44
persObj->
materialData
[1] = transObj->
m_hitX
;
45
persObj->
materialData
[2] = transObj->
m_hitY
;
46
persObj->
materialData
[3] = transObj->
m_hitZ
;
47
persObj->
materialData
[4] = transObj->
m_material
.
X0
;
48
persObj->
materialData
[5] = transObj->
m_material
.
L0
;
49
persObj->
materialData
[6] = transObj->
m_material
.
A
;
50
persObj->
materialData
[7] = transObj->
m_material
.
Z
;
51
persObj->
materialData
[8] = transObj->
m_material
.
rho
;
52
53
// write the composition vector if present
54
// disentangle the ElementFraction for columnwise write support (compression optimised)
55
if
( transObj->
m_material
.
composition
){
56
persObj->
elements
.reserve(transObj->
m_material
.
composition
->size());
57
persObj->
fractions
.reserve(transObj->
m_material
.
composition
->size());
58
for
(
auto
& iel: (*transObj->
m_material
.
composition
)){
59
persObj->
elements
.push_back(iel.first);
60
persObj->
fractions
.push_back(iel.second);
61
}
62
}
63
}
Trk::MaterialStep_p1
Definition:
MaterialStep_p1.h:36
MaterialStepCnv_p1.h
Trk::MaterialStep_p1::elements
std::vector< unsigned char > elements
Definition:
MaterialStep_p1.h:43
Trk::Material::L0
float L0
Definition:
Material.h:120
Trk::Material::Z
float Z
Definition:
Material.h:122
Trk::MaterialStep_p1::fractions
std::vector< unsigned char > fractions
Definition:
MaterialStep_p1.h:44
Trk::MaterialComposition
Definition:
Material.h:60
Trk::MaterialStep
Definition:
MaterialStep.h:34
Trk::Material::A
float A
Definition:
Material.h:121
Trk::Material::X0
float X0
Definition:
Material.h:119
MaterialStepCnv_p1::transToPers
virtual void transToPers(const Trk::MaterialStep *transObj, Trk::MaterialStep_p1 *persObj, MsgStream &log)
Definition:
MaterialStepCnv_p1.cxx:39
Trk::MaterialStep::m_hitY
float m_hitY
Definition:
MaterialStep.h:94
Trk::MaterialStep::m_hitX
float m_hitX
Definition:
MaterialStep.h:93
Trk::MaterialStep::m_material
Material m_material
Definition:
MaterialStep.h:97
Trk::MaterialStep_p1::materialData
std::vector< float > materialData
Definition:
MaterialStep_p1.h:41
Trk::Material::rho
float rho
Definition:
Material.h:123
Trk::MaterialStep::m_steplength
float m_steplength
Definition:
MaterialStep.h:92
Trk::Material::composition
MaterialComposition * composition
Definition:
Material.h:126
MaterialStepCnv_p1::persToTrans
virtual void persToTrans(const Trk::MaterialStep_p1 *persObj, Trk::MaterialStep *transObj, MsgStream &log)
Definition:
MaterialStepCnv_p1.cxx:17
Trk::MaterialStep::m_hitZ
float m_hitZ
Definition:
MaterialStep.h:95
Material.h
Trk::MaterialStep::m_hitR
float m_hitR
Definition:
MaterialStep.h:96
MaterialStep.h
Generated on Thu Nov 7 2024 21:20:27 for ATLAS Offline Software by
1.8.18