72 if (axis==
kXAxis) { axisString =
"kXAxis"; }
73 else if (axis==
kYAxis) { axisString =
"kYAxis"; }
74 else if (axis==
kZAxis) { axisString =
"kZAxis"; }
75 else if (axis==
kRho) { axisString =
"kRho"; }
76 else if (axis==
kPhi) { axisString =
"kPhi"; unitString =
"rad"; }
84 xercesc::DOMElement* divisionvolElement =
NewElement(
"divisionvol");
85 divisionvolElement->setAttributeNode(
NewAttribute(
"axis",axisString));
86 divisionvolElement->setAttributeNode(
NewAttribute(
"number",number));
87 divisionvolElement->setAttributeNode(
NewAttribute(
"width",width));
88 divisionvolElement->setAttributeNode(
NewAttribute(
"offset",offset));
89 divisionvolElement->setAttributeNode(
NewAttribute(
"unit",unitString));
90 xercesc::DOMElement* volumerefElement =
NewElement(
"volumeref");
91 volumerefElement->setAttributeNode(
NewAttribute(
"ref",volumeref));
92 divisionvolElement->appendChild(volumerefElement);
93 volumeElement->appendChild(divisionvolElement);
113 xercesc::DOMElement* physvolElement =
NewElement(
"physvol");
114 physvolElement->setAttributeNode(
NewAttribute(
"name",name));
115 volumeElement->appendChild(physvolElement);
121 if (ModuleName.empty())
123 xercesc::DOMElement* volumerefElement =
NewElement(
"volumeref");
124 volumerefElement->setAttributeNode(
NewAttribute(
"ref",volumeref));
125 physvolElement->appendChild(volumerefElement);
129 xercesc::DOMElement* fileElement =
NewElement(
"file");
130 fileElement->setAttributeNode(
NewAttribute(
"name",ModuleName));
131 fileElement->setAttributeNode(
NewAttribute(
"volname",volumeref));
132 physvolElement->appendChild(fileElement);
171 xercesc::DOMElement* replicavolElement =
NewElement(
"replicavol");
172 replicavolElement->setAttributeNode(
NewAttribute(
"number",number));
173 xercesc::DOMElement* volumerefElement =
NewElement(
"volumeref");
174 volumerefElement->setAttributeNode(
NewAttribute(
"ref",volumeref));
175 replicavolElement->appendChild(volumerefElement);
176 xercesc::DOMElement* replicateElement =
NewElement(
"replicate_along_axis");
177 replicavolElement->appendChild(replicateElement);
179 xercesc::DOMElement* dirElement =
NewElement(
"direction");
181 { dirElement->setAttributeNode(
NewAttribute(
"x",
"1")); }
183 { dirElement->setAttributeNode(
NewAttribute(
"y",
"1")); }
185 { dirElement->setAttributeNode(
NewAttribute(
"z",
"1")); }
187 { dirElement->setAttributeNode(
NewAttribute(
"rho",
"1")); }
189 { dirElement->setAttributeNode(
NewAttribute(
"phi",
"1"));
191 replicateElement->appendChild(dirElement);
193 xercesc::DOMElement* widthElement =
NewElement(
"width");
194 widthElement->setAttributeNode(
NewAttribute(
"value",width));
195 widthElement->setAttributeNode(
NewAttribute(
"unit",unitString));
196 replicateElement->appendChild(widthElement);
198 xercesc::DOMElement* offsetElement =
NewElement(
"offset");
199 offsetElement->setAttributeNode(
NewAttribute(
"value",offset));
200 offsetElement->setAttributeNode(
NewAttribute(
"unit",unitString));
201 replicateElement->appendChild(offsetElement);
203 volumeElement->appendChild(replicavolElement);
209 if (!bsurf) {
return; }
215 xercesc::DOMElement* borderElement =
NewElement(
"bordersurface");
217 borderElement->setAttributeNode(
NewAttribute(
"surfaceproperty",
224 xercesc::DOMElement* volumerefElement1 =
NewElement(
"physvolref");
225 xercesc::DOMElement* volumerefElement2 =
NewElement(
"physvolref");
226 volumerefElement1->setAttributeNode(
NewAttribute(
"ref",volumeref1));
227 volumerefElement2->setAttributeNode(
NewAttribute(
"ref",volumeref2));
228 borderElement->appendChild(volumerefElement1);
229 borderElement->appendChild(volumerefElement2);
237 G4Exception(
"G4GDMLWriteStructure::BorderSurfaceCache()",
250 if (!ssurf) {
return; }
256 xercesc::DOMElement* skinElement =
NewElement(
"skinsurface");
258 skinElement->setAttributeNode(
NewAttribute(
"surfaceproperty",
263 xercesc::DOMElement* volumerefElement =
NewElement(
"volumeref");
264 volumerefElement->setAttributeNode(
NewAttribute(
"ref",volumeref));
265 skinElement->appendChild(volumerefElement);
273 G4Exception(
"G4GDMLWriteStructure::SkinSurfaceCache()",
286 std::vector<const G4OpticalSurface*>::const_iterator pos;
287 pos = std::find(opt_vec.begin(), opt_vec.end(), osurf);
288 if (pos != opt_vec.end()) {
return false; }
290 opt_vec.push_back(osurf);
303 std::vector<G4LogicalSkinSurface*>::const_iterator pos;
304 for (pos = stable->begin(); pos != stable->end(); pos++)
306 if (lvol == (*pos)->GetLogicalVolume())
324 std::vector<G4LogicalBorderSurface*>::const_iterator pos;
325 for (pos = btable->begin(); pos != btable->end(); pos++)
327 if (pvol == (*pos)->GetVolume1())
340 std::vector<xercesc::DOMElement*>::const_iterator pos;
375 G4String ErrorMessage =
"Referenced solid in volume '"
377 +
"' was displaced/reflected too many times!";
378 G4Exception(
"G4GDMLWriteStructure::TraverseVolumeTree()",
384 R = R*refl->GetTransform3D();
385 solidPtr = refl->GetConstituentMovedSolid();
393 disp->GetObjectTranslation());
394 solidPtr = disp->GetConstituentMovedSolid();
404 if (trans>0) { invR = R.
inverse(); }
414 xercesc::DOMElement* volumeElement =
NewElement(
"volume");
415 volumeElement->setAttributeNode(
NewAttribute(
"name",name));
416 xercesc::DOMElement* materialrefElement =
NewElement(
"materialref");
417 materialrefElement->setAttributeNode(
NewAttribute(
"ref",materialref));
418 volumeElement->appendChild(materialrefElement);
419 xercesc::DOMElement* solidrefElement =
NewElement(
"solidref");
420 solidrefElement->setAttributeNode(
NewAttribute(
"ref",solidref));
421 volumeElement->appendChild(solidrefElement);
425 for (
G4int i=0;i<daughterCount;i++)
432 if (ModuleName.empty())
444 = dynamic_cast<const G4PVDivision*>(physvol))
448 G4String ErrorMessage =
"Division volume in '"
450 +
"' can not be related to reflected solid!";
451 G4Exception(
"G4GDMLWriteStructure::TraverseVolumeTree()",
460 G4String ErrorMessage =
"Parameterised volume in '"
462 +
"' can not be related to reflected solid!";
463 G4Exception(
"G4GDMLWriteStructure::TraverseVolumeTree()",
472 G4String ErrorMessage =
"Replica volume in '"
474 +
"' can not be related to reflected solid!";
475 G4Exception(
"G4GDMLWriteStructure::TraverseVolumeTree()",
489 PhysvolWrite(volumeElement,physvol,invR*P*daughterR,ModuleName);