85 if (axis==
kXAxis) { axisString =
"kXAxis"; }
86 else if (axis==
kYAxis) { axisString =
"kYAxis"; }
87 else if (axis==
kZAxis) { axisString =
"kZAxis"; }
88 else if (axis==
kRho) { axisString =
"kRho"; }
89 else if (axis==
kPhi) { axisString =
"kPhi"; unitString =
"rad"; }
97 xercesc::DOMElement* divisionvolElement =
NewElement(
"divisionvol");
98 divisionvolElement->setAttributeNode(
NewAttribute(
"axis",axisString));
99 divisionvolElement->setAttributeNode(
NewAttribute(
"number",number));
100 divisionvolElement->setAttributeNode(
NewAttribute(
"width",width));
101 divisionvolElement->setAttributeNode(
NewAttribute(
"offset",offset));
102 divisionvolElement->setAttributeNode(
NewAttribute(
"unit",unitString));
103 xercesc::DOMElement* volumerefElement =
NewElement(
"volumeref");
104 volumerefElement->setAttributeNode(
NewAttribute(
"ref",volumeref));
105 divisionvolElement->appendChild(volumerefElement);
106 volumeElement->appendChild(divisionvolElement);
127 xercesc::DOMElement* physvolElement =
NewElement(
"physvol");
128 physvolElement->setAttributeNode(
NewAttribute(
"name",name));
129 if (copynumber) physvolElement->setAttributeNode(
NewAttribute(
"copynumber", copynumber));
131 volumeElement->appendChild(physvolElement);
146 if (ModuleName.empty())
148 xercesc::DOMElement* volumerefElement =
NewElement(
"volumeref");
149 volumerefElement->setAttributeNode(
NewAttribute(
"ref",volumeref));
150 physvolElement->appendChild(volumerefElement);
154 xercesc::DOMElement* fileElement =
NewElement(
"file");
155 fileElement->setAttributeNode(
NewAttribute(
"name",ModuleName));
156 fileElement->setAttributeNode(
NewAttribute(
"volname",volumeref));
157 physvolElement->appendChild(fileElement);
196 xercesc::DOMElement* replicavolElement =
NewElement(
"replicavol");
197 replicavolElement->setAttributeNode(
NewAttribute(
"number",number));
198 xercesc::DOMElement* volumerefElement =
NewElement(
"volumeref");
199 volumerefElement->setAttributeNode(
NewAttribute(
"ref",volumeref));
200 replicavolElement->appendChild(volumerefElement);
201 xercesc::DOMElement* replicateElement =
NewElement(
"replicate_along_axis");
202 replicavolElement->appendChild(replicateElement);
204 xercesc::DOMElement* dirElement =
NewElement(
"direction");
206 { dirElement->setAttributeNode(
NewAttribute(
"x",
"1")); }
208 { dirElement->setAttributeNode(
NewAttribute(
"y",
"1")); }
210 { dirElement->setAttributeNode(
NewAttribute(
"z",
"1")); }
212 { dirElement->setAttributeNode(
NewAttribute(
"rho",
"1")); }
214 { dirElement->setAttributeNode(
NewAttribute(
"phi",
"1"));
216 replicateElement->appendChild(dirElement);
218 xercesc::DOMElement* widthElement =
NewElement(
"width");
219 widthElement->setAttributeNode(
NewAttribute(
"value",width));
220 widthElement->setAttributeNode(
NewAttribute(
"unit",unitString));
221 replicateElement->appendChild(widthElement);
223 xercesc::DOMElement* offsetElement =
NewElement(
"offset");
224 offsetElement->setAttributeNode(
NewAttribute(
"value",offset));
225 offsetElement->setAttributeNode(
NewAttribute(
"unit",unitString));
226 replicateElement->appendChild(offsetElement);
228 volumeElement->appendChild(replicavolElement);
234 if (!bsurf) {
return; }
240 xercesc::DOMElement* borderElement =
NewElement(
"bordersurface");
242 borderElement->setAttributeNode(
NewAttribute(
"surfaceproperty",
249 xercesc::DOMElement* volumerefElement1 =
NewElement(
"physvolref");
250 xercesc::DOMElement* volumerefElement2 =
NewElement(
"physvolref");
251 volumerefElement1->setAttributeNode(
NewAttribute(
"ref",volumeref1));
252 volumerefElement2->setAttributeNode(
NewAttribute(
"ref",volumeref2));
253 borderElement->appendChild(volumerefElement1);
254 borderElement->appendChild(volumerefElement2);
262 G4Exception(
"G4GDMLWriteStructure::BorderSurfaceCache()",
275 if (!ssurf) {
return; }
281 xercesc::DOMElement* skinElement =
NewElement(
"skinsurface");
283 skinElement->setAttributeNode(
NewAttribute(
"surfaceproperty",
288 xercesc::DOMElement* volumerefElement =
NewElement(
"volumeref");
289 volumerefElement->setAttributeNode(
NewAttribute(
"ref",volumeref));
290 skinElement->appendChild(volumerefElement);
298 G4Exception(
"G4GDMLWriteStructure::SkinSurfaceCache()",
311 std::vector<const G4OpticalSurface*>::const_iterator
pos;
312 pos = std::find(opt_vec.begin(), opt_vec.end(), osurf);
313 if (pos != opt_vec.end()) {
return false; }
315 opt_vec.push_back(osurf);
328 std::vector<G4LogicalSkinSurface*>::const_iterator
pos;
329 for (pos = stable->begin(); pos != stable->end(); pos++)
331 if (lvol == (*pos)->GetLogicalVolume())
349 std::vector<G4LogicalBorderSurface*>::const_iterator
pos;
350 for (pos = btable->begin(); pos != btable->end(); pos++)
352 if (pvol == (*pos)->GetVolume1())
365 std::vector<xercesc::DOMElement*>::const_iterator
pos;
396 std::map<const G4LogicalVolume*, G4GDMLAuxListType>::iterator auxiter;
402 G4String ErrorMessage =
"Referenced solid in volume '"
404 +
"' was displaced/reflected too many times!";
405 G4Exception(
"G4GDMLWriteStructure::TraverseVolumeTree()",
411 R = R*refl->GetTransform3D();
412 solidPtr = refl->GetConstituentMovedSolid();
420 disp->GetObjectTranslation());
421 solidPtr = disp->GetConstituentMovedSolid();
443 if (trans>0) { invR = R.
inverse(); }
453 xercesc::DOMElement* volumeElement =
NewElement(
"volume");
454 volumeElement->setAttributeNode(
NewAttribute(
"name",name));
455 xercesc::DOMElement* materialrefElement =
NewElement(
"materialref");
456 materialrefElement->setAttributeNode(
NewAttribute(
"ref",materialref));
457 volumeElement->appendChild(materialrefElement);
458 xercesc::DOMElement* solidrefElement =
NewElement(
"solidref");
459 solidrefElement->setAttributeNode(
NewAttribute(
"ref",solidref));
460 volumeElement->appendChild(solidrefElement);
464 for (
G4int i=0;i<daughterCount;i++)
471 if (ModuleName.empty())
483 = dynamic_cast<const G4PVDivision*>(physvol))
487 G4String ErrorMessage =
"Division volume in '" + name
488 +
"' can not be related to reflected solid!";
489 G4Exception(
"G4GDMLWriteStructure::TraverseVolumeTree()",
498 G4String ErrorMessage =
"Parameterised volume in '" + name
499 +
"' can not be related to reflected solid!";
500 G4Exception(
"G4GDMLWriteStructure::TraverseVolumeTree()",
509 G4String ErrorMessage =
"Replica volume in '" + name
510 +
"' can not be related to reflected solid!";
511 G4Exception(
"G4GDMLWriteStructure::TraverseVolumeTree()",
525 PhysvolWrite(volumeElement,physvol,invR*
P*daughterR,ModuleName);
533 if (sdexport) {
ExportSD(volumePtr); }
538 auxiter =
auxmap.find(volumePtr);
539 if (auxiter !=
auxmap.end())
541 AddAuxInfo(&(auxiter->second), volumeElement);
572 auxmap[lvol].push_back(myaux);
static const G4double kAngularPrecision
G4ProductionCuts * GetProductionCuts() const
void SetEnergyCutsExport(G4bool)
void AddAuxInfo(G4GDMLAuxListType *auxInfoList, xercesc::DOMElement *element)
std::vector< G4LogicalBorderSurface * > G4LogicalBorderSurfaceTable
G4Material * GetMaterial() const
G4Transform3D TraverseVolumeTree(const G4LogicalVolume *const topVol, const G4int depth)
xercesc::DOMElement * structureElement
const G4LogicalVolume * GetLogicalVolume() const
virtual ~G4GDMLWriteStructure()
virtual G4bool IsReplicated() const =0
const G4VPhysicalVolume * GetVolume2() const
G4double GetProductionCut(G4int index) const
const G4LogicalSkinSurface * GetSkinSurface(const G4LogicalVolume *const)
const G4String & GetName() const
void ExportSD(const G4LogicalVolume *const)
G4VSolid * GetSolid() const
G4VPhysicalVolume * GetDaughter(const G4int i) const
G4LogicalVolume * GetConstituentLV(G4LogicalVolume *reflLV) const
const G4String & GetName() const
EAxis GetDivisionAxis() const
void AddMaterial(const G4Material *const)
virtual void ParamvolWrite(xercesc::DOMElement *, const G4VPhysicalVolume *const)
G4Region * GetRegion() const
xercesc::DOMElement * NewElement(const G4String &)
G4bool IsReflected(G4LogicalVolume *lv) const
static size_t GetNumberOfSkinSurfaces()
static G4ReflectionFactory * Instance()
static size_t GetNumberOfBorderSurfaces()
static const G4int maxTransforms
G4String Modularize(const G4VPhysicalVolume *const topvol, const G4int depth)
static const G4LogicalSkinSurfaceTable * GetSurfaceTable()
G4Transform3D Write(const G4String &filename, const G4LogicalVolume *const topLog, const G4String &schemaPath, const G4int depth, G4bool storeReferences=true)
const G4String & GetName() const
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
static const G4LogicalBorderSurfaceTable * GetSurfaceTable()
G4String ConvertToString(G4int ival)
static const G4double kRelativePrecision
virtual void StructureWrite(xercesc::DOMElement *)
void OpticalSurfaceWrite(xercesc::DOMElement *, const G4OpticalSurface *const)
static constexpr double eplus
static G4Proton * Proton()
G4String GenerateName(const G4String &, const void *const)
void RotationWrite(xercesc::DOMElement *element, const G4String &name, const G4ThreeVector &rot)
void BorderSurfaceCache(const G4LogicalBorderSurface *const)
G4int GetNoDaughters() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
virtual G4bool IsParameterised() const =0
void ReplicavolWrite(xercesc::DOMElement *, const G4VPhysicalVolume *const)
void ScaleWrite(xercesc::DOMElement *element, const G4String &name, const G4ThreeVector &scl)
const G4VPhysicalVolume * GetVolume1() const
const G4RotationMatrix * GetFrameRotation() const
void PhysvolWrite(xercesc::DOMElement *, const G4VPhysicalVolume *const topVol, const G4Transform3D &transform, const G4String &moduleName)
static G4ProductionCutsTable * GetProductionCutsTable()
static G4Positron * Positron()
std::map< const G4LogicalVolume *, G4GDMLAuxListType > auxmap
xercesc::DOMAttr * NewAttribute(const G4String &, const G4String &)
G4LogicalVolume * GetLogicalVolume() const
std::vector< G4GDMLAuxStructType > G4GDMLAuxListType
static const G4double kLinearPrecision
void AddVolumeAuxiliary(G4GDMLAuxStructType myaux, const G4LogicalVolume *const)
G4ThreeVector GetAngles(const G4RotationMatrix &)
virtual G4int GetCopyNo() const =0
void SkinSurfaceCache(const G4LogicalSkinSurface *const)
const G4LogicalBorderSurface * GetBorderSurface(const G4VPhysicalVolume *const)
virtual void GetReplicationData(EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const
virtual void AddExtension(xercesc::DOMElement *, const G4LogicalVolume *const)
virtual void GetReplicationData(EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const =0
static G4Electron * Electron()
G4SurfaceProperty * GetSurfaceProperty() const
G4double ConvertRangeToEnergy(const G4ParticleDefinition *particle, const G4Material *material, G4double range)
void PositionWrite(xercesc::DOMElement *element, const G4String &name, const G4ThreeVector &pos)
G4ThreeVector GetObjectTranslation() const
const G4String & GetName() const
std::vector< G4LogicalSkinSurface * > G4LogicalSkinSurfaceTable
void DivisionvolWrite(xercesc::DOMElement *, const G4PVDivision *const)
std::vector< xercesc::DOMElement * > skinElementVec
G4VSensitiveDetector * GetSensitiveDetector() const
void ExportEnergyCuts(const G4LogicalVolume *const)
xercesc::DOMElement * solidsElement
static const G4double pos
VolumeMapType & VolumeMap()
virtual void AddSolid(const G4VSolid *const)
std::vector< xercesc::DOMElement * > borderElementVec
G4bool FindOpticalSurface(const G4SurfaceProperty *)