ATLAS Offline Software
MaterialProperties.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // MaterialProperties.cxx, (c) ATLAS Detector software
8 
10 
11 #include <iostream>
12 
14  float averageA, float averageZ,
15  float averageRho, float dEdX)
16  : m_material(Xo, Lo, averageA, averageZ, averageRho, dEdX),
17  m_dInX0(Xo * Xo > 10e-10 ? path / Xo : 0.),
18  m_dInL0(Lo * Lo > 10e-10 ? path / Lo : 0.),
19  m_zOaTrTd(averageA * averageA > 10e-10
20  ? averageZ / averageA * averageRho * path
21  : 0.) {}
22 
23 // TODO add constructor with element composition
25  float path)
26  : m_material(material),
27  m_dInX0(material.X0 * material.X0 > 10e-10 ? path / material.X0 : 0.),
28  m_dInL0(material.L0 * material.L0 > 10e-10 ? path / material.L0 : 0.),
29  m_zOaTrTd(material.A * material.A > 10e-10
30  ? path * material.Z / material.A * material.rho
31  : 0.) {}
32 
34  return new Trk::MaterialProperties(*this);
35 }
36 
38  // assuming rescaling of the material thickness
39  m_dInX0 *= scale;
40  m_dInL0 *= scale;
41  m_zOaTrTd *= scale;
42 
43  return (*this);
44 }
45 
47  float dInX0) {
49  // averaging factors based on thickness
50  float fnew = dInX0 * mat.X0 / (m_dInX0 * m_material.X0 + dInX0 * mat.X0);
51  float fold = 1. - fnew;
52 
53  // updated material thickness
54  m_dInX0 += dInX0;
55 
56  // updated material
57  m_material = Trk::Material(1. / (fnew / mat.X0 + fold / m_material.X0),
58  1. / (fnew / mat.L0 + fold / m_material.L0),
59  fnew * mat.A + fold * m_material.A,
60  fnew * mat.Z + fold * m_material.Z,
61  fnew * mat.rho + fold * m_material.rho);
62 
63  // updated derived members
64  m_dInL0 = m_dInX0 * m_material.X0 / m_material.L0;
65  m_zOaTrTd = m_material.A > 0 ? m_dInX0 * m_material.X0 * m_material.Z /
66  m_material.A * m_material.rho
67  : 0;
68 }
69 
71  float thickness) {
72  // just overwrite what you have
73  m_material = mat;
74  m_dInX0 = thickness / mat.X0;
75  m_dInL0 = thickness / mat.L0;
76  m_zOaTrTd = mat.Z / mat.A * mat.rho * thickness;
77 }
78 
80  // set the DE/DX value
81  m_material.dEdX = dEdX;
82 }
83 
84 MsgStream& Trk::operator<<(MsgStream& sl,
85  const Trk::MaterialProperties& mprop) {
86  sl << "Trk::MaterialProperties: " << endmsg;
87  sl << " - thickness/X0 = " << mprop.thicknessInX0()
88  << endmsg;
89  sl << " - thickness [mm] = " << mprop.thickness()
90  << endmsg;
91  sl << " - radiation length X0 [mm] = " << mprop.x0() << endmsg;
92  sl << " - nuclear interaction length L0 [mm] = " << mprop.l0() << endmsg;
93  sl << " - average material Z/A*rho [gram/mm^3] = "
94  << mprop.zOverAtimesRho() << endmsg;
95  return sl;
96 }
97 
98 std::ostream& Trk::operator<<(std::ostream& sl,
99  const MaterialProperties& mprop) {
100  sl << "Trk::MaterialProperties: " << std::endl;
101  sl << " - thickness/X0 = " << mprop.thicknessInX0()
102  << std::endl;
103  sl << " - thickness [mm] = " << mprop.thickness()
104  << std::endl;
105  sl << " - radiation length X0 [mm] = " << mprop.x0()
106  << std::endl;
107  sl << " - nuclear interaction length L0 [mm] = " << mprop.l0()
108  << std::endl;
109  sl << " - average material Z/A*rho [gram/mm^3] = "
110  << mprop.zOverAtimesRho() << std::endl;
111  return sl;
112 }
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
Trk::MaterialProperties::setMaterial
void setMaterial(const Material &mp, float thickness=1.)
Set Material.
Definition: MaterialProperties.cxx:70
athena.path
path
python interpreter configuration --------------------------------------—
Definition: athena.py:128
MaterialProperties.h
mat
GeoMaterial * mat
Definition: LArDetectorConstructionTBEC.cxx:55
Trk::MaterialProperties::thicknessInX0
float thicknessInX0() const
Return the radiationlength fraction.
Trk::MaterialProperties::x0
float x0() const
Return the radiation length.
yodamerge_tmp.scale
scale
Definition: yodamerge_tmp.py:138
Trk::MaterialProperties::setDeDx
void setDeDx(float dEdX)
Set dEdX - important for material calibarion.
Definition: MaterialProperties.cxx:79
Trk::MaterialProperties::MaterialProperties
MaterialProperties()=default
Default Constructor.
Trk::MaterialProperties::thickness
float thickness() const
Return the thickness in mm.
pdg_comparison.X0
X0
Definition: pdg_comparison.py:314
A
Trk::MaterialProperties::addMaterial
void addMaterial(const Material &mp, float dInX0)
Material averaging.
Definition: MaterialProperties.cxx:46
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
Trk::MaterialProperties::clone
MaterialProperties * clone() const
Pseudo-Constructor clone()
Definition: MaterialProperties.cxx:33
Trk::MaterialProperties::operator*=
MaterialProperties & operator*=(float scale)
Scale operator - scales the material thickness.
Definition: MaterialProperties.cxx:37
Trk::MaterialProperties
Definition: MaterialProperties.h:40
Trk::operator<<
MsgStream & operator<<(MsgStream &sl, const AlignModule &alignModule)
overload of << operator for MsgStream for debug output
Definition: AlignModule.cxx:204
Trk::MaterialProperties::zOverAtimesRho
float zOverAtimesRho() const
Return the .
Trk::Material
Definition: Material.h:116
Trk::MaterialProperties::l0
float l0() const
Return the nuclear interaction length.
Material
@ Material
Definition: MaterialTypes.h:8
fitman.rho
rho
Definition: fitman.py:532
Trk::L0
@ L0
Definition: AlignModuleList.h:32