65 throw cms::Exception(
"DDException") <<
"DDMaterial::addMaterial(..): name-clash\n trying to add material " 66 <<
m <<
" to itself! ";
68 rep().addMaterial(
m, fm);
69 return rep().noOfConstituents();
83 std::ostream &doStream(std::ostream &os,
const DDMaterial &mat,
int level) {
86 os <<
'[' << mat.
name() <<
']' <<
" z=" << mat.
z() <<
" a=" <<
convertUnitsTo(1._g_per_mole, mat.
a()) <<
"*g/mole" 91 os << std::endl <<
s <<
i + 1 <<
" : fm=" <<
f.second <<
" : ";
92 doStream(os,
f.first,
level);
95 os <<
"* material not declared * ";
DDMaterial is used to define and access material information.
DDMaterial()
Creates a uninitialized reference-object (see DDLogicalPart documentation for details on reference ob...
DDName is used to identify DDD entities uniquely.
const DDI::rep_traits< DDName, std::unique_ptr< DDI::Material > >::reference rep() const
std::unique_ptr< T, impl::DeviceDeleter > unique_ptr
constexpr NumType convertUnitsTo(double desiredUnits, NumType val)
int addMaterial(const DDMaterial &m, double fm)
adds a material to the mixture proportional to its fraction-mass fm.
Container::value_type value_type
std::ostream & operator<<(std::ostream &os, const DDMaterial &mat)
double density() const
returns the density
double z() const
retruns the atomic number
const DDName & name() const
FractionV::value_type constituent(int i) const
returns the i-th compound material and its fraction-mass
const DDName & ddname() const
int noOfConstituents() const
returns the number of compound materials or 0 for elementary materials
double a() const
returns the atomic mass
void create(const DDName &name, std::unique_ptr< DDI::Material > vals)