ATLAS Offline Software
CompoundLayerMaterial.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // CompoundLayerMaterial.h, (c) ATLAS Detector software
8 
9 #ifndef TRKGEOMETRY_COMPOUNDLAYERMATERIAL_H
10 #define TRKGEOMETRY_COMPOUNDLAYERMATERIAL_H
11 
12 // Trk
17 #include "TrkGeometry/Material.h"
20 // Amg
22 // Gaudi
23 #include "GaudiKernel/MsgStream.h"
24 
26 
27 namespace Trk {
28 
29 typedef std::vector<unsigned char> ValueVector;
30 typedef std::vector<ValueVector> ValueMatrix;
31 
32 struct ValueStore {
33  float valueMin;
34  float valueStep;
36 
37  double value(unsigned char ibin0, unsigned char ibin1) const {
38  // allows for single entry
39  if (valueBinMatrix.empty()) return valueMin;
40  // get the entry from the matrix
41  unsigned int ibin = static_cast<unsigned int>(
42  valueBinMatrix[static_cast<unsigned int>(ibin1)]
43  [static_cast<unsigned int>(ibin0)]);
44  if (!ibin) return 0.;
45  double value = valueMin + (double(ibin) - 0.5) * valueStep;
46  return value;
47  }
48 };
49 
61  public:
63  CompoundLayerMaterial() = default;
64 
67  const Trk::BinUtility& binutility, const ValueStore& thicknessBins,
68  const ValueStore& x0Bins, const ValueStore& l0Bins,
69  const ValueStore& aBins, const ValueStore& zBins,
70  const ValueStore& rhoBins,
71  const std::vector<std::vector<MaterialComposition> >& composition,
72  bool fComposition = false);
73 
76 
78  virtual ~CompoundLayerMaterial() override;
79 
81  virtual CompoundLayerMaterial* clone() const override final;
82 
85 
87  virtual CompoundLayerMaterial& operator*=(double scale) override final;
88 
90  virtual const BinUtility* binUtility() const override final;
91 
94  virtual void updateBinning(BinUtility* bu) override final;
95 
98  const Amg::Vector3D& gp) const override final;
99 
101  virtual const MaterialProperties* material(size_t bin0,
102  size_t bin1) const override final;
103 
106 
109 
111  virtual MsgStream& dump(MsgStream& sl) const override final;
112 
114  virtual std::ostream& dump(std::ostream& sl) const override final;
115 
116  private:
118 
120 
122  std::vector<std::vector<MaterialPropertiesCUP> >
124 
132  std::vector<std::vector<MaterialComposition> >
134  bool m_fullComposition{false};
136  m_elementTable; // the ElementTable (filled/synchronised)
137 };
138 
140  return m_binUtility;
141 }
142 
146 }
147 
149  if (bu) {
150  delete m_binUtility;
151  m_binUtility = bu;
152  }
153 }
154 
156  return m_elementTable.get();
157 }
158 
159 } // namespace Trk
160 
161 #endif
ElementTable.h
Trk::CompoundLayerMaterial::m_aBins
ValueStore m_aBins
A parameters (averaged)
Definition: CompoundLayerMaterial.h:129
Trk::CompoundLayerMaterial::m_x0Bins
ValueStore m_x0Bins
x0 parameter
Definition: CompoundLayerMaterial.h:127
Trk::CompoundLayerMaterial::resizeMaterialProperties
void resizeMaterialProperties()
Definition: CompoundLayerMaterial.cxx:162
Trk::ValueStore::valueStep
float valueStep
Definition: CompoundLayerMaterial.h:34
Trk::CompoundLayerMaterial::clone
virtual CompoundLayerMaterial * clone() const override final
Pseudo-Constructor clone()
Definition: CompoundLayerMaterial.cxx:77
CxxUtils::CachedUniquePtr
CachedUniquePtrT< const T > CachedUniquePtr
Definition: CachedUniquePtr.h:114
MaterialProperties.h
CxxUtils::CachedUniquePtrT
Cached pointer with atomic update.
Definition: CachedUniquePtr.h:54
BinUtility.h
Trk::CompoundLayerMaterial
Definition: CompoundLayerMaterial.h:60
Trk::CompoundLayerMaterial::m_l0Bins
ValueStore m_l0Bins
l0 parameter
Definition: CompoundLayerMaterial.h:128
Trk::ValueStore::value
double value(unsigned char ibin0, unsigned char ibin1) const
Definition: CompoundLayerMaterial.h:37
Trk::CompoundLayerMaterial::m_materialProperties
std::vector< std::vector< MaterialPropertiesCUP > > m_materialProperties
the ones you return
Definition: CompoundLayerMaterial.h:123
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
yodamerge_tmp.scale
scale
Definition: yodamerge_tmp.py:138
Trk::CompoundLayerMaterial::updateBinning
virtual void updateBinning(BinUtility *bu) override final
Update the BinUtility if necessary - passing ownership of the utility class.
Definition: CompoundLayerMaterial.h:148
Trk::CompoundLayerMaterial::updateElementTable
void updateElementTable(const SharedObject< const ElementTable > &set)
Update the ElementTable.
Definition: CompoundLayerMaterial.h:143
GeoPrimitives.h
CompoundLayerMaterialCnv_p1
Definition: CompoundLayerMaterialCnv_p1.h:24
Trk::ValueStore
Definition: CompoundLayerMaterial.h:32
Trk::ValueStore::valueBinMatrix
ValueMatrix valueBinMatrix
Definition: CompoundLayerMaterial.h:35
vector
Definition: MultiHisto.h:13
Trk::CompoundLayerMaterial::CompoundLayerMaterial
CompoundLayerMaterial()=default
Default Constructor - needed by POOL.
Trk::CompoundLayerMaterial::m_fullComposition
bool m_fullComposition
full composition calculation
Definition: CompoundLayerMaterial.h:134
Trk::LayerMaterialProperties
Definition: LayerMaterialProperties.h:62
CxxUtils
Definition: aligned_vector.h:29
CachedUniquePtr.h
Cached unique_ptr with atomic update.
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
SharedObject.h
Trk::CompoundLayerMaterial::m_elementTable
SharedObject< const ElementTable > m_elementTable
Definition: CompoundLayerMaterial.h:136
MakeTH3DFromTH2Ds.zBins
list zBins
Definition: MakeTH3DFromTH2Ds.py:86
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:232
Trk::BinUtility
Definition: BinUtility.h:39
Trk::CompoundLayerMaterial::m_binUtility
BinUtility * m_binUtility
the helper for the bin finding
Definition: CompoundLayerMaterial.h:125
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Amg
Definition of ATLAS Math & Geometry primitives (Amg)
Definition: AmgStringHelpers.h:19
private
#define private
Definition: DetDescrConditionsDict_dict_fixes.cxx:13
Trk::CompoundLayerMaterial::elementTable
const ElementTable * elementTable() const
Get the ElementTable.
Definition: CompoundLayerMaterial.h:155
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::CompoundLayerMaterial::dump
virtual MsgStream & dump(MsgStream &sl) const override final
Output Method for MsgStream, to be overloaded by child classes.
Definition: CompoundLayerMaterial.cxx:147
Trk::CompoundLayerMaterial::m_composition
std::vector< std::vector< MaterialComposition > > m_composition
composition matrix
Definition: CompoundLayerMaterial.h:133
Trk::MaterialProperties
Definition: MaterialProperties.h:40
Trk::CompoundLayerMaterial::m_thicknessBins
ValueStore m_thicknessBins
thickness parameter
Definition: CompoundLayerMaterial.h:126
Trk::CompoundLayerMaterial::m_rhoBins
ValueStore m_rhoBins
rho parameter (averaged)
Definition: CompoundLayerMaterial.h:131
Trk::SharedObject
std::shared_ptr< T > SharedObject
Definition: SharedObject.h:24
dqt_zlumi_pandas.bin1
bin1
Definition: dqt_zlumi_pandas.py:336
Trk::ElementTable
Definition: ElementTable.h:24
Trk::ValueMatrix
std::vector< ValueVector > ValueMatrix
Definition: CompoundLayerMaterial.h:30
Trk::CompoundLayerMaterial::~CompoundLayerMaterial
virtual ~CompoundLayerMaterial() override
Destructor.
Definition: CompoundLayerMaterial.cxx:73
Trk::CompoundLayerMaterial::m_zBins
ValueStore m_zBins
Z parameter (averaged)
Definition: CompoundLayerMaterial.h:130
Trk::ValueVector
std::vector< unsigned char > ValueVector
Definition: CompoundLayerMaterial.h:29
Trk::ValueStore::valueMin
float valueMin
Definition: CompoundLayerMaterial.h:33
Trk::CompoundLayerMaterial::material
virtual const MaterialProperties * material(size_t bin0, size_t bin1) const override final
Access the single bin.
Definition: CompoundLayerMaterial.cxx:96
Trk::CompoundLayerMaterial::fullMaterial
virtual const MaterialProperties * fullMaterial(const Amg::Vector3D &gp) const override final
Return method for full material description of the Layer.
Definition: CompoundLayerMaterial.cxx:87
Material.h
LayerMaterialProperties.h
Trk::CompoundLayerMaterial::binUtility
virtual const BinUtility * binUtility() const override final
Return the BinUtility.
Definition: CompoundLayerMaterial.h:139