47 create( name, std::make_unique<Material>( z, a, d ));
65 create( name, std::make_unique<Material>( 0, 0, density ));
75 throw cms::Exception(
"DDException") <<
"DDMaterial::addMaterial(..): name-clash\n trying to add material " << m <<
" to itself! ";
77 rep().addMaterial( m, fm );
78 return rep().noOfConstituents();
84 return rep().noOfConstituents();
89 return rep().constituent( i );
106 return rep().density();
110 std::ostream &doStream(std::ostream & os,
const DDMaterial & mat,
int level)
114 os <<
'[' << mat.
name() <<
']' <<
" z=" << mat.
z()
115 <<
" a=" <<
CONVERT_TO( mat.
a(), g_per_mole ) <<
"*g/mole" 120 os << std::endl << s <<
i+1 <<
" : fm=" << f.second
122 doStream(os, f.first, level);
126 os <<
"* material not declared * ";
134 return doStream( os, mat, 0 );
double a() const
returns the atomic mass
const DDName & name() const
DDMaterial is used to define and access material information.
DDMaterial()
Creates a uninitialized reference-object (see DDLogicalPart documentation for details on reference ob...
#define CONVERT_TO(_x, _y)
DDName is used to identify DDD entities uniquely.
const DDI::rep_traits< DDName, std::unique_ptr< DDI::Material > >::reference rep() const
int addMaterial(const DDMaterial &m, double fm)
adds a material to the mixture proportional to its fraction-mass fm.
double z() const
retruns the atomic number
Container::value_type value_type
FractionV::value_type constituent(int i) const
returns the i-th compound material and its fraction-mass
double density() const
returns the density
int noOfConstituents() const
returns the number of compound materials or 0 for elementary materials
friend std::ostream & operator<<(std::ostream &, const DDMaterial &)
void create(const DDName &name, std::unique_ptr< DDI::Material > vals)