ATLAS Offline Software
Loading...
Searching...
No Matches
Trk::BinnedLayerMaterial Class Reference

It extends the LayerMaterialProperties base class. More...

#include <BinnedLayerMaterial.h>

Inheritance diagram for Trk::BinnedLayerMaterial:
Collaboration diagram for Trk::BinnedLayerMaterial:

Public Member Functions

 BinnedLayerMaterial ()
 Default Constructor - needed by POOL.
 BinnedLayerMaterial (BinUtility &binutility)
 Default Constructor for emptly material.
 BinnedLayerMaterial (const Trk::BinUtility &binutility, const MaterialPropertiesVector &fullProperties, double splitFactor=0.)
 Explizit constructor with only full MaterialProperties, and split factors:
 BinnedLayerMaterial (const Trk::BinUtility &binutility, const MaterialPropertiesMatrix &fullProperties, double splitFactor=0.)
 Explicit constructor with only full MaterialProperties, and split factors:
 BinnedLayerMaterial (const BinnedLayerMaterial &mprop)
 Copy Constructor.
virtual ~BinnedLayerMaterial () override
 Destructor.
virtual BinnedLayerMaterialclone () const override
 Pseudo-Constructor clone().
BinnedLayerMaterialoperator= (const BinnedLayerMaterial &lmp)
 Assignment operator.
BinnedLayerMaterialoperator= (BinnedLayerMaterial &&lmp) noexcept
virtual BinnedLayerMaterialoperator*= (double scale) override
 Scale operator.
virtual const BinUtilitybinUtility () const override
 Return the BinUtility.
virtual void updateBinning (BinUtility *bu) override
 Update the BinUtility if necessary - passing ownership of the utility class.
const MaterialPropertiesMatrixfullMaterial () const
 Return method for full material description of the Layer - for all bins.
virtual const MaterialPropertiesfullMaterial (const Amg::Vector3D &gp) const override
 Return method for full material description of the Layer.
virtual const MaterialPropertiesmaterial (size_t bin0, size_t bin1) const override
 Access the single bin.
virtual MsgStream & dump (MsgStream &sl) const override
 Output Method for MsgStream, to be overloaded by child classes.
virtual std::ostream & dump (std::ostream &sl) const override
 Output Method for std::ostream, to be overloaded by child classes.
void updateElementTable (const std::shared_ptr< const ElementTable > &) const
 Update the ElementTable.
const ElementTableelementTable () const
 Get the ElementTable.
double factor (PropDirection pDir, MaterialUpdateStage mStage) const
 Update pre factor.
double alongPreFactor () const
 Return method for pre update material description of the Layer along normalvector.
double alongPostFactor () const
 Return method for post update material description of the Layer along normalvector.
double oppositePreFactor () const
 Return method for pre update material description of the Layer along normalvector.
double oppositePostFactor () const
 Return method for post update material description of the Layer along normalvector.

Protected Attributes

double m_splitFactor {1.}
 the split factor in favour of oppositePre

Private Member Functions

void clearMaterial ()
 helper method - to clear the material
void fillMaterial (const MaterialPropertiesMatrix &matMatrix)
 helper method - to refill the material

Private Attributes

BinUtilitym_binUtility {}
 the helper for the bin finding
MaterialPropertiesMatrix m_fullMaterial
 The five different MaterialProperties.

Friends

class ::BinnedLayerMaterialCnv_p1

Detailed Description

Constructor & Destructor Documentation

◆ BinnedLayerMaterial() [1/5]

Trk::BinnedLayerMaterial::BinnedLayerMaterial ( )

Default Constructor - needed by POOL.

Definition at line 16 of file BinnedLayerMaterial.cxx.

17 : Trk::LayerMaterialProperties(), m_binUtility(nullptr) {}
BinUtility * m_binUtility
the helper for the bin finding

◆ BinnedLayerMaterial() [2/5]

Trk::BinnedLayerMaterial::BinnedLayerMaterial ( Trk::BinUtility & binutility)

Default Constructor for emptly material.

Definition at line 19 of file BinnedLayerMaterial.cxx.

20 : Trk::LayerMaterialProperties(), m_binUtility(binutility.clone()) {
21 // reserve
22 m_fullMaterial.reserve(binutility.max(1) + 1);
23 for (unsigned int ibin2 = 0; ibin2 < (unsigned int)binutility.max(1) + 1;
24 ++ibin2) {
25 // create the vector for the push_back
27 matVec.reserve(binutility.max(0) + 1);
28 for (unsigned int ibin = 0; ibin < (unsigned int)binutility.max(0) + 1;
29 ++ibin)
30 matVec.push_back(nullptr);
31 m_fullMaterial.push_back(std::move(matVec));
32 }
33}
size_t max(size_t ba=0) const
First bin maximal value.
Definition BinUtility.h:210
BinUtility * clone() const
Implicit Constructor.
Definition BinUtility.h:120
MaterialPropertiesMatrix m_fullMaterial
The five different MaterialProperties.
std::vector< const MaterialProperties * > MaterialPropertiesVector
Useful typedefs.

