Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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// G4tgbGeometryDumper
27//
28// Class description:
29//
30// Class for dumping the whole geometry.
31
32// Author: P.Arce, CIEMAT (November 2007)
33// --------------------------------------------------------------------
34#ifndef G4tgbGeometryDumper_hh
35#define G4tgbGeometryDumper_hh 1
36
37#include <fstream>
38#include <map>
39#include <vector>
40
41#include "globals.hh"
42#include "G4RotationMatrix.hh"
43
44class G4Material;
45class G4Element;
46class G4Isotope;
47class G4VSolid;
48class G4LogicalVolume;
51class G4PVReplica;
52
54{
55 public:
56
59
60 void DumpGeometry(const G4String& fname);
63 void DumpPVPlacement(G4VPhysicalVolume* pv, const G4String& lvName,
64 G4int copyNo = -999);
66 void DumpPVReplica(G4PVReplica* pv, const G4String& lvName);
67 G4String DumpLogVol(G4LogicalVolume* lv, const G4String& extraName = "",
68 G4VSolid* solid = nullptr, G4Material* mate = nullptr);
70 void DumpElement(G4Element* ele);
71 void DumpIsotope(G4Isotope* ele);
72 G4String DumpSolid(G4VSolid* solid, const G4String& extraName = "");
73 void DumpBooleanVolume(const G4String& solidType, G4VSolid* so);
75 void DumpScaledVolume( G4VSolid* so);
76 void DumpSolidParams(G4VSolid* so);
77 std::vector<G4double> GetSolidParams(const G4VSolid* so);
78 void DumpPolySections(G4int zPlanes, G4double* z, G4double* rmin,
79 G4double* rmax);
81
82 private:
83
85
86 std::vector<G4VPhysicalVolume*> GetPVChildren(G4LogicalVolume* lv);
87 G4String GetTGSolidType(const G4String& solidtype);
88 G4double MatDeterminant(G4RotationMatrix* ro);
89 G4double approxTo0(G4double val);
90 G4String AddQuotes(const G4String& str);
91
92 G4String GetIsotopeName(G4Isotope*);
93 template <class TYP>
94 G4String GetObjectName(TYP* obj, std::map<G4String, TYP*> objectsDumped);
95 G4bool CheckIfLogVolExists(const G4String& name, G4LogicalVolume* pt);
96 G4bool CheckIfPhysVolExists(const G4String& name, G4VPhysicalVolume*);
97 G4String LookForExistingRotation(const G4RotationMatrix* rotm);
98 G4String SupressRefl(G4String name);
99 G4String SubstituteRefl(G4String name);
100 G4bool Same2G4Isotopes(G4Isotope* ele1, G4Isotope* ele2);
101 const G4String& FindSolidName(G4VSolid* solid);
102
103 private:
104
105 static G4ThreadLocal G4tgbGeometryDumper* theInstance;
106
107 std::ofstream* theFile = nullptr;
108
109 std::map<G4String, G4Material*> theMaterials;
110 std::map<G4String, G4Element*> theElements;
111 std::map<G4String, G4Isotope*> theIsotopes;
112 std::map<G4String, G4VSolid*> theSolids;
113 std::map<G4String, G4LogicalVolume*> theLogVols;
114 std::map<G4String, G4VPhysicalVolume*> thePhysVols;
115 std::map<G4String, G4RotationMatrix*> theRotMats;
116
117 G4int theRotationNumber = 0;
118};
119
120#endif
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
static G4tgbGeometryDumper * GetInstance()
void DumpIsotope(G4Isotope *ele)
void DumpScaledVolume(G4VSolid *so)
void DumpGeometry(const G4String &fname)
G4String DumpLogVol(G4LogicalVolume *lv, const G4String &extraName="", G4VSolid *solid=nullptr, G4Material *mate=nullptr)
void DumpPhysVol(G4VPhysicalVolume *pv)
G4String DumpRotationMatrix(G4RotationMatrix *rotm)
void DumpBooleanVolume(const G4String &solidType, G4VSolid *so)
G4String DumpMaterial(G4Material *mat)
void DumpPVReplica(G4PVReplica *pv, const G4String &lvName)
void DumpPVParameterised(G4PVParameterised *pv)
void DumpPolySections(G4int zPlanes, G4double *z, G4double *rmin, G4double *rmax)
void DumpMultiUnionVolume(G4VSolid *so)
G4VPhysicalVolume * GetTopPhysVol()
G4String DumpSolid(G4VSolid *solid, const G4String &extraName="")
void DumpElement(G4Element *ele)
void DumpSolidParams(G4VSolid *so)
void DumpPVPlacement(G4VPhysicalVolume *pv, const G4String &lvName, G4int copyNo=-999)
std::vector< G4double > GetSolidParams(const G4VSolid *so)
#define G4ThreadLocal
Definition: tls.hh:77