]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TFluka/TFlukaMCGeometry.h
39e909bee2a6fa21ee7f823682bec7a65eb6f72c
[u/mrichter/AliRoot.git] / TFluka / TFlukaMCGeometry.h
1 // @(#):$Name$:$Id$
2 // Author: Andrei Gheata 10/07/2003
3
4 #ifndef ROOT_TFlukaMCGeometry
5 #define ROOT_TFlukaMCGeometry 
6
7 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
8  * See cxx source for full Copyright notice                               */
9
10
11 //
12 // Class TFlukaMCGeometry
13 // --------------------
14 // Implementation of the TVirtualMCGeometry interface
15 // for defining and using TGeo geometry with FLUKA.
16 //  
17
18 #ifndef ROOT_Riostream
19 #include "Riostream.h"
20 #endif
21
22 #ifndef ROOT_TVirtualMCGeometry
23 #include "TVirtualMCGeometry.h"
24 #endif
25
26 class TFlukaMCGeometry : public TVirtualMCGeometry {
27
28   public:
29     TFlukaMCGeometry();
30     TFlukaMCGeometry(const char* name, const char* title);
31     virtual ~TFlukaMCGeometry();
32   
33   // functions from GCONS 
34     virtual void  Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z,  
35                        Float_t &dens, Float_t &radl, Float_t &absl,
36                        Float_t* ubuf, Int_t& nbuf);
37     virtual void  Gfmate(Int_t imat, char *name, Double_t &a, Double_t &z,  
38                        Double_t &dens, Double_t &radl, Double_t &absl,
39                        Double_t* ubuf, Int_t& nbuf);
40     // detector composition
41     virtual void  Material(Int_t& kmat, const char* name, Double_t a, 
42                      Double_t z, Double_t dens, Double_t radl, Double_t absl,
43                      Float_t* buf, Int_t nwbuf);
44     virtual void  Material(Int_t& kmat, const char* name, Double_t a, 
45                      Double_t z, Double_t dens, Double_t radl, Double_t absl,
46                      Double_t* buf, Int_t nwbuf);
47     virtual void  Mixture(Int_t& kmat, const char *name, Float_t *a, 
48                      Float_t *z, Double_t dens, Int_t nlmat, Float_t *wmat);
49     virtual void  Mixture(Int_t& kmat, const char *name, Double_t *a, 
50                      Double_t *z, Double_t dens, Int_t nlmat, Double_t *wmat);
51     virtual void  Medium(Int_t& kmed, const char *name, Int_t nmat, 
52                      Int_t isvol, Int_t ifield, Double_t fieldm, Double_t tmaxfd, 
53                      Double_t stemax, Double_t deemax, Double_t epsil, 
54                      Double_t stmin, Float_t* ubuf, Int_t nbuf);
55     virtual void  Medium(Int_t& kmed, const char *name, Int_t nmat, 
56                      Int_t isvol, Int_t ifield, Double_t fieldm, Double_t tmaxfd, 
57                      Double_t stemax, Double_t deemax, Double_t epsil, 
58                      Double_t stmin, Double_t* ubuf, Int_t nbuf);
59     virtual void  Matrix(Int_t& krot, Double_t thetaX, Double_t phiX, 
60                      Double_t thetaY, Double_t phiY, Double_t thetaZ, 
61                      Double_t phiZ);
62
63     // functions from GGEOM 
64     void     Gmtod(Float_t* xm, Float_t* xd, Int_t iflag);
65   
66     void     Gmtod(Double_t* xm, Double_t* xd, Int_t iflag);
67   
68     void     Gdtom(Float_t* xd, Float_t* xm, Int_t iflag);
69   
70     void     Gdtom(Double_t* xd, Double_t* xm, Int_t iflag);
71     virtual Int_t  Gsvolu(const char *name, const char *shape, Int_t nmed,  
72                           Float_t *upar, Int_t np); 
73     virtual Int_t  Gsvolu(const char *name, const char *shape, Int_t nmed,  
74                           Double_t *upar, Int_t np); 
75     virtual void  Gsdvn(const char *name, const char *mother, Int_t ndiv, 
76                          Int_t iaxis); 
77     virtual void  Gsdvn2(const char *name, const char *mother, Int_t ndiv, 
78                          Int_t iaxis, Double_t c0i, Int_t numed); 
79     virtual void  Gsdvt(const char *name, const char *mother, Double_t step, 
80                          Int_t iaxis, Int_t numed, Int_t ndvmx); 
81     virtual void  Gsdvt2(const char *name, const char *mother, Double_t step, 
82                          Int_t iaxis, Double_t c0, Int_t numed, Int_t ndvmx); 
83     virtual void  Gsord(const char *name, Int_t iax); 
84     virtual void  Gspos(const char *name, Int_t nr, const char *mother,  
85                          Double_t x, Double_t y, Double_t z, Int_t irot, 
86                          const char *konly); 
87     virtual void  Gsposp(const char *name, Int_t nr, const char *mother,  
88                          Double_t x, Double_t y, Double_t z, Int_t irot,
89                          const char *konly, Float_t *upar, Int_t np);
90     virtual void  Gsposp(const char *name, Int_t nr, const char *mother,  
91                          Double_t x, Double_t y, Double_t z, Int_t irot,
92                          const char *konly, Double_t *upar, Int_t np);
93     virtual void  Gsbool(const char* /*onlyVolName*/, const char* /*manyVolName*/) {}
94   
95     
96     // functions for drawing
97     //virtual void  DrawOneSpec(const char* name);
98     void  Gsatt(const char* name, const char* att, Int_t val);
99     //virtual void  Gdraw(const char*,Double_t theta, Double_t phi,
100     //                  Double_t psi, Double_t u0, Double_t v0,
101     //                  Double_t ul, Double_t vl);
102
103     // Euclid
104     //virtual void  WriteEuclid(const char*, const char*, Int_t, Int_t);
105                                
106     // get methods
107     Int_t         CurrentVolID(Int_t& copyNo) const;
108     Int_t         CurrentVolOffID(Int_t off, Int_t& copyNo) const;
109     const char*   CurrentVolName() const;
110     const char*   CurrentVolOffName(Int_t off) const;
111     Int_t         GetMedium() const;
112     Int_t        *GetRegionList(Int_t imed, Int_t &nreg);
113     Int_t        *GetMaterialList(Int_t imat, Int_t &nreg);
114     Int_t         GetFlukaMaterial(Int_t imed) const;
115     Int_t         GetLastMaterialIndex() const {return fLastMaterial;}
116     virtual Int_t VolId(const Text_t* volName) const;
117     virtual const char* VolName(Int_t id) const;
118     virtual Int_t NofVolumes() const;
119     virtual Int_t VolId2Mate(Int_t id) const;
120
121    // FLUKA specific methods
122     void          CreateFlukaMatFile(const char *fname=0);
123     void          PrintHeader(ofstream &out, const char *text) const;
124     void          SetMreg(Int_t mreg);
125     void          SetNextRegion(Int_t mreg, Int_t latt);
126     Int_t         RegionId() const; 
127     void          ToFlukaString(TString &str) const;
128
129   private:
130     Double_t* CreateDoubleArray(Float_t* array, Int_t size) const;
131     void     Vname(const char *name, char *vname) const;
132    
133     TFlukaMCGeometry(const TFlukaMCGeometry& rhs);
134     TFlukaMCGeometry& operator=(const TFlukaMCGeometry& rhs) {return (*this);}
135
136     static TFlukaMCGeometry*  fgInstance; // singleton instance
137     Int_t        fLastMaterial;           // last FLUKA material index
138     Int_t        fNextRegion;             // next region number
139     Int_t        fNextLattice;            // next lattice history
140     Int_t       *fRegionList;             //! region list matching a given medium number
141   ClassDef(TFlukaMCGeometry,1)  //Virtual MonteCarlo Interface
142 };
143
144 #endif //ROOT_TFlukaMCGeometry