ATLAS Offline Software
CompressedLayerMaterial.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // CompressedLayerMaterial.h, (c) ATLAS Detector software
8 
9 #ifndef TRKGEOMETRY_COMPRESSEDLAYERMATERIAL_H
10 #define TRKGEOMETRY_COMPRESSEDLAYERMATERIAL_H
11 
12 // Trk
16 // Amg
18 // Gaudi
19 #include "GaudiKernel/MsgStream.h"
20 
21 namespace Trk {
22 
32  public:
35 
38 
50  const Trk::BinUtility& binutility,
51  const MaterialPropertiesVector& fullProperties,
52  const std::vector<unsigned short int>& materialIndices,
53  double splitFactor = 0.);
54 
56  std::unique_ptr<Trk::BinUtility> binutility,
57  const MaterialPropertiesVector&& fullProperties,
58  const std::vector<unsigned short int>& materialIndices,
59  double splitFactor = 0.);
60 
63 
65  virtual ~CompressedLayerMaterial() override;
66 
68  virtual CompressedLayerMaterial* clone() const override final;
69 
72 
74  virtual CompressedLayerMaterial& operator*=(double scale) override final;
75 
77  virtual const BinUtility* binUtility() const override final;
78 
81  virtual void updateBinning(BinUtility* bu) override final;
82 
85 
87  const std::vector<unsigned short int>& materialBins() const;
88 
90  virtual const MaterialProperties* fullMaterial(
91  const Amg::Vector3D& gp) const override;
92 
94  virtual const MaterialProperties* material(size_t bin0,
95  size_t bin1) const override final;
96 
98  virtual MsgStream& dump(MsgStream& sl) const override final;
100  virtual std::ostream& dump(std::ostream& sl) const override final;
101 
102  private:
104 
107  std::vector<unsigned short int> m_materialBins;
108 
110  void clearMaterial();
111 
113  void fillMaterial(const MaterialPropertiesVector& matVector);
114 };
115 
117  return m_binUtility;
118 }
119 
121  const {
122  return m_fullMaterial;
123 }
124 
125 inline const std::vector<unsigned short int>&
127  return m_materialBins;
128 }
129 
131  size_t bin0, size_t bin1) const {
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 }
140 
142  if (bu) {
143  delete m_binUtility;
144  m_binUtility = bu;
145  }
146 }
147 
148 } // namespace Trk
149 
150 #endif
Trk::CompressedLayerMaterial::operator*=
virtual CompressedLayerMaterial & operator*=(double scale) override final
Scale operator.
Definition: CompressedLayerMaterial.cxx:89
Trk::CompressedLayerMaterial::m_binUtility
BinUtility * m_binUtility
the helper for the bin finding
Definition: CompressedLayerMaterial.h:103
Trk::CompressedLayerMaterial::operator=
CompressedLayerMaterial & operator=(const CompressedLayerMaterial &lmp)
Assignment operator.
Definition: CompressedLayerMaterial.cxx:54
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
MaterialProperties.h
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
Trk::CompressedLayerMaterial::fullMaterial
const MaterialPropertiesVector & fullMaterial() const
Return method for full material description of the Layer - for all bins.
Definition: CompressedLayerMaterial.h:120
BinUtility.h
Trk::CompressedLayerMaterial::materialBins
const std::vector< unsigned short int > & materialBins() const
Return method for index vector, needs BinUtility to interpret this.
Definition: CompressedLayerMaterial.h:126
yodamerge_tmp.scale
scale
Definition: yodamerge_tmp.py:138
Trk::CompressedLayerMaterial::~CompressedLayerMaterial
virtual ~CompressedLayerMaterial() override
Destructor.
Definition: CompressedLayerMaterial.cxx:38
Trk::MaterialPropertiesVector
std::vector< const MaterialProperties * > MaterialPropertiesVector
Useful typedefs.
Definition: MaterialProperties.h:133
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
Definition: CompressedLayerMaterial.h:31
GeoPrimitives.h
Trk::CompressedLayerMaterial::updateBinning
virtual void updateBinning(BinUtility *bu) override final
Update the BinUtility if necessary - passing ownership of the utility class.
Definition: CompressedLayerMaterial.h:141
Trk::LayerMaterialProperties
Definition: LayerMaterialProperties.h:62
Trk::CompressedLayerMaterial::CompressedLayerMaterial
CompressedLayerMaterial()
Default Constructor - needed by POOL.
Definition: CompressedLayerMaterial.cxx:13
Trk::CompressedLayerMaterial::binUtility
virtual const BinUtility * binUtility() const override final
Return the BinUtility.
Definition: CompressedLayerMaterial.h:116
Trk::BinUtility
Definition: BinUtility.h:39
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
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
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
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::CompressedLayerMaterial::fillMaterial
void fillMaterial(const MaterialPropertiesVector &matVector)
helper method - to refill the material
Definition: CompressedLayerMaterial.cxx:80
LayerMaterialProperties.h