83 if (axis==
kXAxis) { axisString =
"kXAxis"; }
84 else if (axis==
kYAxis) { axisString =
"kYAxis"; }
85 else if (axis==
kZAxis) { axisString =
"kZAxis"; }
86 else if (axis==
kRho) { axisString =
"kRho"; }
87 else if (axis==
kPhi) { axisString =
"kPhi"; unitString =
"rad"; }
95 xercesc::DOMElement* divisionvolElement =
NewElement(
"divisionvol");
96 divisionvolElement->setAttributeNode(
NewAttribute(
"axis",axisString));
97 divisionvolElement->setAttributeNode(
NewAttribute(
"number",number));
98 divisionvolElement->setAttributeNode(
NewAttribute(
"width",width));
99 divisionvolElement->setAttributeNode(
NewAttribute(
"offset",offset));
100 divisionvolElement->setAttributeNode(
NewAttribute(
"unit",unitString));
101 xercesc::DOMElement* volumerefElement =
NewElement(
"volumeref");
102 volumerefElement->setAttributeNode(
NewAttribute(
"ref",volumeref));
103 divisionvolElement->appendChild(volumerefElement);
104 volumeElement->appendChild(divisionvolElement);
112 HepGeom::Scale3D scale;
113 HepGeom::Rotate3D rotate;
114 HepGeom::Translate3D translate;
116 T.getDecomposition(scale,rotate,translate);
125 xercesc::DOMElement* physvolElement =
NewElement(
"physvol");
126 physvolElement->setAttributeNode(
NewAttribute(
"name",name));
127 if (copynumber) physvolElement->setAttributeNode(
NewAttribute(
"copynumber", copynumber));
129 volumeElement->appendChild(physvolElement);
144 if (ModuleName.empty())
146 xercesc::DOMElement* volumerefElement =
NewElement(
"volumeref");
147 volumerefElement->setAttributeNode(
NewAttribute(
"ref",volumeref));
148 physvolElement->appendChild(volumerefElement);
152 xercesc::DOMElement* fileElement =
NewElement(
"file");
153 fileElement->setAttributeNode(
NewAttribute(
"name",ModuleName));
154 fileElement->setAttributeNode(
NewAttribute(
"volname",volumeref));
155 physvolElement->appendChild(fileElement);
194 xercesc::DOMElement* replicavolElement =
NewElement(
"replicavol");
195 replicavolElement->setAttributeNode(
NewAttribute(
"number",number));
196 xercesc::DOMElement* volumerefElement =
NewElement(
"volumeref");
197 volumerefElement->setAttributeNode(
NewAttribute(
"ref",volumeref));
198 replicavolElement->appendChild(volumerefElement);
199 xercesc::DOMElement* replicateElement =
NewElement(
"replicate_along_axis");
200 replicavolElement->appendChild(replicateElement);
202 xercesc::DOMElement* dirElement =
NewElement(
"direction");
204 { dirElement->setAttributeNode(
NewAttribute(
"x",
"1")); }
206 { dirElement->setAttributeNode(
NewAttribute(
"y",
"1")); }
208 { dirElement->setAttributeNode(
NewAttribute(
"z",
"1")); }
210 { dirElement->setAttributeNode(
NewAttribute(
"rho",
"1")); }
212 { dirElement->setAttributeNode(
NewAttribute(
"phi",
"1"));
214 replicateElement->appendChild(dirElement);
216 xercesc::DOMElement* widthElement =
NewElement(
"width");
217 widthElement->setAttributeNode(
NewAttribute(
"value",width));
218 widthElement->setAttributeNode(
NewAttribute(
"unit",unitString));
219 replicateElement->appendChild(widthElement);
221 xercesc::DOMElement* offsetElement =
NewElement(
"offset");
222 offsetElement->setAttributeNode(
NewAttribute(
"value",offset));
223 offsetElement->setAttributeNode(
NewAttribute(
"unit",unitString));
224 replicateElement->appendChild(offsetElement);
226 volumeElement->appendChild(replicavolElement);
232 if (!bsurf) {
return; }
238 xercesc::DOMElement* borderElement =
NewElement(
"bordersurface");
240 borderElement->setAttributeNode(
NewAttribute(
"surfaceproperty",
247 xercesc::DOMElement* volumerefElement1 =
NewElement(
"physvolref");
248 xercesc::DOMElement* volumerefElement2 =
NewElement(
"physvolref");
249 volumerefElement1->setAttributeNode(
NewAttribute(
"ref",volumeref1));
250 volumerefElement2->setAttributeNode(
NewAttribute(
"ref",volumeref2));
251 borderElement->appendChild(volumerefElement1);
252 borderElement->appendChild(volumerefElement2);
260 G4Exception(
"G4GDMLWriteStructure::BorderSurfaceCache()",
273 if (!ssurf) {
return; }
279 xercesc::DOMElement* skinElement =
NewElement(
"skinsurface");
281 skinElement->setAttributeNode(
NewAttribute(
"surfaceproperty",
286 xercesc::DOMElement* volumerefElement =
NewElement(
"volumeref");
287 volumerefElement->setAttributeNode(
NewAttribute(
"ref",volumeref));
288 skinElement->appendChild(volumerefElement);
296 G4Exception(
"G4GDMLWriteStructure::SkinSurfaceCache()",
309 std::vector<const G4OpticalSurface*>::const_iterator
pos;
311 if (pos !=
opt_vec.end()) {
return false; }
326 std::vector<G4LogicalSkinSurface*>::const_iterator
pos;
327 for (pos = stable->begin(); pos != stable->end(); pos++)
329 if (lvol == (*pos)->GetLogicalVolume())
347 std::vector<G4LogicalBorderSurface*>::const_iterator
pos;
348 for (pos = btable->begin(); pos != btable->end(); pos++)
350 if (pvol == (*pos)->GetVolume1())
363 std::vector<xercesc::DOMElement*>::const_iterator
pos;
394 std::map<const G4LogicalVolume*, G4GDMLAuxListType>::iterator auxiter;
400 G4String ErrorMessage =
"Referenced solid in volume '"
402 +
"' was displaced/reflected too many times!";
403 G4Exception(
"G4GDMLWriteStructure::TraverseVolumeTree()",
409 R = R*refl->GetTransform3D();
410 solidPtr = refl->GetConstituentMovedSolid();
418 disp->GetObjectTranslation());
419 solidPtr = disp->GetConstituentMovedSolid();
441 if (trans>0) { invR = R.inverse(); }
451 xercesc::DOMElement* volumeElement =
NewElement(
"volume");
452 volumeElement->setAttributeNode(
NewAttribute(
"name",name));
453 xercesc::DOMElement* materialrefElement =
NewElement(
"materialref");
454 materialrefElement->setAttributeNode(
NewAttribute(
"ref",materialref));
455 volumeElement->appendChild(materialrefElement);
456 xercesc::DOMElement* solidrefElement =
NewElement(
"solidref");
457 solidrefElement->setAttributeNode(
NewAttribute(
"ref",solidref));
458 volumeElement->appendChild(solidrefElement);
462 for (
G4int i=0;i<daughterCount;i++)
469 if (ModuleName.empty())
481 = dynamic_cast<const G4PVDivision*>(physvol))
485 G4String ErrorMessage =
"Division volume in '" + name
486 +
"' can not be related to reflected solid!";
487 G4Exception(
"G4GDMLWriteStructure::TraverseVolumeTree()",
496 G4String ErrorMessage =
"Parameterised volume in '" + name
497 +
"' can not be related to reflected solid!";
498 G4Exception(
"G4GDMLWriteStructure::TraverseVolumeTree()",
507 G4String ErrorMessage =
"Replica volume in '" + name
508 +
"' can not be related to reflected solid!";
509 G4Exception(
"G4GDMLWriteStructure::TraverseVolumeTree()",
523 PhysvolWrite(volumeElement,physvol,invR*
P*daughterR,ModuleName);
533 auxiter =
auxmap.find(volumePtr);
534 if (auxiter !=
auxmap.end())
536 AddAuxInfo(&(auxiter->second), volumeElement);
567 auxmap[lvol].push_back(myaux);
static const G4double kAngularPrecision
G4ReflectionFactory * reflFactory
G4ProductionCuts * GetProductionCuts() const
void SetEnergyCutsExport(G4bool)
void AddAuxInfo(G4GDMLAuxListType *auxInfoList, xercesc::DOMElement *element)
std::vector< G4LogicalBorderSurface * > G4LogicalBorderSurfaceTable
G4Transform3D TraverseVolumeTree(const G4LogicalVolume *const topVol, const G4int depth)
xercesc::DOMElement * structureElement
const G4LogicalVolume * GetLogicalVolume() const
CLHEP::Hep3Vector G4ThreeVector
CLHEP::HepRotation G4RotationMatrix
virtual ~G4GDMLWriteStructure()
virtual G4bool IsReplicated() const =0
G4Material * GetMaterial() const
const G4VPhysicalVolume * GetVolume2() const
G4double GetProductionCut(G4int index) const
const G4LogicalSkinSurface * GetSkinSurface(const G4LogicalVolume *const)
const G4String & GetName() 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 &)
std::vector< const G4OpticalSurface * > opt_vec
G4bool IsReflected(G4LogicalVolume *lv) const
static size_t GetNumberOfSkinSurfaces()
static G4ReflectionFactory * Instance()
static size_t GetNumberOfBorderSurfaces()
const G4RotationMatrix * GetFrameRotation() const
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 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
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
static const double eplus
std::vector< G4LogicalSkinSurface * > G4LogicalSkinSurfaceTable
void DivisionvolWrite(xercesc::DOMElement *, const G4PVDivision *const)
std::vector< xercesc::DOMElement * > skinElementVec
void ExportEnergyCuts(const G4LogicalVolume *const)
xercesc::DOMElement * solidsElement
static const G4double pos
VolumeMapType & VolumeMap()
G4VSolid * GetSolid() const
virtual void AddSolid(const G4VSolid *const)
std::vector< xercesc::DOMElement * > borderElementVec
G4bool FindOpticalSurface(const G4SurfaceProperty *)