Geant4  10.03
G4tgbGeometryDumper.hh
Go to the documentation of this file.
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 // class G4tgbGeometryDumper
28 //
29 // Class description:
30 //
31 // Class for dumping the whole geometry.
32 
33 // History:
34 // - Created. P.Arce, CIEMAT (November 2007)
35 // -------------------------------------------------------------------------
36 
37 #ifndef G4tgbGeometryDumper_HH
38 #define G4tgbGeometryDumper_HH
39 
40 #include "globals.hh"
41 #include "G4RotationMatrix.hh"
42 
43 #include <fstream>
44 #include <map>
45 #include <vector>
46 
47 class G4Material;
48 class G4Element;
49 class G4Isotope;
50 class G4VSolid;
51 class G4LogicalVolume;
52 class G4VPhysicalVolume;
53 class G4PVParameterised;
54 class G4PVReplica;
55 
57 {
58 
59  public: // with description
60 
63 
64  void DumpGeometry(const G4String& fname );
66  void DumpPhysVol( G4VPhysicalVolume* pv );
67  void DumpPVPlacement( G4VPhysicalVolume* pv, const G4String& lvName,
68  G4int copyNo = -999 );
70  void DumpPVReplica( G4PVReplica* pv, const G4String& lvName );
71  G4String DumpLogVol( G4LogicalVolume* lv, G4String extraName = "",
72  G4VSolid* solid = 0, G4Material* mate = 0);
74  void DumpElement( G4Element* ele);
75  void DumpIsotope( G4Isotope* ele);
76  G4String DumpSolid( G4VSolid* solid, const G4String& extraName = "" );
77  void DumpBooleanVolume( const G4String& solidType, G4VSolid* so );
78  void DumpSolidParams(G4VSolid * so);
79  std::vector<G4double> GetSolidParams( const G4VSolid * so);
80  void DumpPolySections(G4int zPlanes, G4double* z,
81  G4double *rmin, G4double *rmax);
83 
84  private:
85 
87 
88  private:
89 
90  std::vector<G4VPhysicalVolume*> GetPVChildren( G4LogicalVolume* lv );
91  G4String GetTGSolidType( const G4String& solidtype );
94  G4String AddQuotes( const G4String& str );
95 
97  template< class TYP> G4String GetObjectName( TYP* obj,
98  std::map<G4String,TYP*> objectsDumped );
102  G4String SupressRefl( G4String name );
105  const G4String& FindSolidName( G4VSolid* solid );
106 
107  private:
108 
110 
111  std::ofstream* theFile;
112 
113  std::map<G4String,G4Material*> theMaterials;
114  std::map<G4String,G4Element*> theElements;
115  std::map<G4String,G4Isotope*> theIsotopes;
116  std::map<G4String,G4VSolid*> theSolids;
117  std::map<G4String,G4LogicalVolume*> theLogVols;
118  std::map<G4String,G4VPhysicalVolume*> thePhysVols;
119  std::map<G4String,G4RotationMatrix*> theRotMats;
120 
122 };
123 
124 #endif
G4String SupressRefl(G4String name)
CLHEP::HepRotation G4RotationMatrix
void DumpIsotope(G4Isotope *ele)
G4String DumpMaterial(G4Material *mat)
const G4String & FindSolidName(G4VSolid *solid)
G4String LookForExistingRotation(const G4RotationMatrix *rotm)
void DumpSolidParams(G4VSolid *so)
std::map< G4String, G4Material * > theMaterials
std::map< G4String, G4Element * > theElements
const char * name(G4int ptype)
#define G4ThreadLocal
Definition: tls.hh:89
void DumpPolySections(G4int zPlanes, G4double *z, G4double *rmin, G4double *rmax)
int G4int
Definition: G4Types.hh:78
std::map< G4String, G4LogicalVolume * > theLogVols
static G4ThreadLocal G4tgbGeometryDumper * theInstance
std::vector< G4VPhysicalVolume * > GetPVChildren(G4LogicalVolume *lv)
void DumpPVReplica(G4PVReplica *pv, const G4String &lvName)
void DumpPhysVol(G4VPhysicalVolume *pv)
G4bool CheckIfLogVolExists(const G4String &name, G4LogicalVolume *pt)
void DumpGeometry(const G4String &fname)
G4bool Same2G4Isotopes(G4Isotope *ele1, G4Isotope *ele2)
std::map< G4String, G4VSolid * > theSolids
G4String AddQuotes(const G4String &str)
bool G4bool
Definition: G4Types.hh:79
static const G4double ele1
G4String GetTGSolidType(const G4String &solidtype)
G4String GetObjectName(TYP *obj, std::map< G4String, TYP * > objectsDumped)
G4bool CheckIfPhysVolExists(const G4String &name, G4VPhysicalVolume *)
G4double approxTo0(G4double val)
static const G4double ele2
std::map< G4String, G4Isotope * > theIsotopes
void DumpPVPlacement(G4VPhysicalVolume *pv, const G4String &lvName, G4int copyNo=-999)
G4String SubstituteRefl(G4String name)
G4String DumpRotationMatrix(G4RotationMatrix *rotm)
std::map< G4String, G4VPhysicalVolume * > thePhysVols
void DumpBooleanVolume(const G4String &solidType, G4VSolid *so)
static G4tgbGeometryDumper * GetInstance()
std::vector< G4double > GetSolidParams(const G4VSolid *so)
void DumpPVParameterised(G4PVParameterised *pv)
G4VPhysicalVolume * GetTopPhysVol()
static const G4double ele
G4String GetIsotopeName(G4Isotope *)
G4double MatDeterminant(G4RotationMatrix *ro)
G4String DumpSolid(G4VSolid *solid, const G4String &extraName="")
double G4double
Definition: G4Types.hh:76
std::map< G4String, G4RotationMatrix * > theRotMats
G4String DumpLogVol(G4LogicalVolume *lv, G4String extraName="", G4VSolid *solid=0, G4Material *mate=0)
void DumpElement(G4Element *ele)