]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TGeant4/TG4GeometryManager.h
updated to introduction of new TG4SDServices class; added comment lines separating...
[u/mrichter/AliRoot.git] / TGeant4 / TG4GeometryManager.h
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"
12
13 #include <globals.hh>
14 #include <G3SensVolVector.hh>
15
16 #include <Rtypes.h>
17
18 #include <g4std/fstream>
19 #include <g4std/vector>
20
21 class TG4CutVector;
22 class TG4FlagVector;
23 class TG4GeometryOutputManager;
24 class TG4GeometryServices;
25
26 class G4Material;
27 class G4VPhysicalVolume;
28 class G4LogicalVolume;
29
30 class TG4GeometryManager
31 {
32   public:
33     TG4GeometryManager();
34     // --> protected
35     // TG4GeometryManager(const TG4GeometryManager& right);
36     virtual ~TG4GeometryManager();
37
38     // static access method
39     static TG4GeometryManager* Instance();
40
41     //
42     // methods (from the base class)
43     
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, Double_t thetaX, Double_t phiX, 
55                      Double_t thetaY, Double_t phiY, Double_t thetaZ, 
56                      Double_t phiZ);
57     void  Matrix(Int_t& krot, Float_t thetaX, Float_t phiX, 
58                      Float_t thetaY, Float_t phiY, Float_t thetaZ, 
59                      Float_t phiZ);
60
61     // functions from GBASE 
62     void  Ggclos(); 
63
64     // functions from GCONS 
65     void  Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z,  
66                          Float_t &dens, Float_t &radl, Float_t &absl,
67                          Float_t* ubuf, Int_t& nbuf); 
68     void  Gstpar(Int_t itmed, const char *param, Float_t parval); 
69     void  SetCerenkov(Int_t itmed, Int_t npckov, Float_t *ppckov,
70                          Float_t *absco, Float_t *effic, Float_t *rindex); 
71
72     // functions from GGEOM 
73     Int_t Gsvolu(const char *name, const char *shape, Int_t nmed,  
74                          Double_t *upar, Int_t np); 
75     Int_t Gsvolu(const char *name, const char *shape, Int_t nmed,  
76                          Float_t *upar, Int_t np); 
77     void  Gsdvn(const char *name, const char *mother, Int_t ndiv, 
78                         Int_t iaxis);
79     void  Gsdvn2(const char *name, const char *mother, Int_t ndiv, 
80                          Int_t iaxis, Double_t c0i, Int_t numed); 
81     void  Gsdvn2(const char *name, const char *mother, Int_t ndiv, 
82                          Int_t iaxis, Float_t c0i, Int_t numed); 
83     void  Gsdvt(const char *name, const char *mother, Double_t step,
84                          Int_t iaxis, Int_t numed, Int_t ndvmx); 
85     void  Gsdvt(const char *name, const char *mother, Float_t step,
86                          Int_t iaxis, Int_t numed, Int_t ndvmx); 
87     void  Gsdvt2(const char *name, const char *mother, Double_t step, 
88                          Int_t iaxis, Double_t c0, Int_t numed, Int_t ndvmx); 
89     void  Gsdvt2(const char *name, const char *mother, Float_t step, 
90                          Int_t iaxis, Float_t c0, Int_t numed, Int_t ndvmx); 
91
92     void  Gsord(const char *name, Int_t iax); 
93     void  Gspos(const char *name, Int_t nr, const char *mother,  
94                         Double_t x, Double_t y, Double_t z, Int_t irot, 
95                         const char *konly); 
96     void  Gspos(const char *name, Int_t nr, const char *mother,  
97                         Float_t x, Float_t y, Float_t z, Int_t irot, 
98                         const char *konly); 
99     void  Gsposp(const char *name, Int_t nr, const char *mother,  
100                          Double_t x, Double_t y, Double_t z, Int_t irot,
101                          const char *konly, Double_t *upar, Int_t np); 
102     void  Gsposp(const char *name, Int_t nr, const char *mother,  
103                          Float_t x, Float_t y, Float_t z, Int_t irot,
104                          const char *konly, Float_t *upar, Int_t np); 
105         
106     // Euclid                  
107     void WriteEuclid(const char* fileName, const char* topVolName, 
108                          Int_t number, Int_t nlevel); //new
109                                
110     // end of methods
111     // 
112
113     //
114     // methods for Geant4 only 
115  
116     G4VPhysicalVolume* CreateG4Geometry();
117     void ReadG3Geometry(G4String filePath);
118     void UseG3TrackingMediaLimits();
119     void FillMediumIdVector();
120     void ClearG3Tables();       
121     void ClearG3TablesFinal();
122     void OpenOutFile(G4String filePath);
123     void CloseOutFile();
124     void PrintNameMap();
125     
126     // set methods
127     void SetWriteGeometry(G4bool writeGeometry);
128     void SetMapSecond(const G4String& name);
129      
130   protected:
131     TG4GeometryManager(const TG4GeometryManager& right);
132
133     // operators
134     TG4GeometryManager& operator=(const TG4GeometryManager& right);
135
136   private:
137     // methods
138     void SetUserLimits();
139         
140     // static data members
141     static TG4GeometryManager*  fgInstance;     //this instance
142
143     // data members
144     TG4GeometryOutputManager*   fOutputManager;   //output manager 
145     TG4GeometryServices*        fGeometryServices;//geometry services
146     TG4intVector  fMediumIdVector;  //vector of second indexes for materials
147     TG4NameMap    fNameMap;         //map of volumes names to modules names
148     G4int         fMediumCounter;   //global medium counter
149     G4int         fMaterialCounter; //global material counter
150     G4int         fMatrixCounter;   //global matrix counter
151     G4bool        fUseG3TMLimits;   //if true: G3 limits are passed to G4 
152                                     //(in development)
153     G4bool        fWriteGeometry;   //if true: geometry parameters are written
154                                     //in a file (ASCII)  
155 };
156
157 // inline methods
158 inline TG4GeometryManager* TG4GeometryManager::Instance()
159 { return fgInstance; }
160
161 #endif //TG4_GEOMETRY_MANAGER_H
162