ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
TrkDetDescr
TrkGeometry
src
CompressedLayerMaterial.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
// CompressedLayerMaterial.cxx, (c) ATLAS Detector software
8
9
#include "
TrkGeometry/CompressedLayerMaterial.h
"
10
11
#include "
TrkGeometry/MaterialProperties.h
"
12
13
Trk::CompressedLayerMaterial::CompressedLayerMaterial
()
14
:
Trk
::
LayerMaterialProperties
(),
m_binUtility
(nullptr) {}
15
16
Trk::CompressedLayerMaterial::CompressedLayerMaterial
(
17
Trk::BinUtility
& binutility)
18
:
Trk
::
LayerMaterialProperties
(),
m_binUtility
(binutility.
clone
()) {}
19
20
Trk::CompressedLayerMaterial::CompressedLayerMaterial
(
21
const
Trk::BinUtility
& binutility,
22
const
MaterialPropertiesVector
& fullProperties,
23
const
std::vector<unsigned short int>& materialIndices,
double
splitFactor)
24
:
Trk
::
LayerMaterialProperties
(splitFactor),
25
m_binUtility
(binutility.
clone
()),
26
m_fullMaterial
(fullProperties),
27
m_materialBins
(materialIndices) {}
28
29
Trk::CompressedLayerMaterial::CompressedLayerMaterial
(
30
std::unique_ptr<Trk::BinUtility> binutility,
31
const
MaterialPropertiesVector
&& fullProperties,
32
const
std::vector<unsigned short int>& materialIndices,
double
splitFactor)
33
:
Trk
::
LayerMaterialProperties
(splitFactor),
34
m_binUtility
(binutility.
release
()),
35
m_fullMaterial
(
std
::move(fullProperties)),
36
m_materialBins
(materialIndices) {}
37
38
Trk::CompressedLayerMaterial::~CompressedLayerMaterial
() {
39
delete
m_binUtility
;
40
clearMaterial
();
41
}
42
43
Trk::CompressedLayerMaterial::CompressedLayerMaterial
(
44
const
Trk::CompressedLayerMaterial
& lmp)
45
:
Trk
::
LayerMaterialProperties
(lmp),
46
m_binUtility
(lmp.
m_binUtility
->
clone
()),
47
m_materialBins
(lmp.
m_materialBins
) {
48
// clear the material
49
clearMaterial
();
50
// and fill the material
51
fillMaterial
(lmp.
m_fullMaterial
);
52
}
53
54
Trk::CompressedLayerMaterial
&
Trk::CompressedLayerMaterial::operator=
(
55
const
Trk::CompressedLayerMaterial
& lmp) {
56
if
(
this
!= &lmp) {
57
Trk::LayerMaterialProperties::operator=
(lmp);
58
// first delete everything
59
delete
m_binUtility
;
60
clearMaterial
();
61
// reassign the material
62
fillMaterial
(lmp.
m_fullMaterial
);
63
// reassign the binutility and the material bins
64
m_binUtility
= lmp.
binUtility
()->
clone
();
65
m_materialBins
= lmp.
m_materialBins
;
66
}
67
return
(*
this
);
68
}
69
70
Trk::CompressedLayerMaterial
*
Trk::CompressedLayerMaterial::clone
()
const
{
71
return
new
Trk::CompressedLayerMaterial
(*
this
);
72
}
73
74
void
Trk::CompressedLayerMaterial::clearMaterial
() {
75
// loop over the matrix
76
for
(
auto
& matIter :
m_fullMaterial
)
delete
matIter;
77
m_fullMaterial
.clear();
78
}
79
80
void
Trk::CompressedLayerMaterial::fillMaterial
(
81
const
Trk::MaterialPropertiesVector
& matVector) {
82
// reassign
83
m_fullMaterial
.clear();
84
m_fullMaterial
.reserve(matVector.size());
85
for
(
const
auto
& matIter : matVector)
86
m_fullMaterial
.push_back(matIter ? matIter->clone() :
nullptr
);
87
}
88
89
Trk::CompressedLayerMaterial
&
Trk::CompressedLayerMaterial::operator*=
(
90
double
scale) {
91
size_t
imat1 = 0;
92
// the vector iterator
93
for
(
auto
& matIter :
m_fullMaterial
) {
94
if
(matIter) {
95
// clone needed for const correctness
96
Trk::MaterialProperties
* mprop = (matIter)->
clone
();
97
(*mprop) *= scale;
98
delete
matIter;
99
m_fullMaterial
[imat1] = mprop;
100
}
101
}
102
103
// scale the reference material
104
return
(*
this
);
105
}
106
107
const
Trk::MaterialProperties
*
Trk::CompressedLayerMaterial::fullMaterial
(
108
const
Amg::Vector3D
& gp)
const
{
109
if
(
m_fullMaterial
.empty() || !
m_binUtility
)
return
nullptr
;
110
// first bin
111
size_t
ibin1 =
m_binUtility
->bin(gp, 0);
112
// second bin
113
size_t
ibin2 = (
m_binUtility
->max(1) == 0) ? 0 :
m_binUtility
->bin(gp, 1);
114
// out of bounds check and return
115
return
(ibin2 >
m_binUtility
->max(1)) ? nullptr :
material
(ibin1, ibin2);
116
}
117
118
MsgStream&
Trk::CompressedLayerMaterial::dump
(MsgStream& sl)
const
{
119
sl <<
"Trk::CompressedLayerMaterial : "
<< std::endl;
120
sl <<
" - Number of Material bins (1/2) : "
<<
m_binUtility
->max(0) + 1
121
<<
" / "
<<
m_binUtility
->max(1) + 1 << std::endl;
122
sl <<
" - Parse full update material : "
<< std::endl;
123
// -------------------------
124
size_t
imat1 = 0;
125
for
(
const
auto
& matIter :
m_fullMaterial
) {
126
if
(matIter)
127
sl <<
" Bin ["
<< imat1 <<
"] - "
<< matIter << std::endl;
128
else
129
sl <<
" Bin ["
<< imat1 <<
"] - empty "
<< std::endl;
130
++imat1;
131
}
132
return
sl;
133
}
134
135
std::ostream&
Trk::CompressedLayerMaterial::dump
(std::ostream& sl)
const
{
136
sl <<
"Trk::CompressedLayerMaterial : "
<< std::endl;
137
sl <<
" - Number of Material bins (1/2) : "
<<
m_binUtility
->max(0) + 1
138
<<
" / "
<<
m_binUtility
->max(1) + 1 << std::endl;
139
sl <<
" - Parse full update material : "
<< std::endl;
//
140
size_t
imat1 = 0;
141
for
(
const
auto
& matIter :
m_fullMaterial
) {
142
if
(matIter)
143
sl <<
" Bin ["
<< imat1 <<
"] - "
<< matIter << std::endl;
144
else
145
sl <<
" Bin ["
<< imat1 <<
"] - empty "
<< std::endl;
146
++imat1;
147
}
148
return
sl;
149
}
CompressedLayerMaterial.h
MaterialProperties.h
Trk::BinUtility
A generic symmetric BinUtility, for fully symmetric binning in terms of binning grid and binning type...
Definition
BinUtility.h:39
Trk::BinUtility::clone
BinUtility * clone() const
Implicit Constructor.
Definition
BinUtility.h:120
Trk::CompressedLayerMaterial
It extends the LayerMaterialProperties base class.
Definition
CompressedLayerMaterial.h:31
Trk::CompressedLayerMaterial::fullMaterial
const MaterialPropertiesVector & fullMaterial() const
Return method for full material description of the Layer - for all bins.
Definition
CompressedLayerMaterial.h:120
Trk::CompressedLayerMaterial::dump
virtual MsgStream & dump(MsgStream &sl) const override final
Output Method for MsgStream, to be overloaded by child classes.
Definition
CompressedLayerMaterial.cxx:118
Trk::CompressedLayerMaterial::material
virtual const MaterialProperties * material(size_t bin0, size_t bin1) const override final
Access the single bin.
Definition
CompressedLayerMaterial.h:130
Trk::CompressedLayerMaterial::~CompressedLayerMaterial
virtual ~CompressedLayerMaterial() override
Destructor.
Definition
CompressedLayerMaterial.cxx:38
Trk::CompressedLayerMaterial::operator=
CompressedLayerMaterial & operator=(const CompressedLayerMaterial &lmp)
Assignment operator.
Definition
CompressedLayerMaterial.cxx:54
Trk::CompressedLayerMaterial::m_binUtility
BinUtility * m_binUtility
the helper for the bin finding
Definition
CompressedLayerMaterial.h:103
Trk::CompressedLayerMaterial::fillMaterial
void fillMaterial(const MaterialPropertiesVector &matVector)
helper method - to refill the material
Definition
CompressedLayerMaterial.cxx:80
Trk::CompressedLayerMaterial::m_materialBins
std::vector< unsigned short int > m_materialBins
Definition
CompressedLayerMaterial.h:107
Trk::CompressedLayerMaterial::binUtility
virtual const BinUtility * binUtility() const override final
Return the BinUtility.
Definition
CompressedLayerMaterial.h:116
Trk::CompressedLayerMaterial::m_fullMaterial
MaterialPropertiesVector m_fullMaterial
The five different MaterialProperties.
Definition
CompressedLayerMaterial.h:106
Trk::CompressedLayerMaterial::operator*=
virtual CompressedLayerMaterial & operator*=(double scale) override final
Scale operator.
Definition
CompressedLayerMaterial.cxx:89
Trk::CompressedLayerMaterial::CompressedLayerMaterial
CompressedLayerMaterial()
Default Constructor - needed by POOL.
Definition
CompressedLayerMaterial.cxx:13
Trk::CompressedLayerMaterial::clearMaterial
void clearMaterial()
helper method - to clear the material
Definition
CompressedLayerMaterial.cxx:74
Trk::CompressedLayerMaterial::clone
virtual CompressedLayerMaterial * clone() const override final
Pseudo-Constructor clone().
Definition
CompressedLayerMaterial.cxx:70
Trk::LayerMaterialProperties::LayerMaterialProperties
LayerMaterialProperties()=default
Constructor.
Trk::LayerMaterialProperties::operator=
LayerMaterialProperties & operator=(const LayerMaterialProperties &)=default
Trk::MaterialProperties
Material with information about thickness of material.
Definition
MaterialProperties.h:40
release
static std::string release
Definition
computils.h:50
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition
GeoPrimitives.h:47
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition
FakeTrackBuilder.h:9
Trk::MaterialPropertiesVector
std::vector< const MaterialProperties * > MaterialPropertiesVector
Useful typedefs.
Definition
MaterialProperties.h:133
std
STL namespace.
Generated on
for ATLAS Offline Software by
1.17.0