◆ BinnedLayerMaterial() [3/5]

Trk::BinnedLayerMaterial::BinnedLayerMaterial ( const Trk::BinUtility & binutility,
const MaterialPropertiesVector & fullProperties,
double splitFactor = 0. )

Explizit constructor with only full MaterialProperties, and split factors:

  • 1. : oppositePre
  • 0. : alongPre

===> 1 Dimensional array

ATTENTION: Ownership of MaterialProperties objects is given!

Definition at line 35 of file BinnedLayerMaterial.cxx.

38 : Trk::LayerMaterialProperties(splitFactor),
39 m_binUtility(binutility.clone()) {
40 // constructor from a single vector
42 // fill the material with deep copy
43 m_fullMaterial.push_back(fullProperties);
44}
void clearMaterial()
helper method - to clear the material

◆ BinnedLayerMaterial() [4/5]

Trk::BinnedLayerMaterial::BinnedLayerMaterial ( const Trk::BinUtility & binutility,
const MaterialPropertiesMatrix & fullProperties,
double splitFactor = 0. )

Explicit constructor with only full MaterialProperties, and split factors:

  • 1. : oppositePre
  • 0. : alongPre

===> 2 Dimensional array

ATTENTION: Ownership of MaterialProperties objects is given!

Definition at line 46 of file BinnedLayerMaterial.cxx.

49 : Trk::LayerMaterialProperties(splitFactor),
50 m_binUtility(binutility.clone()),
51 m_fullMaterial(fullProperties) {}

◆ BinnedLayerMaterial() [5/5]

Trk::BinnedLayerMaterial::BinnedLayerMaterial ( const BinnedLayerMaterial & mprop)

Copy Constructor.

Definition at line 58 of file BinnedLayerMaterial.cxx.

60 : Trk::LayerMaterialProperties(lmp),
61 m_binUtility(lmp.m_binUtility->clone()) {
62 // clear the material
64 // and fill the material
65 fillMaterial(lmp.m_fullMaterial);
66}
void fillMaterial(const MaterialPropertiesMatrix &matMatrix)
helper method - to refill the material

◆ ~BinnedLayerMaterial()

Trk::BinnedLayerMaterial::~BinnedLayerMaterial ( )
overridevirtual

Destructor.

Definition at line 53 of file BinnedLayerMaterial.cxx.

53 {
54 delete m_binUtility;
56}

Member Function Documentation

◆ alongPostFactor()

double Trk::LayerMaterialProperties::alongPostFactor ( ) const
inlineinherited

Return method for post update material description of the Layer along normalvector.

Definition at line 150 of file LayerMaterialProperties.h.

150 {
151 return m_splitFactor;
152}
double m_splitFactor
the split factor in favour of oppositePre

◆ alongPreFactor()

double Trk::LayerMaterialProperties::alongPreFactor ( ) const
inlineinherited

Return method for pre update material description of the Layer along normalvector.

inline return methods for the pre/post factors

Definition at line 146 of file LayerMaterialProperties.h.

146 {
147 return (1. - m_splitFactor);
148}

◆ binUtility()

const BinUtility * Trk::BinnedLayerMaterial::binUtility ( ) const
inlineoverridevirtual

Return the BinUtility.

Implements Trk::LayerMaterialProperties.

Definition at line 123 of file BinnedLayerMaterial.h.

124 { return m_binUtility; }

◆ clearMaterial()

void Trk::BinnedLayerMaterial::clearMaterial ( )
private

helper method - to clear the material

Definition at line 102 of file BinnedLayerMaterial.cxx.

102 {
103 // clear the full material
104 for (auto& matMatrixIter : m_fullMaterial) {
105 for (auto& matIter : matMatrixIter) delete matIter;
106 }
107
108 m_fullMaterial.clear();
109}

◆ clone()

Trk::BinnedLayerMaterial * Trk::BinnedLayerMaterial::clone ( ) const
overridevirtual

Pseudo-Constructor clone().

Implements Trk::LayerMaterialProperties.

Definition at line 98 of file BinnedLayerMaterial.cxx.

98 {
99 return new Trk::BinnedLayerMaterial(*this);
100}

◆ dump() [1/2]

MsgStream & Trk::BinnedLayerMaterial::dump ( MsgStream & sl) const
overridevirtual

