]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TGeant4/TG4GeometryManager.h
MevSim interfaced through AliGenerator, first commit (Sylwester Radomski et al.)
[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 #include "TG4G3Cut.h"
13 #include "TG4G3Control.h"
14
15 #include <globals.hh>
16 #include <G3SensVolVector.hh>
17
18 #include <Rtypes.h>
19
20 #include <g4std/fstream>
21 #include <g4std/vector>
22
23 class TG4CutVector;
24 class TG4FlagVector;
25 class TG4GeometryOutputManager;
26 class TG4GeometryServices;
27
28 class G4Material;
29 class G4VPhysicalVolume;
30 class G4LogicalVolume;
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);
56     void  Matrix(Int_t& krot, Float_t thetaX, Float_t phiX, 
57                      Float_t thetaY, Float_t phiY, Float_t thetaZ, 
58                      Float_t phiZ);
59
60     // functions from GBASE 
61     void  Ggclos(); 
62
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); 
70
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, 
75                         Int_t iaxis);
76  
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); 
83
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, 
87                         const char *konly); 
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); 
91         
92     // Euclid                  
93     void WriteEuclid(const char* fileName, const char* topVolName, 
94                          Int_t number, Int_t nlevel); //new
95                                
96     // get methods
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;
101     
102     // end of methods
103     // 
104
105     //
106     // methods for Geant4 only 
107  
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);
115     void CloseOutFile();
116     void PrintNameMap();
117     
118     // set methods
119     void SetWriteGeometry(G4bool writeGeometry);
120     void SetMapSecond(const G4String& name);
121
122     // get methods 
123     G3SensVolVector GetG3SensVolVector() const;
124      
125   protected:
126     TG4GeometryManager(const TG4GeometryManager& right);
127
128     // operators
129     TG4GeometryManager& operator=(const TG4GeometryManager& right);
130
131   private:
132     // methods
133     void GstparCut(G4int itmed, TG4G3Cut par, G4double parval);
134     void GstparControl(G4int itmed, TG4G3Control control, G4double parval);
135         
136     // static data members
137     static TG4GeometryManager*  fgInstance;     //this instance
138
139     // data members
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 
148                                     //(in development)
149     G4bool        fWriteGeometry;   //if true: geometry parameters are written
150                                     //in a file (ASCII)  
151 };
152
153 // inline methods
154 inline TG4GeometryManager* TG4GeometryManager::Instance()
155 { return fgInstance; }
156
157 inline G3SensVolVector TG4GeometryManager::GetG3SensVolVector() const
158 { return G3SensVol; }
159
160 #endif //TG4_GEOMETRY_MANAGER_H
161