83 const xercesc::DOMElement*
const booleanElement,
const BooleanOp op)
93 const xercesc::DOMNamedNodeMap*
const attributes =
94 booleanElement->getAttributes();
95 XMLSize_t attributeCount = attributes->getLength();
97 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
100 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
102 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
107 const xercesc::DOMAttr*
const attribute =
108 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
109 if(attribute ==
nullptr)
111 G4Exception(
"G4GDMLReadSolids::BooleanRead()",
"InvalidRead",
118 if(attName ==
"name")
124 for(xercesc::DOMNode* iter = booleanElement->getFirstChild(); iter !=
nullptr;
125 iter = iter->getNextSibling())
127 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
132 const xercesc::DOMElement*
const child =
133 dynamic_cast<xercesc::DOMElement*
>(iter);
136 G4Exception(
"G4GDMLReadSolids::BooleanRead()",
"InvalidRead",
146 else if(
tag ==
"second")
150 else if(
tag ==
"position")
154 else if(
tag ==
"rotation")
158 else if(
tag ==
"positionref")
162 else if(
tag ==
"rotationref")
166 else if(
tag ==
"firstposition")
170 else if(
tag ==
"firstrotation")
174 else if(
tag ==
"firstpositionref")
178 else if(
tag ==
"firstrotationref")
184 G4String error_msg =
"Unknown tag in boolean solid: " +
tag;
185 G4Exception(
"G4GDMLReadSolids::BooleanRead()",
"ReadError",
195 if(((firstrotation.
x() != 0.0) || (firstrotation.
y() != 0.0) ||
196 (firstrotation.
z() != 0.0)) ||
197 ((firstposition.
x() != 0.0) || (firstposition.
y() != 0.0) ||
198 (firstposition.
z() != 0.0)))
203 firstSolid, firsttransform);
208 new G4UnionSolid(name, firstSolid, secondSolid, transform);
210 else if(op == SUBTRACTION)
214 else if(op == INTERSECTION)
229 const xercesc::DOMNamedNodeMap*
const attributes =
230 boxElement->getAttributes();
231 XMLSize_t attributeCount = attributes->getLength();
233 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
236 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
238 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
243 const xercesc::DOMAttr*
const attribute =
244 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
245 if(attribute ==
nullptr)
248 "No attribute found!");
254 if(attName ==
"name")
258 else if(attName ==
"lunit")
263 G4Exception(
"G4GDMLReadSolids::BoxRead()",
"InvalidRead",
267 else if(attName ==
"x")
271 else if(attName ==
"y")
275 else if(attName ==
"z")
285 new G4Box(name, x, y, z);
302 const xercesc::DOMNamedNodeMap*
const attributes =
303 coneElement->getAttributes();
304 XMLSize_t attributeCount = attributes->getLength();
306 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
309 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
311 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
316 const xercesc::DOMAttr*
const attribute =
317 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
318 if(attribute ==
nullptr)
321 "No attribute found!");
327 if(attName ==
"name")
331 else if(attName ==
"lunit")
336 G4Exception(
"G4GDMLReadSolids::ConeRead()",
"InvalidRead",
340 else if(attName ==
"aunit")
345 G4Exception(
"G4GDMLReadSolids::ConeRead()",
"InvalidRead",
349 else if(attName ==
"rmin1")
353 else if(attName ==
"rmax1")
357 else if(attName ==
"rmin2")
361 else if(attName ==
"rmax2")
365 else if(attName ==
"z")
369 else if(attName ==
"startphi")
373 else if(attName ==
"deltaphi")
387 new G4Cons(name, rmin1, rmax1, rmin2, rmax2, z, startphi, deltaphi);
392 const xercesc::DOMElement*
const elconeElement)
401 const xercesc::DOMNamedNodeMap*
const attributes =
402 elconeElement->getAttributes();
403 XMLSize_t attributeCount = attributes->getLength();
405 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
408 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
410 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
415 const xercesc::DOMAttr*
const attribute =
416 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
417 if(attribute ==
nullptr)
419 G4Exception(
"G4GDMLReadSolids::ElconeRead()",
"InvalidRead",
426 if(attName ==
"name")
430 else if(attName ==
"lunit")
435 G4Exception(
"G4GDMLReadSolids::ElconeRead()",
"InvalidRead",
439 else if(attName ==
"dx")
443 else if(attName ==
"dy")
447 else if(attName ==
"zmax")
451 else if(attName ==
"zcut")
465 const xercesc::DOMElement*
const ellipsoidElement)
475 const xercesc::DOMNamedNodeMap*
const attributes =
476 ellipsoidElement->getAttributes();
477 XMLSize_t attributeCount = attributes->getLength();
479 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
482 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
484 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
489 const xercesc::DOMAttr*
const attribute =
490 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
491 if(attribute ==
nullptr)
493 G4Exception(
"G4GDMLReadSolids::EllipsoidRead()",
"InvalidRead",
500 if(attName ==
"name")
504 else if(attName ==
"lunit")
509 G4Exception(
"G4GDMLReadSolids::EllipsoidRead()",
"InvalidRead",
513 else if(attName ==
"ax")
517 else if(attName ==
"by")
521 else if(attName ==
"cz")
525 else if(attName ==
"zcut1")
529 else if(attName ==
"zcut2")
546 const xercesc::DOMElement*
const eltubeElement)
554 const xercesc::DOMNamedNodeMap*
const attributes =
555 eltubeElement->getAttributes();
556 XMLSize_t attributeCount = attributes->getLength();
558 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
561 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
563 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
568 const xercesc::DOMAttr*
const attribute =
569 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
570 if(attribute ==
nullptr)
572 G4Exception(
"G4GDMLReadSolids::EltubeRead()",
"InvalidRead",
579 if(attName ==
"name")
583 else if(attName ==
"lunit")
588 G4Exception(
"G4GDMLReadSolids::EltubeRead()",
"InvalidRead",
592 else if(attName ==
"dx")
596 else if(attName ==
"dy")
600 else if(attName ==
"dz")
619 const xercesc::DOMNamedNodeMap*
const attributes =
620 xtruElement->getAttributes();
621 XMLSize_t attributeCount = attributes->getLength();
623 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
626 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
628 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
633 const xercesc::DOMAttr*
const attribute =
634 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
635 if(attribute ==
nullptr)
638 "No attribute found!");
644 if(attName ==
"name")
648 else if(attName ==
"lunit")
653 G4Exception(
"G4GDMLReadSolids::XtruRead()",
"InvalidRead",
659 std::vector<G4TwoVector> twoDimVertexList;
660 std::vector<G4ExtrudedSolid::ZSection> sectionList;
662 for(xercesc::DOMNode* iter = xtruElement->getFirstChild(); iter !=
nullptr;
663 iter = iter->getNextSibling())
665 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
670 const xercesc::DOMElement*
const child =
671 dynamic_cast<xercesc::DOMElement*
>(iter);
680 if(
tag ==
"twoDimVertex")
684 else if(
tag ==
"section")
705 const xercesc::DOMNamedNodeMap*
const attributes =
706 hypeElement->getAttributes();
707 XMLSize_t attributeCount = attributes->getLength();
709 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
712 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
714 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
719 const xercesc::DOMAttr*
const attribute =
720 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
721 if(attribute ==
nullptr)
724 "No attribute found!");
730 if(attName ==
"name")
734 else if(attName ==
"lunit")
739 G4Exception(
"G4GDMLReadSolids::HypeRead()",
"InvalidRead",
743 else if(attName ==
"aunit")
748 G4Exception(
"G4GDMLReadSolids::HypeRead()",
"InvalidRead",
752 else if(attName ==
"rmin")
756 else if(attName ==
"rmax")
760 else if(attName ==
"inst")
764 else if(attName ==
"outst")
768 else if(attName ==
"z")
780 new G4Hype(name, rmin, rmax, inst, outst, z);
785 const xercesc::DOMElement*
const unionNodeElement,
793 const xercesc::DOMNamedNodeMap*
const attributes =
794 unionNodeElement->getAttributes();
795 XMLSize_t attributeCount = attributes->getLength();
797 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
800 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
802 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
807 const xercesc::DOMAttr*
const attribute =
808 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
809 if(attribute ==
nullptr)
811 G4Exception(
"G4GDMLReadSolids::MultiUnionNodeRead()",
"InvalidRead",
818 if(attName ==
"name")
824 for(xercesc::DOMNode* iter = unionNodeElement->getFirstChild();
825 iter !=
nullptr; iter = iter->getNextSibling())
827 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
832 const xercesc::DOMElement*
const child =
833 dynamic_cast<xercesc::DOMElement*
>(iter);
836 G4Exception(
"G4GDMLReadSolids::MultiUnionNodeRead()",
"InvalidRead",
842 if(
tag ==
"position")
846 else if(
tag ==
"rotation")
850 else if(
tag ==
"positionref")
854 else if(
tag ==
"rotationref")
858 else if(
tag ==
"solid")
864 G4String error_msg =
"Unknown tag in MultiUnion structure: " +
tag;
865 G4Exception(
"G4GDMLReadSolids::MultiUnionNodeRead()",
"ReadError",
871 multiUnionSolid->
AddNode(*solidNode, transform);
876 const xercesc::DOMElement*
const unionElement)
880 const xercesc::DOMNamedNodeMap*
const attributes =
881 unionElement->getAttributes();
882 XMLSize_t attributeCount = attributes->getLength();
884 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
887 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
889 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
894 const xercesc::DOMAttr*
const attribute =
895 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
896 if(attribute ==
nullptr)
898 G4Exception(
"G4GDMLReadSolids::MultiUnionRead()",
"InvalidRead",
905 if(attName ==
"name")
913 for(xercesc::DOMNode* iter = unionElement->getFirstChild(); iter !=
nullptr;
914 iter = iter->getNextSibling())
916 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
921 const xercesc::DOMElement*
const child =
922 dynamic_cast<xercesc::DOMElement*
>(iter);
925 G4Exception(
"G4GDMLReadSolids::MultiUnionRead()",
"InvalidRead",
931 if(
tag ==
"multiUnionNode")
937 G4String error_msg =
"Unknown tag in MultiUnion structure: " +
tag;
938 G4Exception(
"G4GDMLReadSolids::MultiUnionRead()",
"ReadError",
952 const xercesc::DOMNamedNodeMap*
const attributes =
953 orbElement->getAttributes();
954 XMLSize_t attributeCount = attributes->getLength();
956 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
959 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
961 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
966 const xercesc::DOMAttr*
const attribute =
967 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
968 if(attribute ==
nullptr)
971 "No attribute found!");
977 if(attName ==
"name")
981 else if(attName ==
"lunit")
986 G4Exception(
"G4GDMLReadSolids::OrbRead()",
"InvalidRead",
990 else if(attName ==
"r")
1014 const xercesc::DOMNamedNodeMap*
const attributes =
1015 paraElement->getAttributes();
1016 XMLSize_t attributeCount = attributes->getLength();
1018 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
1021 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1023 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1028 const xercesc::DOMAttr*
const attribute =
1029 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
1030 if(attribute ==
nullptr)
1033 "No attribute found!");
1039 if(attName ==
"name")
1043 else if(attName ==
"lunit")
1048 G4Exception(
"G4GDMLReadSolids::ParaRead()",
"InvalidRead",
1052 else if(attName ==
"aunit")
1057 G4Exception(
"G4GDMLReadSolids::ParaRead()",
"InvalidRead",
1061 else if(attName ==
"x")
1065 else if(attName ==
"y")
1069 else if(attName ==
"z")
1073 else if(attName ==
"alpha")
1077 else if(attName ==
"theta")
1081 else if(attName ==
"phi")
1094 new G4Para(name, x, y, z, alpha, theta, phi);
1099 const xercesc::DOMElement*
const paraElement)
1107 const xercesc::DOMNamedNodeMap*
const attributes =
1108 paraElement->getAttributes();
1109 XMLSize_t attributeCount = attributes->getLength();
1111 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
1114 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1116 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1121 const xercesc::DOMAttr*
const attribute =
1122 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
1123 if(attribute ==
nullptr)
1125 G4Exception(
"G4GDMLReadSolids::ParaboloidRead()",
"InvalidRead",
1132 if(attName ==
"name")
1136 else if(attName ==
"lunit")
1141 G4Exception(
"G4GDMLReadSolids::ParaboloidRead()",
"InvalidRead",
1145 else if(attName ==
"rlo")
1149 else if(attName ==
"rhi")
1153 else if(attName ==
"dz")
1168 const xercesc::DOMElement*
const polyconeElement)
1176 const xercesc::DOMNamedNodeMap*
const attributes =
1177 polyconeElement->getAttributes();
1178 XMLSize_t attributeCount = attributes->getLength();
1180 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
1183 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1185 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1190 const xercesc::DOMAttr*
const attribute =
1191 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
1192 if(attribute ==
nullptr)
1194 G4Exception(
"G4GDMLReadSolids::PolyconeRead()",
"InvalidRead",
1201 if(attName ==
"name")
1205 else if(attName ==
"lunit")
1210 G4Exception(
"G4GDMLReadSolids::PolyconeRead()",
"InvalidRead",
1214 else if(attName ==
"aunit")
1219 G4Exception(
"G4GDMLReadSolids::PolyconeRead()",
"InvalidRead",
1223 else if(attName ==
"startphi")
1227 else if(attName ==
"deltaphi")
1236 std::vector<zplaneType> zplaneList;
1238 for(xercesc::DOMNode* iter = polyconeElement->getFirstChild(); iter!=
nullptr;
1239 iter = iter->getNextSibling())
1241 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
1246 const xercesc::DOMElement*
const child =
1247 dynamic_cast<xercesc::DOMElement*
>(iter);
1248 if(child ==
nullptr)
1250 G4Exception(
"G4GDMLReadSolids::PolyconeRead()",
"InvalidRead",
1262 G4int numZPlanes = zplaneList.size();
1268 for(
G4int i = 0; i < numZPlanes; ++i)
1270 rmin_array[i] = zplaneList[i].rmin * lunit;
1271 rmax_array[i] = zplaneList[i].rmax * lunit;
1272 z_array[i] = zplaneList[i].z * lunit;
1275 new G4Polycone(name, startphi, deltaphi, numZPlanes, z_array, rmin_array,
1278 delete[] rmin_array;
1279 delete[] rmax_array;
1285 const xercesc::DOMElement*
const polyconeElement)
1293 const xercesc::DOMNamedNodeMap*
const attributes =
1294 polyconeElement->getAttributes();
1295 XMLSize_t attributeCount = attributes->getLength();
1297 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
1300 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1302 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1307 const xercesc::DOMAttr*
const attribute =
1308 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
1309 if(attribute ==
nullptr)
1311 G4Exception(
"G4GDMLReadSolids::GenericPolyconeRead()",
"InvalidRead",
1318 if(attName ==
"name")
1322 else if(attName ==
"lunit")
1327 G4Exception(
"G4GDMLReadSolids::GenericPolyconeRead()",
"InvalidRead",
1331 else if(attName ==
"aunit")
1336 G4Exception(
"G4GDMLReadSolids::GenericPolyconeRead()",
"InvalidRead",
1340 else if(attName ==
"startphi")
1344 else if(attName ==
"deltaphi")
1353 std::vector<rzPointType> rzPointList;
1355 for(xercesc::DOMNode* iter = polyconeElement->getFirstChild();
1356 iter !=
nullptr; iter = iter->getNextSibling())
1358 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
1363 const xercesc::DOMElement*
const child =
1364 dynamic_cast<xercesc::DOMElement*
>(iter);
1365 if(child ==
nullptr)
1367 G4Exception(
"G4GDMLReadSolids::GenericPolyconeRead()",
"InvalidRead",
1373 if(
tag ==
"rzpoint")
1379 G4int numRZPoints = rzPointList.size();
1384 for(
G4int i = 0; i < numRZPoints; ++i)
1386 r_array[i] = rzPointList[i].r * lunit;
1387 z_array[i] = rzPointList[i].z * lunit;
1397 const xercesc::DOMElement*
const polyhedraElement)
1406 const xercesc::DOMNamedNodeMap*
const attributes =
1407 polyhedraElement->getAttributes();
1408 XMLSize_t attributeCount = attributes->getLength();
1410 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
1413 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1415 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1420 const xercesc::DOMAttr*
const attribute =
1421 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
1422 if(attribute ==
nullptr)
1424 G4Exception(
"G4GDMLReadSolids::PolyhedraRead()",
"InvalidRead",
1431 if(attName ==
"name")
1435 else if(attName ==
"lunit")
1440 G4Exception(
"G4GDMLReadSolids::PolyhedraRead()",
"InvalidRead",
1444 else if(attName ==
"aunit")
1449 G4Exception(
"G4GDMLReadSolids::PolyhedraRead()",
"InvalidRead",
1453 else if(attName ==
"startphi")
1457 else if(attName ==
"deltaphi")
1461 else if(attName ==
"numsides")
1470 std::vector<zplaneType> zplaneList;
1472 for(xercesc::DOMNode* iter = polyhedraElement->getFirstChild();
1473 iter !=
nullptr; iter = iter->getNextSibling())
1475 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
1480 const xercesc::DOMElement*
const child =
1481 dynamic_cast<xercesc::DOMElement*
>(iter);
1482 if(child ==
nullptr)
1484 G4Exception(
"G4GDMLReadSolids::PolyhedraRead()",
"InvalidRead",
1496 G4int numZPlanes = zplaneList.size();
1502 for(
G4int i = 0; i < numZPlanes; ++i)
1504 rmin_array[i] = zplaneList[i].rmin * lunit;
1505 rmax_array[i] = zplaneList[i].rmax * lunit;
1506 z_array[i] = zplaneList[i].z * lunit;
1509 new G4Polyhedra(name, startphi, deltaphi, numsides, numZPlanes, z_array,
1510 rmin_array, rmax_array);
1512 delete[] rmin_array;
1513 delete[] rmax_array;
1519 const xercesc::DOMElement*
const polyhedraElement)
1528 const xercesc::DOMNamedNodeMap*
const attributes =
1529 polyhedraElement->getAttributes();
1530 XMLSize_t attributeCount = attributes->getLength();
1532 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
1535 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1537 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1542 const xercesc::DOMAttr*
const attribute =
1543 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
1544 if(attribute ==
nullptr)
1546 G4Exception(
"G4GDMLReadSolids::GenericPolyhedraRead()",
"InvalidRead",
1553 if(attName ==
"name")
1557 else if(attName ==
"lunit")
1562 G4Exception(
"G4GDMLReadSolids::GenericPolyhedraRead()",
"InvalidRead",
1566 else if(attName ==
"aunit")
1571 G4Exception(
"G4GDMLReadSolids::GenericPolyhedraRead()",
"InvalidRead",
1575 else if(attName ==
"startphi")
1579 else if(attName ==
"deltaphi")
1583 else if(attName ==
"numsides")
1592 std::vector<rzPointType> rzpointList;
1594 for(xercesc::DOMNode* iter = polyhedraElement->getFirstChild();
1595 iter !=
nullptr; iter = iter->getNextSibling())
1597 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
1602 const xercesc::DOMElement*
const child =
1603 dynamic_cast<xercesc::DOMElement*
>(iter);
1604 if(child ==
nullptr)
1606 G4Exception(
"G4GDMLReadSolids::GenericPolyhedraRead()",
"InvalidRead",
1612 if(
tag ==
"rzpoint")
1618 G4int numRZPoints = rzpointList.size();
1623 for(
G4int i = 0; i < numRZPoints; ++i)
1625 r_array[i] = rzpointList[i].r * lunit;
1626 z_array[i] = rzpointList[i].z * lunit;
1629 new G4Polyhedra(name, startphi, deltaphi, numsides, numRZPoints, r_array,
1638 const xercesc::DOMElement*
const quadrangularElement)
1647 const xercesc::DOMNamedNodeMap*
const attributes =
1648 quadrangularElement->getAttributes();
1649 XMLSize_t attributeCount = attributes->getLength();
1651 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
1654 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1656 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1661 const xercesc::DOMAttr*
const attribute =
1662 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
1663 if(attribute ==
nullptr)
1665 G4Exception(
"G4GDMLReadSolids::QuadrangularRead()",
"InvalidRead",
1672 if(attName ==
"vertex1")
1676 else if(attName ==
"vertex2")
1680 else if(attName ==
"vertex3")
1684 else if(attName ==
"vertex4")
1688 else if(attName ==
"lunit")
1693 G4Exception(
"G4GDMLReadSolids::QuadrangularRead()",
"InvalidRead",
1697 else if(attName ==
"type")
1699 if(attValue ==
"RELATIVE")
1707 vertex3 * lunit, vertex4 * lunit, type);
1712 const xercesc::DOMElement*
const reflectedSolidElement)
1722 const xercesc::DOMNamedNodeMap*
const attributes =
1723 reflectedSolidElement->getAttributes();
1724 XMLSize_t attributeCount = attributes->getLength();
1726 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
1729 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1731 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1736 const xercesc::DOMAttr*
const attribute =
1737 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
1738 if(attribute ==
nullptr)
1740 G4Exception(
"G4GDMLReadSolids::ReflectedSolidRead()",
"InvalidRead",
1747 if(attName ==
"name")
1751 else if(attName ==
"lunit")
1756 G4Exception(
"G4GDMLReadSolids::ReflectedSolidRead()",
"InvalidRead",
1760 else if(attName ==
"aunit")
1765 G4Exception(
"G4GDMLReadSolids::ReflectedSolidRead()",
"InvalidRead",
1769 else if(attName ==
"solid")
1773 else if(attName ==
"sx")
1777 else if(attName ==
"sy")
1781 else if(attName ==
"sz")
1785 else if(attName ==
"rx")
1789 else if(attName ==
"ry")
1793 else if(attName ==
"rz")
1797 else if(attName ==
"dx")
1801 else if(attName ==
"dy")
1805 else if(attName ==
"dz")
1815 transform = transform *
G4Scale3D(scale.
x(), scale.
y(), scale.
z());
1822 const xercesc::DOMElement*
const scaledSolidElement)
1828 const xercesc::DOMNamedNodeMap*
const attributes =
1829 scaledSolidElement->getAttributes();
1830 XMLSize_t attributeCount = attributes->getLength();
1832 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
1835 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1837 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1842 const xercesc::DOMAttr*
const attribute =
1843 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
1844 if(attribute ==
nullptr)
1846 G4Exception(
"G4GDMLReadSolids::ScaledSolidRead()",
"InvalidRead",
1853 if(attName ==
"name")
1859 for(xercesc::DOMNode* iter = scaledSolidElement->getFirstChild();
1860 iter !=
nullptr; iter = iter->getNextSibling())
1862 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
1867 const xercesc::DOMElement*
const child =
1868 dynamic_cast<xercesc::DOMElement*
>(iter);
1869 if(child ==
nullptr)
1871 G4Exception(
"G4GDMLReadSolids::ScaledSolidRead()",
"InvalidRead",
1877 if(
tag ==
"solidref")
1881 else if(
tag ==
"scale")
1885 else if(
tag ==
"scaleref")
1891 G4String error_msg =
"Unknown tag in scaled solid: " +
tag;
1892 G4Exception(
"G4GDMLReadSolids::ScaledSolidRead()",
"ReadError",
1905 const xercesc::DOMElement*
const sectionElement,
G4double lunit)
1911 const xercesc::DOMNamedNodeMap*
const attributes =
1912 sectionElement->getAttributes();
1913 XMLSize_t attributeCount = attributes->getLength();
1915 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
1918 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1920 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1925 const xercesc::DOMAttr*
const attribute =
1926 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
1927 if(attribute ==
nullptr)
1929 G4Exception(
"G4GDMLReadSolids::SectionRead()",
"InvalidRead",
1936 if(attName ==
"zPosition")
1940 else if(attName ==
"xOffset")
1944 else if(attName ==
"yOffset")
1948 else if(attName ==
"scalingFactor")
1959 const xercesc::DOMElement*
const sphereElement)
1971 const xercesc::DOMNamedNodeMap*
const attributes =
1972 sphereElement->getAttributes();
1973 XMLSize_t attributeCount = attributes->getLength();
1975 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
1978 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1980 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1985 const xercesc::DOMAttr*
const attribute =
1986 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
1987 if(attribute ==
nullptr)
1989 G4Exception(
"G4GDMLReadSolids::SphereRead()",
"InvalidRead",
1996 if(attName ==
"name")
2000 else if(attName ==
"lunit")
2005 G4Exception(
"G4GDMLReadSolids::SphereRead()",
"InvalidRead",
2009 else if(attName ==
"aunit")
2014 G4Exception(
"G4GDMLReadSolids::SphereRead()",
"InvalidRead",
2018 else if(attName ==
"rmin")
2022 else if(attName ==
"rmax")
2026 else if(attName ==
"startphi")
2030 else if(attName ==
"deltaphi")
2034 else if(attName ==
"starttheta")
2038 else if(attName ==
"deltatheta")
2048 starttheta *= aunit;
2049 deltatheta *= aunit;
2051 new G4Sphere(name, rmin, rmax, startphi, deltaphi, starttheta, deltatheta);
2056 const xercesc::DOMElement*
const tessellatedElement)
2060 const xercesc::DOMNamedNodeMap*
const attributes =
2061 tessellatedElement->getAttributes();
2062 XMLSize_t attributeCount = attributes->getLength();
2064 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
2067 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
2069 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
2074 const xercesc::DOMAttr*
const attribute =
2075 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
2076 if(attribute ==
nullptr)
2078 G4Exception(
"G4GDMLReadSolids::TessellatedRead()",
"InvalidRead",
2085 if(attName ==
"name")
2093 for(xercesc::DOMNode* iter = tessellatedElement->getFirstChild();
2094 iter !=
nullptr; iter = iter->getNextSibling())
2096 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
2101 const xercesc::DOMElement*
const child =
2102 dynamic_cast<xercesc::DOMElement*
>(iter);
2103 if(child ==
nullptr)
2105 G4Exception(
"G4GDMLReadSolids::TessellatedRead()",
"InvalidRead",
2111 if(
tag ==
"triangular")
2115 else if(
tag ==
"quadrangular")
2134 const xercesc::DOMNamedNodeMap*
const attributes =
2135 tetElement->getAttributes();
2136 XMLSize_t attributeCount = attributes->getLength();
2138 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
2141 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
2143 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
2148 const xercesc::DOMAttr*
const attribute =
2149 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
2150 if(attribute ==
nullptr)
2153 "No attribute found!");
2159 if(attName ==
"name")
2163 else if(attName ==
"lunit")
2168 G4Exception(
"G4GDMLReadSolids::TetRead()",
"InvalidRead",
2172 else if(attName ==
"vertex1")
2176 else if(attName ==
"vertex2")
2180 else if(attName ==
"vertex3")
2184 else if(attName ==
"vertex4")
2190 new G4Tet(name, vertex1 * lunit, vertex2 * lunit, vertex3 * lunit,
2206 const xercesc::DOMNamedNodeMap*
const attributes =
2207 torusElement->getAttributes();
2208 XMLSize_t attributeCount = attributes->getLength();
2210 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
2213 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
2215 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
2220 const xercesc::DOMAttr*
const attribute =
2221 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
2222 if(attribute ==
nullptr)
2224 G4Exception(
"G4GDMLReadSolids::TorusRead()",
"InvalidRead",
2231 if(attName ==
"name")
2235 else if(attName ==
"lunit")
2240 G4Exception(
"G4GDMLReadSolids::TorusRead()",
"InvalidRead",
2244 else if(attName ==
"aunit")
2249 G4Exception(
"G4GDMLReadSolids::TorusRead()",
"InvalidRead",
2253 else if(attName ==
"rmin")
2257 else if(attName ==
"rmax")
2261 else if(attName ==
"rtor")
2265 else if(attName ==
"startphi")
2269 else if(attName ==
"deltaphi")
2281 new G4Torus(name, rmin, rmax, rtor, startphi, deltaphi);
2286 const xercesc::DOMElement*
const gtrapElement)
2291 G4double v1x = 0.0, v1y = 0.0, v2x = 0.0, v2y = 0.0, v3x = 0.0, v3y = 0.0,
2292 v4x = 0.0, v4y = 0.0, v5x = 0.0, v5y = 0.0, v6x = 0.0, v6y = 0.0,
2293 v7x = 0.0, v7y = 0.0, v8x = 0.0, v8y = 0.0;
2295 const xercesc::DOMNamedNodeMap*
const attributes =
2296 gtrapElement->getAttributes();
2297 XMLSize_t attributeCount = attributes->getLength();
2299 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
2302 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
2304 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
2309 const xercesc::DOMAttr*
const attribute =
2310 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
2311 if(attribute ==
nullptr)
2313 G4Exception(
"G4GDMLReadSolids::GenTrapRead()",
"InvalidRead",
2320 if(attName ==
"name")
2324 else if(attName ==
"lunit")
2329 G4Exception(
"G4GDMLReadSolids::GenTrapRead()",
"InvalidRead",
2333 else if(attName ==
"dz")
2337 else if(attName ==
"v1x")
2341 else if(attName ==
"v1y")
2345 else if(attName ==
"v2x")
2349 else if(attName ==
"v2y")
2353 else if(attName ==
"v3x")
2357 else if(attName ==
"v3y")
2361 else if(attName ==
"v4x")
2365 else if(attName ==
"v4y")
2369 else if(attName ==
"v5x")
2373 else if(attName ==
"v5y")
2377 else if(attName ==
"v6x")
2381 else if(attName ==
"v6y")
2385 else if(attName ==
"v7x")
2389 else if(attName ==
"v7y")
2393 else if(attName ==
"v8x")
2397 else if(attName ==
"v8y")
2404 std::vector<G4TwoVector> vertices;
2405 vertices.push_back(
G4TwoVector(v1x * lunit, v1y * lunit));
2406 vertices.push_back(
G4TwoVector(v2x * lunit, v2y * lunit));
2407 vertices.push_back(
G4TwoVector(v3x * lunit, v3y * lunit));
2408 vertices.push_back(
G4TwoVector(v4x * lunit, v4y * lunit));
2409 vertices.push_back(
G4TwoVector(v5x * lunit, v5y * lunit));
2410 vertices.push_back(
G4TwoVector(v6x * lunit, v6y * lunit));
2411 vertices.push_back(
G4TwoVector(v7x * lunit, v7y * lunit));
2412 vertices.push_back(
G4TwoVector(v8x * lunit, v8y * lunit));
2434 const xercesc::DOMNamedNodeMap*
const attributes =
2435 trapElement->getAttributes();
2436 XMLSize_t attributeCount = attributes->getLength();
2438 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
2441 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
2443 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
2448 const xercesc::DOMAttr*
const attribute =
2449 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
2450 if(attribute ==
nullptr)
2453 "No attribute found!");
2459 if(attName ==
"name")
2463 else if(attName ==
"lunit")
2468 G4Exception(
"G4GDMLReadSolids::TrapRead()",
"InvalidRead",
2472 else if(attName ==
"aunit")
2477 G4Exception(
"G4GDMLReadSolids::TrapRead()",
"InvalidRead",
2481 else if(attName ==
"z")
2485 else if(attName ==
"theta")
2489 else if(attName ==
"phi")
2493 else if(attName ==
"y1")
2497 else if(attName ==
"x1")
2501 else if(attName ==
"x2")
2505 else if(attName ==
"alpha1")
2509 else if(attName ==
"y2")
2513 else if(attName ==
"x3")
2517 else if(attName ==
"x4")
2521 else if(attName ==
"alpha2")
2539 new G4Trap(name, z, theta, phi, y1, x1, x2, alpha1, y2, x3, x4, alpha2);
2553 const xercesc::DOMNamedNodeMap*
const attributes =
2554 trdElement->getAttributes();
2555 XMLSize_t attributeCount = attributes->getLength();
2557 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
2560 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
2562 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
2567 const xercesc::DOMAttr*
const attribute =
2568 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
2569 if(attribute ==
nullptr)
2572 "No attribute found!");
2578 if(attName ==
"name")
2582 else if(attName ==
"lunit")
2587 G4Exception(
"G4GDMLReadSolids::TrdRead()",
"InvalidRead",
2591 else if(attName ==
"x1")
2595 else if(attName ==
"x2")
2599 else if(attName ==
"y1")
2603 else if(attName ==
"y2")
2607 else if(attName ==
"z")
2619 new G4Trd(name, x1, x2, y1, y2, z);
2624 const xercesc::DOMElement*
const triangularElement)
2632 const xercesc::DOMNamedNodeMap*
const attributes =
2633 triangularElement->getAttributes();
2634 XMLSize_t attributeCount = attributes->getLength();
2636 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
2639 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
2641 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
2646 const xercesc::DOMAttr*
const attribute =
2647 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
2648 if(attribute ==
nullptr)
2650 G4Exception(
"G4GDMLReadSolids::TriangularRead()",
"InvalidRead",
2657 if(attName ==
"vertex1")
2661 else if(attName ==
"vertex2")
2665 else if(attName ==
"vertex3")
2669 else if(attName ==
"lunit")
2674 G4Exception(
"G4GDMLReadSolids::TriangularRead()",
"InvalidRead",
2678 else if(attName ==
"type")
2680 if(attValue ==
"RELATIVE")
2688 vertex3 * lunit, type);
2703 const xercesc::DOMNamedNodeMap*
const attributes =
2704 tubeElement->getAttributes();
2705 XMLSize_t attributeCount = attributes->getLength();
2707 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
2710 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
2712 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
2717 const xercesc::DOMAttr*
const attribute =
2718 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
2719 if(attribute ==
nullptr)
2722 "No attribute found!");
2728 if(attName ==
"name")
2732 else if(attName ==
"lunit")
2737 G4Exception(
"G4GDMLReadSolids::TubeRead()",
"InvalidRead",
2741 else if(attName ==
"aunit")
2746 G4Exception(
"G4GDMLReadSolids::TubeRead()",
"InvalidRead",
2750 else if(attName ==
"rmin")
2754 else if(attName ==
"rmax")
2758 else if(attName ==
"z")
2762 else if(attName ==
"startphi")
2766 else if(attName ==
"deltaphi")
2778 new G4Tubs(name, rmin, rmax, z, startphi, deltaphi);
2783 const xercesc::DOMElement*
const cuttubeElement)
2796 const xercesc::DOMNamedNodeMap*
const attributes =
2797 cuttubeElement->getAttributes();
2798 XMLSize_t attributeCount = attributes->getLength();
2800 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
2803 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
2805 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
2810 const xercesc::DOMAttr*
const attribute =
2811 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
2812 if(attribute ==
nullptr)
2814 G4Exception(
"G4GDMLReadSolids::CutTubeRead()",
"InvalidRead",
2821 if(attName ==
"name")
2825 else if(attName ==
"lunit")
2830 G4Exception(
"G4GDMLReadSolids::CutTubeRead()",
"InvalidRead",
2834 else if(attName ==
"aunit")
2839 G4Exception(
"G4GDMLReadSolids::CutTubeRead()",
"InvalidRead",
2843 else if(attName ==
"rmin")
2847 else if(attName ==
"rmax")
2851 else if(attName ==
"z")
2855 else if(attName ==
"startphi")
2859 else if(attName ==
"deltaphi")
2863 else if(attName ==
"lowX")
2867 else if(attName ==
"lowY")
2871 else if(attName ==
"lowZ")
2875 else if(attName ==
"highX")
2879 else if(attName ==
"highY")
2883 else if(attName ==
"highZ")
2895 new G4CutTubs(name, rmin, rmax, z, startphi, deltaphi, lowNorm, highNorm);
2900 const xercesc::DOMElement*
const twistedboxElement)
2910 const xercesc::DOMNamedNodeMap*
const attributes =
2911 twistedboxElement->getAttributes();
2912 XMLSize_t attributeCount = attributes->getLength();
2914 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
2917 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
2919 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
2924 const xercesc::DOMAttr*
const attribute =
2925 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
2926 if(attribute ==
nullptr)
2928 G4Exception(
"G4GDMLReadSolids::TwistedboxRead()",
"InvalidRead",
2935 if(attName ==
"name")
2939 else if(attName ==
"lunit")
2944 G4Exception(
"G4GDMLReadSolids::TwistedBoxRead()",
"InvalidRead",
2948 else if(attName ==
"aunit")
2953 G4Exception(
"G4GDMLReadSolids::TwistedboxRead()",
"InvalidRead",
2957 else if(attName ==
"PhiTwist")
2961 else if(attName ==
"x")
2965 else if(attName ==
"y")
2969 else if(attName ==
"z")
2985 const xercesc::DOMElement*
const twistedtrapElement)
3002 const xercesc::DOMNamedNodeMap*
const attributes =
3003 twistedtrapElement->getAttributes();
3004 XMLSize_t attributeCount = attributes->getLength();
3006 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
3009 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
3011 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
3016 const xercesc::DOMAttr*
const attribute =
3017 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
3018 if(attribute ==
nullptr)
3020 G4Exception(
"G4GDMLReadSolids::TwistedtrapRead()",
"InvalidRead",
3027 if(attName ==
"name")
3031 else if(attName ==
"lunit")
3036 G4Exception(
"G4GDMLReadSolids::TwistedtrapRead()",
"InvalidRead",
3040 else if(attName ==
"aunit")
3045 G4Exception(
"G4GDMLReadSolids::TwistedtrapRead()",
"InvalidRead",
3049 else if(attName ==
"PhiTwist")
3053 else if(attName ==
"z")
3057 else if(attName ==
"Theta")
3061 else if(attName ==
"Phi")
3065 else if(attName ==
"y1")
3069 else if(attName ==
"x1")
3073 else if(attName ==
"x2")
3077 else if(attName ==
"y2")
3081 else if(attName ==
"x3")
3085 else if(attName ==
"x4")
3089 else if(attName ==
"Alph")
3107 new G4TwistedTrap(name, PhiTwist, z, Theta, Phi, y1, x1, x2, y2, x3, x4,
3113 const xercesc::DOMElement*
const twistedtrdElement)
3125 const xercesc::DOMNamedNodeMap*
const attributes =
3126 twistedtrdElement->getAttributes();
3127 XMLSize_t attributeCount = attributes->getLength();
3129 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
3132 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
3134 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
3139 const xercesc::DOMAttr*
const attribute =
3140 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
3141 if(attribute ==
nullptr)
3143 G4Exception(
"G4GDMLReadSolids::TwistedtrdRead()",
"InvalidRead",
3150 if(attName ==
"name")
3154 else if(attName ==
"lunit")
3159 G4Exception(
"G4GDMLReadSolids::TwistedtrdRead()",
"InvalidRead",
3163 else if(attName ==
"aunit")
3168 G4Exception(
"G4GDMLReadSolids::TwistedtrdRead()",
"InvalidRead",
3172 else if(attName ==
"x1")
3176 else if(attName ==
"x2")
3180 else if(attName ==
"y1")
3184 else if(attName ==
"y2")
3188 else if(attName ==
"z")
3192 else if(attName ==
"PhiTwist")
3210 const xercesc::DOMElement*
const twistedtubsElement)
3227 const xercesc::DOMNamedNodeMap*
const attributes =
3228 twistedtubsElement->getAttributes();
3229 XMLSize_t attributeCount = attributes->getLength();
3231 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
3234 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
3236 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
3241 const xercesc::DOMAttr*
const attribute =
3242 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
3243 if(attribute ==
nullptr)
3245 G4Exception(
"G4GDMLReadSolids::TwistedtubsRead()",
"InvalidRead",
3252 if(attName ==
"name")
3256 else if(attName ==
"lunit")
3261 G4Exception(
"G4GDMLReadSolids::TwistedtubsRead()",
"InvalidRead",
3265 else if(attName ==
"aunit")
3270 G4Exception(
"G4GDMLReadSolids::TwistedtubsRead()",
"InvalidRead",
3274 else if(attName ==
"twistedangle")
3278 else if(attName ==
"endinnerrad")
3282 else if(attName ==
"endouterrad")
3286 else if(attName ==
"zlen")
3290 else if(attName ==
"midinnerrad")
3294 else if(attName ==
"midouterrad")
3298 else if(attName ==
"negativeEndz")
3302 else if(attName ==
"positiveEndz")
3306 else if(attName ==
"nseg")
3310 else if(attName ==
"totphi")
3314 else if(attName ==
"phi")
3320 twistedangle *= aunit;
3321 endinnerrad *= lunit;
3322 endouterrad *= lunit;
3323 zlen *= 0.5 * lunit;
3324 midinnerrad *= lunit;
3325 midouterrad *= lunit;
3326 positiveEndz *= lunit;
3327 negativeEndz *= lunit;
3334 new G4TwistedTubs(name, twistedangle, endinnerrad, endouterrad, zlen,
3337 new G4TwistedTubs(name, twistedangle, endinnerrad, endouterrad, zlen,
3343 new G4TwistedTubs(name, twistedangle, midinnerrad, midouterrad,
3344 negativeEndz, positiveEndz, nseg, totphi);
3346 new G4TwistedTubs(name, twistedangle, midinnerrad, midouterrad,
3347 negativeEndz, positiveEndz, phi);
3353 const xercesc::DOMElement*
const element,
G4double lunit)
3357 const xercesc::DOMNamedNodeMap*
const attributes = element->getAttributes();
3358 XMLSize_t attributeCount = attributes->getLength();
3360 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
3363 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
3365 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
3370 const xercesc::DOMAttr*
const attribute =
3371 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
3372 if(attribute ==
nullptr)
3374 G4Exception(
"G4GDMLReadSolids::TwoDimVertexRead()",
"InvalidRead",
3385 else if(attName ==
"y")
3396 const xercesc::DOMElement*
const zplaneElement)
3400 const xercesc::DOMNamedNodeMap*
const attributes =
3401 zplaneElement->getAttributes();
3402 XMLSize_t attributeCount = attributes->getLength();
3404 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
3407 xercesc::DOMNode* node = attributes->item(attribute_index);
3409 if(node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
3414 const xercesc::DOMAttr*
const attribute =
3415 dynamic_cast<xercesc::DOMAttr*
>(node);
3416 if(attribute ==
nullptr)
3418 G4Exception(
"G4GDMLReadSolids::ZplaneRead()",
"InvalidRead",
3425 if(attName ==
"rmin")
3429 else if(attName ==
"rmax")
3433 else if(attName ==
"z")
3444 const xercesc::DOMElement*
const zplaneElement)
3446 rzPointType rzpoint = { 0., 0. };
3448 const xercesc::DOMNamedNodeMap*
const attributes =
3449 zplaneElement->getAttributes();
3450 XMLSize_t attributeCount = attributes->getLength();
3452 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
3455 xercesc::DOMNode* node = attributes->item(attribute_index);
3457 if(node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
3462 const xercesc::DOMAttr*
const attribute =
3463 dynamic_cast<xercesc::DOMAttr*
>(node);
3464 if(attribute ==
nullptr)
3466 G4Exception(
"G4GDMLReadSolids::RZPointRead()",
"InvalidRead",
3477 else if(attName ==
"z")
3488 const xercesc::DOMElement*
const propertyElement,
3495 const xercesc::DOMNamedNodeMap*
const attributes =
3496 propertyElement->getAttributes();
3497 XMLSize_t attributeCount = attributes->getLength();
3499 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
3502 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
3504 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
3509 const xercesc::DOMAttr*
const attribute =
3510 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
3511 if(attribute ==
nullptr)
3513 G4Exception(
"G4GDMLReadSolids::PropertyRead()",
"InvalidRead",
3520 if(attName ==
"name")
3524 else if(attName ==
"ref")
3549 if(matprop ==
nullptr)
3562 if(mapOfMatPropVects.find(
Strip(name)) == mapOfMatPropVects.end())
3566 for(
size_t i = 0; i < matrix.
GetRows(); i++)
3571 mapOfMatPropVects[
Strip(name)] = propvect;
3575 propvect = mapOfMatPropVects[
Strip(name)];
3584 const xercesc::DOMElement*
const opticalsurfaceElement)
3592 const xercesc::DOMNamedNodeMap*
const attributes =
3593 opticalsurfaceElement->getAttributes();
3594 XMLSize_t attributeCount = attributes->getLength();
3596 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
3599 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
3601 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
3606 const xercesc::DOMAttr*
const attribute =
3607 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
3608 if(attribute ==
nullptr)
3610 G4Exception(
"G4GDMLReadSolids::OpticalSurfaceRead()",
"InvalidRead",
3617 if(attName ==
"name")
3621 else if(attName ==
"model")
3625 else if(attName ==
"finish")
3629 else if(attName ==
"type")
3633 else if(attName ==
"value")
3643 if((smodel ==
"glisur") || (smodel ==
"0"))
3647 else if((smodel ==
"unified") || (smodel ==
"1"))
3651 else if((smodel ==
"LUT") || (smodel ==
"2"))
3660 if((sfinish ==
"polished") || (sfinish ==
"0"))
3664 else if((sfinish ==
"polishedfrontpainted") || (sfinish ==
"1"))
3668 else if((sfinish ==
"polishedbackpainted") || (sfinish ==
"2"))
3672 else if((sfinish ==
"ground") || (sfinish ==
"3"))
3676 else if((sfinish ==
"groundfrontpainted") || (sfinish ==
"4"))
3680 else if((sfinish ==
"groundbackpainted") || (sfinish ==
"5"))
3684 else if((sfinish ==
"polishedlumirrorair") || (sfinish ==
"6"))
3688 else if((sfinish ==
"polishedlumirrorglue") || (sfinish ==
"7"))
3692 else if((sfinish ==
"polishedair") || (sfinish ==
"8"))
3696 else if((sfinish ==
"polishedteflonair") || (sfinish ==
"9"))
3700 else if((sfinish ==
"polishedtioair") || (sfinish ==
"10"))
3704 else if((sfinish ==
"polishedtyvekair") || (sfinish ==
"11"))
3708 else if((sfinish ==
"polishedvm2000air") || (sfinish ==
"12"))
3712 else if((sfinish ==
"polishedvm2000glue") || (sfinish ==
"13"))
3716 else if((sfinish ==
"etchedlumirrorair") || (sfinish ==
"14"))
3720 else if((sfinish ==
"etchedlumirrorglue") || (sfinish ==
"15"))
3724 else if((sfinish ==
"etchedair") || (sfinish ==
"16"))
3728 else if((sfinish ==
"etchedteflonair") || (sfinish ==
"17"))
3732 else if((sfinish ==
"etchedtioair") || (sfinish ==
"18"))
3736 else if((sfinish ==
"etchedtyvekair") || (sfinish ==
"19"))
3740 else if((sfinish ==
"etchedvm2000air") || (sfinish ==
"20"))
3744 else if((sfinish ==
"etchedvm2000glue") || (sfinish ==
"21"))
3748 else if((sfinish ==
"groundlumirrorair") || (sfinish ==
"22"))
3752 else if((sfinish ==
"groundlumirrorglue") || (sfinish ==
"23"))
3756 else if((sfinish ==
"groundair") || (sfinish ==
"24"))
3760 else if((sfinish ==
"groundteflonair") || (sfinish ==
"25"))
3764 else if((sfinish ==
"groundtioair") || (sfinish ==
"26"))
3768 else if((sfinish ==
"groundtyvekair") || (sfinish ==
"27"))
3772 else if((sfinish ==
"groundvm2000air") || (sfinish ==
"28"))
3781 if((stype ==
"dielectric_metal") || (stype ==
"0"))
3785 else if((stype ==
"dielectric_dielectric") || (stype ==
"1"))
3789 else if((stype ==
"dielectric_LUT") || (stype ==
"2"))
3793 else if((stype ==
"dielectric_dichroic") || (stype ==
"3"))
3797 else if((stype ==
"firsov") || (stype ==
"4"))
3809 for(xercesc::DOMNode* iter = opticalsurfaceElement->getFirstChild();
3810 iter !=
nullptr; iter = iter->getNextSibling())
3812 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
3817 const xercesc::DOMElement*
const child =
3818 dynamic_cast<xercesc::DOMElement*
>(iter);
3819 if(child ==
nullptr)
3821 G4Exception(
"G4GDMLReadSolids::OpticalSurfaceRead()",
"InvalidRead",
3827 if(
tag ==
"property")
3836 const xercesc::DOMElement*
const solidsElement)
3841 for(xercesc::DOMNode* iter = solidsElement->getFirstChild(); iter !=
nullptr;
3842 iter = iter->getNextSibling())
3844 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
3849 const xercesc::DOMElement*
const child =
3850 dynamic_cast<xercesc::DOMElement*
>(iter);
3851 if(child ==
nullptr)
3853 G4Exception(
"G4GDMLReadSolids::SolidsRead()",
"InvalidRead",
3862 else if(
tag ==
"box")
3866 else if(
tag ==
"cone")
3870 else if(
tag ==
"elcone")
3874 else if(
tag ==
"ellipsoid")
3878 else if(
tag ==
"eltube")
3882 else if(
tag ==
"xtru")
3886 else if(
tag ==
"hype")
3890 else if(
tag ==
"intersection")
3894 else if(
tag ==
"multiUnion")
3898 else if(
tag ==
"orb")
3902 else if(
tag ==
"para")
3906 else if(
tag ==
"paraboloid")
3910 else if(
tag ==
"polycone")
3914 else if(
tag ==
"genericPolycone")
3918 else if(
tag ==
"polyhedra")
3922 else if(
tag ==
"genericPolyhedra")
3926 else if(
tag ==
"reflectedSolid")
3930 else if(
tag ==
"scaledSolid")
3934 else if(
tag ==
"sphere")
3938 else if(
tag ==
"subtraction")
3942 else if(
tag ==
"tessellated")
3946 else if(
tag ==
"tet")
3950 else if(
tag ==
"torus")
3954 else if(
tag ==
"arb8")
3958 else if(
tag ==
"trap")
3962 else if(
tag ==
"trd")
3966 else if(
tag ==
"tube")
3970 else if(
tag ==
"cutTube")
3974 else if(
tag ==
"twistedbox")
3978 else if(
tag ==
"twistedtrap")
3982 else if(
tag ==
"twistedtrd")
3986 else if(
tag ==
"twistedtubs")
3990 else if(
tag ==
"union")
3994 else if(
tag ==
"opticalsurface")
3998 else if(
tag ==
"loop")
4004 G4String error_msg =
"Unknown tag in solids: " +
tag;
4016 if(solidPtr ==
nullptr)
4018 G4String error_msg =
"Referenced solid '" + ref +
"' was not found!";
4032 const std::size_t surfaceCount = surfaceList->size();
4034 for(std::size_t i = 0; i < surfaceCount; ++i)
4036 if((*surfaceList)[i]->GetName() == ref)
4038 return (*surfaceList)[i];
4043 "Referenced optical surface '" + ref +
"' was not found!";
4044 G4Exception(
"G4GDMLReadSolids::GetSurfaceProperty()",
"ReadError",
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4PhysicsOrderedFreeVector G4MaterialPropertyVector
std::vector< G4SurfaceProperty * > G4SurfacePropertyTable
CLHEP::Hep2Vector G4TwoVector
G4GLOB_DLL std::ostream G4cout
G4double Evaluate(const G4String &)
G4int EvaluateInteger(const G4String &)
std::size_t GetCols() const
std::size_t GetRows() const
G4double Get(std::size_t r, std::size_t c) const
G4ThreeVector GetScale(const G4String &)
void VectorRead(const xercesc::DOMElement *const, G4ThreeVector &)
G4RotationMatrix GetRotationMatrix(const G4ThreeVector &)
G4ThreeVector GetPosition(const G4String &)
G4GDMLMatrix GetMatrix(const G4String &)
G4String RefRead(const xercesc::DOMElement *const)
G4ThreeVector GetRotation(const G4String &)
virtual void DefineRead(const xercesc::DOMElement *const)
G4SurfaceProperty * GetSurfaceProperty(const G4String &) const
void ReflectedSolidRead(const xercesc::DOMElement *const)
G4ExtrudedSolid::ZSection SectionRead(const xercesc::DOMElement *const, G4double)
void ParaboloidRead(const xercesc::DOMElement *const)
void PropertyRead(const xercesc::DOMElement *const, G4OpticalSurface *)
void XtruRead(const xercesc::DOMElement *const)
void SphereRead(const xercesc::DOMElement *const)
void TwistedtrapRead(const xercesc::DOMElement *const)
void TubeRead(const xercesc::DOMElement *const)
void GenTrapRead(const xercesc::DOMElement *const)
G4VSolid * GetSolid(const G4String &) const
void HypeRead(const xercesc::DOMElement *const)
rzPointType RZPointRead(const xercesc::DOMElement *const)
void TrdRead(const xercesc::DOMElement *const)
void ParaRead(const xercesc::DOMElement *const)
void TwistedtrdRead(const xercesc::DOMElement *const)
void PolyhedraRead(const xercesc::DOMElement *const)
void ConeRead(const xercesc::DOMElement *const)
void OpticalSurfaceRead(const xercesc::DOMElement *const)
G4QuadrangularFacet * QuadrangularRead(const xercesc::DOMElement *const)
void CutTubeRead(const xercesc::DOMElement *const)
void TetRead(const xercesc::DOMElement *const)
void GenericPolyhedraRead(const xercesc::DOMElement *const)
void MultiUnionRead(const xercesc::DOMElement *const)
void MultiUnionNodeRead(const xercesc::DOMElement *const, G4MultiUnion *const)
virtual void SolidsRead(const xercesc::DOMElement *const)
void EllipsoidRead(const xercesc::DOMElement *const)
void ElconeRead(const xercesc::DOMElement *const)
void TessellatedRead(const xercesc::DOMElement *const)
void TwistedboxRead(const xercesc::DOMElement *const)
void GenericPolyconeRead(const xercesc::DOMElement *const)
void BoxRead(const xercesc::DOMElement *const)
zplaneType ZplaneRead(const xercesc::DOMElement *const)
virtual ~G4GDMLReadSolids()
void OrbRead(const xercesc::DOMElement *const)
void PolyconeRead(const xercesc::DOMElement *const)
G4TwoVector TwoDimVertexRead(const xercesc::DOMElement *const, G4double)
void EltubeRead(const xercesc::DOMElement *const)
void TwistedtubsRead(const xercesc::DOMElement *const)
void TorusRead(const xercesc::DOMElement *const)
void ScaledSolidRead(const xercesc::DOMElement *const)
void BooleanRead(const xercesc::DOMElement *const, const BooleanOp)
void TrapRead(const xercesc::DOMElement *const)
G4TriangularFacet * TriangularRead(const xercesc::DOMElement *const)
G4String Strip(const G4String &) const
virtual void SolidsRead(const xercesc::DOMElement *const)=0
G4String GenerateName(const G4String &name, G4bool strip=false)
void LoopRead(const xercesc::DOMElement *const, void(G4GDMLRead::*)(const xercesc::DOMElement *const))
G4String Transcode(const XMLCh *const)
G4MaterialPropertyVector * AddProperty(const G4String &key, const std::vector< G4double > &photonEnergies, const std::vector< G4double > &propertyValues)
void AddConstProperty(const G4String &key, G4double PropertyValue)
void AddNode(G4VSolid &solid, G4Transform3D &trans)
void SetMaterialPropertiesTable(G4MaterialPropertiesTable *anMPT)
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
void InsertValues(G4double energy, G4double value)
G4VSolid * GetSolid(const G4String &name, G4bool verbose=true) const
static G4SolidStore * GetInstance()
static const G4SurfacePropertyTable * GetSurfacePropertyTable()
G4bool AddFacet(G4VFacet *aFacet)
void SetSolidClosed(const G4bool t)
static G4double GetValueOf(const G4String &)
static G4String GetCategory(const G4String &)