Output Method for MsgStream, to be overloaded by child classes.

Implements Trk::LayerMaterialProperties.

Definition at line 154 of file BinnedLayerMaterial.cxx.

154 {
155 sl << "Trk::BinnedLayerMaterial : " << std::endl;
156 sl << " - Number of Material bins (1/2) : " << m_binUtility->max(0) + 1
157 << " / " << m_binUtility->max(1) + 1 << std::endl;
158 sl << " - Parse full update material : " << std::endl;
159 // output the full material
160 unsigned int imat2 = 0;
161 for (const auto& matMatrixIter : m_fullMaterial) {
162 unsigned int imat1 = 0;
163 // the vector iterator
164 for (const auto& matIter : matMatrixIter) {
165 if (matIter)
166 sl << " Bin [" << imat2 << "][" << imat1 << "] - " << (*matIter)
167 << std::endl;
168 else
169 sl << " Bin [" << imat2 << "][" << imat1 << "] - empty " << std::endl;
170 ++imat1;
171 }
172 ++imat2;
173 }
174 return sl;
175}

◆ dump() [2/2]

std::ostream & Trk::BinnedLayerMaterial::dump ( std::ostream & sl) const
overridevirtual

Output Method for std::ostream, to be overloaded by child classes.

Implements Trk::LayerMaterialProperties.

Definition at line 177 of file BinnedLayerMaterial.cxx.

177 {
178 sl << "Trk::BinnedLayerMaterial : " << std::endl;
179 sl << " - Number of Material bins (1/2) : " << m_binUtility->max(0) + 1
180 << " / " << m_binUtility->max(1) + 1 << std::endl;
181 sl << " - Parse full update material : " << std::endl; //
182 // output the full material
183 unsigned int imat2 = 0;
184 for (const auto& matMatrixIter : m_fullMaterial) {
185 unsigned int imat1 = 0;
186 // the vector iterator
187 for (const auto& matIter : matMatrixIter) {
188 if (matIter)
189 sl << " Bin [" << imat2 << "][" << imat1 << "] - " << (*matIter)
190 << std::endl;
191 else
192 sl << " Bin [" << imat2 << "][" << imat1 << "] - empty " << std::endl;
193 ++imat1;
194 }
195 ++imat2;
196 }
197 return sl;
198}

◆ elementTable()

const ElementTable * Trk::LayerMaterialProperties::elementTable ( ) const
inlineinherited

Get the ElementTable.

Definition at line 98 of file LayerMaterialProperties.h.

98{ return nullptr; }

◆ factor()

double Trk::LayerMaterialProperties::factor ( PropDirection pDir,
MaterialUpdateStage mStage ) const
inlineinherited

Update pre factor.

inline return methods for the pre/post factors

Definition at line 138 of file LayerMaterialProperties.h.

