88 if (axis==
kXAxis) { axisString =
"kXAxis"; }
89 else if (axis==
kYAxis) { axisString =
"kYAxis"; }
90 else if (axis==
kZAxis) { axisString =
"kZAxis"; }
91 else if (axis==
kRho) { axisString =
"kRho"; }
92 else if (axis==
kPhi) { axisString =
"kPhi"; unitString =
"rad"; }
100 xercesc::DOMElement* divisionvolElement =
NewElement(
"divisionvol");
101 divisionvolElement->setAttributeNode(
NewAttribute(
"axis",axisString));
102 divisionvolElement->setAttributeNode(
NewAttribute(
"number",number));
103 divisionvolElement->setAttributeNode(
NewAttribute(
"width",width));
104 divisionvolElement->setAttributeNode(
NewAttribute(
"offset",offset));
105 divisionvolElement->setAttributeNode(
NewAttribute(
"unit",unitString));
106 xercesc::DOMElement* volumerefElement =
NewElement(
"volumeref");
107 volumerefElement->setAttributeNode(
NewAttribute(
"ref",volumeref));
108 divisionvolElement->appendChild(volumerefElement);
109 volumeElement->appendChild(divisionvolElement);
130 xercesc::DOMElement* physvolElement =
NewElement(
"physvol");
131 physvolElement->setAttributeNode(
NewAttribute(
"name",name));
132 if (copynumber) physvolElement->setAttributeNode(
NewAttribute(
"copynumber", copynumber));
134 volumeElement->appendChild(physvolElement);
149 if (ModuleName.empty())
151 xercesc::DOMElement* volumerefElement =
NewElement(
"volumeref");
152 volumerefElement->setAttributeNode(
NewAttribute(
"ref",volumeref));
153 physvolElement->appendChild(volumerefElement);
157 xercesc::DOMElement* fileElement =
NewElement(
"file");
158 fileElement->setAttributeNode(
NewAttribute(
"name",ModuleName));
159 fileElement->setAttributeNode(
NewAttribute(
"volname",volumeref));
160 physvolElement->appendChild(fileElement);
199 xercesc::DOMElement* replicavolElement =
NewElement(
"replicavol");
200 replicavolElement->setAttributeNode(
NewAttribute(
"number",number));
201 xercesc::DOMElement* volumerefElement =
NewElement(
"volumeref");
202 volumerefElement->setAttributeNode(
NewAttribute(
"ref",volumeref));
203 replicavolElement->appendChild(volumerefElement);
204 xercesc::DOMElement* replicateElement =
NewElement(
"replicate_along_axis");
205 replicavolElement->appendChild(replicateElement);
207 xercesc::DOMElement* dirElement =
NewElement(
"direction");
209 { dirElement->setAttributeNode(
NewAttribute(
"x",
"1")); }
211 { dirElement->setAttributeNode(
NewAttribute(
"y",
"1")); }
213 { dirElement->setAttributeNode(
NewAttribute(
"z",
"1")); }
215 { dirElement->setAttributeNode(
NewAttribute(
"rho",
"1")); }
217 { dirElement->setAttributeNode(
NewAttribute(
"phi",
"1"));
219 replicateElement->appendChild(dirElement);
221 xercesc::DOMElement* widthElement =
NewElement(
"width");
222 widthElement->setAttributeNode(
NewAttribute(
"value",width));
223 widthElement->setAttributeNode(
NewAttribute(
"unit",unitString));
224 replicateElement->appendChild(widthElement);
226 xercesc::DOMElement* offsetElement =
NewElement(
"offset");
227 offsetElement->setAttributeNode(
NewAttribute(
"value",offset));
228 offsetElement->setAttributeNode(
NewAttribute(
"unit",unitString));
229 replicateElement->appendChild(offsetElement);
231 volumeElement->appendChild(replicavolElement);
236 const int assemblyID)
242 xercesc::DOMElement* assemblyElement =
NewElement(
"assembly");
245 assemblyElement->setAttributeNode(
NewAttribute(
"name",name));
261 xercesc::DOMElement* physvolElement =
NewElement(
"physvol");
262 physvolElement->setAttributeNode(
NewAttribute(
"name",pname));
264 assemblyElement->appendChild(physvolElement);
268 xercesc::DOMElement* volumerefElement =
NewElement(
"volumeref");
269 volumerefElement->setAttributeNode(
NewAttribute(
"ref",volumeref));
270 physvolElement->appendChild(volumerefElement);
287 volumeElement->appendChild(assemblyElement);
294 if (!bsurf) {
return; }
302 xercesc::DOMElement* borderElement =
NewElement(
"bordersurface");
303 borderElement->setAttributeNode(
NewAttribute(
"name", bsname));
304 borderElement->setAttributeNode(
NewAttribute(
"surfaceproperty", psname));
310 xercesc::DOMElement* volumerefElement1 =
NewElement(
"physvolref");
311 xercesc::DOMElement* volumerefElement2 =
NewElement(
"physvolref");
312 volumerefElement1->setAttributeNode(
NewAttribute(
"ref",volumeref1));
313 volumerefElement2->setAttributeNode(
NewAttribute(
"ref",volumeref2));
314 borderElement->appendChild(volumerefElement1);
315 borderElement->appendChild(volumerefElement2);
323 G4Exception(
"G4GDMLWriteStructure::BorderSurfaceCache()",
336 if (!ssurf) {
return; }
344 xercesc::DOMElement* skinElement =
NewElement(
"skinsurface");
345 skinElement->setAttributeNode(
NewAttribute(
"name", ssname));
346 skinElement->setAttributeNode(
NewAttribute(
"surfaceproperty", psname));
350 xercesc::DOMElement* volumerefElement =
NewElement(
"volumeref");
351 volumerefElement->setAttributeNode(
NewAttribute(
"ref",volumeref));
352 skinElement->appendChild(volumerefElement);
360 G4Exception(
"G4GDMLWriteStructure::SkinSurfaceCache()",
373 std::vector<const G4OpticalSurface*>::const_iterator
pos;
375 if (pos !=
opt_vec.end()) {
return false; }
390 std::vector<G4LogicalSkinSurface*>::const_iterator
pos;
391 for (pos = stable->begin(); pos != stable->end(); pos++)
393 if (lvol == (*pos)->GetLogicalVolume())
411 std::vector<G4LogicalBorderSurface*>::const_iterator
pos;
412 for (pos = btable->begin(); pos != btable->end(); pos++)
414 if (pvol == (*pos)->GetVolume1())
429 std::vector<xercesc::DOMElement*>::const_iterator
pos;
450 for(G4AssemblyStore::iterator
it=assemblies->begin();
it!=assemblies->end();
it++)
453 std::vector<G4VPhysicalVolume*>::iterator vit = (*it)->GetVolumesIterator();
455 for (
size_t i5=0; i5<(*it)->TotalImprintedVolumes(); i5++)
457 G4String pvname = (*vit)->GetName();
458 std::size_t
pos = pvname.find(
"_impr_") + 6;
459 G4String impID = pvname.substr(pos);
461 pos = impID.find(
"_");
462 impID = impID.substr(0, pos);
486 std::map<const G4LogicalVolume*, G4GDMLAuxListType>::iterator auxiter;
494 G4String ErrorMessage =
"Referenced solid in volume '"
496 +
"' was displaced/reflected too many times!";
497 G4Exception(
"G4GDMLWriteStructure::TraverseVolumeTree()",
503 R = R*refl->GetTransform3D();
504 solidPtr = refl->GetConstituentMovedSolid();
512 disp->GetObjectTranslation());
513 solidPtr = disp->GetConstituentMovedSolid();
535 if (trans>0) { invR = R.
inverse(); }
551 xercesc::DOMElement* volumeElement =
NewElement(
"volume");
552 volumeElement->setAttributeNode(
NewAttribute(
"name",name));
553 xercesc::DOMElement* materialrefElement =
NewElement(
"materialref");
554 materialrefElement->setAttributeNode(
NewAttribute(
"ref",materialref));
555 volumeElement->appendChild(materialrefElement);
556 xercesc::DOMElement* solidrefElement =
NewElement(
"solidref");
557 solidrefElement->setAttributeNode(
NewAttribute(
"ref",solidref));
558 volumeElement->appendChild(solidrefElement);
567 std::vector<int> addedImprints;
569 for (
G4int i=0;i<daughterCount;i++)
576 if (ModuleName.empty())
588 = dynamic_cast<const G4PVDivision*>(physvol))
592 G4String ErrorMessage =
"Division volume in '" + name
593 +
"' can not be related to reflected solid!";
594 G4Exception(
"G4GDMLWriteStructure::TraverseVolumeTree()",
603 G4String ErrorMessage =
"Parameterised volume in '" + name
604 +
"' can not be related to reflected solid!";
605 G4Exception(
"G4GDMLWriteStructure::TraverseVolumeTree()",
614 G4String ErrorMessage =
"Replica volume in '" + name
615 +
"' can not be related to reflected solid!";
616 G4Exception(
"G4GDMLWriteStructure::TraverseVolumeTree()",
650 if(std::find(addedImprints.begin(), addedImprints.end(), imprintID) == addedImprints.end())
673 xercesc::DOMElement* physvolElement =
NewElement(
"physvol");
674 physvolElement->setAttributeNode(
NewAttribute(
"name",imprintname));
676 xercesc::DOMElement* volumerefElement =
NewElement(
"volumeref");
677 volumerefElement->setAttributeNode(
NewAttribute(
"ref",assemblyref));
678 physvolElement->appendChild(volumerefElement);
699 volumeElement->appendChild(physvolElement);
701 addedImprints.push_back(imprintID);
713 PhysvolWrite(volumeElement,physvol,invR*
P*daughterR,ModuleName);
728 auxiter =
auxmap.find(volumePtr);
729 if (auxiter !=
auxmap.end())
731 AddAuxInfo(&(auxiter->second), volumeElement);
762 auxmap[lvol].push_back(myaux);
838 G4Exception(
"G4GDMLWriteStructure::TraverseVolumeTree()",
840 "Levels to export must be greater than zero!");