51 const xercesc::DOMElement*
const element,
56 const xercesc::DOMNamedNodeMap*
const attributes = element->getAttributes();
57 XMLSize_t attributeCount = attributes->getLength();
59 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
62 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
64 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
69 const xercesc::DOMAttr*
const attribute =
70 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
71 if(attribute ==
nullptr)
73 G4Exception(
"G4GDMLReadParamvol::Box_dimensionsRead()",
"InvalidRead",
80 if(attName ==
"lunit")
85 G4Exception(
"G4GDMLReadParamvol::Box_dimensionsRead()",
"InvalidRead",
89 else if(attName ==
"x")
93 else if(attName ==
"y")
97 else if(attName ==
"z")
110 const xercesc::DOMElement*
const element,
115 const xercesc::DOMNamedNodeMap*
const attributes = element->getAttributes();
116 XMLSize_t attributeCount = attributes->getLength();
118 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
121 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
123 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
128 const xercesc::DOMAttr*
const attribute =
129 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
130 if(attribute ==
nullptr)
132 G4Exception(
"G4GDMLReadParamvol::Trd_dimensionsRead()",
"InvalidRead",
139 if(attName ==
"lunit")
144 G4Exception(
"G4GDMLReadParamvol::Trd_dimensionsRead()",
"InvalidRead",
148 else if(attName ==
"x1")
152 else if(attName ==
"x2")
156 else if(attName ==
"y1")
160 else if(attName ==
"y2")
164 else if(attName ==
"z")
179 const xercesc::DOMElement*
const element,
185 const xercesc::DOMNamedNodeMap*
const attributes = element->getAttributes();
186 XMLSize_t attributeCount = attributes->getLength();
188 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
191 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
193 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
198 const xercesc::DOMAttr*
const attribute =
199 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
200 if(attribute ==
nullptr)
202 G4Exception(
"G4GDMLReadParamvol::Trap_dimensionsRead()",
"InvalidRead",
209 if(attName ==
"lunit")
214 G4Exception(
"G4GDMLReadParamvol::Trap_dimensionsRead()",
"InvalidRead",
218 else if(attName ==
"aunit")
223 G4Exception(
"G4GDMLReadParamvol::Trap_dimensionsRead()",
"InvalidRead",
227 else if(attName ==
"z")
231 else if(attName ==
"theta")
235 else if(attName ==
"phi")
239 else if(attName ==
"y1")
243 else if(attName ==
"x1")
247 else if(attName ==
"x2")
251 else if(attName ==
"alpha1")
255 else if(attName ==
"y2")
259 else if(attName ==
"x3")
263 else if(attName ==
"x4")
267 else if(attName ==
"alpha2")
288 const xercesc::DOMElement*
const element,
294 const xercesc::DOMNamedNodeMap*
const attributes = element->getAttributes();
295 XMLSize_t attributeCount = attributes->getLength();
297 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
300 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
302 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
307 const xercesc::DOMAttr*
const attribute =
308 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
309 if(attribute ==
nullptr)
311 G4Exception(
"G4GDMLReadParamvol::Tube_dimensionsRead()",
"InvalidRead",
318 if(attName ==
"lunit")
323 G4Exception(
"G4GDMLReadParamvol::Tube_dimensionsRead()",
"InvalidRead",
327 else if(attName ==
"aunit")
332 G4Exception(
"G4GDMLReadParamvol::Tube_dimensionsRead()",
"InvalidRead",
336 else if(attName ==
"InR")
340 else if(attName ==
"OutR")
344 else if(attName ==
"hz")
348 else if(attName ==
"StartPhi")
352 else if(attName ==
"DeltaPhi")
367 const xercesc::DOMElement*
const element,
373 const xercesc::DOMNamedNodeMap*
const attributes = element->getAttributes();
374 XMLSize_t attributeCount = attributes->getLength();
376 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
379 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
381 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
386 const xercesc::DOMAttr*
const attribute =
387 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
388 if(attribute ==
nullptr)
390 G4Exception(
"G4GDMLReadParamvol::Cone_dimensionsRead()",
"InvalidRead",
397 if(attName ==
"lunit")
402 G4Exception(
"G4GDMLReadParamvol::Cone_dimensionsRead()",
"InvalidRead",
406 else if(attName ==
"aunit")
411 G4Exception(
"G4GDMLReadParamvol::Cone_dimensions()",
"InvalidRead",
415 else if(attName ==
"rmin1")
419 else if(attName ==
"rmax1")
423 else if(attName ==
"rmin2")
427 else if(attName ==
"rmax2")
431 else if(attName ==
"z")
435 else if(attName ==
"startphi")
439 else if(attName ==
"deltaphi")
456 const xercesc::DOMElement*
const element,
462 const xercesc::DOMNamedNodeMap*
const attributes = element->getAttributes();
463 XMLSize_t attributeCount = attributes->getLength();
465 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
468 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
470 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
475 const xercesc::DOMAttr*
const attribute =
476 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
477 if(attribute ==
nullptr)
479 G4Exception(
"G4GDMLReadParamvol::Sphere_dimensionsRead()",
"InvalidRead",
486 if(attName ==
"lunit")
491 G4Exception(
"G4GDMLReadParamvol::Sphere_dimensionsRead()",
495 else if(attName ==
"aunit")
500 G4Exception(
"G4GDMLReadParamvol::Sphere_dimensionsRead()",
504 else if(attName ==
"rmin")
508 else if(attName ==
"rmax")
512 else if(attName ==
"startphi")
516 else if(attName ==
"deltaphi")
520 else if(attName ==
"starttheta")
524 else if(attName ==
"deltatheta")
540 const xercesc::DOMElement*
const element,
545 const xercesc::DOMNamedNodeMap*
const attributes = element->getAttributes();
546 XMLSize_t attributeCount = attributes->getLength();
548 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
551 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
553 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
558 const xercesc::DOMAttr*
const attribute =
559 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
560 if(attribute ==
nullptr)
562 G4Exception(
"G4GDMLReadParamvol::Orb_dimensionsRead()",
"InvalidRead",
569 if(attName ==
"lunit")
575 G4Exception(
"G4GDMLReadParamvol::Orb_dimensionsRead()",
"InvalidRead",
578 else if(attName ==
"r")
589 const xercesc::DOMElement*
const element,
595 const xercesc::DOMNamedNodeMap*
const attributes = element->getAttributes();
596 XMLSize_t attributeCount = attributes->getLength();
598 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
601 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
603 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
608 const xercesc::DOMAttr*
const attribute =
609 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
610 if(attribute ==
nullptr)
612 G4Exception(
"G4GDMLReadParamvol::Torus_dimensionsRead()",
"InvalidRead",
619 if(attName ==
"lunit")
624 G4Exception(
"G4GDMLReadParamvol::Torus_dimensionsRead()",
"InvalidRead",
628 else if(attName ==
"aunit")
633 G4Exception(
"G4GDMLReadParamvol::Torus_dimensionsRead()",
"InvalidRead",
637 else if(attName ==
"rmin")
641 else if(attName ==
"rmax")
645 else if(attName ==
"rtor")
649 else if(attName ==
"startphi")
653 else if(attName ==
"deltaphi")
668 const xercesc::DOMElement*
const element,
672 const xercesc::DOMNamedNodeMap*
const attributes = element->getAttributes();
673 XMLSize_t attributeCount = attributes->getLength();
675 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
678 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
680 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
685 const xercesc::DOMAttr*
const attribute =
686 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
687 if(attribute ==
nullptr)
689 G4Exception(
"G4GDMLReadParamvol::Ellipsoid_dimensionsRead()",
696 if(attName ==
"lunit")
701 G4Exception(
"G4GDMLReadParamvol::Ellipsoid_dimensionsRead()",
705 else if(attName ==
"ax")
709 else if(attName ==
"by")
713 else if(attName ==
"cz")
717 else if(attName ==
"zcut1")
721 else if(attName ==
"zcut2")
736 const xercesc::DOMElement*
const element,
742 const xercesc::DOMNamedNodeMap*
const attributes = element->getAttributes();
743 XMLSize_t attributeCount = attributes->getLength();
745 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
748 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
750 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
755 const xercesc::DOMAttr*
const attribute =
756 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
757 if(attribute ==
nullptr)
759 G4Exception(
"G4GDMLReadParamvol::Para_dimensionsRead()",
"InvalidRead",
766 if(attName ==
"lunit")
771 G4Exception(
"G4GDMLReadParamvol::Para_dimensionsRead()",
"InvalidRead",
775 else if(attName ==
"aunit")
780 G4Exception(
"G4GDMLReadParamvol::Para_dimensionsRead()",
"InvalidRead",
784 else if(attName ==
"x")
788 else if(attName ==
"y")
792 else if(attName ==
"z")
796 else if(attName ==
"alpha")
800 else if(attName ==
"theta")
804 else if(attName ==
"phi")
820 const xercesc::DOMElement*
const element,
826 const xercesc::DOMNamedNodeMap*
const attributes = element->getAttributes();
827 XMLSize_t attributeCount = attributes->getLength();
829 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
832 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
834 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
839 const xercesc::DOMAttr*
const attribute =
840 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
841 if(attribute ==
nullptr)
843 G4Exception(
"G4GDMLReadParamvol::Hype_dimensionsRead()",
"InvalidRead",
850 if(attName ==
"lunit")
855 G4Exception(
"G4GDMLReadParamvol::Hype_dimensionsRead()",
"InvalidRead",
859 else if(attName ==
"aunit")
864 G4Exception(
"G4GDMLReadParamvol::Hype_dimensionsRead()",
"InvalidRead",
868 else if(attName ==
"rmin")
872 else if(attName ==
"rmax")
876 else if(attName ==
"inst")
880 else if(attName ==
"outst")
884 else if(attName ==
"z")
899 const xercesc::DOMElement*
const element,
905 std::vector<zplaneType> zplaneList;
907 const xercesc::DOMNamedNodeMap*
const attributes = element->getAttributes();
908 XMLSize_t attributeCount = attributes->getLength();
910 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
913 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
915 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
920 const xercesc::DOMAttr*
const attribute =
921 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
922 if(attribute ==
nullptr)
924 G4Exception(
"G4GDMLReadParamvol::Polycone_dimensionsRead()",
931 if(attName ==
"lunit")
936 G4Exception(
"G4GDMLReadParamvol::Polycone_dimensionsRead()",
940 else if(attName ==
"aunit")
945 G4Exception(
"G4GDMLReadParamvol::Polycone_dimensionsRead()",
949 else if(attName ==
"startPhi")
953 else if(attName ==
"openPhi")
957 else if(attName ==
"numRZ")
966 for(xercesc::DOMNode* iter = element->getFirstChild(); iter !=
nullptr;
967 iter = iter->getNextSibling())
969 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
974 const xercesc::DOMElement*
const child =
975 dynamic_cast<xercesc::DOMElement*
>(iter);
978 G4Exception(
"G4GDMLReadParamVol::Polycone_dimensionsRead()",
990 G4int numZPlanes = zplaneList.size();
991 for(
G4int i = 0; i < numZPlanes; ++i)
993 parameter.
dimension[3 + i * 3] = zplaneList[i].rmin * lunit;
994 parameter.
dimension[4 + i * 3] = zplaneList[i].rmax * lunit;
995 parameter.
dimension[5 + i * 3] = zplaneList[i].z * lunit;
1001 const xercesc::DOMElement*
const element,
1007 std::vector<zplaneType> zplaneList;
1009 const xercesc::DOMNamedNodeMap*
const attributes = element->getAttributes();
1010 XMLSize_t attributeCount = attributes->getLength();
1012 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
1015 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1017 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1022 const xercesc::DOMAttr*
const attribute =
1023 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
1024 if(attribute ==
nullptr)
1026 G4Exception(
"G4GDMLReadParamvol::Polycone_dimensionsRead()",
1033 if(attName ==
"lunit")
1038 G4Exception(
"G4GDMLReadParamvol::Polyhedra_dimensionsRead()",
1042 else if(attName ==
"aunit")
1047 G4Exception(
"G4GDMLReadParamvol::Polyhedra_dimensionsRead()",
1051 else if(attName ==
"startPhi")
1055 else if(attName ==
"openPhi")
1059 else if(attName ==
"numRZ")
1063 else if(attName ==
"numSide")
1072 for(xercesc::DOMNode* iter = element->getFirstChild(); iter !=
nullptr;
1073 iter = iter->getNextSibling())
1075 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
1080 const xercesc::DOMElement*
const child =
1081 dynamic_cast<xercesc::DOMElement*
>(iter);
1082 if(child ==
nullptr)
1084 G4Exception(
"G4GDMLReadParamvo::PolyhedraRead()",
"InvalidRead",
1096 G4int numZPlanes = zplaneList.size();
1097 for(
G4int i = 0; i < numZPlanes; ++i)
1099 parameter.
dimension[4 + i * 3] = zplaneList[i].rmin * lunit;
1100 parameter.
dimension[5 + i * 3] = zplaneList[i].rmax * lunit;
1101 parameter.
dimension[6 + i * 3] = zplaneList[i].z * lunit;
1107 const xercesc::DOMElement*
const element)
1114 for(xercesc::DOMNode* iter = element->getFirstChild(); iter !=
nullptr;
1115 iter = iter->getNextSibling())
1117 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
1122 const xercesc::DOMElement*
const child =
1123 dynamic_cast<xercesc::DOMElement*
>(iter);
1124 if(child ==
nullptr)
1126 G4Exception(
"G4GDMLReadParamvol::ParametersRead()",
"InvalidRead",
1131 if(
tag ==
"rotation")
1135 else if(
tag ==
"position")
1139 else if(
tag ==
"positionref")
1143 else if(
tag ==
"rotationref")
1147 else if(
tag ==
"box_dimensions")
1151 else if(
tag ==
"trd_dimensions")
1155 else if(
tag ==
"trap_dimensions")
1159 else if(
tag ==
"tube_dimensions")
1163 else if(
tag ==
"cone_dimensions")
1167 else if(
tag ==
"sphere_dimensions")
1171 else if(
tag ==
"orb_dimensions")
1175 else if(
tag ==
"torus_dimensions")
1179 else if(
tag ==
"ellipsoid_dimensions")
1183 else if(
tag ==
"para_dimensions")
1187 else if(
tag ==
"polycone_dimensions")
1191 else if(
tag ==
"polyhedra_dimensions")
1195 else if(
tag ==
"hype_dimensions")
1201 G4String error_msg =
"Unknown tag in parameters: " +
tag;
1202 G4Exception(
"G4GDMLReadParamvol::ParametersRead()",
"ReadError",
1220 const xercesc::DOMElement*
const element)
1222 for(xercesc::DOMNode* iter = element->getFirstChild(); iter !=
nullptr;
1223 iter = iter->getNextSibling())
1225 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
1230 const xercesc::DOMElement*
const child =
1231 dynamic_cast<xercesc::DOMElement*
>(iter);
1232 if(child ==
nullptr)
1234 G4Exception(
"G4GDMLReadParamvol::ParameterisedRead()",
"InvalidRead",
1240 if(
tag ==
"parameters")
1242 const xercesc::DOMNamedNodeMap*
const attributes =
1243 element->getAttributes();
1244 XMLSize_t attributeCount = attributes->getLength();
1245 for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
1248 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1250 if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1255 const xercesc::DOMAttr*
const attribute =
1256 dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
1257 if(attribute ==
nullptr)
1259 G4Exception(
"G4GDMLReadParamvol::ParameterisedRead()",
"InvalidRead",
1266 if(attName ==
"number")
1285 const xercesc::DOMElement*
const element)
1287 for(xercesc::DOMNode* iter = element->getFirstChild(); iter !=
nullptr;
1288 iter = iter->getNextSibling())
1290 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
1295 const xercesc::DOMElement*
const child =
1296 dynamic_cast<xercesc::DOMElement*
>(iter);
1297 if(child ==
nullptr)
1299 G4Exception(
"G4GDMLReadParamvol::Paramvol_contentRead()",
"InvalidRead",
1304 if(
tag ==
"parameterised_position_size")
1308 else if(
tag ==
"loop")
1322 for(xercesc::DOMNode* iter = element->getFirstChild(); iter !=
nullptr;
1323 iter = iter->getNextSibling())
1325 if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
1330 const xercesc::DOMElement*
const child =
1331 dynamic_cast<xercesc::DOMElement*
>(iter);
1332 if(child ==
nullptr)
1334 G4Exception(
"G4GDMLReadParamvol::ParamvolRead()",
"InvalidRead",
1340 if(
tag ==
"volumeref")
1352 G4Exception(
"G4GDMLReadParamvol::ParamvolRead()",
"ReadError",
1354 "No parameters are defined in parameterised volume!");
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
CLHEP::HepRotation G4RotationMatrix
HepRotation & rotateX(double delta)
HepRotation & rotateZ(double delta)
HepRotation & rotateY(double delta)
G4double Evaluate(const G4String &)
void AddParameter(const PARAMETER &)
void VectorRead(const xercesc::DOMElement *const, G4ThreeVector &)
G4ThreeVector GetPosition(const G4String &)
G4String RefRead(const xercesc::DOMElement *const)
G4ThreeVector GetRotation(const G4String &)
virtual void ParamvolRead(const xercesc::DOMElement *const, G4LogicalVolume *)
virtual ~G4GDMLReadParamvol()
void ParametersRead(const xercesc::DOMElement *const)
void Ellipsoid_dimensionsRead(const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
void Cone_dimensionsRead(const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
void Box_dimensionsRead(const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
void Para_dimensionsRead(const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
void Torus_dimensionsRead(const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
G4GDMLParameterisation * parameterisation
void Sphere_dimensionsRead(const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
void Hype_dimensionsRead(const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
void ParameterisedRead(const xercesc::DOMElement *const)
void Trap_dimensionsRead(const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
void Orb_dimensionsRead(const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
void Trd_dimensionsRead(const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
virtual void Paramvol_contentRead(const xercesc::DOMElement *const)
void Polyhedra_dimensionsRead(const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
void Tube_dimensionsRead(const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
void Polycone_dimensionsRead(const xercesc::DOMElement *const, G4GDMLParameterisation::PARAMETER &)
zplaneType ZplaneRead(const xercesc::DOMElement *const)
virtual void Paramvol_contentRead(const xercesc::DOMElement *const)=0
G4String GenerateName(const G4String &name, G4bool strip=false)
virtual G4LogicalVolume * GetVolume(const G4String &) const =0
void LoopRead(const xercesc::DOMElement *const, void(G4GDMLRead::*)(const xercesc::DOMElement *const))
G4String Transcode(const XMLCh *const)
const G4String & GetName() const
static G4double GetValueOf(const G4String &)
static G4String GetCategory(const G4String &)