60 const xercesc::DOMNamedNodeMap*
const attributes
61 = atomElement->getAttributes();
62 XMLSize_t attributeCount = attributes->getLength();
64 for (XMLSize_t attribute_index=0;
65 attribute_index<attributeCount; attribute_index++)
67 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
69 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
72 const xercesc::DOMAttr*
const attribute
73 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
76 G4Exception(
"G4GDMLReadMaterials::AtomRead()",
"InvalidRead",
83 if (attName==
"value") { value =
eval.
Evaluate(attValue); }
else
95 const xercesc::DOMNamedNodeMap*
const attributes
96 = compositeElement->getAttributes();
97 XMLSize_t attributeCount = attributes->getLength();
99 for (XMLSize_t attribute_index=0;
100 attribute_index<attributeCount; attribute_index++)
102 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
104 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
107 const xercesc::DOMAttr*
const attribute
108 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
111 G4Exception(
"G4GDMLReadMaterials::CompositeRead()",
"InvalidRead",
119 if (attName==
"ref") { ref = attValue; }
130 const xercesc::DOMNamedNodeMap*
const attributes
131 = DElement->getAttributes();
132 XMLSize_t attributeCount = attributes->getLength();
134 for (XMLSize_t attribute_index=0;
135 attribute_index<attributeCount; attribute_index++)
137 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
139 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
142 const xercesc::DOMAttr*
const attribute
143 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
146 G4Exception(
"G4GDMLReadMaterials::DRead()",
"InvalidRead",
153 if (attName==
"value") { value =
eval.
Evaluate(attValue); }
else
165 const xercesc::DOMNamedNodeMap*
const attributes = PElement->getAttributes();
166 XMLSize_t attributeCount = attributes->getLength();
168 for (XMLSize_t attribute_index=0;
169 attribute_index<attributeCount; attribute_index++)
171 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
173 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
176 const xercesc::DOMAttr*
const attribute
177 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
180 G4Exception(
"G4GDMLReadMaterials::PRead()",
"InvalidRead",
187 if (attName==
"value") { value =
eval.
Evaluate(attValue); }
else
199 const xercesc::DOMNamedNodeMap*
const attributes = TElement->getAttributes();
200 XMLSize_t attributeCount = attributes->getLength();
202 for (XMLSize_t attribute_index=0;
203 attribute_index<attributeCount; attribute_index++)
205 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
207 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
210 const xercesc::DOMAttr*
const attribute
211 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
214 G4Exception(
"G4GDMLReadMaterials::TRead()",
"InvalidRead",
221 if (attName==
"value") { value =
eval.
Evaluate(attValue); }
else
233 const xercesc::DOMNamedNodeMap*
const attributes = PElement->getAttributes();
234 XMLSize_t attributeCount = attributes->getLength();
236 for (XMLSize_t attribute_index=0;
237 attribute_index<attributeCount; attribute_index++)
239 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
241 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
244 const xercesc::DOMAttr*
const attribute
245 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
248 G4Exception(
"G4GDMLReadMaterials::MEERead()",
"InvalidRead",
255 if (attName==
"value") { value =
eval.
Evaluate(attValue); }
else
270 const xercesc::DOMNamedNodeMap*
const attributes
271 = elementElement->getAttributes();
272 XMLSize_t attributeCount = attributes->getLength();
274 for (XMLSize_t attribute_index=0;
275 attribute_index<attributeCount; attribute_index++)
277 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
279 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
282 const xercesc::DOMAttr*
const attribute
283 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
286 G4Exception(
"G4GDMLReadMaterials::ElementRead()",
"InvalidRead",
293 if (attName==
"name") { name =
GenerateName(attValue); }
else
294 if (attName==
"formula") { formula = attValue; }
else
300 for (xercesc::DOMNode* iter = elementElement->getFirstChild();
301 iter != 0; iter = iter->getNextSibling())
303 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
305 const xercesc::DOMElement*
const child
306 =
dynamic_cast<xercesc::DOMElement*
>(iter);
309 G4Exception(
"G4GDMLReadMaterials::ElementRead()",
"InvalidRead",
315 if (tag==
"atom") { a =
AtomRead(child); }
else
316 if (tag==
"fraction") { nComponents++; }
335 const xercesc::DOMNamedNodeMap*
const attributes
336 = fractionElement->getAttributes();
337 XMLSize_t attributeCount = attributes->getLength();
339 for (XMLSize_t attribute_index=0;
340 attribute_index<attributeCount; attribute_index++)
342 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
344 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
347 const xercesc::DOMAttr*
const attribute
348 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
351 G4Exception(
"G4GDMLReadMaterials::FractionRead()",
"InvalidRead",
359 if (attName==
"ref") { ref = attValue; }
373 const xercesc::DOMNamedNodeMap*
const attributes
374 = isotopeElement->getAttributes();
375 XMLSize_t attributeCount = attributes->getLength();
377 for (XMLSize_t attribute_index=0;
378 attribute_index<attributeCount;attribute_index++)
380 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
382 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
385 const xercesc::DOMAttr*
const attribute
386 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
389 G4Exception(
"G4GDMLReadMaterials::IsotopeRead()",
"InvalidRead",
396 if (attName==
"name") { name =
GenerateName(attValue); }
else
401 for (xercesc::DOMNode* iter = isotopeElement->getFirstChild();
402 iter != 0; iter = iter->getNextSibling())
404 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
406 const xercesc::DOMElement*
const child
407 =
dynamic_cast<xercesc::DOMElement*
>(iter);
410 G4Exception(
"G4GDMLReadMaterials::IsotopeRead()",
"InvalidRead",
416 if (tag==
"atom") { a =
AtomRead(child); }
434 const xercesc::DOMNamedNodeMap*
const attributes
435 = materialElement->getAttributes();
436 XMLSize_t attributeCount = attributes->getLength();
438 for (XMLSize_t attribute_index=0;
439 attribute_index<attributeCount; attribute_index++)
441 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
443 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
446 const xercesc::DOMAttr*
const attribute
447 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
450 G4Exception(
"G4GDMLReadMaterials::MaterialRead()",
"InvalidRead",
457 if (attName==
"name") { name =
GenerateName(attValue); }
else
459 if (attName==
"state")
461 if (attValue==
"solid") { state =
kStateSolid; }
else
463 if (attValue==
"gas") { state =
kStateGas; }
469 for (xercesc::DOMNode* iter = materialElement->getFirstChild();
470 iter != 0; iter = iter->getNextSibling())
472 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
474 const xercesc::DOMElement*
const child
475 =
dynamic_cast<xercesc::DOMElement*
>(iter);
478 G4Exception(
"G4GDMLReadMaterials::MaterialRead()",
"InvalidRead",
484 if (tag==
"atom") { a =
AtomRead(child); }
else
489 if (tag==
"D") { D =
DRead(child); }
else
490 if (tag==
"P") { P =
PRead(child); }
else
491 if (tag==
"T") { T =
TRead(child); }
else
492 if (tag==
"MEE") { MEE =
MEERead(child); }
else
493 if (tag==
"fraction" || tag==
"composite") { nComponents++; }
512 for (xercesc::DOMNode* iter = materialElement->getFirstChild();
513 iter != 0; iter = iter->getNextSibling())
515 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
517 const xercesc::DOMElement*
const child
518 =
dynamic_cast<xercesc::DOMElement*
>(iter);
521 G4Exception(
"G4GDMLReadMaterials::MaterialRead()",
"InvalidRead",
534 for (xercesc::DOMNode* iter = mixtureElement->getFirstChild();
535 iter != 0; iter = iter->getNextSibling())
537 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
539 const xercesc::DOMElement*
const child
540 =
dynamic_cast<xercesc::DOMElement*
>(iter);
543 G4Exception(
"G4GDMLReadMaterials::MixtureRead()",
"InvalidRead",
562 for (xercesc::DOMNode* iter = mixtureElement->getFirstChild();
563 iter != 0; iter = iter->getNextSibling())
565 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
567 const xercesc::DOMElement*
const child
568 =
dynamic_cast<xercesc::DOMElement*
>(iter);
571 G4Exception(
"G4GDMLReadMaterials::MixtureRead()",
"InvalidRead",
585 if (elementPtr != 0) { material->
AddElement(elementPtr,n); }
else
586 if (materialPtr != 0) { material->
AddMaterial(materialPtr,n); }
588 if ((materialPtr == 0) && (elementPtr == 0))
590 G4String error_msg =
"Referenced material/element '"
592 G4Exception(
"G4GDMLReadMaterials::MixtureRead()",
"InvalidSetup",
596 else if (tag==
"composite")
615 const xercesc::DOMNamedNodeMap*
const attributes
616 = propertyElement->getAttributes();
617 XMLSize_t attributeCount = attributes->getLength();
619 for (XMLSize_t attribute_index=0;
620 attribute_index<attributeCount; attribute_index++)
622 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
624 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
627 const xercesc::DOMAttr*
const attribute
628 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
631 G4Exception(
"G4GDMLReadMaterials::PropertyRead()",
"InvalidRead",
638 if (attName==
"name") { name =
GenerateName(attValue); }
else
639 if (attName==
"ref") { matrix =
GetMatrix(ref=attValue); }
653 if (matrix.
GetRows() == 0) {
return; }
668 for (
size_t i=0; i<matrix.
GetRows(); i++)
681 for (xercesc::DOMNode* iter = materialsElement->getFirstChild();
682 iter != 0; iter = iter->getNextSibling())
684 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
686 const xercesc::DOMElement*
const child
687 =
dynamic_cast<xercesc::DOMElement*
>(iter);
690 G4Exception(
"G4GDMLReadMaterials::MaterialsRead()",
"InvalidRead",
696 if (tag==
"define") {
DefineRead(child); }
else
702 G4String error_msg =
"Unknown tag in materials: " + tag;
703 G4Exception(
"G4GDMLReadMaterials::MaterialsRead()",
"InvalidSetup",
719 if (verbose && !elementPtr)
721 G4String error_msg =
"Referenced element '" + ref +
"' was not found!";
722 G4Exception(
"G4GDMLReadMaterials::GetElement()",
"InvalidRead",
734 if (verbose && !isotopePtr)
736 G4String error_msg =
"Referenced isotope '" + ref +
"' was not found!";
737 G4Exception(
"G4GDMLReadMaterials::GetIsotope()",
"InvalidRead",
754 if (verbose && !materialPtr)
756 G4String error_msg =
"Referenced material '" + ref +
"' was not found!";
757 G4Exception(
"G4GDMLReadMaterials::GetMaterial()",
"InvalidRead",
G4double TRead(const xercesc::DOMElement *const)
G4IonisParamMat * GetIonisation() const
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
G4int EvaluateInteger(const G4String &)
G4double GetQuantity(const G4String &)
G4double DRead(const xercesc::DOMElement *const)
static G4Element * GetElement(G4String name, G4bool warning=true)
void AddMaterial(G4Material *material, G4double fraction)
G4Material * GetMaterial(const G4String &, G4bool verbose=true) const
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
virtual void DefineRead(const xercesc::DOMElement *const)
void SetMeanExcitationEnergy(G4double value)
void SetMaterialPropertiesTable(G4MaterialPropertiesTable *anMPT)
static const double hep_pascal
virtual ~G4GDMLReadMaterials()
G4String Transcode(const XMLCh *const)
void InsertValues(G4double energy, G4double value)
G4double Get(size_t r, size_t c) const
static G4NistManager * Instance()
static G4Isotope * GetIsotope(const G4String &name, G4bool warning=false)
G4MaterialPropertyVector * AddProperty(const char *key, G4double *PhotonEnergies, G4double *PropertyValues, G4int NumEntries)
G4String RefRead(const xercesc::DOMElement *const)
G4double FractionRead(const xercesc::DOMElement *const, G4String &)
void MixtureRead(const xercesc::DOMElement *const, G4Element *)
G4Isotope * GetIsotope(const G4String &, G4bool verbose=true) const
static G4double GetValueOf(const G4String &)
G4int CompositeRead(const xercesc::DOMElement *const, G4String &)
G4GLOB_DLL std::ostream G4cout
void IsotopeRead(const xercesc::DOMElement *const)
G4PhysicsOrderedFreeVector G4MaterialPropertyVector
G4Element * GetElement(const G4String &, G4bool verbose=true) const
void AddIsotope(G4Isotope *isotope, G4double RelativeAbundance)
void AddConstProperty(const char *key, G4double PropertyValue)
virtual void MaterialsRead(const xercesc::DOMElement *const)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
static const double kelvin
G4String GenerateName(const G4String &name, G4bool strip=false)
G4double PRead(const xercesc::DOMElement *const)
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
G4double MEERead(const xercesc::DOMElement *const)
G4String Strip(const G4String &) const
void PropertyRead(const xercesc::DOMElement *const, G4Material *)
void AddElement(G4Element *element, G4int nAtoms)
void ElementRead(const xercesc::DOMElement *const)
G4Element * FindOrBuildElement(G4int Z, G4bool isotopes=true)
void MaterialRead(const xercesc::DOMElement *const)
G4double Evaluate(const G4String &)
G4GDMLMatrix GetMatrix(const G4String &)
G4double AtomRead(const xercesc::DOMElement *const)