39 mat =
DDMaterial( ddn, ev.
eval( nmspace, atts.find(
"density" )->second ));
58 if( myMF->size() != myrMaterial->size())
60 std::string msg =
"/nDDLCompositeMaterial::processElement found that the ";
61 msg +=
"number of MaterialFractions does not match the number ";
62 msg +=
"of rMaterial names for ";
63 msg += ddn.
ns() +
":" + ddn.
name() +
".";
66 for(
size_t i = 0;
i < myrMaterial->size(); ++
i )
68 atts = myMF->getAttributeSet(
i );
69 mat.
addMaterial( myrMaterial->getDDName( nmspace,
"name",
i ),
70 ev.
eval( nmspace, atts.find(
"fraction" )->second ));
void processElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv) override
Processing the element.
DDLMaterial processes Box elements.
DDLElementRegistry * myRegistry_
DDMaterial is used to define and access material information.
virtual const DDXMLAttribute & getAttributeSet(size_t aIndex=0) const
Get a "row" of attributes, i.e. one attribute set.
void throwError(const std::string &keyMessage) const
format std::string for throw an error.
const std::string & ns() const
Returns the namespace.
DDName is used to identify DDD entities uniquely.
Compact representation of the geometrical detector hierarchy.
std::map< std::string, std::string > DDXMLAttribute
int addMaterial(const DDMaterial &m, double fm)
adds a material to the mixture proportional to its fraction-mass fm.
ClhepEvaluator & evaluator()
DDLCompositeMaterial(DDLElementRegistry *myreg)
std::shared_ptr< DDXMLElement > getElement(const std::string &name)
THE most important part. Getting the pointer to a given element type.
virtual void setReference(const std::string &nmspace, DDCompactView &cpv)
void preProcessElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv) override
Called by loadAttributes AFTER attributes are loaded.
double eval(const std::string &ns, const std::string &expr)
The main class for processing parsed elements.
virtual void clear(void)
clear this element's contents.
virtual const DDName getDDName(const std::string &defaultNS, const std::string &attname=std::string("name"), size_t aIndex=0)
const std::string & name() const
Returns the name.