8495a208 |
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: |
d11bf3ca |
29 | enum EFlukaLatticeTypes { |
30 | kLttcOutside = 999999999, |
31 | kLttcVirtual = 1000000000 |
32 | }; |
33 | |
8495a208 |
34 | TFlukaMCGeometry(); |
35 | TFlukaMCGeometry(const char* name, const char* title); |
36 | virtual ~TFlukaMCGeometry(); |
37 | |
38 | // functions from GCONS |
39 | virtual void Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z, |
40 | Float_t &dens, Float_t &radl, Float_t &absl, |
41 | Float_t* ubuf, Int_t& nbuf); |
42 | virtual void Gfmate(Int_t imat, char *name, Double_t &a, Double_t &z, |
43 | Double_t &dens, Double_t &radl, Double_t &absl, |
44 | Double_t* ubuf, Int_t& nbuf); |
45 | // detector composition |
46 | virtual void Material(Int_t& kmat, const char* name, Double_t a, |
47 | Double_t z, Double_t dens, Double_t radl, Double_t absl, |
48 | Float_t* buf, Int_t nwbuf); |
49 | virtual void Material(Int_t& kmat, const char* name, Double_t a, |
50 | Double_t z, Double_t dens, Double_t radl, Double_t absl, |
51 | Double_t* buf, Int_t nwbuf); |
52 | virtual void Mixture(Int_t& kmat, const char *name, Float_t *a, |
53 | Float_t *z, Double_t dens, Int_t nlmat, Float_t *wmat); |
54 | virtual void Mixture(Int_t& kmat, const char *name, Double_t *a, |
55 | Double_t *z, Double_t dens, Int_t nlmat, Double_t *wmat); |
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, Float_t* ubuf, Int_t nbuf); |
60 | virtual void Medium(Int_t& kmed, const char *name, Int_t nmat, |
61 | Int_t isvol, Int_t ifield, Double_t fieldm, Double_t tmaxfd, |
62 | Double_t stemax, Double_t deemax, Double_t epsil, |
63 | Double_t stmin, Double_t* ubuf, Int_t nbuf); |
64 | virtual void Matrix(Int_t& krot, Double_t thetaX, Double_t phiX, |
65 | Double_t thetaY, Double_t phiY, Double_t thetaZ, |
66 | Double_t phiZ); |
67 | |
68 | // functions from GGEOM |
69 | void Gmtod(Float_t* xm, Float_t* xd, Int_t iflag); |
70 | |
71 | void Gmtod(Double_t* xm, Double_t* xd, Int_t iflag); |
72 | |
73 | void Gdtom(Float_t* xd, Float_t* xm, Int_t iflag); |
74 | |
75 | void Gdtom(Double_t* xd, Double_t* xm, Int_t iflag); |
76 | virtual Int_t Gsvolu(const char *name, const char *shape, Int_t nmed, |
77 | Float_t *upar, Int_t np); |
78 | virtual Int_t Gsvolu(const char *name, const char *shape, Int_t nmed, |
79 | Double_t *upar, Int_t np); |
80 | virtual void Gsdvn(const char *name, const char *mother, Int_t ndiv, |
81 | Int_t iaxis); |
82 | virtual void Gsdvn2(const char *name, const char *mother, Int_t ndiv, |
83 | Int_t iaxis, Double_t c0i, Int_t numed); |
84 | virtual void Gsdvt(const char *name, const char *mother, Double_t step, |
85 | Int_t iaxis, Int_t numed, Int_t ndvmx); |
86 | virtual void Gsdvt2(const char *name, const char *mother, Double_t step, |
87 | Int_t iaxis, Double_t c0, Int_t numed, Int_t ndvmx); |
88 | virtual void Gsord(const char *name, Int_t iax); |
89 | virtual void Gspos(const char *name, Int_t nr, const char *mother, |
90 | Double_t x, Double_t y, Double_t z, Int_t irot, |
91 | const char *konly); |
92 | virtual void Gsposp(const char *name, Int_t nr, const char *mother, |
93 | Double_t x, Double_t y, Double_t z, Int_t irot, |
94 | const char *konly, Float_t *upar, Int_t np); |
95 | virtual void Gsposp(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, Double_t *upar, Int_t np); |
98 | virtual void Gsbool(const char* /*onlyVolName*/, const char* /*manyVolName*/) {} |
99 | |
100 | |
101 | // functions for drawing |
102 | //virtual void DrawOneSpec(const char* name); |
103 | void Gsatt(const char* name, const char* att, Int_t val); |
104 | //virtual void Gdraw(const char*,Double_t theta, Double_t phi, |
105 | // Double_t psi, Double_t u0, Double_t v0, |
106 | // Double_t ul, Double_t vl); |
107 | |
108 | // Euclid |
109 | //virtual void WriteEuclid(const char*, const char*, Int_t, Int_t); |
110 | |
111 | // get methods |
112 | Int_t CurrentVolID(Int_t& copyNo) const; |
113 | Int_t CurrentVolOffID(Int_t off, Int_t& copyNo) const; |
114 | const char* CurrentVolName() const; |
115 | const char* CurrentVolOffName(Int_t off) const; |
116 | Int_t GetMedium() const; |
b1536e91 |
117 | Int_t *GetRegionList(Int_t imed, Int_t &nreg); |
118 | Int_t *GetMaterialList(Int_t imat, Int_t &nreg); |
0bc73b6c |
119 | Int_t GetFlukaMaterial(Int_t imed) const; |
efde9b4d |
120 | Int_t GetLastMaterialIndex() const {return fLastMaterial;} |
8495a208 |
121 | virtual Int_t VolId(const Text_t* volName) const; |
122 | virtual const char* VolName(Int_t id) const; |
123 | virtual Int_t NofVolumes() const; |
124 | virtual Int_t VolId2Mate(Int_t id) const; |
125 | |
126 | // FLUKA specific methods |
efde9b4d |
127 | void CreateFlukaMatFile(const char *fname=0); |
8495a208 |
128 | void PrintHeader(ofstream &out, const char *text) const; |
2bc4c610 |
129 | Bool_t IsDebugging() const {return fDebug;} |
130 | void SetDebugMode(Bool_t flag=kTRUE) {fDebug = flag;} |
05265ca9 |
131 | void SetMreg(Int_t mreg); |
d11bf3ca |
132 | void SetCurrentRegion(Int_t mreg, Int_t latt); |
133 | void GetCurrentRegion(Int_t &mreg, Int_t &latt) const {mreg=fCurrentRegion; latt=fCurrentLattice;} |
05265ca9 |
134 | void SetNextRegion(Int_t mreg, Int_t latt); |
d11bf3ca |
135 | void GetNextRegion(Int_t &mreg, Int_t &latt) const {mreg=fNextRegion; latt=fNextLattice;} |
8495a208 |
136 | Int_t RegionId() const; |
137 | void ToFlukaString(TString &str) const; |
138 | |
139 | private: |
140 | Double_t* CreateDoubleArray(Float_t* array, Int_t size) const; |
141 | void Vname(const char *name, char *vname) const; |
142 | |
143 | TFlukaMCGeometry(const TFlukaMCGeometry& rhs); |
144 | TFlukaMCGeometry& operator=(const TFlukaMCGeometry& rhs) {return (*this);} |
145 | |
146 | static TFlukaMCGeometry* fgInstance; // singleton instance |
2bc4c610 |
147 | Bool_t fDebug; // debug flag |
05265ca9 |
148 | Int_t fLastMaterial; // last FLUKA material index |
d11bf3ca |
149 | Int_t fCurrentRegion; // current region number |
150 | Int_t fCurrentLattice; // current lattice history |
05265ca9 |
151 | Int_t fNextRegion; // next region number |
152 | Int_t fNextLattice; // next lattice history |
b1536e91 |
153 | Int_t *fRegionList; //! region list matching a given medium number |
8495a208 |
154 | ClassDef(TFlukaMCGeometry,1) //Virtual MonteCarlo Interface |
155 | }; |
156 | |
157 | #endif //ROOT_TFlukaMCGeometry |