ATLAS Offline Software
Loading...
Searching...
No Matches
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
13Trk::MaterialProperties::MaterialProperties(float path, float Xo, float Lo,
14 float averageA, float averageZ,
15 float averageRho, float 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)
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
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
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
84MsgStream& 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
98std::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}
#define endmsg
Material with information about thickness of material.
float averageRho() const
Return the average density of the material.
MaterialProperties * clone() const
Pseudo-Constructor clone()
float thicknessInX0() const
Return the radiationlength fraction.
float zOverAtimesRho() const
Return the .
float averageA() const
Return the average A of the material [gram/mole].
void addMaterial(const Material &mp, float dInX0)
Material averaging.
float averageZ() const
Returns the average Z of the material.
const Material & material() const
Return the stored Material.
float dEdX() const
Return method for .
float m_zOaTrTd
- in ATLAS units
void setDeDx(float dEdX)
Set dEdX - important for material calibarion.
float l0() const
Return the nuclear interaction length.
void setMaterial(const Material &mp, float thickness=1.)
Set Material.
float m_dInX0
thickness in units of radiation length
float m_dInL0
thickness in units of nuclear interaction length
float x0() const
Return the radiation length.
MaterialProperties & operator*=(float scale)
Scale operator - scales the material thickness.
float thickness() const
Return the thickness in mm.
MaterialProperties()=default
Default Constructor.
A common object to be contained by.
Definition Material.h:117
MsgStream & operator<<(MsgStream &sl, const AlignModule &alignModule)
overload of << operator for MsgStream for debug output
hold the test vectors and ease the comparison