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
86 G4Exception(
"G4GDMLReadMaterials::AtomRead()",
"InvalidRead",
99 const xercesc::DOMNamedNodeMap*
const attributes
100 = compositeElement->getAttributes();
101 XMLSize_t attributeCount = attributes->getLength();
103 for (XMLSize_t attribute_index=0;
104 attribute_index<attributeCount; attribute_index++)
106 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
108 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
111 const xercesc::DOMAttr*
const attribute
112 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
115 G4Exception(
"G4GDMLReadMaterials::CompositeRead()",
"InvalidRead",
123 if (attName==
"ref") { ref = attValue; }
134 const xercesc::DOMNamedNodeMap*
const attributes
135 = DElement->getAttributes();
136 XMLSize_t attributeCount = attributes->getLength();
138 for (XMLSize_t attribute_index=0;
139 attribute_index<attributeCount; attribute_index++)
141 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
143 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
146 const xercesc::DOMAttr*
const attribute
147 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
150 G4Exception(
"G4GDMLReadMaterials::DRead()",
"InvalidRead",
157 if (attName==
"value") { value =
eval.
Evaluate(attValue); }
else
158 if (attName==
"unit") {
161 G4Exception(
"G4GDMLReadMaterials::DRead()",
"InvalidRead",
174 const xercesc::DOMNamedNodeMap*
const attributes = PElement->getAttributes();
175 XMLSize_t attributeCount = attributes->getLength();
177 for (XMLSize_t attribute_index=0;
178 attribute_index<attributeCount; attribute_index++)
180 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
182 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
185 const xercesc::DOMAttr*
const attribute
186 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
189 G4Exception(
"G4GDMLReadMaterials::PRead()",
"InvalidRead",
196 if (attName==
"value") { value =
eval.
Evaluate(attValue); }
else
199 G4Exception(
"G4GDMLReadMaterials::PRead()",
"InvalidRead",
212 const xercesc::DOMNamedNodeMap*
const attributes = TElement->getAttributes();
213 XMLSize_t attributeCount = attributes->getLength();
215 for (XMLSize_t attribute_index=0;
216 attribute_index<attributeCount; attribute_index++)
218 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
220 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
223 const xercesc::DOMAttr*
const attribute
224 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
227 G4Exception(
"G4GDMLReadMaterials::TRead()",
"InvalidRead",
234 if (attName==
"value") { value =
eval.
Evaluate(attValue); }
else
237 G4Exception(
"G4GDMLReadMaterials::TRead()",
"InvalidRead",
250 const xercesc::DOMNamedNodeMap*
const attributes = PElement->getAttributes();
251 XMLSize_t attributeCount = attributes->getLength();
253 for (XMLSize_t attribute_index=0;
254 attribute_index<attributeCount; attribute_index++)
256 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
258 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
261 const xercesc::DOMAttr*
const attribute
262 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
265 G4Exception(
"G4GDMLReadMaterials::MEERead()",
"InvalidRead",
272 if (attName==
"value") { value =
eval.
Evaluate(attValue); }
else
275 G4Exception(
"G4GDMLReadMaterials::MEERead()",
"InvalidRead",
291 const xercesc::DOMNamedNodeMap*
const attributes
292 = elementElement->getAttributes();
293 XMLSize_t attributeCount = attributes->getLength();
295 for (XMLSize_t attribute_index=0;
296 attribute_index<attributeCount; attribute_index++)
298 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
300 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
303 const xercesc::DOMAttr*
const attribute
304 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
307 G4Exception(
"G4GDMLReadMaterials::ElementRead()",
"InvalidRead",
314 if (attName==
"name") { name =
GenerateName(attValue); }
else
315 if (attName==
"formula") { formula = attValue; }
else
319 G4int nComponents = 0;
321 for (xercesc::DOMNode* iter = elementElement->getFirstChild();
322 iter != 0; iter = iter->getNextSibling())
324 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
326 const xercesc::DOMElement*
const child
327 =
dynamic_cast<xercesc::DOMElement*
>(iter);
330 G4Exception(
"G4GDMLReadMaterials::ElementRead()",
"InvalidRead",
336 if (tag==
"atom") { a =
AtomRead(child); }
else
337 if (tag==
"fraction") { nComponents++; }
356 const xercesc::DOMNamedNodeMap*
const attributes
357 = fractionElement->getAttributes();
358 XMLSize_t attributeCount = attributes->getLength();
360 for (XMLSize_t attribute_index=0;
361 attribute_index<attributeCount; attribute_index++)
363 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
365 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
368 const xercesc::DOMAttr*
const attribute
369 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
372 G4Exception(
"G4GDMLReadMaterials::FractionRead()",
"InvalidRead",
380 if (attName==
"ref") { ref = attValue; }
394 const xercesc::DOMNamedNodeMap*
const attributes
395 = isotopeElement->getAttributes();
396 XMLSize_t attributeCount = attributes->getLength();
398 for (XMLSize_t attribute_index=0;
399 attribute_index<attributeCount;attribute_index++)
401 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
403 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
406 const xercesc::DOMAttr*
const attribute
407 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
410 G4Exception(
"G4GDMLReadMaterials::IsotopeRead()",
"InvalidRead",
417 if (attName==
"name") { name =
GenerateName(attValue); }
else
422 for (xercesc::DOMNode* iter = isotopeElement->getFirstChild();
423 iter != 0; iter = iter->getNextSibling())
425 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
427 const xercesc::DOMElement*
const child
428 =
dynamic_cast<xercesc::DOMElement*
>(iter);
431 G4Exception(
"G4GDMLReadMaterials::IsotopeRead()",
"InvalidRead",
437 if (tag==
"atom") { a =
AtomRead(child); }
455 const xercesc::DOMNamedNodeMap*
const attributes
456 = materialElement->getAttributes();
457 XMLSize_t attributeCount = attributes->getLength();
459 for (XMLSize_t attribute_index=0;
460 attribute_index<attributeCount; attribute_index++)
462 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
464 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
467 const xercesc::DOMAttr*
const attribute
468 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
471 G4Exception(
"G4GDMLReadMaterials::MaterialRead()",
"InvalidRead",
478 if (attName==
"name") { name =
GenerateName(attValue); }
else
480 if (attName==
"state")
482 if (attValue==
"solid") { state =
kStateSolid; }
else
484 if (attValue==
"gas") { state =
kStateGas; }
488 size_t nComponents = 0;
490 for (xercesc::DOMNode* iter = materialElement->getFirstChild();
491 iter != 0; iter = iter->getNextSibling())
493 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
495 const xercesc::DOMElement*
const child
496 =
dynamic_cast<xercesc::DOMElement*
>(iter);
499 G4Exception(
"G4GDMLReadMaterials::MaterialRead()",
"InvalidRead",
505 if (tag==
"atom") { a =
AtomRead(child); }
else
510 if (tag==
"D") { D =
DRead(child); }
else
511 if (tag==
"P") { P =
PRead(child); }
else
512 if (tag==
"T") { T =
TRead(child); }
else
513 if (tag==
"MEE") { MEE =
MEERead(child); }
else
514 if (tag==
"fraction" || tag==
"composite") { nComponents++; }
533 for (xercesc::DOMNode* iter = materialElement->getFirstChild();
534 iter != 0; iter = iter->getNextSibling())
536 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
538 const xercesc::DOMElement*
const child
539 =
dynamic_cast<xercesc::DOMElement*
>(iter);
542 G4Exception(
"G4GDMLReadMaterials::MaterialRead()",
"InvalidRead",
555 for (xercesc::DOMNode* iter = mixtureElement->getFirstChild();
556 iter != 0; iter = iter->getNextSibling())
558 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
560 const xercesc::DOMElement*
const child
561 =
dynamic_cast<xercesc::DOMElement*
>(iter);
564 G4Exception(
"G4GDMLReadMaterials::MixtureRead()",
"InvalidRead",
583 for (xercesc::DOMNode* iter = mixtureElement->getFirstChild();
584 iter != 0; iter = iter->getNextSibling())
586 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
588 const xercesc::DOMElement*
const child
589 =
dynamic_cast<xercesc::DOMElement*
>(iter);
592 G4Exception(
"G4GDMLReadMaterials::MixtureRead()",
"InvalidRead",
606 if (elementPtr != 0) { material->
AddElement(elementPtr,n); }
else
607 if (materialPtr != 0) { material->
AddMaterial(materialPtr,n); }
609 if ((materialPtr == 0) && (elementPtr == 0))
611 G4String error_msg =
"Referenced material/element '"
613 G4Exception(
"G4GDMLReadMaterials::MixtureRead()",
"InvalidSetup",
617 else if (tag==
"composite")
636 const xercesc::DOMNamedNodeMap*
const attributes
637 = propertyElement->getAttributes();
638 XMLSize_t attributeCount = attributes->getLength();
640 for (XMLSize_t attribute_index=0;
641 attribute_index<attributeCount; attribute_index++)
643 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
645 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
648 const xercesc::DOMAttr*
const attribute
649 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
652 G4Exception(
"G4GDMLReadMaterials::PropertyRead()",
"InvalidRead",
659 if (attName==
"name") { name =
GenerateName(attValue); }
else
660 if (attName==
"ref") { matrix =
GetMatrix(ref=attValue); }
674 if (matrix.
GetRows() == 0) {
return; }
689 for (
size_t i=0; i<matrix.
GetRows(); i++)
703 for (xercesc::DOMNode* iter = materialsElement->getFirstChild();
704 iter != 0; iter = iter->getNextSibling())
706 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
708 const xercesc::DOMElement*
const child
709 =
dynamic_cast<xercesc::DOMElement*
>(iter);
712 G4Exception(
"G4GDMLReadMaterials::MaterialsRead()",
"InvalidRead",
718 if (tag==
"define") {
DefineRead(child); }
else
724 G4String error_msg =
"Unknown tag in materials: " + tag;
725 G4Exception(
"G4GDMLReadMaterials::MaterialsRead()",
"InvalidSetup",
741 if (verbose && !elementPtr)
743 G4String error_msg =
"Referenced element '" + ref +
"' was not found!";
744 G4Exception(
"G4GDMLReadMaterials::GetElement()",
"InvalidRead",
756 if (verbose && !isotopePtr)
758 G4String error_msg =
"Referenced isotope '" + ref +
"' was not found!";
759 G4Exception(
"G4GDMLReadMaterials::GetIsotope()",
"InvalidRead",
776 if (verbose && !materialPtr)
778 G4String error_msg =
"Referenced material '" + ref +
"' was not found!";
779 G4Exception(
"G4GDMLReadMaterials::GetMaterial()",
"InvalidRead",
static constexpr double kelvin
G4double DRead(const xercesc::DOMElement *const)
static constexpr double hep_pascal
G4double MEERead(const xercesc::DOMElement *const)
std::vector< ExP01TrackerHit * > a
G4double GetQuantity(const G4String &)
G4Element * GetElement(const G4String &, G4bool verbose=true) const
static constexpr double STP_Temperature
G4double AtomRead(const xercesc::DOMElement *const)
void InsertValues(G4double energy, G4double value)
G4PhysicsOrderedFreeVector G4MaterialPropertyVector
static G4Element * GetElement(G4String name, G4bool warning=true)
void AddConstProperty(const char *key, G4double PropertyValue)
G4String GenerateName(const G4String &name, G4bool strip=false)
void SetMeanExcitationEnergy(G4double value)
G4int CompositeRead(const xercesc::DOMElement *const, G4String &)
G4double Evaluate(const G4String &)
static G4Isotope * GetIsotope(const G4String &name, G4bool warning=false)
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
virtual ~G4GDMLReadMaterials()
static constexpr double STP_Pressure
void AddIsotope(G4Isotope *isotope, G4double RelativeAbundance)
G4Element * FindOrBuildElement(G4int Z, G4bool isotopes=true)
static constexpr double g
G4String RefRead(const xercesc::DOMElement *const)
void SetMaterialPropertiesTable(G4MaterialPropertiesTable *anMPT)
void MaterialRead(const xercesc::DOMElement *const)
virtual void DefineRead(const xercesc::DOMElement *const)
G4String Strip(const G4String &) const
G4Material * GetMaterial(const G4String &, G4bool verbose=true) const
const XML_Char int const XML_Char * value
G4String Transcode(const XMLCh *const)
G4MaterialPropertyVector * AddProperty(const char *key, G4double *PhotonEnergies, G4double *PropertyValues, G4int NumEntries)
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
static G4double GetValueOf(const G4String &)
static constexpr double eV
void PropertyRead(const xercesc::DOMElement *const, G4Material *)
G4double TRead(const xercesc::DOMElement *const)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
void AddElement(G4Element *element, G4int nAtoms)
void IsotopeRead(const xercesc::DOMElement *const)
G4IonisParamMat * GetIonisation() const
G4GLOB_DLL std::ostream G4cout
G4double Get(size_t r, size_t c) const
static G4String GetCategory(const G4String &)
G4GDMLMatrix GetMatrix(const G4String &)
G4int EvaluateInteger(const G4String &)
static constexpr double mole
G4double FractionRead(const xercesc::DOMElement *const, G4String &)
G4Isotope * GetIsotope(const G4String &, G4bool verbose=true) const
void AddMaterial(G4Material *material, G4double fraction)
virtual void MaterialsRead(const xercesc::DOMElement *const)
static constexpr double cm3
G4double PRead(const xercesc::DOMElement *const)
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
void ElementRead(const xercesc::DOMElement *const)
void MixtureRead(const xercesc::DOMElement *const, G4Element *)
static G4NistManager * Instance()