ATLAS Offline Software
Loading...
Searching...
No Matches
CompoundLayerMaterial.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6// CompoundLayerMaterial.cxx, (c) ATLAS Detector software
8
10
12
13
15 const Trk::BinUtility& binutility, const ValueStore& thicknessBins,
16 const ValueStore& x0Bins, const ValueStore& l0Bins, const ValueStore& aBins,
17 const ValueStore& zBins, const ValueStore& rhoBins,
18 const std::vector<std::vector<MaterialComposition> >& composition,
19 bool fComposition)
20 : m_binUtility(binutility.clone()),
21 m_thicknessBins(thicknessBins),
22 m_x0Bins(x0Bins),
23 m_l0Bins(l0Bins),
24 m_aBins(aBins),
25 m_zBins(zBins),
26 m_rhoBins(rhoBins),
27 m_composition(composition),
28 m_fullComposition(fComposition),
29 m_elementTable(std::shared_ptr<const Trk::ElementTable>(nullptr))
30{
32}
33
50
72
76
80
83 // scale the reference material
84 return (*this);
85}
86
88 const Amg::Vector3D& gp) const {
89 // first bin
90 size_t bin0 = m_binUtility->bin(gp, 0);
91 // second bin
92 size_t bin1 = (m_binUtility->max(1) == 0) ? 0 : m_binUtility->bin(gp, 1);
93 return material(bin0, bin1);
94}
95
97 size_t bin0, size_t bin1) const
98{
99 const MaterialPropertiesCUP& p = m_materialProperties[bin1][bin0];
100 if (!p) {
101 // get the size
102 const double thickness = m_thicknessBins.value(bin0, bin1);
103 // no thickness or no x0 - return a null pointer
104 if (thickness == 0.) return nullptr;
105 double x0 = 0.;
106 double l0 = 0.;
107 double a = 0.;
108 double z = 0.;
109 double rho = 0.;
110 // the full composition calculation
111 if (m_fullComposition && m_elementTable.get()) {
113 for (const auto& eFraction : m_composition[bin1][bin0]) {
114 double fraction = eFraction.fraction();
115 const Trk::Material* material =
116 m_elementTable->element(eFraction.element());
117 if (material) {
118 x0 += material->X0 * fraction;
119 l0 += material->L0 * fraction;
120 a += material->A * fraction;
121 z += material->Z * fraction;
122 rho += material->rho * fraction;
123 }
124 }
125 } else {
126 x0 = m_x0Bins.value(bin0, bin1);
127 l0 = m_l0Bins.value(bin0, bin1);
128 a = m_aBins.value(bin0, bin1);
129 z = m_zBins.value(bin0, bin1);
130 rho = m_rhoBins.value(bin0, bin1);
131 }
132
133 // check for 0 material
134 if (x0 == 0.) {
135 return nullptr;
136 }
137
138 // record the material composition
139 Trk::MaterialComposition* mComposition =
141 p.set (std::make_unique<Trk::MaterialProperties>
142 (Trk::Material(x0, l0, a, z, rho, 0., mComposition), thickness));
143 }
144 return p.get();
145}
146
147MsgStream& Trk::CompoundLayerMaterial::dump(MsgStream& sl) const {
148 sl << "Trk::CompoundLayerMaterial : \n";
149 sl << " - Number of Material bins (1/2) : " << m_binUtility->max(0) + 1
150 << " / " << m_binUtility->max(1) + 1 << "\n";
151 return sl;
152}
153
154std::ostream& Trk::CompoundLayerMaterial::dump(std::ostream& sl) const {
155 sl << "Trk::CompoundLayerMaterial : " << std::endl;
156 sl << " - Number of Material bins (1/2) : " << m_binUtility->max(0) + 1
157 << " / " << m_binUtility->max(1) + 1 << std::endl;
158 return sl;
159}
160
161
163{
164 m_materialProperties.clear();
165 m_materialProperties.resize (m_thicknessBins.valueBinMatrix.size());
166 for (size_t i = 0; i < m_materialProperties.size(); i++) {
167 m_materialProperties[i].resize (m_thicknessBins.valueBinMatrix[i].size());
168 }
169}
170
static Double_t a
A generic symmetric BinUtility, for fully symmetric binning in terms of binning grid and binning type...
Definition BinUtility.h:39
BinUtility * clone() const
Implizit Constructor.
Definition BinUtility.h:120
It extends the LayerMaterialProperties base class, and has a intrinsic accuracy of about 0....
CompoundLayerMaterial()=default
Default Constructor - needed by POOL.
ValueStore m_rhoBins
rho parameter (averaged)
std::vector< std::vector< MaterialPropertiesCUP > > m_materialProperties
the ones you return
virtual ~CompoundLayerMaterial() override
Destructor.
bool m_fullComposition
full composition calculation
virtual const MaterialProperties * fullMaterial(const Amg::Vector3D &gp) const override final
Return method for full material description of the Layer.
std::shared_ptr< const ElementTable > m_elementTable
virtual CompoundLayerMaterial & operator*=(double scale) override final
Scale operator.
ValueStore m_thicknessBins
thickness parameter
ValueStore m_x0Bins
x0 parameter
CxxUtils::CachedUniquePtr< MaterialProperties > MaterialPropertiesCUP
ValueStore m_aBins
A parameters (averaged)
CompoundLayerMaterial & operator=(const CompoundLayerMaterial &lmp)
Assignment operator.
ValueStore m_zBins
Z parameter (averaged)
virtual const MaterialProperties * material(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.
std::vector< std::vector< MaterialComposition > > m_composition
composition matrix
virtual CompoundLayerMaterial * clone() const override final
Pseudo-Constructor clone()
BinUtility * m_binUtility
the helper for the bin finding
ValueStore m_l0Bins
l0 parameter
Material with information about thickness of material.
A common object to be contained by.
Definition Material.h:117
Eigen::Matrix< double, 3, 1 > Vector3D
Ensure that the ATLAS eigen extensions are properly loaded.
@ z
global position (cartesian)
Definition ParamDefs.h:57
STL namespace.