]>
Commit | Line | Data |
---|---|---|
2817d3e2 | 1 | // $Id$ |
2 | // Category: geometry | |
3 | // | |
4 | // Geant4 implementation of the MonteCarlo interface methods | |
5 | // for building Geant4 geometry and access to it | |
6 | ||
7 | #ifndef TG4_GEOMETRY_MANAGER_H | |
8 | #define TG4_GEOMETRY_MANAGER_H | |
9 | ||
10 | #include "TG4NameMap.h" | |
11 | #include "TG4Globals.h" | |
6eb43d7c | 12 | #include "TG4G3Cut.h" |
13 | #include "TG4G3Control.h" | |
2817d3e2 | 14 | |
15 | #include <globals.hh> | |
16 | #include <G3SensVolVector.hh> | |
17 | ||
18 | #include <Rtypes.h> | |
19 | ||
63c8351a | 20 | #include <g4std/fstream> |
21 | #include <g4std/vector> | |
2817d3e2 | 22 | |
23 | class TG4CutVector; | |
24 | class TG4FlagVector; | |
25 | class TG4GeometryOutputManager; | |
154fc5a5 | 26 | class TG4GeometryServices; |
2817d3e2 | 27 | |
28 | class G4Material; | |
29 | class G4VPhysicalVolume; | |
154fc5a5 | 30 | class G4LogicalVolume; |
2817d3e2 | 31 | |
32 | class TG4GeometryManager | |
33 | { | |
34 | public: | |
35 | TG4GeometryManager(); | |
36 | // --> protected | |
37 | // TG4GeometryManager(const TG4GeometryManager& right); | |
38 | virtual ~TG4GeometryManager(); | |
39 | ||
40 | // static access method | |
41 | static TG4GeometryManager* Instance(); | |
42 | ||
43 | // | |
44 | // methods (from the base class) | |
45 | ||
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); | |
2ce4a261 | 56 | void Matrix(Int_t& krot, Double_t thetaX, Double_t phiX, |
57 | Double_t thetaY, Double_t phiY, Double_t thetaZ, | |
58 | Double_t phiZ); | |
2817d3e2 | 59 | void Matrix(Int_t& krot, Float_t thetaX, Float_t phiX, |
60 | Float_t thetaY, Float_t phiY, Float_t thetaZ, | |
61 | Float_t phiZ); | |
62 | ||
2817d3e2 | 63 | // functions from GBASE |
64 | void Ggclos(); | |
65 | ||
66 | // functions from GCONS | |
67 | void Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z, | |
68 | Float_t &dens, Float_t &radl, Float_t &absl, | |
69 | Float_t* ubuf, Int_t& nbuf); | |
70 | void Gstpar(Int_t itmed, const char *param, Float_t parval); | |
ad390979 | 71 | void SetCerenkov(Int_t itmed, Int_t npckov, Float_t *ppckov, |
2817d3e2 | 72 | Float_t *absco, Float_t *effic, Float_t *rindex); |
73 | ||
74 | // functions from GGEOM | |
2ce4a261 | 75 | Int_t Gsvolu(const char *name, const char *shape, Int_t nmed, |
76 | Double_t *upar, Int_t np); | |
2817d3e2 | 77 | Int_t Gsvolu(const char *name, const char *shape, Int_t nmed, |
78 | Float_t *upar, Int_t np); | |
79 | void Gsdvn(const char *name, const char *mother, Int_t ndiv, | |
80 | Int_t iaxis); | |
2ce4a261 | 81 | void Gsdvn2(const char *name, const char *mother, Int_t ndiv, |
82 | Int_t iaxis, Double_t c0i, Int_t numed); | |
2817d3e2 | 83 | void Gsdvn2(const char *name, const char *mother, Int_t ndiv, |
84 | Int_t iaxis, Float_t c0i, Int_t numed); | |
2ce4a261 | 85 | void Gsdvt(const char *name, const char *mother, Double_t step, |
86 | Int_t iaxis, Int_t numed, Int_t ndvmx); | |
2817d3e2 | 87 | void Gsdvt(const char *name, const char *mother, Float_t step, |
88 | Int_t iaxis, Int_t numed, Int_t ndvmx); | |
2ce4a261 | 89 | void Gsdvt2(const char *name, const char *mother, Double_t step, |
90 | Int_t iaxis, Double_t c0, Int_t numed, Int_t ndvmx); | |
2817d3e2 | 91 | void Gsdvt2(const char *name, const char *mother, Float_t step, |
92 | Int_t iaxis, Float_t c0, Int_t numed, Int_t ndvmx); | |
93 | ||
94 | void Gsord(const char *name, Int_t iax); | |
2ce4a261 | 95 | void Gspos(const char *name, Int_t nr, const char *mother, |
96 | Double_t x, Double_t y, Double_t z, Int_t irot, | |
97 | const char *konly); | |
2817d3e2 | 98 | void Gspos(const char *name, Int_t nr, const char *mother, |
99 | Float_t x, Float_t y, Float_t z, Int_t irot, | |
100 | const char *konly); | |
2ce4a261 | 101 | void Gsposp(const char *name, Int_t nr, const char *mother, |
102 | Double_t x, Double_t y, Double_t z, Int_t irot, | |
103 | const char *konly, Double_t *upar, Int_t np); | |
2817d3e2 | 104 | void Gsposp(const char *name, Int_t nr, const char *mother, |
105 | Float_t x, Float_t y, Float_t z, Int_t irot, | |
106 | const char *konly, Float_t *upar, Int_t np); | |
107 | ||
108 | // Euclid | |
57f88f6f | 109 | void WriteEuclid(const char* fileName, const char* topVolName, |
110 | Int_t number, Int_t nlevel); //new | |
2817d3e2 | 111 | |
112 | // get methods | |
113 | Int_t VolId(const Text_t* volName) const; | |
154fc5a5 | 114 | const char* VolName(Int_t id) const; |
2817d3e2 | 115 | Int_t NofVolumes() const; |
154fc5a5 | 116 | Int_t VolId2Mate(Int_t volumeId) const; |
2817d3e2 | 117 | |
118 | // end of methods | |
119 | // | |
120 | ||
121 | // | |
122 | // methods for Geant4 only | |
123 | ||
124 | G4VPhysicalVolume* CreateG4Geometry(); | |
125 | void ReadG3Geometry(G4String filePath); | |
126 | void UseG3TrackingMediaLimits(); | |
154fc5a5 | 127 | void FillMediumIdVector(); |
2817d3e2 | 128 | void ClearG3Tables(); |
129 | void ClearG3TablesFinal(); | |
130 | void OpenOutFile(G4String filePath); | |
73b4b945 | 131 | void CloseOutFile(); |
2817d3e2 | 132 | void PrintNameMap(); |
133 | ||
134 | // set methods | |
135 | void SetWriteGeometry(G4bool writeGeometry); | |
136 | void SetMapSecond(const G4String& name); | |
137 | ||
154fc5a5 | 138 | // get methods |
2817d3e2 | 139 | G3SensVolVector GetG3SensVolVector() const; |
154fc5a5 | 140 | |
2817d3e2 | 141 | protected: |
142 | TG4GeometryManager(const TG4GeometryManager& right); | |
143 | ||
144 | // operators | |
145 | TG4GeometryManager& operator=(const TG4GeometryManager& right); | |
146 | ||
147 | private: | |
148 | // methods | |
6eb43d7c | 149 | void GstparCut(G4int itmed, TG4G3Cut par, G4double parval); |
150 | void GstparControl(G4int itmed, TG4G3Control control, G4double parval); | |
2ce4a261 | 151 | void SetUserLimits(); |
2817d3e2 | 152 | |
153 | // static data members | |
154 | static TG4GeometryManager* fgInstance; //this instance | |
155 | ||
156 | // data members | |
154fc5a5 | 157 | TG4GeometryOutputManager* fOutputManager; //output manager |
158 | TG4GeometryServices* fGeometryServices;//geometry services | |
3c7cd15a | 159 | TG4intVector fMediumIdVector; //vector of second indexes for materials |
154fc5a5 | 160 | TG4NameMap fNameMap; //map of volumes names to modules names |
3c7cd15a | 161 | G4int fMediumCounter; //global medium counter |
162 | G4int fMaterialCounter; //global material counter | |
163 | G4int fMatrixCounter; //global matrix counter | |
164 | G4bool fUseG3TMLimits; //if true: G3 limits are passed to G4 | |
165 | //(in development) | |
166 | G4bool fWriteGeometry; //if true: geometry parameters are written | |
167 | //in a file (ASCII) | |
2817d3e2 | 168 | }; |
169 | ||
170 | // inline methods | |
171 | inline TG4GeometryManager* TG4GeometryManager::Instance() | |
172 | { return fgInstance; } | |
173 | ||
174 | inline G3SensVolVector TG4GeometryManager::GetG3SensVolVector() const | |
175 | { return G3SensVol; } | |
176 | ||
177 | #endif //TG4_GEOMETRY_MANAGER_H | |
178 |