87 if (axis==
kXAxis) { axisString =
"kXAxis"; }
88 else if (axis==
kYAxis) { axisString =
"kYAxis"; }
89 else if (axis==
kZAxis) { axisString =
"kZAxis"; }
90 else if (axis==
kRho) { axisString =
"kRho"; }
91 else if (axis==
kPhi) { axisString =
"kPhi"; unitString =
"rad"; }
99 xercesc::DOMElement* divisionvolElement =
NewElement(
"divisionvol");
100 divisionvolElement->setAttributeNode(
NewAttribute(
"axis",axisString));
101 divisionvolElement->setAttributeNode(
NewAttribute(
"number",number));
102 divisionvolElement->setAttributeNode(
NewAttribute(
"width",width));
103 divisionvolElement->setAttributeNode(
NewAttribute(
"offset",offset));
104 divisionvolElement->setAttributeNode(
NewAttribute(
"unit",unitString));
105 xercesc::DOMElement* volumerefElement =
NewElement(
"volumeref");
106 volumerefElement->setAttributeNode(
NewAttribute(
"ref",volumeref));
107 divisionvolElement->appendChild(volumerefElement);
108 volumeElement->appendChild(divisionvolElement);
129 xercesc::DOMElement* physvolElement =
NewElement(
"physvol");
130 physvolElement->setAttributeNode(
NewAttribute(
"name",name));
131 if (copynumber) physvolElement->setAttributeNode(
NewAttribute(
"copynumber", copynumber));
133 volumeElement->appendChild(physvolElement);
148 if (ModuleName.empty())
150 xercesc::DOMElement* volumerefElement =
NewElement(
"volumeref");
151 volumerefElement->setAttributeNode(
NewAttribute(
"ref",volumeref));
152 physvolElement->appendChild(volumerefElement);
156 xercesc::DOMElement* fileElement =
NewElement(
"file");
157 fileElement->setAttributeNode(
NewAttribute(
"name",ModuleName));
158 fileElement->setAttributeNode(
NewAttribute(
"volname",volumeref));
159 physvolElement->appendChild(fileElement);
198 xercesc::DOMElement* replicavolElement =
NewElement(
"replicavol");
199 replicavolElement->setAttributeNode(
NewAttribute(
"number",number));
200 xercesc::DOMElement* volumerefElement =
NewElement(
"volumeref");
201 volumerefElement->setAttributeNode(
NewAttribute(
"ref",volumeref));
202 replicavolElement->appendChild(volumerefElement);
203 xercesc::DOMElement* replicateElement =
NewElement(
"replicate_along_axis");
204 replicavolElement->appendChild(replicateElement);
206 xercesc::DOMElement* dirElement =
NewElement(
"direction");
208 { dirElement->setAttributeNode(
NewAttribute(
"x",
"1")); }
210 { dirElement->setAttributeNode(
NewAttribute(
"y",
"1")); }
212 { dirElement->setAttributeNode(
NewAttribute(
"z",
"1")); }
214 { dirElement->setAttributeNode(
NewAttribute(
"rho",
"1")); }
216 { dirElement->setAttributeNode(
NewAttribute(
"phi",
"1"));
218 replicateElement->appendChild(dirElement);
220 xercesc::DOMElement* widthElement =
NewElement(
"width");
221 widthElement->setAttributeNode(
NewAttribute(
"value",width));
222 widthElement->setAttributeNode(
NewAttribute(
"unit",unitString));
223 replicateElement->appendChild(widthElement);
225 xercesc::DOMElement* offsetElement =
NewElement(
"offset");
226 offsetElement->setAttributeNode(
NewAttribute(
"value",offset));
227 offsetElement->setAttributeNode(
NewAttribute(
"unit",unitString));
228 replicateElement->appendChild(offsetElement);
230 volumeElement->appendChild(replicavolElement);
236 if (!bsurf) {
return; }
242 xercesc::DOMElement* borderElement =
NewElement(
"bordersurface");
244 borderElement->setAttributeNode(
NewAttribute(
"surfaceproperty",
251 xercesc::DOMElement* volumerefElement1 =
NewElement(
"physvolref");
252 xercesc::DOMElement* volumerefElement2 =
NewElement(
"physvolref");
253 volumerefElement1->setAttributeNode(
NewAttribute(
"ref",volumeref1));
254 volumerefElement2->setAttributeNode(
NewAttribute(
"ref",volumeref2));
255 borderElement->appendChild(volumerefElement1);
256 borderElement->appendChild(volumerefElement2);
264 G4Exception(
"G4GDMLWriteStructure::BorderSurfaceCache()",
277 if (!ssurf) {
return; }
283 xercesc::DOMElement* skinElement =
NewElement(
"skinsurface");
285 skinElement->setAttributeNode(
NewAttribute(
"surfaceproperty",
290 xercesc::DOMElement* volumerefElement =
NewElement(
"volumeref");
291 volumerefElement->setAttributeNode(
NewAttribute(
"ref",volumeref));
292 skinElement->appendChild(volumerefElement);
300 G4Exception(
"G4GDMLWriteStructure::SkinSurfaceCache()",
313 std::vector<const G4OpticalSurface*>::const_iterator
pos;
315 if (pos !=
opt_vec.end()) {
return false; }
330 std::vector<G4LogicalSkinSurface*>::const_iterator
pos;
331 for (pos = stable->begin(); pos != stable->end(); pos++)
333 if (lvol == (*pos)->GetLogicalVolume())
351 std::vector<G4LogicalBorderSurface*>::const_iterator
pos;
352 for (pos = btable->begin(); pos != btable->end(); pos++)
354 if (pvol == (*pos)->GetVolume1())
368 std::vector<xercesc::DOMElement*>::const_iterator
pos;
400 std::map<const G4LogicalVolume*, G4GDMLAuxListType>::iterator auxiter;
408 G4String ErrorMessage =
"Referenced solid in volume '"
410 +
"' was displaced/reflected too many times!";
411 G4Exception(
"G4GDMLWriteStructure::TraverseVolumeTree()",
417 R = R*refl->GetTransform3D();
418 solidPtr = refl->GetConstituentMovedSolid();
426 disp->GetObjectTranslation());
427 solidPtr = disp->GetConstituentMovedSolid();
449 if (trans>0) { invR = R.
inverse(); }
465 xercesc::DOMElement* volumeElement =
NewElement(
"volume");
466 volumeElement->setAttributeNode(
NewAttribute(
"name",name));
467 xercesc::DOMElement* materialrefElement =
NewElement(
"materialref");
468 materialrefElement->setAttributeNode(
NewAttribute(
"ref",materialref));
469 volumeElement->appendChild(materialrefElement);
470 xercesc::DOMElement* solidrefElement =
NewElement(
"solidref");
471 solidrefElement->setAttributeNode(
NewAttribute(
"ref",solidref));
472 volumeElement->appendChild(solidrefElement);
481 for (
G4int i=0;i<daughterCount;i++)
488 if (ModuleName.empty())
500 = dynamic_cast<const G4PVDivision*>(physvol))
504 G4String ErrorMessage =
"Division volume in '" + name
505 +
"' can not be related to reflected solid!";
506 G4Exception(
"G4GDMLWriteStructure::TraverseVolumeTree()",
515 G4String ErrorMessage =
"Parameterised volume in '" + name
516 +
"' can not be related to reflected solid!";
517 G4Exception(
"G4GDMLWriteStructure::TraverseVolumeTree()",
526 G4String ErrorMessage =
"Replica volume in '" + name
527 +
"' can not be related to reflected solid!";
528 G4Exception(
"G4GDMLWriteStructure::TraverseVolumeTree()",
542 PhysvolWrite(volumeElement,physvol,invR*
P*daughterR,ModuleName);
555 auxiter =
auxmap.find(volumePtr);
556 if (auxiter !=
auxmap.end())
558 AddAuxInfo(&(auxiter->second), volumeElement);
589 auxmap[lvol].push_back(myaux);
665 G4Exception(
"G4GDMLWriteStructure::TraverseVolumeTree()",
667 "Levels to export must be greater than zero!");
const G4RotationMatrix * GetFrameRotation() const
void ExportSD(const G4LogicalVolume *const)
G4String Modularize(const G4VPhysicalVolume *const topvol, const G4int depth)
static const G4double pos
G4LogicalVolume * GetLogicalVolume() const
virtual G4bool IsParameterised() const =0
G4double ConvertRangeToEnergy(const G4ParticleDefinition *particle, const G4Material *material, G4double range)
G4VSensitiveDetector * GetSensitiveDetector() const
static const G4LogicalSkinSurfaceTable * GetSurfaceTable()
const G4VPhysicalVolume * GetVolume1() const
const G4LogicalVolume * GetLogicalVolume() const
void ReplicavolWrite(xercesc::DOMElement *, const G4VPhysicalVolume *const)
G4String GenerateName(const G4String &, const void *const)
void AddVolumeAuxiliary(G4GDMLAuxStructType myaux, const G4LogicalVolume *const)
const G4LogicalBorderSurface * GetBorderSurface(const G4VPhysicalVolume *const)
static size_t GetNumberOfSkinSurfaces()
static const G4LogicalBorderSurfaceTable * GetSurfaceTable()
const G4VPhysicalVolume * GetVolume2() const
xercesc::DOMElement * NewElement(const G4String &)
static const G4double kLinearPrecision
G4Transform3D TraverseVolumeTree(const G4LogicalVolume *const topVol, const G4int depth)
G4int GetNoDaughters() const
std::vector< const G4OpticalSurface * > opt_vec
G4String ConvertToString(G4int ival)
static G4Proton * Proton()
G4Material * GetMaterial() const
G4double GetProductionCut(G4int index) const
const G4String & GetName() const
virtual void GetReplicationData(EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const
void DivisionvolWrite(xercesc::DOMElement *, const G4PVDivision *const)
std::vector< xercesc::DOMElement * > borderElementVec
const G4String & GetName() const
G4ThreeVector GetAngles(const G4RotationMatrix &)
void SetMaxExportLevel(G4int)
const G4String & GetName() const
static const G4double kAngularPrecision
static const G4int maxTransforms
void AddAuxInfo(G4GDMLAuxListType *auxInfoList, xercesc::DOMElement *element)
void PhysvolWrite(xercesc::DOMElement *, const G4VPhysicalVolume *const topVol, const G4Transform3D &transform, const G4String &moduleName)
virtual void AddSolid(const G4VSolid *const)
EAxis GetDivisionAxis() const
void AddMaterial(const G4Material *const)
static G4Positron * Positron()
G4SurfaceProperty * GetSurfaceProperty() const
virtual G4int GetCopyNo() const =0
void BorderSurfaceCache(const G4LogicalBorderSurface *const)
virtual void ParamvolWrite(xercesc::DOMElement *, const G4VPhysicalVolume *const)
void SetEnergyCutsExport(G4bool)
G4bool FindOpticalSurface(const G4SurfaceProperty *)
static G4Electron * Electron()
std::vector< G4LogicalSkinSurface * > G4LogicalSkinSurfaceTable
std::vector< G4LogicalBorderSurface * > G4LogicalBorderSurfaceTable
virtual void StructureWrite(xercesc::DOMElement *)
virtual ~G4GDMLWriteStructure()
G4ProductionCuts * GetProductionCuts() const
G4int GetMaxExportLevel() const
static G4ProductionCutsTable * GetProductionCutsTable()
static constexpr double eplus
const G4LogicalSkinSurface * GetSkinSurface(const G4LogicalVolume *const)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
VolumeMapType & VolumeMap()
void OpticalSurfaceWrite(xercesc::DOMElement *, const G4OpticalSurface *const)
std::map< const G4LogicalVolume *, G4GDMLAuxListType > auxmap
virtual void GetReplicationData(EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const =0
std::vector< G4GDMLAuxStructType > G4GDMLAuxListType
void SkinSurfaceCache(const G4LogicalSkinSurface *const)
static const G4double kRelativePrecision
virtual void AddExtension(xercesc::DOMElement *, const G4LogicalVolume *const)
G4GLOB_DLL std::ostream G4cout
xercesc::DOMElement * structureElement
virtual G4bool IsReplicated() const =0
xercesc::DOMAttr * NewAttribute(const G4String &, const G4String &)
G4VSolid * GetSolid() const
G4bool IsReflected(G4LogicalVolume *lv) const
void RotationWrite(xercesc::DOMElement *element, const G4String &name, const G4ThreeVector &rot)
void ExportEnergyCuts(const G4LogicalVolume *const)
G4ReflectionFactory * reflFactory
G4ThreeVector GetObjectTranslation() const
std::vector< xercesc::DOMElement * > skinElementVec
G4Transform3D Write(const G4String &filename, const G4LogicalVolume *const topLog, const G4String &schemaPath, const G4int depth, G4bool storeReferences=true)
xercesc::DOMElement * solidsElement
static size_t GetNumberOfBorderSurfaces()
G4Region * GetRegion() const
void ScaleWrite(xercesc::DOMElement *element, const G4String &name, const G4ThreeVector &scl)
void PositionWrite(xercesc::DOMElement *element, const G4String &name, const G4ThreeVector &pos)
const G4String & GetName() const
G4VPhysicalVolume * GetDaughter(const G4int i) const
G4LogicalVolume * GetConstituentLV(G4LogicalVolume *reflLV) const
const G4String & GetName() const
static G4ReflectionFactory * Instance()