Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
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);
74 void DumpSolidParams(G4VSolid* so);
75 std::vector<G4double> GetSolidParams(const G4VSolid* so);
76 void DumpPolySections(G4int zPlanes, G4double* z, G4double* rmin,
77 G4double* rmax);
79
80 private:
81
83
84 std::vector<G4VPhysicalVolume*> GetPVChildren(G4LogicalVolume* lv);
85 G4String GetTGSolidType(const G4String& solidtype);
86 G4double MatDeterminant(G4RotationMatrix* ro);
87 G4double approxTo0(G4double val);
88 G4String AddQuotes(const G4String& str);
89
90 G4String GetIsotopeName(G4Isotope*);
91 template <class TYP>
92 G4String GetObjectName(TYP* obj, std::map<G4String, TYP*> objectsDumped);
93 G4bool CheckIfLogVolExists(const G4String& name, G4LogicalVolume* pt);
94 G4bool CheckIfPhysVolExists(const G4String& name, G4VPhysicalVolume*);
95 G4String LookForExistingRotation(const G4RotationMatrix* rotm);
96 G4String SupressRefl(G4String name);
97 G4String SubstituteRefl(G4String name);
98 G4bool Same2G4Isotopes(G4Isotope* ele1, G4Isotope* ele2);
99 const G4String& FindSolidName(G4VSolid* solid);
100
101 private:
102
103 static G4ThreadLocal G4tgbGeometryDumper* theInstance;
104
105 std::ofstream* theFile = nullptr;
106
107 std::map<G4String, G4Material*> theMaterials;
108 std::map<G4String, G4Element*> theElements;
109 std::map<G4String, G4Isotope*> theIsotopes;
110 std::map<G4String, G4VSolid*> theSolids;
111 std::map<G4String, G4LogicalVolume*> theLogVols;
112 std::map<G4String, G4VPhysicalVolume*> thePhysVols;
113 std::map<G4String, G4RotationMatrix*> theRotMats;
114
115 G4int theRotationNumber = 0;
116};
117
118#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 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)
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