ATLAS Offline Software
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
Trk::CompressedLayerMaterial Class Referencefinal

#include <CompressedLayerMaterial.h>

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

Public Member Functions

 CompressedLayerMaterial ()
 Default Constructor - needed by POOL. More...
 
 CompressedLayerMaterial (BinUtility &binutility)
 Default Constructor for emptly material. More...
 
 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: More...
 
 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. More...
 
virtual ~CompressedLayerMaterial () override
 Destructor. More...
 
virtual CompressedLayerMaterialclone () const override final
 Pseudo-Constructor clone() More...
 
CompressedLayerMaterialoperator= (const CompressedLayerMaterial &lmp)
 Assignment operator. More...
 
virtual CompressedLayerMaterialoperator*= (double scale) override final
 Scale operator. More...
 
virtual const BinUtilitybinUtility () const override final
 Return the BinUtility. More...
 
virtual void updateBinning (BinUtility *bu) override final
 Update the BinUtility if necessary - passing ownership of the utility class. More...
 
const MaterialPropertiesVectorfullMaterial () const
 Return method for full material description of the Layer - for all bins. More...
 
const std::vector< unsigned short int > & materialBins () const
 Return method for index vector, needs BinUtility to interpret this. More...
 
virtual const MaterialPropertiesfullMaterial (const Amg::Vector3D &gp) const override
 Return method for full material description of the Layer. More...
 
virtual const MaterialPropertiesmaterial (size_t bin0, size_t bin1) const override final
 Access the single bin. More...
 
virtual MsgStream & dump (MsgStream &sl) const override final
 Output Method for MsgStream, to be overloaded by child classes. More...
 
virtual std::ostream & dump (std::ostream &sl) const override final
 Output Method for std::ostream, to be overloaded by child classes. More...
 
void updateElementTable (const SharedObject< const ElementTable > &) const
 Update the ElementTable. More...
 
const ElementTableelementTable () const
 Get the ElementTable. More...
 
double factor (PropDirection pDir, MaterialUpdateStage mStage) const
 Update pre factor. More...
 
double alongPreFactor () const
 Return method for pre update material description of the Layer along normalvector. More...
 
double alongPostFactor () const
 Return method for post update material description of the Layer along normalvector. More...
 
double oppositePreFactor () const
 Return method for pre update material description of the Layer along normalvector. More...
 
double oppositePostFactor () const
 Return method for post update material description of the Layer along normalvector. More...
 

Protected Attributes

double m_splitFactor
 the split factor in favour of oppositePre More...
 

Private Member Functions

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

Private Attributes

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

Detailed Description

It extends the LayerMaterialProperties base class

Author
Andre.nosp@m.as.S.nosp@m.alzbu.nosp@m.rger.nosp@m.@cern.nosp@m..ch

Definition at line 31 of file CompressedLayerMaterial.h.

Constructor & Destructor Documentation

◆ CompressedLayerMaterial() [1/5]

Trk::CompressedLayerMaterial::CompressedLayerMaterial ( )

Default Constructor - needed by POOL.

Definition at line 13 of file CompressedLayerMaterial.cxx.

◆ 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()) {}

◆ 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) {}

◆ 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.

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 }

◆ ~CompressedLayerMaterial()

Trk::CompressedLayerMaterial::~CompressedLayerMaterial ( )
overridevirtual

Destructor.

Definition at line 38 of file CompressedLayerMaterial.cxx.

38  {
39  delete m_binUtility;
40  clearMaterial();
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 }

◆ 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 }

◆ 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 }

◆ 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 }

◆ 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;
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 }

◆ 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 SharedObject< 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:
Trk::CompressedLayerMaterial::m_binUtility
BinUtility * m_binUtility
the helper for the bin finding
Definition: CompressedLayerMaterial.h:103
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
Trk::BinUtility::max
size_t max(size_t ba=0) const
First bin maximal value.
Definition: BinUtility.h:215
Trk::CompressedLayerMaterial::m_fullMaterial
MaterialPropertiesVector m_fullMaterial
The five different MaterialProperties.
Definition: CompressedLayerMaterial.h:106
yodamerge_tmp.scale
scale
Definition: yodamerge_tmp.py:138
Trk::fullUpdate
@ fullUpdate
Definition: PropDirection.h:43
Trk::CompressedLayerMaterial
Definition: CompressedLayerMaterial.h:31
Trk::LayerMaterialProperties::m_splitFactor
double m_splitFactor
the split factor in favour of oppositePre
Definition: LayerMaterialProperties.h:126
Trk::LayerMaterialProperties
Definition: LayerMaterialProperties.h:62
Trk::CompressedLayerMaterial::clearMaterial
void clearMaterial()
helper method - to clear the material
Definition: CompressedLayerMaterial.cxx:74
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::m_materialBins
std::vector< unsigned short int > m_materialBins
Definition: CompressedLayerMaterial.h:107
Trk::MaterialProperties
Definition: MaterialProperties.h:40
Trk::CompressedLayerMaterial::clone
virtual CompressedLayerMaterial * clone() const override final
Pseudo-Constructor clone()
Definition: CompressedLayerMaterial.cxx:70
dqt_zlumi_pandas.bin1
bin1
Definition: dqt_zlumi_pandas.py:336
Trk::BinUtility::clone
BinUtility * clone() const
Implizit Constructor.
Definition: BinUtility.h:130
Trk::BinUtility::bin
size_t bin(const Amg::Vector3D &position, size_t ba=0) const
Bin from a 3D vector (already in binning frame)
Definition: BinUtility.h:136
Trk::CompressedLayerMaterial::fillMaterial
void fillMaterial(const MaterialPropertiesVector &matVector)
helper method - to refill the material
Definition: CompressedLayerMaterial.cxx:80