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;
28 class G4VPhysicalVolume;
30 class TG4GeometryManager
35 // TG4GeometryManager(const TG4GeometryManager& right);
36 virtual ~TG4GeometryManager();
38 // static access method
39 static TG4GeometryManager* Instance();
42 // methods (from the base class)
44 // detector composition
45 void Material(Int_t& kmat, const char* name, Float_t a,
46 Float_t z, Float_t dens, Float_t radl, Float_t absl,
47 Float_t* buf, Int_t nwbuf);
48 void Mixture(Int_t& kmat, const char *name, Float_t *a,
49 Float_t *z, Float_t dens, Int_t nlmat, Float_t *wmat);
50 void Medium(Int_t& kmed, const char *name, Int_t nmat,
51 Int_t isvol, Int_t ifield, Float_t fieldm, Float_t tmaxfd,
52 Float_t stemax, Float_t deemax, Float_t epsil,
53 Float_t stmin, Float_t* ubuf, Int_t nbuf);
54 void Matrix(Int_t& krot, Float_t thetaX, Float_t phiX,
55 Float_t thetaY, Float_t phiY, Float_t thetaZ,
59 G4Material* MixMaterials(G4String name, G4double density,
60 TG4StringVector* matNames, TG4doubleVector* matWeights);
62 // functions from GBASE
65 // functions from GCONS
66 void Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z,
67 Float_t &dens, Float_t &radl, Float_t &absl,
68 Float_t* ubuf, Int_t& nbuf);
69 void Gstpar(Int_t itmed, const char *param, Float_t parval);
70 void Gsckov(Int_t itmed, Int_t npckov, Float_t *ppckov,
71 Float_t *absco, Float_t *effic, Float_t *rindex);
73 // functions from GGEOM
74 Int_t Gsvolu(const char *name, const char *shape, Int_t nmed,
75 Float_t *upar, Int_t np);
76 void Gsdvn(const char *name, const char *mother, Int_t ndiv,
79 void Gsdvn2(const char *name, const char *mother, Int_t ndiv,
80 Int_t iaxis, Float_t c0i, Int_t numed);
81 void Gsdvt(const char *name, const char *mother, Float_t step,
82 Int_t iaxis, Int_t numed, Int_t ndvmx);
83 void Gsdvt2(const char *name, const char *mother, Float_t step,
84 Int_t iaxis, Float_t c0, Int_t numed, Int_t ndvmx);
86 void Gsord(const char *name, Int_t iax);
87 void Gspos(const char *name, Int_t nr, const char *mother,
88 Float_t x, Float_t y, Float_t z, Int_t irot,
90 void Gsposp(const char *name, Int_t nr, const char *mother,
91 Float_t x, Float_t y, Float_t z, Int_t irot,
92 const char *konly, Float_t *upar, Int_t np);
95 void WriteEuclid(const char* fileName, const char* topVolName,
96 Int_t number, Int_t nlevel); //new
99 Int_t VolId(const Text_t* volName) const;
100 const char* VolName(Int_t id) const; //new
101 Int_t NofVolumes() const;
107 // methods for Geant4 only
109 G4VPhysicalVolume* CreateG4Geometry();
110 void ReadG3Geometry(G4String filePath);
111 void UseG3TrackingMediaLimits();
112 void ClearG3Tables();
113 void ClearG3TablesFinal();
114 void OpenOutFile(G4String filePath);
119 void SetWriteGeometry(G4bool writeGeometry);
120 void SetMapSecond(const G4String& name);
124 Int_t NofG3Volumes() const;
125 Int_t NofG4LogicalVolumes() const;
126 Int_t NofG4PhysicalVolumes() const;
127 Int_t NofSensitiveDetectors() const;
128 G4bool IsG3Volume(G4String lvName) const;
129 void G4ToG3VolumeName(G4String& name) const;
130 const G4String& GetMapSecond(const G4String& name);
133 G3SensVolVector GetG3SensVolVector() const;
136 G4int GetMediumId(G4Material* material) const;
137 G4double GetEffA(G4Material* material) const;
138 G4double GetEffZ(G4Material* material) const;
140 // end of methods for Geant4 only
144 TG4GeometryManager(const TG4GeometryManager& right);
147 TG4GeometryManager& operator=(const TG4GeometryManager& right);
151 G4double* CreateG4doubleArray(Float_t* array, G4int size) const;
152 G4String CutName(const char* name) const;
153 void GstparCut(G4int itmed, TG3Cut par, G4double parval);
154 void GstparFlag(G4int itmed, TG3Flag par, G4double parval);
155 void FillMediumIdVector();
157 // static data members
158 static TG4GeometryManager* fgInstance; //this instance
161 TG4GeometryOutputManager* fOutputManager; //output manager
162 TG4NameMap fNameMap; //map of volumes names to modules names
163 TG4intVector fMediumIdVector; //vector of second indexes for materials
164 G4int fMediumCounter; //global medium counter
165 G4int fMaterialCounter; //global material counter
166 G4int fMatrixCounter; //global matrix counter
167 G4bool fUseG3TMLimits; //if true: G3 limits are passed to G4
169 G4bool fWriteGeometry; //if true: geometry parameters are written
174 inline TG4GeometryManager* TG4GeometryManager::Instance()
175 { return fgInstance; }
177 inline G3SensVolVector TG4GeometryManager::GetG3SensVolVector() const
178 { return G3SensVol; }
180 #endif //TG4_GEOMETRY_MANAGER_H