ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4GDMLParser.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4GDMLParser.hh
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 //
28 //
29 // class G4GDMLParser
30 //
31 // Class description:
32 //
33 // GDML main parser.
34 
35 // History:
36 // - Created. Zoltan Torzsok, November 2007
37 // -------------------------------------------------------------------------
38 
39 #ifndef _G4GDMLPARSER_INCLUDED_
40 #define _G4GDMLPARSER_INCLUDED_
41 
42 #include "G4GDMLReadStructure.hh"
43 #include "G4GDMLWriteStructure.hh"
44 #include "G4STRead.hh"
45 #include "G4GDMLMessenger.hh"
46 #include "G4GDMLEvaluator.hh"
47 
49 #include "G4Navigator.hh"
50 #include "G4Threading.hh"
51 
52 #define G4GDML_DEFAULT_SCHEMALOCATION G4String("http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema/gdml.xsd")
53 
55 {
56  public: // with description
57 
58  G4GDMLParser();
61  ~G4GDMLParser();
62  //
63  // Parser constructors & destructor
64 
65  inline void Read(const G4String& filename, G4bool Validate=true);
66  //
67  // Imports geometry with world-volume, specified by the GDML filename
68  // in input. Validation against schema is activated by default.
69 
70  inline void ReadModule(const G4String& filename, G4bool Validate=true);
71  //
72  // Imports a single GDML module, specified by the GDML filename
73  // in input. Validation against schema is activated by default.
74 
75  inline void Write(const G4String& filename,
76  const G4VPhysicalVolume* pvol = 0,
77  G4bool storeReferences = true,
78  const G4String& SchemaLocation = G4GDML_DEFAULT_SCHEMALOCATION);
79  //
80  // Exports on a GDML file, specified by 'filename' a geometry tree
81  // starting from 'pvol' as top volume. Uniqueness of stored entities
82  // is guaranteed by storing pointer-references by default.
83  // Alternative path for the schema location can be specified; by default
84  // the URL to the GDML web site is used.
85 
86  inline void Write(const G4String& filename,
87  const G4LogicalVolume* lvol,
88  G4bool storeReferences = true,
89  const G4String& SchemaLocation = G4GDML_DEFAULT_SCHEMALOCATION);
90  //
91  // Exports on a GDML file, specified by 'filename' a geometry tree
92  // starting from 'pvol' as top volume. Uniqueness of stored entities
93  // is guaranteed by storing pointer-references by default.
94  // Alternative path for the schema location can be specified; by default
95  // the URL to the GDML web site is used. Same as method above except
96  // that the logical volume must be provided here.
97 
98  inline G4LogicalVolume* ParseST(const G4String& name,
99  G4Material* medium,
100  G4Material* solid);
101  //
102  // Imports a tessellated geometry stored as STEP-Tools files
103  // 'name.geom' and 'name.tree'. It returns a pointer of a generated
104  // mother volume with 'medium' material associated, including the
105  // imported tessellated geometry with 'solid' material associated.
106 
107  // Methods for Reader
108  //
109  inline G4bool IsValid(const G4String& name) const;
110  inline G4double GetConstant(const G4String& name) const;
111  inline G4double GetVariable(const G4String& name) const;
112  inline G4double GetQuantity(const G4String& name) const;
113  inline G4ThreeVector GetPosition(const G4String& name) const;
114  inline G4ThreeVector GetRotation(const G4String& name) const;
115  inline G4ThreeVector GetScale(const G4String& name) const;
116  inline G4GDMLMatrix GetMatrix(const G4String& name) const;
117  inline G4LogicalVolume* GetVolume(const G4String& name) const;
118  inline G4VPhysicalVolume* GetWorldVolume(const G4String& setupName="Default") const;
120  inline const G4GDMLAuxMapType* GetAuxMap() const;
121  inline const G4GDMLAuxListType* GetAuxList() const;
122  inline void AddAuxiliary(G4GDMLAuxStructType myaux);
123  inline void StripNamePointers() const;
124  inline void SetStripFlag(G4bool);
125  inline void SetOverlapCheck(G4bool);
126  inline void SetRegionExport(G4bool);
127  inline void SetEnergyCutsExport(G4bool);
128  inline void SetSDExport(G4bool);
129 
130  inline G4int GetMaxExportLevel() const; // Manage max number of levels
131  inline void SetMaxExportLevel(G4int); // to export
132 
133  inline void Clear(); // Clears the evaluator
134 
135  // Methods for Writer
136  //
137  inline void AddModule(const G4VPhysicalVolume* const physvol);
138  inline void AddModule(const G4int depth);
139  inline void SetAddPointerToName(G4bool set);
140  inline void AddVolumeAuxiliary(G4GDMLAuxStructType myaux, const G4LogicalVolume* const lvol);
141 
142  private:
143 
144  void ImportRegions();
145  void ExportRegions(G4bool storeReferences = true);
146 
147  private:
148 
155 
156 };
157 
158 #include "G4GDMLParser.icc"
159 
160 #endif