2 // Author: Andrei Gheata 10/07/2003
4 #ifndef ROOT_TFlukaMCGeometry
5 #define ROOT_TFlukaMCGeometry
7 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
8 * See cxx source for full Copyright notice */
12 // Class TFlukaMCGeometry
13 // --------------------
14 // Implementation of the TVirtualMCGeometry interface
15 // for defining and using TGeo geometry with FLUKA.
18 #ifndef ROOT_Riostream
19 #include "Riostream.h"
22 #ifndef ROOT_TVirtualMCGeometry
23 #include "TVirtualMCGeometry.h"
26 class TFlukaMCGeometry : public TVirtualMCGeometry {
30 TFlukaMCGeometry(const char* name, const char* title);
31 virtual ~TFlukaMCGeometry();
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,
63 // functions from GGEOM
64 void Gmtod(Float_t* xm, Float_t* xd, Int_t iflag);
66 void Gmtod(Double_t* xm, Double_t* xd, Int_t iflag);
68 void Gdtom(Float_t* xd, Float_t* xm, Int_t iflag);
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,
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,
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*/) {}
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);
104 //virtual void WriteEuclid(const char*, const char*, Int_t, Int_t);
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;
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;
130 Double_t* CreateDoubleArray(Float_t* array, Int_t size) const;
131 void Vname(const char *name, char *vname) const;
133 TFlukaMCGeometry(const TFlukaMCGeometry& rhs);
134 TFlukaMCGeometry& operator=(const TFlukaMCGeometry& rhs) {return (*this);}
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
144 #endif //ROOT_TFlukaMCGeometry