4 // Geant4 implementation of the MonteCarlo interface methods
5 // for building Geant4 geometry and access to it
7 #ifndef TG4_GEOMETRY_MANAGER_H
8 #define TG4_GEOMETRY_MANAGER_H
10 #include "TG4NameMap.h"
11 #include "TG4Globals.h"
16 #include <G3SensVolVector.hh>
20 #include <g4std/fstream>
21 #include <g4std/vector>
25 class TG4GeometryOutputManager;
26 class TG4GeometryServices;
29 class G4VPhysicalVolume;
30 class G4LogicalVolume;
32 class TG4GeometryManager
37 // TG4GeometryManager(const TG4GeometryManager& right);
38 virtual ~TG4GeometryManager();
40 // static access method
41 static TG4GeometryManager* Instance();
44 // methods (from the base class)
46 // detector composition
47 void Material(Int_t& kmat, const char* name, Float_t a,
48 Float_t z, Float_t dens, Float_t radl, Float_t absl,
49 Float_t* buf, Int_t nwbuf);
50 void Mixture(Int_t& kmat, const char *name, Float_t *a,
51 Float_t *z, Float_t dens, Int_t nlmat, Float_t *wmat);
52 void Medium(Int_t& kmed, const char *name, Int_t nmat,
53 Int_t isvol, Int_t ifield, Float_t fieldm, Float_t tmaxfd,
54 Float_t stemax, Float_t deemax, Float_t epsil,
55 Float_t stmin, Float_t* ubuf, Int_t nbuf);
56 void Matrix(Int_t& krot, Float_t thetaX, Float_t phiX,
57 Float_t thetaY, Float_t phiY, Float_t thetaZ,
60 // functions from GBASE
63 // functions from GCONS
64 void Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z,
65 Float_t &dens, Float_t &radl, Float_t &absl,
66 Float_t* ubuf, Int_t& nbuf);
67 void Gstpar(Int_t itmed, const char *param, Float_t parval);
68 void SetCerenkov(Int_t itmed, Int_t npckov, Float_t *ppckov,
69 Float_t *absco, Float_t *effic, Float_t *rindex);
71 // functions from GGEOM
72 Int_t Gsvolu(const char *name, const char *shape, Int_t nmed,
73 Float_t *upar, Int_t np);
74 void Gsdvn(const char *name, const char *mother, Int_t ndiv,
77 void Gsdvn2(const char *name, const char *mother, Int_t ndiv,
78 Int_t iaxis, Float_t c0i, Int_t numed);
79 void Gsdvt(const char *name, const char *mother, Float_t step,
80 Int_t iaxis, Int_t numed, Int_t ndvmx);
81 void Gsdvt2(const char *name, const char *mother, Float_t step,
82 Int_t iaxis, Float_t c0, Int_t numed, Int_t ndvmx);
84 void Gsord(const char *name, Int_t iax);
85 void Gspos(const char *name, Int_t nr, const char *mother,
86 Float_t x, Float_t y, Float_t z, Int_t irot,
88 void Gsposp(const char *name, Int_t nr, const char *mother,
89 Float_t x, Float_t y, Float_t z, Int_t irot,
90 const char *konly, Float_t *upar, Int_t np);
93 void WriteEuclid(const char* fileName, const char* topVolName,
94 Int_t number, Int_t nlevel); //new
97 Int_t VolId(const Text_t* volName) const;
98 const char* VolName(Int_t id) const;
99 Int_t NofVolumes() const;
100 Int_t VolId2Mate(Int_t volumeId) const;
106 // methods for Geant4 only
108 G4VPhysicalVolume* CreateG4Geometry();
109 void ReadG3Geometry(G4String filePath);
110 void UseG3TrackingMediaLimits();
111 void FillMediumIdVector();
112 void ClearG3Tables();
113 void ClearG3TablesFinal();
114 void OpenOutFile(G4String filePath);
119 void SetWriteGeometry(G4bool writeGeometry);
120 void SetMapSecond(const G4String& name);
123 G3SensVolVector GetG3SensVolVector() const;
126 TG4GeometryManager(const TG4GeometryManager& right);
129 TG4GeometryManager& operator=(const TG4GeometryManager& right);
133 void GstparCut(G4int itmed, TG3Cut par, G4double parval);
134 void GstparFlag(G4int itmed, TG3Flag par, G4double parval);
136 // static data members
137 static TG4GeometryManager* fgInstance; //this instance
140 TG4GeometryOutputManager* fOutputManager; //output manager
141 TG4GeometryServices* fGeometryServices;//geometry services
142 TG4intVector fMediumIdVector; //vector of second indexes for materials
143 TG4NameMap fNameMap; //map of volumes names to modules names
144 G4int fMediumCounter; //global medium counter
145 G4int fMaterialCounter; //global material counter
146 G4int fMatrixCounter; //global matrix counter
147 G4bool fUseG3TMLimits; //if true: G3 limits are passed to G4
149 G4bool fWriteGeometry; //if true: geometry parameters are written
154 inline TG4GeometryManager* TG4GeometryManager::Instance()
155 { return fgInstance; }
157 inline G3SensVolVector TG4GeometryManager::GetG3SensVolVector() const
158 { return G3SensVol; }
160 #endif //TG4_GEOMETRY_MANAGER_H