Region to media mapping corrected and improved.
[u/mrichter/AliRoot.git] / TFluka / TFluka.h
CommitLineData
b9d0a01d 1#ifndef TFLUKA
2#define TFLUKA
03ca248b 3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6/* $Id$ */
7
8///////////////////////////////////////////////////////////////////////////////
9// //
10// //
27b2f7fe 11// FLUKA implementation of the AliMC Interface //
03ca248b 12// //
13// //
14///////////////////////////////////////////////////////////////////////////////
15
16
b9d0a01d 17#include "TVirtualMC.h"
18#include "TMCProcess.h"
03ca248b 19
27b2f7fe 20#include <map>
21#include <vector>
22
bf3aa28e 23//Forward declaration
24class TG4GeometryManager;
25class TG4DetConstruction;
6d4d27f2 26class TClonesArray;
27
b9d0a01d 28
29class TFluka : public TVirtualMC {
30
03ca248b 31 public:
b9d0a01d 32 TFluka(const char *title, Int_t verbosity = 0);
33 TFluka();
bf3aa28e 34 virtual ~TFluka();
03ca248b 35
b9d0a01d 36 //
37 // methods for building/management of geometry
38 // ------------------------------------------------
39 //
40
41 // functions from GCONS
42 virtual void Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z,
43 Float_t &dens, Float_t &radl, Float_t &absl,
bf3aa28e 44 Float_t* ubuf, Int_t& nbuf);
b9d0a01d 45 virtual void Gfmate(Int_t imat, char *name, Double_t &a, Double_t &z,
46 Double_t &dens, Double_t &radl, Double_t &absl,
bf3aa28e 47 Double_t* ubuf, Int_t& nbuf);
b9d0a01d 48
49 // detector composition
50 virtual void Material(Int_t& kmat, const char* name, Double_t a,
51 Double_t z, Double_t dens, Double_t radl, Double_t absl,
bf3aa28e 52 Float_t* buf, Int_t nwbuf);
b9d0a01d 53 virtual void Material(Int_t& kmat, const char* name, Double_t a,
54 Double_t z, Double_t dens, Double_t radl, Double_t absl,
bf3aa28e 55 Double_t* buf, Int_t nwbuf);
b9d0a01d 56 virtual void Mixture(Int_t& kmat, const char *name, Float_t *a,
bf3aa28e 57 Float_t *z, Double_t dens, Int_t nlmat, Float_t *wmat);
b9d0a01d 58 virtual void Mixture(Int_t& kmat, const char *name, Double_t *a,
bf3aa28e 59 Double_t *z, Double_t dens, Int_t nlmat, Double_t *wmat);
b9d0a01d 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,
bf3aa28e 63 Double_t stmin, Float_t* ubuf, Int_t nbuf);
b9d0a01d 64 virtual void Medium(Int_t& kmed, const char *name, Int_t nmat,
65 Int_t isvol, Int_t ifield, Double_t fieldm, Double_t tmaxfd,
66 Double_t stemax, Double_t deemax, Double_t epsil,
bf3aa28e 67 Double_t stmin, Double_t* ubuf, Int_t nbuf);
b9d0a01d 68 virtual void Matrix(Int_t& krot, Double_t thetaX, Double_t phiX,
69 Double_t thetaY, Double_t phiY, Double_t thetaZ,
bf3aa28e 70 Double_t phiZ);
71 virtual void Gstpar(Int_t itmed, const char *param, Double_t parval);
b9d0a01d 72
73 // functions from GGEOM
74 virtual Int_t Gsvolu(const char *name, const char *shape, Int_t nmed,
bf3aa28e 75 Float_t *upar, Int_t np);
b9d0a01d 76 virtual Int_t Gsvolu(const char *name, const char *shape, Int_t nmed,
bf3aa28e 77 Double_t *upar, Int_t np);
b9d0a01d 78 virtual void Gsdvn(const char *name, const char *mother, Int_t ndiv,
bf3aa28e 79 Int_t iaxis);
b9d0a01d 80 virtual void Gsdvn2(const char *name, const char *mother, Int_t ndiv,
bf3aa28e 81 Int_t iaxis, Double_t c0i, Int_t numed);
b9d0a01d 82 virtual void Gsdvt(const char *name, const char *mother, Double_t step,
bf3aa28e 83 Int_t iaxis, Int_t numed, Int_t ndvmx);
b9d0a01d 84 virtual void Gsdvt2(const char *name, const char *mother, Double_t step,
bf3aa28e 85 Int_t iaxis, Double_t c0, Int_t numed, Int_t ndvmx);
86 virtual void Gsord(const char *name, Int_t iax);
b9d0a01d 87 virtual void Gspos(const char *name, Int_t nr, const char *mother,
88 Double_t x, Double_t y, Double_t z, Int_t irot,
bf3aa28e 89 const char *konly="ONLY");
b9d0a01d 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,
bf3aa28e 92 const char *konly, Float_t *upar, Int_t np);
b9d0a01d 93 virtual void Gsposp(const char *name, Int_t nr, const char *mother,
94 Double_t x, Double_t y, Double_t z, Int_t irot,
bf3aa28e 95 const char *konly, Double_t *upar, Int_t np);
96 virtual void Gsbool(const char* onlyVolName, const char* manyVolName);
b9d0a01d 97
98 virtual void SetCerenkov(Int_t itmed, Int_t npckov, Float_t *ppckov,
bf3aa28e 99 Float_t *absco, Float_t *effic, Float_t *rindex);
b9d0a01d 100 virtual void SetCerenkov(Int_t itmed, Int_t npckov, Double_t *ppckov,
bf3aa28e 101 Double_t *absco, Double_t *effic, Double_t *rindex);
b9d0a01d 102
103
104 // functions for drawing
105 virtual void DrawOneSpec(const char* name)
106 {printf("WARNING: DrawOneSpec not yet implemented !\n");}
107 virtual void Gsatt(const char* name, const char* att, Int_t val)
108 {printf("WARNING: Gsatt not yet implemented !\n");}
109 virtual void Gdraw(const char*,Double_t theta = 30, Double_t phi = 30,
110 Double_t psi = 0, Double_t u0 = 10, Double_t v0 = 10,
111 Double_t ul = 0.01, Double_t vl = 0.01)
112 {printf("WARNING: Gdraw not yet implemented !\n");}
113
114 // Euclid
bf3aa28e 115 virtual void WriteEuclid(const char*, const char*, Int_t, Int_t);
b9d0a01d 116
117 // get methods
118 virtual Int_t VolId(const Text_t* volName) const
119 {printf("WARNING: VolId not yet implemented !\n"); return -1;}
120 virtual const char* VolName(Int_t id) const
121 {printf("WARNING: VolName not yet implemented !\n"); return "void";}
122 virtual Int_t NofVolumes() const
123 {printf("WARNING: NofVolumes not yet implemented !\n"); return -1;}
124 virtual Int_t VolId2Mate(Int_t id) const
125 {printf("WARNING: VolId2Mate not yet implemented !\n"); return -1;}
126
127 //
128 // methods for physics management
129 // ------------------------------------------------
130 //
131
132 // set methods
133 virtual void SetCut(const char* cutName, Double_t cutValue)
134 {printf("WARNING: SetCut not yet implemented !\n");}
135 virtual void SetProcess(const char* flagName, Int_t flagValue)
136 {printf("WARNING: SetProcess not yet implemented !\n");}
137 virtual Double_t Xsec(char*, Double_t, Int_t, Int_t)
138 {printf("WARNING: Xsec not yet implemented !\n"); return -1.;}
139
140 // particle table usage
141 virtual Int_t IdFromPDG(Int_t id) const;
b9d0a01d 142 virtual Int_t PDGFromId(Int_t pdg) const;
f9cb2fec 143 virtual void DefineParticles()
144 {printf("WARNING: DefineParticles not yet implemented !\n");}
b9d0a01d 145
146 //
147 // methods for step management
148 // ------------------------------------------------
149 //
150
151 // action methods
152 virtual void StopTrack()
153 {printf("WARNING: StopTrack not yet implemented !\n");}
154 virtual void StopEvent()
155 {printf("WARNING: StopEvent not yet implemented !\n");}
156
157 // set methods
158 virtual void SetMaxStep(Double_t)
159 {printf("WARNING: SetMaxStep not yet implemented !\n");}
160 virtual void SetMaxNStep(Int_t)
161 {printf("WARNING: SetMaxNStep not yet implemented !\n");}
162 virtual void SetUserDecay(Int_t)
163 {printf("WARNING: SetUserDecay not yet implemented !\n");}
164
165 // get methods
166 // tracking volume(s)
167 virtual Int_t CurrentVolID(Int_t& copyNo) const
168 {printf("WARNING: CurrentVolID not yet implemented !\n"); return -1;}
169 virtual Int_t CurrentVolOffID(Int_t off, Int_t& copyNo) const
170 {printf("WARNING: CurrentVolOffID not yet implemented !\n"); return -1;}
171 virtual const char* CurrentVolName() const
172 {printf("WARNING: CurrentVolName not yet implemented !\n"); return "void";}
173 virtual const char* CurrentVolOffName(Int_t off) const
174 {printf("WARNING: CurrentVolOffName not yet implemented !\n"); return "void";}
175 virtual Int_t CurrentMaterial(Float_t &a, Float_t &z,
176 Float_t &dens, Float_t &radl, Float_t &absl) const
177 {printf("WARNING: CurrentMaterial not yet implemented !\n"); return -1;}
178 virtual Int_t CurrentEvent() const
179 {printf("WARNING: CurrentEvent not yet implemented !\n"); return -1;}
180 virtual void Gmtod(Float_t* xm, Float_t* xd, Int_t iflag)
181 {printf("WARNING: Gmtod not yet implemented !\n");}
182 virtual void Gmtod(Double_t* xm, Double_t* xd, Int_t iflag)
183 {printf("WARNING: Gmtod not yet implemented !\n");}
184 virtual void Gdtom(Float_t* xd, Float_t* xm, Int_t iflag)
185 {printf("WARNING: Gdtom not yet implemented !\n");}
186 virtual void Gdtom(Double_t* xd, Double_t* xm, Int_t iflag)
187 {printf("WARNING: Gdtom not yet implemented !\n");}
188 virtual Double_t MaxStep() const
189 {printf("WARNING: MaxStep not yet implemented !\n"); return -1.;}
190 virtual Int_t GetMaxNStep() const
191 {printf("WARNING: GetMaxNStep not yet implemented !\n"); return -1;}
27b2f7fe 192 virtual Int_t GetMedium() const;
b9d0a01d 193
194 // tracking particle
195 // dynamic properties
fa3d1cc7 196 virtual void TrackPosition(TLorentzVector& position) const;
197 virtual void TrackMomentum(TLorentzVector& momentum) const;
198 virtual Double_t TrackStep() const;
199 virtual Double_t TrackLength() const;
200 virtual Double_t TrackTime() const;
201 virtual Double_t Edep() const;
b9d0a01d 202 // static properties
fa3d1cc7 203 virtual Int_t TrackPid() const;
204 virtual Double_t TrackCharge() const;
205 virtual Double_t TrackMass() const;
206 virtual Double_t Etot() const;
b9d0a01d 207 // track status
fa3d1cc7 208 virtual Bool_t IsNewTrack() const;
209 virtual Bool_t IsTrackInside() const;
210 virtual Bool_t IsTrackEntering() const;
211 virtual Bool_t IsTrackExiting() const;
212 virtual Bool_t IsTrackOut() const;
213 virtual Bool_t IsTrackDisappeared() const;
214 virtual Bool_t IsTrackStop() const;
215 virtual Bool_t IsTrackAlive() const;
03ca248b 216
b9d0a01d 217 // secondaries
fa3d1cc7 218 virtual Int_t NSecondaries() const ;
b9d0a01d 219 virtual void GetSecondary(Int_t isec, Int_t& particleId,
fa3d1cc7 220 TLorentzVector& position, TLorentzVector& momentum);
b9d0a01d 221 virtual TMCProcess ProdProcess(Int_t isec) const
222 {printf("WARNING: StepProcesses not yet implemented !\n"); return kPNoProcess;}
223 virtual Int_t StepProcesses(TArrayI &proc) const
224 {printf("WARNING: StepProcesses not yet implemented !\n"); return -1;}
225
226
227 //
228 // Geant3 specific methods
229 // !!! need to be transformed to common interface
230 //
231 virtual void Gdopt(const char*,const char*)
232 {printf("WARNING: Gdopt not yet implemented !\n");}
233 virtual void SetClipBox(const char*,Double_t=-9999,Double_t=0, Double_t=-9999,
234 Double_t=0,Double_t=-9999,Double_t=0)
235 {printf("WARNING: SetClipBox not yet implemented !\n");}
236 virtual void DefaultRange()
237 {printf("WARNING: DefaultRange not yet implemented !\n");}
238 virtual void Gdhead(Int_t, const char*, Double_t=0)
239 {printf("WARNING: Gdhead not yet implemented !\n");}
240 virtual void Gdman(Double_t, Double_t, const char*)
241 {printf("WARNING: Gdman not yet implemented !\n");}
242 virtual void SetColors()
243 {printf("WARNING: SetColors not yet implemented !\n");}
244 virtual void Gtreve()
245 {printf("WARNING: Gtreve not yet implemented !\n");}
246 virtual void GtreveRoot()
247 {printf("WARNING: GtreveRoot not yet implemented !\n");}
248 virtual void Gckmat(Int_t, char*)
249 {printf("WARNING: Gckmat not yet implemented !\n");}
250 virtual void InitLego()
251 {printf("WARNING: InitLego not yet implemented !\n");}
252 virtual void Gfpart(Int_t, char*, Int_t&, Float_t&, Float_t&, Float_t&)
253 {printf("WARNING: Gfpart not yet implemented !\n");}
254 virtual void Gspart(Int_t, const char*, Int_t, Double_t, Double_t, Double_t)
255 {printf("WARNING: Gspart not yet implemented !\n");}
256
257 //
258 // control methods
259 // ------------------------------------------------
260 //
261
262 virtual void Init();
bf3aa28e 263 virtual void FinishGeometry();
264 virtual void BuildPhysics();
b9d0a01d 265 virtual void ProcessEvent();
b9d0a01d 266 virtual void ProcessRun(Int_t nevent);
03ca248b 267
03ca248b 268
b9d0a01d 269 //
270 //New Getter and Setters
271 // ------------------------------------------------
272 //
273 // - Input file name
274 TString GetInputFileName() const {return fInputFileName;}
275 void SetInputFileName(const char* n) {fInputFileName = n;}
276 // - Verbosity level
277 Int_t GetVerbosityLevel() const {return fVerbosityLevel;}
278 void SetVerbosityLevel(Int_t l) {fVerbosityLevel = l;}
fa3d1cc7 279
280 // - Fluka Draw procedures formal parameters
281 Int_t GetIcode() const {return fIcode;}
282 void SetIcode(Int_t l) {fIcode = l;}
283
284 Int_t GetMreg() const {return fCurrentFlukaRegion;}
285 void SetMreg(Int_t l) {fCurrentFlukaRegion = l;}
286
287 Int_t GetNewreg() const {return fNewreg;}
288 void SetNewreg(Int_t l) {fNewreg = l;}
289
290 Double_t GetRull() const {return fRull;}
291 void SetRull(Double_t r) {fRull = r;}
292
293 Double_t GetXsco() const {return fXsco;}
294 void SetXsco(Double_t x) {fXsco = x;}
295
296 Double_t GetYsco() const {return fYsco;}
297 void SetYsco(Double_t y) {fYsco = y;}
298
299 Double_t GetZsco() const {return fZsco;}
300 void SetZsco(Double_t z) {fZsco = z;}
301
27b2f7fe 302 void SetCurrentFlukaRegion(Int_t reg) {fCurrentFlukaRegion=reg;}
303 Int_t GetCurrentFlukaRegion() const {return fCurrentFlukaRegion;}
fa3d1cc7 304 //
305 // test
306 // ------------------------------------------------
307 //
308 virtual void FutoTest() ;
309
b9d0a01d 310 private:
311 TFluka(const TFluka &mc){}
312 TFluka & operator=(const TFluka &) {return (*this);}
03ca248b 313
b9d0a01d 314 protected:
315 Int_t fVerbosityLevel; //Verbosity level (0 lowest - 3 highest)
fa3d1cc7 316
317 TString fInputFileName; //Name of the input file (f.e. mu.inp)
318
319 Int_t fIcode; //Fluka Draw procedures formal parameter
fa3d1cc7 320 Int_t fNewreg; //Fluka Draw procedures formal parameter
321 Double_t fRull; //Fluka Draw procedures formal parameter
322 Double_t fXsco; //Fluka Draw procedures formal parameter
323 Double_t fYsco; //Fluka Draw procedures formal parameter
324 Double_t fZsco; //Fluka Draw procedures formal parameter
325
03ca248b 326
03ca248b 327
bf3aa28e 328 //Geometry through Geant4 for the time being!!!
6d4d27f2 329 TG4GeometryManager* fGeometryManager; //Geometry manager
bf3aa28e 330 TG4DetConstruction* fDetector; //Detector
03ca248b 331
6d4d27f2 332 TClonesArray* fVolumeMediaMap; //!Transient list of volumes
333 Int_t fNVolumes; //!Current number of volumes
334 Int_t* fMediaByRegion; //!Media by Fluka region
fa3d1cc7 335
6d4d27f2 336
337 Int_t fCurrentFlukaRegion; //Index of fluka region at each step
b9d0a01d 338 ClassDef(TFluka,1) //C++ interface to Fluka montecarlo
03ca248b 339};
340
b9d0a01d 341#endif //TFLUKA
03ca248b 342