diff --git a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/MaterialProperties.h b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/MaterialProperties.h index e448d6e3e1b1768c35829b2be4552265ec10ddea..ab34f2f13a4a677e6008cbbd30c3b2c95f03faff 100755 --- a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/MaterialProperties.h +++ b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/MaterialProperties.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -40,10 +40,19 @@ namespace Trk { class MaterialProperties { public: - /** Default Constructor */ - MaterialProperties(); - + MaterialProperties() = default; + /** Copy Constructor */ + MaterialProperties(const MaterialProperties& mprop) = default; + /** Assignment Operator */ + MaterialProperties& operator=(const MaterialProperties& mprop) = default; + /** Move Constructor */ + MaterialProperties(MaterialProperties&& mprop) = default; + /** Move Assignment Operator */ + MaterialProperties& operator=(MaterialProperties&& mprop) = default; + /** Destructor */ + ~MaterialProperties() = default; + /** Constructor - for averaged material */ MaterialProperties(float path, float Xo, @@ -51,23 +60,15 @@ namespace Trk { float averageA, float averageZ, float averageRho, - float dEdX=0.); + float dEdX = 0.); /** Constructor - for full Material class */ MaterialProperties(const Material& material, float path); - /** Copy Constructor */ - MaterialProperties(const MaterialProperties& mprop); - - /** Destructor */ - virtual ~MaterialProperties(){} - /** Pseudo-Constructor clone() */ - virtual MaterialProperties* clone() const; + MaterialProperties* clone() const; - /** Assignment Operator */ - MaterialProperties& operator =( const MaterialProperties& mprop); - + /** Scale operator - scales the material thickness */ MaterialProperties& operator *= ( float scale); @@ -122,75 +123,24 @@ namespace Trk { friend class ::MaterialPropertiesCnv_p1; /** Set dEdX - important for material calibarion */ - virtual void setDeDx(float dEdX); - - Material m_material; - - float m_dInX0; //!< thickness in units of radiation length - float m_dInL0; //!< thickness in units of nuclear interaction length - float m_zOaTrTd; //!< @f$ \frac{Z}{A}\cdot\rho\cdot d @f$ - in ATLAS units + void setDeDx(float dEdX); + Material m_material; + float m_dInX0 = 0; //!< thickness in units of radiation length + float m_dInL0 = 0; //!< thickness in units of nuclear interaction length + float m_zOaTrTd = 0; //!< @f$ \frac{Z}{A}\cdot\rho\cdot d @f$ - in ATLAS units }; - - /** Return method for the full material */ - inline const Material& MaterialProperties::material() const - { return m_material; } - - inline Material& MaterialProperties::material() - { return m_material; } - - /** Return method for thicknes in units of radiation length - dimensionless */ - inline float MaterialProperties::thicknessInX0() const { return m_dInX0; } - - /** Return method for thickness in units of nuclear interaction length - dimensionless */ - inline float MaterialProperties::thicknessInL0() const { return m_dInL0; } - - /** Return method for thickness in mm */ - inline float MaterialProperties::thickness() const { return m_dInX0*m_material.X0; } - - /** Return method for radiation length - in [mm] */ - inline float MaterialProperties::x0() const - { return m_material.X0; } - - /** Return method for nuclear interaction length - in [mm] */ - inline float MaterialProperties::l0() const - { return m_material.L0; } - - /** Return method for @f$ \frac{A}{Z}\cdot\rho @f$ */ - inline float MaterialProperties::zOverAtimesRho() const - { return m_material.zOaTr; } - - /** Return method for @f$ \frac{A}{Z}\cdot\rho\cdot d @f$ */ - inline float MaterialProperties::zOverAtimesRhoTimesD() const - { return m_zOaTrTd; } - - /** Return method for @f$ A @f$ */ - inline float MaterialProperties::averageA() const - { return m_material.A; } - - /** Return method for @f$ Z @f$ */ - inline float MaterialProperties::averageZ() const - { return m_material.Z; } - - /** Return method for @f$ Z @f$ */ - inline float MaterialProperties::averageRho() const - { return m_material.rho; } - - /** Return method for @f$ dE/dX @f$ */ - inline float MaterialProperties::dEdX() const - { return m_material.dEdX; } - /**Overload of << operator for both, MsgStream and std::ostream for debug output*/ MsgStream& operator<<( MsgStream& sl, const MaterialProperties& mprop); std::ostream& operator<<( std::ostream& sl, const MaterialProperties& mprop); /** Useful typedefs */ - typedef std::vector< const MaterialProperties*> MaterialPropertiesVector; typedef std::vector<MaterialPropertiesVector> MaterialPropertiesMatrix; } // end of namespace +#include "TrkGeometry/MaterialProperties.icc" #endif // TRKGEOMETRY_MATERIALPROPERTIES_H diff --git a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/MaterialProperties.icc b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/MaterialProperties.icc new file mode 100644 index 0000000000000000000000000000000000000000..9e34e23e83416df5ba595a4c67b2386fd873ce45 --- /dev/null +++ b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/MaterialProperties.icc @@ -0,0 +1,98 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +namespace Trk { + +/** Return method for the full material */ +inline const Material& +MaterialProperties::material() const +{ + return m_material; +} + +inline Material& +MaterialProperties::material() +{ + return m_material; +} + +/** Return method for thicknes in units of radiation length - dimensionless */ +inline float +MaterialProperties::thicknessInX0() const +{ + return m_dInX0; +} + +/** Return method for thickness in units of nuclear interaction length - + * dimensionless */ +inline float +MaterialProperties::thicknessInL0() const +{ + return m_dInL0; +} + +/** Return method for thickness in mm */ +inline float +MaterialProperties::thickness() const +{ + return m_dInX0 * m_material.X0; +} + +/** Return method for radiation length - in [mm] */ +inline float +MaterialProperties::x0() const +{ + return m_material.X0; +} + +/** Return method for nuclear interaction length - in [mm] */ +inline float +MaterialProperties::l0() const +{ + return m_material.L0; +} + +/** Return method for @f$ \frac{A}{Z}\cdot\rho @f$ */ +inline float +MaterialProperties::zOverAtimesRho() const +{ + return m_material.zOaTr; +} + +/** Return method for @f$ \frac{A}{Z}\cdot\rho\cdot d @f$ */ +inline float +MaterialProperties::zOverAtimesRhoTimesD() const +{ + return m_zOaTrTd; +} + +/** Return method for @f$ A @f$ */ +inline float +MaterialProperties::averageA() const +{ + return m_material.A; +} + +/** Return method for @f$ Z @f$ */ +inline float +MaterialProperties::averageZ() const +{ + return m_material.Z; +} + +/** Return method for @f$ Z @f$ */ +inline float +MaterialProperties::averageRho() const +{ + return m_material.rho; +} + +/** Return method for @f$ dE/dX @f$ */ +inline float +MaterialProperties::dEdX() const +{ + return m_material.dEdX; +} + +} diff --git a/Tracking/TrkDetDescr/TrkGeometry/src/MaterialProperties.cxx b/Tracking/TrkDetDescr/TrkGeometry/src/MaterialProperties.cxx index 5b4ddede34eb611c941b31be9d972b0d77f04adc..ac63428b3fd7d6a1edc8a1f10067d192faac5b4a 100755 --- a/Tracking/TrkDetDescr/TrkGeometry/src/MaterialProperties.cxx +++ b/Tracking/TrkDetDescr/TrkGeometry/src/MaterialProperties.cxx @@ -9,12 +9,6 @@ #include "TrkGeometry/MaterialProperties.h" #include <iostream> -Trk::MaterialProperties::MaterialProperties(): - m_material(), - m_dInX0(0.), - m_dInL0(0.), - m_zOaTrTd(0.) -{} Trk::MaterialProperties::MaterialProperties( float path, @@ -27,11 +21,10 @@ Trk::MaterialProperties::MaterialProperties( m_material(Xo, Lo, averageA, averageZ, averageRho, dEdX), m_dInX0( Xo*Xo > 10e-10 ? path/Xo : 0.), m_dInL0( Lo*Lo > 10e-10 ? path/Lo : 0.), - m_zOaTrTd(averageA * averageA > 10e-10 ? averageZ/averageA*averageRho*path : 0.) + m_zOaTrTd(averageA * averageA > 10e-10 ? averageZ/averageA*averageRho*path : 0.) {} // TODO add constructor with element composition - Trk::MaterialProperties::MaterialProperties(const Trk::Material& material, float path) : m_material(material), m_dInX0( material.X0*material.X0 > 10e-10 ? path/material.X0 : 0.), @@ -39,38 +32,22 @@ Trk::MaterialProperties::MaterialProperties(const Trk::Material& material, float m_zOaTrTd( material.A*material.A > 10e-10 ? path*material.Z/material.A*material.rho : 0.) {} -Trk::MaterialProperties::MaterialProperties(const Trk::MaterialProperties& mprop) - -= default; - - -Trk::MaterialProperties* Trk::MaterialProperties::clone() const +Trk::MaterialProperties* Trk::MaterialProperties::clone() const { return new Trk::MaterialProperties(*this); } -Trk::MaterialProperties& Trk::MaterialProperties::operator =( const Trk::MaterialProperties& mprop) -{ - if (this!= &mprop){ - m_material = mprop.m_material; - m_dInX0 = mprop.m_dInX0; - m_dInL0 = mprop.m_dInL0; - m_zOaTrTd = mprop.m_zOaTrTd; - } - return(*this); -} - Trk::MaterialProperties& Trk::MaterialProperties::operator *=( float scale ) { - // assuming rescaling of the material thickness + // assuming rescaling of the material thickness m_dInX0 *= scale; m_dInL0 *= scale; m_zOaTrTd *= scale; - + return(*this); } void Trk::MaterialProperties::addMaterial(const Trk::Material& mat, float dInX0){ - + //!< @todo update ? // averaging factors based on thickness float fnew = dInX0*mat.X0/(m_dInX0*m_material.X0+dInX0*mat.X0); @@ -78,7 +55,7 @@ void Trk::MaterialProperties::addMaterial(const Trk::Material& mat, float dInX0) // updated material thickness m_dInX0 += dInX0; - + // updated material m_material = Trk::Material(1./(fnew/mat.X0+fold/m_material.X0), 1./(fnew/mat.L0+fold/m_material.L0), @@ -88,7 +65,7 @@ void Trk::MaterialProperties::addMaterial(const Trk::Material& mat, float dInX0) // updated derived members m_dInL0 = m_dInX0*m_material.X0/m_material.L0; - m_zOaTrTd = m_material.A > 0 ? m_dInX0*m_material.X0*m_material.Z/m_material.A*m_material.rho : 0; + m_zOaTrTd = m_material.A > 0 ? m_dInX0*m_material.X0*m_material.Z/m_material.A*m_material.rho : 0; } void Trk::MaterialProperties::setMaterial(const Trk::Material& mat, float thickness) { @@ -108,37 +85,21 @@ void Trk::MaterialProperties::setDeDx(float dEdX) MsgStream& Trk::operator << ( MsgStream& sl, const Trk::MaterialProperties& mprop) { sl << "Trk::MaterialProperties: " << endmsg; - sl << " - thickness/X0 = " << mprop.thicknessInX0() << endmsg; + sl << " - thickness/X0 = " << mprop.thicknessInX0() << endmsg; sl << " - thickness [mm] = " << mprop.thickness() << endmsg; sl << " - radiation length X0 [mm] = " << mprop.x0() << endmsg; sl << " - nuclear interaction length L0 [mm] = " << mprop.l0() << endmsg; sl << " - average material Z/A*rho [gram/mm^3] = " << mprop.zOverAtimesRho() << endmsg; - /* interface not finalized - if (mprop.material().composition){ - sl << " - material composition from " << mprop.material().composition->size() << " elements " << std::endl; - sl << " listing them (prob. ordereded ) : " << std::endl; - for ( auto& eIter : (*mprop.material().composition) ) - sl << " -> Z : " << eIter.element() << "( fraction : " << eIter.fraction() << " )" << std::endl; - } - */ return sl; } std::ostream& Trk::operator << ( std::ostream& sl, const MaterialProperties& mprop) -{ +{ sl << "Trk::MaterialProperties: " << std::endl; - sl << " - thickness/X0 = " << mprop.thicknessInX0() << std::endl; + sl << " - thickness/X0 = " << mprop.thicknessInX0() << std::endl; sl << " - thickness [mm] = " << mprop.thickness() << std::endl; sl << " - radiation length X0 [mm] = " << mprop.x0() << std::endl; sl << " - nuclear interaction length L0 [mm] = " << mprop.l0() << std::endl; sl << " - average material Z/A*rho [gram/mm^3] = " << mprop.zOverAtimesRho() << std::endl; - /* interface not finalized - if (mprop.material().composition){ - sl << " - material composition from " << mprop.material().composition->size() << " elements " << std::endl; - sl << " listing them (prob. ordereded ) : " << std::endl; - for ( auto& eIter : (*mprop.material().composition) ) - sl << " -> Z : " << eIter.element() << "( fraction : " << eIter.fraction() << " )" << std::endl; - } - */ return sl; }