63 const xercesc::DOMNamedNodeMap*
const attributes
64 = auxiliaryElement->getAttributes();
65 XMLSize_t attributeCount = attributes->getLength();
67 for (XMLSize_t attribute_index=0;
68 attribute_index<attributeCount; attribute_index++)
70 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
72 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
75 const xercesc::DOMAttr*
const attribute
76 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
86 if (attName==
"auxtype") { auxpair.
type = attValue; }
else
88 if (attName==
"auxvalue") { auxpair.
value = attValue; }
103 const xercesc::DOMNamedNodeMap*
const attributes
104 = bordersurfaceElement->getAttributes();
105 XMLSize_t attributeCount = attributes->getLength();
107 for (XMLSize_t attribute_index=0;
108 attribute_index<attributeCount; attribute_index++)
110 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
112 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
115 const xercesc::DOMAttr*
const attribute
116 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
119 G4Exception(
"G4GDMLReadStructure::BorderSurfaceRead()",
128 if (attName==
"surfaceproperty")
132 for (xercesc::DOMNode* iter = bordersurfaceElement->getFirstChild();
133 iter != 0; iter = iter->getNextSibling())
135 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
137 const xercesc::DOMElement*
const child
138 =
dynamic_cast<xercesc::DOMElement*
>(iter);
141 G4Exception(
"G4GDMLReadStructure::BorderSurfaceRead()",
147 if (tag !=
"physvolref") {
continue; }
170 const xercesc::DOMNamedNodeMap*
const attributes
171 = divisionvolElement->getAttributes();
172 XMLSize_t attributeCount = attributes->getLength();
174 for (XMLSize_t attribute_index=0;
175 attribute_index<attributeCount; attribute_index++)
177 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
179 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
182 const xercesc::DOMAttr*
const attribute
183 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
186 G4Exception(
"G4GDMLReadStructure::DivisionvolRead()",
193 if (attName==
"name") { name = attValue; }
else
195 if (attName==
"width") { width =
eval.
Evaluate(attValue); }
else
196 if (attName==
"offset") { offset =
eval.
Evaluate(attValue); }
else
200 if (attValue==
"kXAxis") { axis =
kXAxis; }
else
201 if (attValue==
"kYAxis") { axis =
kYAxis; }
else
202 if (attValue==
"kZAxis") { axis =
kZAxis; }
else
203 if (attValue==
"kRho") { axis =
kRho; }
else
204 if (attValue==
"kPhi") { axis =
kPhi; }
211 for (xercesc::DOMNode* iter = divisionvolElement->getFirstChild();
212 iter != 0;iter = iter->getNextSibling())
214 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
216 const xercesc::DOMElement*
const child
217 =
dynamic_cast<xercesc::DOMElement*
>(iter);
220 G4Exception(
"G4GDMLReadStructure::DivisionvolRead()",
229 if (!logvol) {
return; }
235 if ((number != 0) && (width == 0.0))
240 else if ((number == 0) && (width != 0.0))
256 FileRead(
const xercesc::DOMElement*
const fileElement)
261 const xercesc::DOMNamedNodeMap*
const attributes
262 = fileElement->getAttributes();
263 XMLSize_t attributeCount = attributes->getLength();
265 for (XMLSize_t attribute_index=0;
266 attribute_index<attributeCount; attribute_index++)
268 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
270 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
273 const xercesc::DOMAttr*
const attribute
274 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
284 if (attName==
"name") { name = attValue; }
else
285 if (attName==
"volname") { volname = attValue; }
288 const G4bool isModule =
true;
297 G4GDMLAuxMapType::const_iterator
pos;
298 for (pos = aux->begin(); pos != aux->end(); ++
pos)
300 auxMap.insert(std::make_pair(pos->first,pos->second));
327 const xercesc::DOMNamedNodeMap*
const attributes
328 = physvolElement->getAttributes();
329 XMLSize_t attributeCount = attributes->getLength();
331 for (XMLSize_t attribute_index=0;
332 attribute_index<attributeCount; attribute_index++)
334 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
336 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
339 const xercesc::DOMAttr*
const attribute
340 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
350 if (attName==
"name") { name = attValue; }
353 for (xercesc::DOMNode* iter = physvolElement->getFirstChild();
354 iter != 0; iter = iter->getNextSibling())
356 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
358 const xercesc::DOMElement*
const child
359 =
dynamic_cast<xercesc::DOMElement*
>(iter);
368 if (tag==
"volumeref")
372 if (!assembly) { logvol =
GetVolume(child_name); }
374 else if (tag==
"file")
376 else if (tag==
"position")
378 else if (tag==
"rotation")
380 else if (tag==
"scale")
382 else if (tag==
"positionref")
384 else if (tag==
"rotationref")
386 else if (tag==
"scaleref")
390 G4String error_msg =
"Unknown tag in physvol: " + tag;
391 G4Exception(
"G4GDMLReadStructure::PhysvolRead()",
"ReadError",
398 transform = transform*
G4Scale3D(scale.x(),scale.y(),scale.z());
402 if (!logvol) {
return; }
413 if (!logvol) {
return; }
428 for (xercesc::DOMNode* iter = replicavolElement->getFirstChild();
429 iter != 0; iter = iter->getNextSibling())
431 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
433 const xercesc::DOMElement*
const child
434 =
dynamic_cast<xercesc::DOMElement*
>(iter);
437 G4Exception(
"G4GDMLReadStructure::ReplicavolRead()",
443 if (tag==
"volumeref")
447 else if (tag==
"replicate_along_axis")
453 G4String error_msg =
"Unknown tag in ReplicavolRead: " + tag;
454 G4Exception(
"G4GDMLReadStructure::ReplicavolRead()",
471 for (xercesc::DOMNode* iter = replicaElement->getFirstChild();
472 iter != 0; iter = iter->getNextSibling())
474 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
476 const xercesc::DOMElement*
const child
477 =
dynamic_cast<xercesc::DOMElement*
>(iter);
490 if (tag==
"positionref")
492 if (tag==
"rotationref")
494 if (tag==
"direction")
502 G4String error_msg =
"Unknown tag in ReplicaRead: " + tag;
503 G4Exception(
"G4GDMLReadStructure::ReplicaRead()",
"ReadError",
518 AxisRead(
const xercesc::DOMElement*
const axisElement)
522 const xercesc::DOMNamedNodeMap*
const attributes
523 = axisElement->getAttributes();
524 XMLSize_t attributeCount = attributes->getLength();
526 for (XMLSize_t attribute_index=0;
527 attribute_index<attributeCount; attribute_index++)
529 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
531 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
534 const xercesc::DOMAttr*
const attribute
535 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
546 else if (attName==
"y")
548 else if (attName==
"z")
550 else if (attName==
"rho")
552 else if (attName==
"phi")
564 const xercesc::DOMNamedNodeMap*
const attributes
565 = readElement->getAttributes();
566 XMLSize_t attributeCount = attributes->getLength();
568 for (XMLSize_t attribute_index=0;
569 attribute_index<attributeCount; attribute_index++)
571 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
573 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
575 const xercesc::DOMAttr*
const attribute
576 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
587 if (attName==
"value"){ value=
eval.
Evaluate(attValue); }
600 XMLCh *name_attr = xercesc::XMLString::transcode(
"name");
604 for (xercesc::DOMNode* iter = volumeElement->getFirstChild();
605 iter != 0; iter = iter->getNextSibling())
607 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
609 const xercesc::DOMElement*
const child
610 =
dynamic_cast<xercesc::DOMElement*
>(iter);
619 if (tag==
"auxiliary")
621 if (tag==
"materialref")
638 XMLCh *name_attr = xercesc::XMLString::transcode(
"name");
645 for (xercesc::DOMNode* iter = assemblyElement->getFirstChild();
646 iter != 0; iter = iter->getNextSibling())
648 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
649 const xercesc::DOMElement*
const child
650 =
dynamic_cast<xercesc::DOMElement*
>(iter);
665 G4cout <<
"Unsupported GDML tag '" << tag
666 <<
"' for Geant4 assembly structure !" <<
G4endl;
678 const xercesc::DOMNamedNodeMap*
const attributes
679 = skinsurfaceElement->getAttributes();
680 XMLSize_t attributeCount = attributes->getLength();
682 for (XMLSize_t attribute_index=0;
683 attribute_index<attributeCount; attribute_index++)
685 xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
687 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
690 const xercesc::DOMAttr*
const attribute
691 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
694 G4Exception(
"G4GDMLReadStructure::SkinsurfaceRead()",
703 if (attName==
"surfaceproperty")
707 for (xercesc::DOMNode* iter = skinsurfaceElement->getFirstChild();
708 iter != 0; iter = iter->getNextSibling())
710 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
712 const xercesc::DOMElement*
const child
713 =
dynamic_cast<xercesc::DOMElement*
>(iter);
716 G4Exception(
"G4GDMLReadStructure::SkinsurfaceRead()",
722 if (tag==
"volumeref")
728 G4String error_msg =
"Unknown tag in skinsurface: " + tag;
729 G4Exception(
"G4GDMLReadStructure::SkinsurfaceRead()",
"ReadError",
740 for (xercesc::DOMNode* iter = volumeElement->getFirstChild();
741 iter != 0; iter = iter->getNextSibling())
743 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
745 const xercesc::DOMElement*
const child
746 =
dynamic_cast<xercesc::DOMElement*
>(iter);
749 G4Exception(
"G4GDMLReadStructure::Volume_contentRead()",
755 if ((tag==
"auxiliary") || (tag==
"materialref") || (tag==
"solidref"))
759 else if (tag==
"paramvol")
763 else if (tag==
"physvol")
767 else if (tag==
"replicavol")
770 const xercesc::DOMNamedNodeMap*
const attributes
771 = child->getAttributes();
772 XMLSize_t attributeCount = attributes->getLength();
773 for (XMLSize_t attribute_index=0;
774 attribute_index<attributeCount; attribute_index++)
776 xercesc::DOMNode* attribute_node
777 = attributes->item(attribute_index);
778 if (attribute_node->getNodeType()!=xercesc::DOMNode::ATTRIBUTE_NODE)
782 const xercesc::DOMAttr*
const attribute
783 =
dynamic_cast<xercesc::DOMAttr*
>(attribute_node);
786 G4Exception(
"G4GDMLReadStructure::Volume_contentRead()",
792 if (attName==
"number")
799 else if (tag==
"divisionvol")
803 else if (tag==
"loop")
809 G4cout <<
"Treating unknown GDML tag in volume '" << tag
810 <<
"' as GDML extension..." <<
G4endl;
820 for (xercesc::DOMNode* iter = structureElement->getFirstChild();
821 iter != 0; iter = iter->getNextSibling())
823 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) {
continue; }
825 const xercesc::DOMElement*
const child
826 =
dynamic_cast<xercesc::DOMElement*
>(iter);
829 G4Exception(
"G4GDMLReadStructure::StructureRead()",
837 if (tag==
"volume") {
VolumeRead(child); }
else
842 G4String error_msg =
"Unknown tag in structure: " + tag;
843 G4Exception(
"G4GDMLReadStructure::StructureRead()",
857 G4String error_msg =
"Referenced physvol '" + ref +
"' was not found!";
858 G4Exception(
"G4GDMLReadStructure::GetPhysvol()",
"ReadError",
873 G4String error_msg =
"Referenced volume '" + ref +
"' was not found!";
874 G4Exception(
"G4GDMLReadStructure::GetVolume()",
"ReadError",
884 G4GDMLAssemblyMapType::const_iterator
pos =
assemblyMap.find(ref);
885 if (pos !=
assemblyMap.end()) {
return pos->second; }
892 G4GDMLAuxMapType::const_iterator
pos =
auxMap.find(logvol);
893 if (pos !=
auxMap.end()) {
return pos->second; }
919 volume->
GetName()+
"_PV",0,0,0);
G4PhysicalVolumesPair Divide(const G4String &name, G4LogicalVolume *LV, G4LogicalVolume *motherLV, EAxis axis, G4int nofDivisions, G4double width, G4double offset)
static int release(statusMessageReporting *smr, xDataType *xDT)
G4AssemblyVolume * GetAssembly(const G4String &) const
G4LogicalVolume * FileRead(const xercesc::DOMElement *const)
G4int EvaluateInteger(const G4String &)
void MakeImprint(G4LogicalVolume *pMotherLV, G4ThreeVector &translationInMother, G4RotationMatrix *pRotationInMother, G4int copyNumBase=0, G4bool surfCheck=false)
virtual void ParamvolRead(const xercesc::DOMElement *const, G4LogicalVolume *)
CLHEP::Hep3Vector G4ThreeVector
G4Material * GetMaterial(const G4String &, G4bool verbose=true) const
virtual void Volume_contentRead(const xercesc::DOMElement *const)=0
G4double QuantityRead(const xercesc::DOMElement *const readElement)
void DivisionvolRead(const xercesc::DOMElement *const)
G4String Transcode(const XMLCh *const)
G4GDMLAuxPairType AuxiliaryRead(const xercesc::DOMElement *const)
G4ThreeVector GetScale(const G4String &)
G4SurfaceProperty * GetSurfaceProperty(const G4String &) const
void ReplicavolRead(const xercesc::DOMElement *const, G4int number)
G4PhysicalVolumesPair Replicate(const G4String &name, G4LogicalVolume *LV, G4LogicalVolume *motherLV, EAxis axis, G4int nofReplicas, G4double width, G4double offset=0)
void GeneratePhysvolName(const G4String &, G4VPhysicalVolume *)
virtual ~G4GDMLReadStructure()
G4VPhysicalVolume * GetPhysvol(const G4String &) const
G4LogicalVolume * GetVolume(const G4String &name, G4bool verbose=true) const
static G4ReflectionFactory * Instance()
G4VSolid * GetSolid(const G4String &) const
virtual void StructureRead(const xercesc::DOMElement *const)=0
static G4PhysicalVolumeStore * GetInstance()
G4String RefRead(const xercesc::DOMElement *const)
static G4PVDivisionFactory * GetInstance()
void LoopRead(const xercesc::DOMElement *const, void(G4GDMLRead::*)(const xercesc::DOMElement *const))
static G4double GetValueOf(const G4String &)
G4GLOB_DLL std::ostream G4cout
G4PhysicalVolumesPair Place(const G4Transform3D &transform3D, const G4String &name, G4LogicalVolume *LV, G4LogicalVolume *motherLV, G4bool isMany, G4int copyNo, G4bool surfCheck=false)
G4GDMLAssemblyMapType assemblyMap
G4LogicalVolume * GetVolume(const G4String &) const
void ReplicaRead(const xercesc::DOMElement *const replicaElement, G4LogicalVolume *logvol, G4int number)
static G4LogicalVolumeStore * GetInstance()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4LogicalVolume * pMotherLogical
const G4GDMLAuxMapType * GetAuxMap() const
std::vector< G4GDMLAuxPairType > G4GDMLAuxListType
G4String GenerateName(const G4String &name, G4bool strip=false)
std::map< std::string, G4VPhysicalVolume * > setuptoPV
void BorderSurfaceRead(const xercesc::DOMElement *const)
void AddPlacedVolume(G4LogicalVolume *pPlacedVolume, G4ThreeVector &translation, G4RotationMatrix *rotation)
G4String Strip(const G4String &) const
G4VPhysicalVolume * GetWorldVolume(const G4String &)
EAxis AxisRead(const xercesc::DOMElement *const axisElement)
void SkinSurfaceRead(const xercesc::DOMElement *const)
void VectorRead(const xercesc::DOMElement *const, G4ThreeVector &)
static const G4VisAttributes Invisible
virtual void Volume_contentRead(const xercesc::DOMElement *const)
std::pair< G4VPhysicalVolume *, G4VPhysicalVolume * > G4PhysicalVolumesPair
G4ThreeVector GetRotation(const G4String &)
G4GDMLAuxListType GetVolumeAuxiliaryInformation(G4LogicalVolume *) const
G4RotationMatrix GetRotationMatrix(const G4ThreeVector &)
std::map< G4LogicalVolume *, G4GDMLAuxListType > G4GDMLAuxMapType
virtual void StructureRead(const xercesc::DOMElement *const)
void AssemblyRead(const xercesc::DOMElement *const)
G4VPhysicalVolume * GetVolume(const G4String &name, G4bool verbose=true) const
void SetVisAttributes(const G4VisAttributes *pVA)
static const G4double pos
G4String GetSetup(const G4String &)
void Read(const G4String &, G4bool validation, G4bool isModule, G4bool strip=true)
G4double Evaluate(const G4String &)
void PhysvolRead(const xercesc::DOMElement *const, G4AssemblyVolume *assembly=0)
G4ThreeVector GetPosition(const G4String &)
virtual void VolumeRead(const xercesc::DOMElement *const)