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