3 // by I. Hrivnacova, 27.07.2000
5 // XML convertor that converts G4 basic geometry objects
6 // to XML defined by AGDD.dtd
7 // (ATLAS Generic Detector Description)
9 #ifndef TG4_XML_CONVERTOR_H
10 #define TG4_XML_CONVERTOR_H
12 #include "TG4VXMLConvertor.h"
13 #include "TG4Globals.h"
16 #include <g4std/fstream>
20 class G4LogicalVolume;
30 class TG4XMLConvertor : public TG4VXMLConvertor
33 TG4XMLConvertor(G4std::ofstream& outFile);
34 virtual ~TG4XMLConvertor();
37 virtual void OpenMaterials(const G4String& version, const G4String& date,
38 const G4String& author, const G4String dtdVersion);
39 virtual void OpenSection(const G4String& name, const G4String& version,
40 const G4String& date, const G4String& author,
41 const G4String& topVolume);
42 virtual void OpenComposition(const G4String& name);
43 virtual void CloseMaterials();
44 virtual void CloseSection();
45 virtual void CloseComposition();
47 virtual void WriteMaterial(const G4Material* material);
48 virtual void WriteSolid(G4String lvName, const G4VSolid* solid,
49 G4String materialName);
50 virtual void WriteRotation(const G4RotationMatrix* rotation);
51 virtual void WritePosition(G4String lvName, G4ThreeVector position);
52 virtual void WritePositionWithRotation(
53 G4String lvName, G4ThreeVector position,
54 const G4RotationMatrix* rotation);
55 virtual void WriteReplica(G4String lvName, G4PVReplica* pvr);
56 virtual void WriteEmptyLine();
57 virtual void IncreaseIndention();
58 virtual void DecreaseIndention();
62 void CutName(G4String& name) const;
63 void CutName(G4String& name, G4int size) const;
64 void PutName(G4String& element, G4String name, G4String templ) const;
67 void WriteBox (G4String lvName, const G4Box* box, G4String materialName);
68 void WriteTubs(G4String lvName, const G4Tubs* tubs, G4String materialName);
69 void WriteCons(G4String lvName, const G4Cons* cons, G4String materialName);
70 void WriteTrd (G4String lvName, const G4Trd* trd, G4String materialName);
71 void WriteTrap(G4String lvName, const G4Trap* trap, G4String materialName);
72 void WritePolycone(G4String lvName, const G4Polycone* polycone,
73 G4String materialName);
74 void WritePolyhedra(G4String lvName, const G4Polyhedra* polyhedra,
75 G4String materialName);
77 // static data members
78 static const G4int fgkMaxVolumeNameLength; //maximal volume name length
79 static const G4int fgkMaxMaterialNameLength;//maximal material name length
82 G4std::ofstream& fOutFile; //output file
83 const G4String fkBasicIndention; //basic indention
84 G4String fIndention; //indention string
85 G4int fRotationCounter; //counter of rotations
86 TG4RotationMatrixVector fRotations; // vector of rot matrices
89 #endif //TG4_XML_CONVERTOR_H