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