139 {
140 if (mStage == Trk::fullUpdate) return 1.;
141 return (static_cast<int>(pDir) * static_cast<int>(mStage) > 0 ?
143}
@ fullUpdate

◆ fillMaterial()

void Trk::BinnedLayerMaterial::fillMaterial ( const MaterialPropertiesMatrix & matMatrix)
private

helper method - to refill the material

Definition at line 111 of file BinnedLayerMaterial.cxx.

112 {
113 m_fullMaterial.reserve(m_binUtility->max(1) + 1);
114 for (const auto& matMatrixIter : matMatrix) {
115 // the vector to be copied
117 matVector.reserve(m_binUtility->max(0) + 1);
118 // reassign
119 for (const auto& matIter : matMatrixIter)
120 matVector.push_back(matIter ? matIter->clone() : nullptr);
121 m_fullMaterial.push_back(std::move(matVector));
122 }
123}

◆ fullMaterial() [1/2]

const MaterialPropertiesMatrix & Trk::BinnedLayerMaterial::fullMaterial ( ) const
inline

Return method for full material description of the Layer - for all bins.

Definition at line 126 of file BinnedLayerMaterial.h.

127 { return m_fullMaterial; }

◆ fullMaterial() [2/2]

const Trk::MaterialProperties * Trk::BinnedLayerMaterial::fullMaterial ( const Amg::Vector3D & gp) const
overridevirtual

Return method for full material description of the Layer.

Implements Trk::LayerMaterialProperties.

Definition at line 145 of file BinnedLayerMaterial.cxx.

146 {
147 if (m_fullMaterial.empty() || !m_binUtility) return nullptr;
148 // the first bin
149 size_t ibin1 = m_binUtility->bin(gp, 0);
150 size_t ibin2 = m_binUtility->max(1) ? m_binUtility->bin(gp, 1) : 0;
151 return m_fullMaterial[ibin2][ibin1];
152}

◆ material()

const MaterialProperties * Trk::BinnedLayerMaterial::material ( size_t bin0,
size_t bin1 ) const
inlineoverridevirtual

Access the single bin.

Implements Trk::LayerMaterialProperties.

Definition at line 129 of file BinnedLayerMaterial.h.

130 {
131 return m_fullMaterial[bin1][bin0];
132 }

◆ operator*=()

Trk::BinnedLayerMaterial & Trk::BinnedLayerMaterial::operator*= ( double scale)
overridevirtual

Scale operator.

Implements Trk::LayerMaterialProperties.

Definition at line 125 of file BinnedLayerMaterial.cxx.

125 {
126 // scale the full material
127 unsigned int imat2 = 0;
128 for (auto& matMatrixIter : m_fullMaterial) {
129 unsigned int imat1 = 0;
130 // the vector iterator
131 for (auto& matIter : matMatrixIter) {
132 if (matIter) {
133 Trk::MaterialProperties* mprop = matIter->clone();
134 (*mprop) *= scale;
135 delete matIter;
136 m_fullMaterial[imat2][imat1] = mprop;
137 }
138 ++imat1;
139 }
140 ++imat2;
141 }
142 return (*this);
143}

◆ operator=() [1/2]

Trk::BinnedLayerMaterial & Trk::BinnedLayerMaterial::operator= ( Trk::BinnedLayerMaterial && lmp)
noexcept

Definition at line 84 of file BinnedLayerMaterial.cxx.

84 {
85 if (this != &lmp) {
86
87 // first delete everything
88 delete m_binUtility;
90 m_binUtility = std::exchange(lmp.m_binUtility, nullptr);
91 // reassign the material
92 m_fullMaterial = std::move(lmp.m_fullMaterial);
94 }
95 return (*this);
96}
LayerMaterialProperties & operator=(const LayerMaterialProperties &)=default

◆ operator=() [2/2]

Trk::BinnedLayerMaterial & Trk::BinnedLayerMaterial::operator= ( const BinnedLayerMaterial & lmp)

Assignment operator.

Definition at line 68 of file BinnedLayerMaterial.cxx.

69 {
70 if (this != &lmp) {
72 // first delete everything
73 delete m_binUtility;
74 // reassign
75 m_binUtility = lmp.binUtility()->clone();
77 // reassign the material
78 fillMaterial(lmp.m_fullMaterial);
79 }
80 return (*this);
81}

◆ oppositePostFactor()

double Trk::LayerMaterialProperties::oppositePostFactor ( ) const
inlineinherited

Return method for post update material description of the Layer along normalvector.

Definition at line 158 of file LayerMaterialProperties.h.

158 {
159 return (1. - m_splitFactor);
160}

◆ oppositePreFactor()

double Trk::LayerMaterialProperties::oppositePreFactor ( ) const
inlineinherited

Return method for pre update material description of the Layer along normalvector.

Definition at line 154 of file LayerMaterialProperties.h.

154 {
155 return m_splitFactor;
156}

◆ updateBinning()

void Trk::BinnedLayerMaterial::updateBinning ( BinUtility * bu)
inlineoverridevirtual

Update the BinUtility if necessary - passing ownership of the utility class.

Implements Trk::LayerMaterialProperties.

Definition at line 134 of file BinnedLayerMaterial.h.

134 {
135 if (bu){
136 delete m_binUtility;
137 m_binUtility = bu;
138 }
139 }

◆ updateElementTable()

void Trk::LayerMaterialProperties::updateElementTable ( const std::shared_ptr< const ElementTable > & ) const
inlineinherited

Update the ElementTable.

Definition at line 95 of file LayerMaterialProperties.h.

95{}

◆ ::BinnedLayerMaterialCnv_p1

friend class ::BinnedLayerMaterialCnv_p1
friend

Definition at line 107 of file BinnedLayerMaterial.h.

Member Data Documentation

◆ m_binUtility

BinUtility* Trk::BinnedLayerMaterial::m_binUtility {}
private

the helper for the bin finding

Definition at line 109 of file BinnedLayerMaterial.h.

109{};

◆ m_fullMaterial

MaterialPropertiesMatrix Trk::BinnedLayerMaterial::m_fullMaterial
private

The five different MaterialProperties.

Definition at line 112 of file BinnedLayerMaterial.h.

◆ m_splitFactor

double Trk::LayerMaterialProperties::m_splitFactor {1.}
protectedinherited

the split factor in favour of oppositePre

Definition at line 134 of file LayerMaterialProperties.h.

134{1.};

The documentation for this class was generated from the following files: