ATLAS Offline Software
Loading...
Searching...
No Matches
Trk::CompressedLayerMaterial Class Referencefinal

It extends the LayerMaterialProperties base class. More...

#include <CompressedLayerMaterial.h>

Inheritance diagram for Trk::CompressedLayerMaterial:
Collaboration diagram for Trk::CompressedLayerMaterial:

Public Member Functions

 CompressedLayerMaterial ()
 Default Constructor - needed by POOL.
 CompressedLayerMaterial (BinUtility &binutility)
 Default Constructor for emptly material.
 CompressedLayerMaterial (const Trk::BinUtility &binutility, const MaterialPropertiesVector &fullProperties, const std::vector< unsigned short int > &materialIndices, double splitFactor=0.)
 Explizit constructor with only full MaterialProperties, and split factors:
 CompressedLayerMaterial (std::unique_ptr< Trk::BinUtility > binutility, const MaterialPropertiesVector &&fullProperties, const std::vector< unsigned short int > &materialIndices, double splitFactor=0.)
 CompressedLayerMaterial (const CompressedLayerMaterial &mprop)
 Copy Constructor.
virtual ~CompressedLayerMaterial () override
 Destructor.
virtual CompressedLayerMaterialclone () const override final
 Pseudo-Constructor clone()
CompressedLayerMaterialoperator= (const CompressedLayerMaterial &lmp)
 Assignment operator.
virtual CompressedLayerMaterialoperator*= (double scale) override final
 Scale operator.
virtual const BinUtilitybinUtility () const override final
 Return the BinUtility.
virtual void updateBinning (BinUtility *bu) override final
 Update the BinUtility if necessary - passing ownership of the utility class.
const MaterialPropertiesVectorfullMaterial () const
 Return method for full material description of the Layer - for all bins.
const std::vector< unsigned short int > & materialBins () const
 Return method for index vector, needs BinUtility to interpret this.
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 final
 Access the single bin.
virtual MsgStream & dump (MsgStream &sl) const override final
 Output Method for MsgStream, to be overloaded by child classes.
virtual std::ostream & dump (std::ostream &sl) const override final
 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
 the split factor in favour of oppositePre

Private Member Functions

void clearMaterial ()
 helper method - to clear the material
void fillMaterial (const MaterialPropertiesVector &matVector)
 helper method - to refill the material

Private Attributes

BinUtilitym_binUtility
 the helper for the bin finding
MaterialPropertiesVector m_fullMaterial
 The five different MaterialProperties.
std::vector< unsigned short int > m_materialBins

Detailed Description

Constructor & Destructor Documentation

◆ CompressedLayerMaterial() [1/5]

Trk::CompressedLayerMaterial::CompressedLayerMaterial ( )

Default Constructor - needed by POOL.

Definition at line 13 of file CompressedLayerMaterial.cxx.

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

◆ CompressedLayerMaterial() [2/5]

Trk::CompressedLayerMaterial::CompressedLayerMaterial ( Trk::BinUtility & binutility)

Default Constructor for emptly material.

Definition at line 16 of file CompressedLayerMaterial.cxx.

18 : Trk::LayerMaterialProperties(), m_binUtility(binutility.clone()) {}
BinUtility * clone() const
Implizit Constructor.
Definition BinUtility.h:120

◆ CompressedLayerMaterial() [3/5]

Trk::CompressedLayerMaterial::CompressedLayerMaterial ( const Trk::BinUtility & binutility,
const MaterialPropertiesVector & fullProperties,
const std::vector< unsigned short int > & materialIndices,
double splitFactor = 0. )

Explizit constructor with only full MaterialProperties, and split factors:

  • 1. : oppositePre
  • 0. : alongPre

===> 1 Dimensional array, 1 dimensional indices ( can represent 2-dim indices)

ATTENTION: Ownership of MaterialProperties objects is given!

Definition at line 20 of file CompressedLayerMaterial.cxx.

24 : Trk::LayerMaterialProperties(splitFactor),
25 m_binUtility(binutility.clone()),
26 m_fullMaterial(fullProperties),
27 m_materialBins(materialIndices) {}
std::vector< unsigned short int > m_materialBins
MaterialPropertiesVector m_fullMaterial
The five different MaterialProperties.

◆ CompressedLayerMaterial() [4/5]

Trk::CompressedLayerMaterial::CompressedLayerMaterial ( std::unique_ptr< Trk::BinUtility > binutility,
const MaterialPropertiesVector && fullProperties,
const std::vector< unsigned short int > & materialIndices,
double splitFactor = 0. )

Definition at line 29 of file CompressedLayerMaterial.cxx.

33 : Trk::LayerMaterialProperties(splitFactor),
34 m_binUtility(binutility.release()),
35 m_fullMaterial(fullProperties),
36 m_materialBins(materialIndices) {}

◆ CompressedLayerMaterial() [5/5]

Trk::CompressedLayerMaterial::CompressedLayerMaterial ( const CompressedLayerMaterial & mprop)

Copy Constructor.

Definition at line 43 of file CompressedLayerMaterial.cxx.

45 : Trk::LayerMaterialProperties(lmp),
46 m_binUtility(lmp.m_binUtility->clone()),
47 m_materialBins(lmp.m_materialBins) {
48 // clear the material
50 // and fill the material
51 fillMaterial(lmp.m_fullMaterial);
52}
void fillMaterial(const MaterialPropertiesVector &matVector)
helper method - to refill the material
void clearMaterial()
helper method - to clear the material

◆ ~CompressedLayerMaterial()

Trk::CompressedLayerMaterial::~CompressedLayerMaterial ( )
overridevirtual

Destructor.

Definition at line 38 of file CompressedLayerMaterial.cxx.

38 {
39 delete m_binUtility;
41}

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 142 of file LayerMaterialProperties.h.

142 {
143 return m_splitFactor;
144}
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 138 of file LayerMaterialProperties.h.

138 {
139 return (1. - m_splitFactor);
140}

◆ binUtility()

const BinUtility * Trk::CompressedLayerMaterial::binUtility ( ) const
inlinefinaloverridevirtual

Return the BinUtility.

Implements Trk::LayerMaterialProperties.

Definition at line 116 of file CompressedLayerMaterial.h.

116 {
117 return m_binUtility;
118}

◆ clearMaterial()

void Trk::CompressedLayerMaterial::clearMaterial ( )
private

helper method - to clear the material

Definition at line 74 of file CompressedLayerMaterial.cxx.

74 {
75 // loop over the matrix
76 for (auto& matIter : m_fullMaterial) delete matIter;
77 m_fullMaterial.clear();
78}

◆ clone()

Trk::CompressedLayerMaterial * Trk::CompressedLayerMaterial::clone ( ) const
finaloverridevirtual

Pseudo-Constructor clone()

Implements Trk::LayerMaterialProperties.

Definition at line 70 of file CompressedLayerMaterial.cxx.

70 {
71 return new Trk::CompressedLayerMaterial(*this);
72}

◆ dump() [1/2]

MsgStream & Trk::CompressedLayerMaterial::dump ( MsgStream & sl) const
finaloverridevirtual

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

Implements Trk::LayerMaterialProperties.

Definition at line 118 of file CompressedLayerMaterial.cxx.

118 {
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}

◆ dump() [2/2]

std::ostream & Trk::CompressedLayerMaterial::dump ( std::ostream & sl) const
finaloverridevirtual

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

Implements Trk::LayerMaterialProperties.

Definition at line 135 of file CompressedLayerMaterial.cxx.

135 {
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}

◆ elementTable()

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

Get the ElementTable.

Definition at line 90 of file LayerMaterialProperties.h.

90{ 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 130 of file LayerMaterialProperties.h.

131 {
132 if (mStage == Trk::fullUpdate) return 1.;
133 return (static_cast<int>(pDir) * static_cast<int>(mStage) > 0 ?
135}
@ fullUpdate

◆ fillMaterial()

void Trk::CompressedLayerMaterial::fillMaterial ( const MaterialPropertiesVector & matVector)
private

helper method - to refill the material

Definition at line 80 of file CompressedLayerMaterial.cxx.

81 {
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}

◆ fullMaterial() [1/2]

const MaterialPropertiesVector & Trk::CompressedLayerMaterial::fullMaterial ( ) const
inline

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

Definition at line 120 of file CompressedLayerMaterial.h.

121 {
122 return m_fullMaterial;
123}

◆ fullMaterial() [2/2]

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

Return method for full material description of the Layer.

Implements Trk::LayerMaterialProperties.

Definition at line 107 of file CompressedLayerMaterial.cxx.

108 {
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}
virtual const MaterialProperties * material(size_t bin0, size_t bin1) const override final
Access the single bin.

◆ material()

const MaterialProperties * Trk::CompressedLayerMaterial::material ( size_t bin0,
size_t bin1 ) const
inlinefinaloverridevirtual

Access the single bin.

Implements Trk::LayerMaterialProperties.

Definition at line 130 of file CompressedLayerMaterial.h.

131 {
132 int accessBin = bin1 * (m_binUtility->max(0) + 1) + bin0;
133 // safety check
134 if (bin0 <= (unsigned int)m_binUtility->max(0) &&
135 bin1 <= (unsigned int)m_binUtility->max(1) && !m_fullMaterial.empty() &&
136 accessBin < int(m_materialBins.size()))
137 return m_fullMaterial[m_materialBins[accessBin]];
138 return nullptr;
139}

◆ materialBins()

const std::vector< unsigned short int > & Trk::CompressedLayerMaterial::materialBins ( ) const
inline

Return method for index vector, needs BinUtility to interpret this.

Definition at line 126 of file CompressedLayerMaterial.h.

126 {
127 return m_materialBins;
128}

◆ operator*=()

Trk::CompressedLayerMaterial & Trk::CompressedLayerMaterial::operator*= ( double scale)
finaloverridevirtual

Scale operator.

Implements Trk::LayerMaterialProperties.

Definition at line 89 of file CompressedLayerMaterial.cxx.

90 {
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}
virtual CompressedLayerMaterial * clone() const override final
Pseudo-Constructor clone()

◆ operator=()

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

Assignment operator.

Definition at line 54 of file CompressedLayerMaterial.cxx.

55 {
56 if (this != &lmp) {
57 Trk::LayerMaterialProperties::operator=(lmp);
58 // first delete everything
59 delete m_binUtility;
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}

◆ oppositePostFactor()

double Trk::LayerMaterialProperties::oppositePostFactor ( ) 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 (1. - m_splitFactor);
152}

◆ oppositePreFactor()

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

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

Definition at line 146 of file LayerMaterialProperties.h.

146 {
147 return m_splitFactor;
148}

◆ updateBinning()

void Trk::CompressedLayerMaterial::updateBinning ( BinUtility * bu)
inlinefinaloverridevirtual

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

Implements Trk::LayerMaterialProperties.

Definition at line 141 of file CompressedLayerMaterial.h.

141 {
142 if (bu) {
143 delete m_binUtility;
144 m_binUtility = bu;
145 }
146}

◆ updateElementTable()

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

Update the ElementTable.

Definition at line 87 of file LayerMaterialProperties.h.

87{}

Member Data Documentation

◆ m_binUtility

BinUtility* Trk::CompressedLayerMaterial::m_binUtility
private

the helper for the bin finding

Definition at line 103 of file CompressedLayerMaterial.h.

◆ m_fullMaterial

MaterialPropertiesVector Trk::CompressedLayerMaterial::m_fullMaterial
private

The five different MaterialProperties.

Definition at line 106 of file CompressedLayerMaterial.h.

◆ m_materialBins

std::vector<unsigned short int> Trk::CompressedLayerMaterial::m_materialBins
private

Definition at line 107 of file CompressedLayerMaterial.h.

◆ m_splitFactor

double Trk::LayerMaterialProperties::m_splitFactor
protectedinherited

the split factor in favour of oppositePre

Definition at line 126 of file LayerMaterialProperties.h.


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