4 // Author: V. Berejnoi, I. Hrivnacova
6 // Class TG4GeometryManager
7 // ------------------------
8 // Geant4 implementation of the MonteCarlo interface methods
9 // for building Geant4 geometry and access to it.
11 #ifndef TG4_GEOMETRY_MANAGER_H
12 #define TG4_GEOMETRY_MANAGER_H
14 #include "TG4Verbose.h"
15 #include "TG4NameMap.h"
16 #include "TG4IntMap.h"
17 #include "TG4Globals.h"
24 class TG4GeometryOutputManager;
25 class TG4GeometryServices;
27 class TG4G3ControlVector;
29 class G4VPhysicalVolume;
31 class TG4GeometryManager : public TG4Verbose
36 // TG4GeometryManager(const TG4GeometryManager& right);
37 virtual ~TG4GeometryManager();
39 // static access method
40 static TG4GeometryManager* Instance();
43 // methods (from the base class)
45 // detector composition
46 void Material(Int_t& kmat, const char* name, Float_t a,
47 Float_t z, Float_t dens, Float_t radl, Float_t absl,
48 Float_t* buf, Int_t nwbuf);
49 void Mixture(Int_t& kmat, const char *name, Float_t *a,
50 Float_t *z, Float_t dens, Int_t nlmat, Float_t *wmat);
51 void Medium(Int_t& kmed, const char *name, Int_t nmat,
52 Int_t isvol, Int_t ifield, Float_t fieldm, Float_t tmaxfd,
53 Float_t stemax, Float_t deemax, Float_t epsil,
54 Float_t stmin, Float_t* ubuf, Int_t nbuf);
55 void Matrix(Int_t& krot, Double_t thetaX, Double_t phiX,
56 Double_t thetaY, Double_t phiY, Double_t thetaZ,
58 void Matrix(Int_t& krot, Float_t thetaX, Float_t phiX,
59 Float_t thetaY, Float_t phiY, Float_t thetaZ,
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 SetCerenkov(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 Double_t *upar, Int_t np);
76 Int_t Gsvolu(const char *name, const char *shape, Int_t nmed,
77 Float_t *upar, Int_t np);
78 void Gsdvn(const char *name, const char *mother, Int_t ndiv,
80 void Gsdvn2(const char *name, const char *mother, Int_t ndiv,
81 Int_t iaxis, Double_t c0i, Int_t numed);
82 void Gsdvn2(const char *name, const char *mother, Int_t ndiv,
83 Int_t iaxis, Float_t c0i, Int_t numed);
84 void Gsdvt(const char *name, const char *mother, Double_t step,
85 Int_t iaxis, Int_t numed, Int_t ndvmx);
86 void Gsdvt(const char *name, const char *mother, Float_t step,
87 Int_t iaxis, Int_t numed, Int_t ndvmx);
88 void Gsdvt2(const char *name, const char *mother, Double_t step,
89 Int_t iaxis, Double_t c0, Int_t numed, Int_t ndvmx);
90 void Gsdvt2(const char *name, const char *mother, Float_t step,
91 Int_t iaxis, Float_t c0, Int_t numed, Int_t ndvmx);
93 void Gsord(const char *name, Int_t iax);
94 void Gspos(const char *name, Int_t nr, const char *mother,
95 Double_t x, Double_t y, Double_t z, Int_t irot,
97 void Gspos(const char *name, Int_t nr, const char *mother,
98 Float_t x, Float_t y, Float_t z, Int_t irot,
100 void Gsposp(const char *name, Int_t nr, const char *mother,
101 Double_t x, Double_t y, Double_t z, Int_t irot,
102 const char *konly, Double_t *upar, Int_t np);
103 void Gsposp(const char *name, Int_t nr, const char *mother,
104 Float_t x, Float_t y, Float_t z, Int_t irot,
105 const char *konly, Float_t *upar, Int_t np);
106 void Gsbool(const char* onlyVolName, const char* manyVolName);
109 void WriteEuclid(const char* fileName, const char* topVolName,
110 Int_t number, Int_t nlevel); //new
116 // methods for Geant4 only
118 G4VPhysicalVolume* CreateG4Geometry();
119 void SetUserLimits(const TG4G3CutVector& cuts,
120 const TG4G3ControlVector& controls) const;
121 void ReadG3Geometry(G4String filePath);
122 void UseG3TrackingMediaLimits();
123 void ClearG3Tables();
124 void ClearG3TablesFinal();
125 void OpenOutFile(G4String filePath);
129 void SetWriteGeometry(G4bool writeGeometry);
130 void SetMapSecond(const G4String& name);
133 TG4GeometryManager(const TG4GeometryManager& right);
136 TG4GeometryManager& operator=(const TG4GeometryManager& right);
140 void FillMediumMap();
142 // static data members
143 static TG4GeometryManager* fgInstance; //this instance
144 static const G4double fgLimitDensity; //material density limit
145 //for setting max allowed step
146 static const G4double fgMaxStep; //max allowed step in materials
147 //with density < fLimitDensity
150 TG4GeometryOutputManager* fOutputManager; //output manager
151 TG4GeometryServices* fGeometryServices;//geometry services
152 TG4IntMap fMediumMap; //map of volumes names to medias IDs
153 TG4NameMap fNameMap; //map of volumes names to modules names
154 TG4StringVector fMaterialNameVector; // vector of material names sorted in the
155 // the order of materials in G3Mat
156 TG4StringVector fMediumNameVector; // vector of material names sorted in the
157 // the order of medias in G3Med
158 G4int fMediumCounter; //global medium counter
159 G4int fMaterialCounter; //global material counter
160 G4int fMatrixCounter; //global matrix counter
161 G4bool fUseG3TMLimits; //if true: G3 limits are passed to G4
163 G4bool fWriteGeometry; //if true: geometry parameters are written
168 inline TG4GeometryManager* TG4GeometryManager::Instance()
169 { return fgInstance; }
171 #endif //TG4_GEOMETRY_MANAGER_H