File indexing completed on 2025-08-05 08:18:02
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040 #ifndef _PHG4GDMLWRITE_INCLUDED_
0041 #define _PHG4GDMLWRITE_INCLUDED_
0042
0043 #include <map>
0044
0045 #pragma GCC diagnostic push
0046 #pragma GCC diagnostic ignored "-Wshadow"
0047 #include <xercesc/dom/DOM.hpp>
0048 #include <xercesc/framework/LocalFileFormatTarget.hpp>
0049 #include <xercesc/util/PlatformUtils.hpp>
0050 #include <xercesc/util/XMLString.hpp>
0051 #pragma GCC diagnostic pop
0052
0053 #include <Geant4/G4Transform3D.hh>
0054
0055
0056 #include "PHG4GDMLAuxStructType.hh"
0057
0058 class G4LogicalVolume;
0059 class G4VPhysicalVolume;
0060
0061 class PHG4GDMLWrite
0062 {
0063 typedef std::map<const G4LogicalVolume*,G4Transform3D> VolumeMapType;
0064 typedef std::map<const G4VPhysicalVolume*,G4String> PhysVolumeMapType;
0065 typedef std::map<G4int,G4int> DepthMapType;
0066
0067 public:
0068
0069 G4Transform3D Write(const G4String& filename,
0070 const G4LogicalVolume* const topLog,
0071 const G4String& schemaPath,
0072 const G4int depth, G4bool storeReferences=true);
0073
0074
0075
0076 void AddModule(const G4VPhysicalVolume* const topVol);
0077 void AddModule(const G4int depth);
0078
0079
0080
0081 void AddAuxiliary(PHG4GDMLAuxStructType myaux);
0082
0083
0084
0085 static void SetAddPointerToName(G4bool);
0086
0087
0088
0089 virtual void DefineWrite(xercesc::DOMElement*)=0;
0090 virtual void MaterialsWrite(xercesc::DOMElement*)=0;
0091 virtual void SolidsWrite(xercesc::DOMElement*)=0;
0092 virtual void StructureWrite(xercesc::DOMElement*)=0;
0093 virtual G4Transform3D TraverseVolumeTree(const G4LogicalVolume* const,
0094 const G4int)=0;
0095 virtual void SurfacesWrite()=0;
0096 virtual void SetupWrite(xercesc::DOMElement*,
0097 const G4LogicalVolume* const)=0;
0098
0099
0100
0101 virtual void ExtensionWrite(xercesc::DOMElement*);
0102 virtual void UserinfoWrite(xercesc::DOMElement*);
0103 virtual void AddExtension(xercesc::DOMElement*,
0104 const G4LogicalVolume* const);
0105
0106
0107
0108
0109
0110
0111
0112 G4String GenerateName(const G4String&,const void* const);
0113
0114 protected:
0115
0116 PHG4GDMLWrite();
0117 virtual ~PHG4GDMLWrite();
0118
0119 VolumeMapType& VolumeMap();
0120
0121 xercesc::DOMAttr* NewAttribute(const G4String&, const G4String&);
0122 xercesc::DOMAttr* NewAttribute(const G4String&, const G4double&);
0123 xercesc::DOMElement* NewElement(const G4String&);
0124 G4String Modularize(const G4VPhysicalVolume* const topvol,
0125 const G4int depth);
0126
0127 void AddAuxInfo(PHG4GDMLAuxListType* auxInfoList, xercesc::DOMElement* element);
0128
0129 G4bool FileExists(const G4String&) const;
0130 PhysVolumeMapType& PvolumeMap();
0131 DepthMapType& DepthMap();
0132
0133 protected:
0134
0135 G4String SchemaLocation;
0136 static G4bool addPointerToName;
0137 xercesc::DOMDocument* doc;
0138 xercesc::DOMElement* extElement;
0139 xercesc::DOMElement* userinfoElement;
0140 XMLCh tempStr[10000];
0141 PHG4GDMLAuxListType auxList;
0142 };
0143
0144 #endif
0145