Sync with TFlukaGeo.h
[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// //
00a11cac 11// FLUKA implementation of the VirtualMC 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;
2941d654 27class TGeoMaterial;
6d4d27f2 28
b9d0a01d 29
30class TFluka : public TVirtualMC {
31
03ca248b 32 public:
22229ba5 33 TFluka(const char *title, Int_t verbosity = 0, Bool_t isRootGeometrySupported = 0);
b9d0a01d 34 TFluka();
bf3aa28e 35 virtual ~TFluka();
03ca248b 36
b9d0a01d 37 //
38 // methods for building/management of geometry
39 // ------------------------------------------------
40 //
41
42 // functions from GCONS
43 virtual void Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z,
44 Float_t &dens, Float_t &radl, Float_t &absl,
bf3aa28e 45 Float_t* ubuf, Int_t& nbuf);
b9d0a01d 46 virtual void Gfmate(Int_t imat, char *name, Double_t &a, Double_t &z,
47 Double_t &dens, Double_t &radl, Double_t &absl,
bf3aa28e 48 Double_t* ubuf, Int_t& nbuf);
b9d0a01d 49
50 // detector composition
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 Float_t* buf, Int_t nwbuf);
b9d0a01d 54 virtual void Material(Int_t& kmat, const char* name, Double_t a,
55 Double_t z, Double_t dens, Double_t radl, Double_t absl,
bf3aa28e 56 Double_t* buf, Int_t nwbuf);
b9d0a01d 57 virtual void Mixture(Int_t& kmat, const char *name, Float_t *a,
bf3aa28e 58 Float_t *z, Double_t dens, Int_t nlmat, Float_t *wmat);
b9d0a01d 59 virtual void Mixture(Int_t& kmat, const char *name, Double_t *a,
bf3aa28e 60 Double_t *z, Double_t dens, Int_t nlmat, Double_t *wmat);
b9d0a01d 61 virtual void Medium(Int_t& kmed, const char *name, Int_t nmat,
62 Int_t isvol, Int_t ifield, Double_t fieldm, Double_t tmaxfd,
63 Double_t stemax, Double_t deemax, Double_t epsil,
bf3aa28e 64 Double_t stmin, Float_t* ubuf, Int_t nbuf);
b9d0a01d 65 virtual void Medium(Int_t& kmed, const char *name, Int_t nmat,
66 Int_t isvol, Int_t ifield, Double_t fieldm, Double_t tmaxfd,
67 Double_t stemax, Double_t deemax, Double_t epsil,
bf3aa28e 68 Double_t stmin, Double_t* ubuf, Int_t nbuf);
b9d0a01d 69 virtual void Matrix(Int_t& krot, Double_t thetaX, Double_t phiX,
70 Double_t thetaY, Double_t phiY, Double_t thetaZ,
bf3aa28e 71 Double_t phiZ);
72 virtual void Gstpar(Int_t itmed, const char *param, Double_t parval);
b9d0a01d 73
74 // functions from GGEOM
75 virtual Int_t Gsvolu(const char *name, const char *shape, Int_t nmed,
bf3aa28e 76 Float_t *upar, Int_t np);
b9d0a01d 77 virtual Int_t Gsvolu(const char *name, const char *shape, Int_t nmed,
bf3aa28e 78 Double_t *upar, Int_t np);
b9d0a01d 79 virtual void Gsdvn(const char *name, const char *mother, Int_t ndiv,
bf3aa28e 80 Int_t iaxis);
b9d0a01d 81 virtual void Gsdvn2(const char *name, const char *mother, Int_t ndiv,
bf3aa28e 82 Int_t iaxis, Double_t c0i, Int_t numed);
b9d0a01d 83 virtual void Gsdvt(const char *name, const char *mother, Double_t step,
bf3aa28e 84 Int_t iaxis, Int_t numed, Int_t ndvmx);
b9d0a01d 85 virtual void Gsdvt2(const char *name, const char *mother, Double_t step,
bf3aa28e 86 Int_t iaxis, Double_t c0, Int_t numed, Int_t ndvmx);
87 virtual void Gsord(const char *name, Int_t iax);
b9d0a01d 88 virtual void Gspos(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="ONLY");
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, Float_t *upar, Int_t np);
b9d0a01d 94 virtual void Gsposp(const char *name, Int_t nr, const char *mother,
95 Double_t x, Double_t y, Double_t z, Int_t irot,
bf3aa28e 96 const char *konly, Double_t *upar, Int_t np);
97 virtual void Gsbool(const char* onlyVolName, const char* manyVolName);
b9d0a01d 98
99 virtual void SetCerenkov(Int_t itmed, Int_t npckov, Float_t *ppckov,
bf3aa28e 100 Float_t *absco, Float_t *effic, Float_t *rindex);
b9d0a01d 101 virtual void SetCerenkov(Int_t itmed, Int_t npckov, Double_t *ppckov,
bf3aa28e 102 Double_t *absco, Double_t *effic, Double_t *rindex);
b9d0a01d 103
104
105 // functions for drawing
70541a80 106 virtual void DrawOneSpec(const char* /*name*/)
b9d0a01d 107 {printf("WARNING: DrawOneSpec not yet implemented !\n");}
70541a80 108 virtual void Gsatt(const char* /*name*/, const char* /*att*/, Int_t /*val*/)
b9d0a01d 109 {printf("WARNING: Gsatt not yet implemented !\n");}
70541a80 110 virtual void Gdraw(const char*,Double_t /*theta = 30*/, Double_t /*phi = 30*/,
111 Double_t /*psi = 0*/, Double_t /*u0 = 10*/, Double_t /*v0 = 10*/,
112 Double_t /*ul = 0.01*/, Double_t /*vl = 0.01*/)
b9d0a01d 113 {printf("WARNING: Gdraw not yet implemented !\n");}
114
115 // Euclid
bf3aa28e 116 virtual void WriteEuclid(const char*, const char*, Int_t, Int_t);
b9d0a01d 117
118 // get methods
b0d8df96 119 virtual Int_t VolId(const Text_t* volName) const;
120 virtual const char* VolName(Int_t id) const;
fee5ea25 121 virtual Int_t NofVolumes() const {return fNVolumes;}
b0d8df96 122 virtual Int_t VolId2Mate(Int_t id) const;
b9d0a01d 123 //
124 // methods for physics management
125 // ------------------------------------------------
126 //
127
128 // set methods
1de0a072 129 virtual void SetProcess(const char* flagName, Int_t flagValue);
130 virtual void SetCut(const char* cutName, Double_t cutValue);
131 virtual Double_t Xsec(char*, Double_t, Int_t, Int_t);
b9d0a01d 132
133 // particle table usage
134 virtual Int_t IdFromPDG(Int_t id) const;
b9d0a01d 135 virtual Int_t PDGFromId(Int_t pdg) const;
f9cb2fec 136 virtual void DefineParticles()
137 {printf("WARNING: DefineParticles not yet implemented !\n");}
b9d0a01d 138
139 //
140 // methods for step management
141 // ------------------------------------------------
142 //
143
144 // action methods
145 virtual void StopTrack()
146 {printf("WARNING: StopTrack not yet implemented !\n");}
147 virtual void StopEvent()
148 {printf("WARNING: StopEvent not yet implemented !\n");}
149
150 // set methods
bc021b12 151 virtual void SetMaxStep(Double_t);
152 virtual void SetMaxNStep(Int_t);
153 virtual void SetUserDecay(Int_t);
b9d0a01d 154
155 // get methods
156 // tracking volume(s)
b0d8df96 157 virtual Int_t CurrentVolID(Int_t& copyNo) const;
158 virtual Int_t CurrentVolOffID(Int_t off, Int_t& copyNo) const;
159 virtual const char* CurrentVolName() const;
160 virtual const char* CurrentVolOffName(Int_t off) const;
b9d0a01d 161 virtual Int_t CurrentMaterial(Float_t &a, Float_t &z,
b0d8df96 162 Float_t &dens, Float_t &radl, Float_t &absl) const;
b9d0a01d 163 virtual Int_t CurrentEvent() const
b0d8df96 164 {printf("WARNING: CurrentEvent not yet implemented !\n"); return -1;}
dc37cac6 165 virtual void Gmtod(Float_t* xm, Float_t* xd, Int_t iflag);
166
167 virtual void Gmtod(Double_t* xm, Double_t* xd, Int_t iflag);
168
169 virtual void Gdtom(Float_t* xd, Float_t* xm, Int_t iflag);
170
171 virtual void Gdtom(Double_t* xd, Double_t* xm, Int_t iflag);
172
b9d0a01d 173 virtual Double_t MaxStep() const
174 {printf("WARNING: MaxStep not yet implemented !\n"); return -1.;}
175 virtual Int_t GetMaxNStep() const
176 {printf("WARNING: GetMaxNStep not yet implemented !\n"); return -1;}
27b2f7fe 177 virtual Int_t GetMedium() const;
b9d0a01d 178
179 // tracking particle
180 // dynamic properties
fa3d1cc7 181 virtual void TrackPosition(TLorentzVector& position) const;
1de0a072 182 virtual void TrackPosition(Double_t& x, Double_t& y, Double_t& z) const;
fa3d1cc7 183 virtual void TrackMomentum(TLorentzVector& momentum) const;
1de0a072 184 virtual void TrackMomentum(Double_t& px, Double_t& py, Double_t& pz, Double_t& e) const;
fa3d1cc7 185 virtual Double_t TrackStep() const;
186 virtual Double_t TrackLength() const;
187 virtual Double_t TrackTime() const;
188 virtual Double_t Edep() const;
b9d0a01d 189 // static properties
fa3d1cc7 190 virtual Int_t TrackPid() const;
191 virtual Double_t TrackCharge() const;
192 virtual Double_t TrackMass() const;
193 virtual Double_t Etot() const;
b9d0a01d 194 // track status
fa3d1cc7 195 virtual Bool_t IsNewTrack() const;
196 virtual Bool_t IsTrackInside() const;
197 virtual Bool_t IsTrackEntering() const;
198 virtual Bool_t IsTrackExiting() const;
199 virtual Bool_t IsTrackOut() const;
200 virtual Bool_t IsTrackDisappeared() const;
201 virtual Bool_t IsTrackStop() const;
202 virtual Bool_t IsTrackAlive() const;
03ca248b 203
b9d0a01d 204 // secondaries
fa3d1cc7 205 virtual Int_t NSecondaries() const ;
b9d0a01d 206 virtual void GetSecondary(Int_t isec, Int_t& particleId,
fa3d1cc7 207 TLorentzVector& position, TLorentzVector& momentum);
adbc5ae1 208 virtual TMCProcess ProdProcess(Int_t iproc) const ;
70541a80 209 virtual Int_t StepProcesses(TArrayI &/*proc*/) const
b9d0a01d 210 {printf("WARNING: StepProcesses not yet implemented !\n"); return -1;}
211
212
213 //
214 // Geant3 specific methods
215 // !!! need to be transformed to common interface
216 //
217 virtual void Gdopt(const char*,const char*)
218 {printf("WARNING: Gdopt not yet implemented !\n");}
219 virtual void SetClipBox(const char*,Double_t=-9999,Double_t=0, Double_t=-9999,
220 Double_t=0,Double_t=-9999,Double_t=0)
221 {printf("WARNING: SetClipBox not yet implemented !\n");}
222 virtual void DefaultRange()
223 {printf("WARNING: DefaultRange not yet implemented !\n");}
224 virtual void Gdhead(Int_t, const char*, Double_t=0)
225 {printf("WARNING: Gdhead not yet implemented !\n");}
226 virtual void Gdman(Double_t, Double_t, const char*)
227 {printf("WARNING: Gdman not yet implemented !\n");}
228 virtual void SetColors()
229 {printf("WARNING: SetColors not yet implemented !\n");}
230 virtual void Gtreve()
231 {printf("WARNING: Gtreve not yet implemented !\n");}
232 virtual void GtreveRoot()
233 {printf("WARNING: GtreveRoot not yet implemented !\n");}
234 virtual void Gckmat(Int_t, char*)
235 {printf("WARNING: Gckmat not yet implemented !\n");}
236 virtual void InitLego()
237 {printf("WARNING: InitLego not yet implemented !\n");}
238 virtual void Gfpart(Int_t, char*, Int_t&, Float_t&, Float_t&, Float_t&)
239 {printf("WARNING: Gfpart not yet implemented !\n");}
240 virtual void Gspart(Int_t, const char*, Int_t, Double_t, Double_t, Double_t)
241 {printf("WARNING: Gspart not yet implemented !\n");}
242
a49cf58f 243 // Dummy methods
244 virtual void DefineParticle(int, const char*, TMCParticleType, double, double, double){;}
245 virtual void DefineIon(const char*, int, int, int, double, double){;}
246 virtual TString ParticleName(int) const {return "";}
247 virtual Double_t ParticleMass(int) const {return 0.;}
248 virtual Double_t ParticleCharge(int) const {return 0.;}
249 virtual Double_t ParticleLifeTime(int) const {return 0.;}
250 virtual TMCParticleType ParticleMCType(int) const {return (TMCParticleType) 0;}
2941d654 251 void SetDummyBoundary(Int_t mode) {fDummyBoundary = mode;}
252 Int_t GetDummyBoundary() const {return fDummyBoundary;}
b9d0a01d 253 //
254 // control methods
255 // ------------------------------------------------
256 //
257
258 virtual void Init();
1de0a072 259 virtual void InitPhysics();
bf3aa28e 260 virtual void FinishGeometry();
261 virtual void BuildPhysics();
b9d0a01d 262 virtual void ProcessEvent();
b9d0a01d 263 virtual void ProcessRun(Int_t nevent);
03ca248b 264
03ca248b 265
b9d0a01d 266 //
267 //New Getter and Setters
268 // ------------------------------------------------
269 //
1de0a072 270 // - Core input file name
271 TString GetCoreInputFileName() const {return sCoreInputFileName;}
272 void SetCoreInputFileName(const char* n) {sCoreInputFileName = n;}
273
b9d0a01d 274 // - Input file name
1de0a072 275 TString GetInputFileName() const {return sInputFileName;}
276 void SetInputFileName(const char* n) {sInputFileName = n;}
277
278 // - SetProcess and SetCut
279 Int_t GetProcessNb() const {return iNbOfProc;}
280 void SetProcessNb(Int_t l) {iNbOfProc = l;}
281 Int_t GetCutNb() const {return iNbOfProc;}
282 void SetCutNb(Int_t l) {iNbOfCut = l;}
283
b9d0a01d 284 // - Verbosity level
285 Int_t GetVerbosityLevel() const {return fVerbosityLevel;}
286 void SetVerbosityLevel(Int_t l) {fVerbosityLevel = l;}
fa3d1cc7 287
1de0a072 288 // - Fluka Draw procedures identifiers
289 // bxdraw = 1 inside
290 // bxdraw = 11 entering
291 // bxdraw = 12 exiting
292 // eedraw = 2
293 // endraw = 3
294 // mgdraw = 4
295 // sodraw = 5
296 // usdraw = 6
70541a80 297 Int_t GetCaller() const {return fCaller;}
298 void SetCaller(Int_t l) {fCaller = l;}
1de0a072 299
fa3d1cc7 300 // - Fluka Draw procedures formal parameters
70541a80 301 Int_t GetIcode() const {return fIcode;}
302 void SetIcode(Int_t l) {fIcode = l;}
303 // in the case of sodraw fIcode=0
fa3d1cc7 304
305 Int_t GetMreg() const {return fCurrentFlukaRegion;}
306 void SetMreg(Int_t l) {fCurrentFlukaRegion = l;}
307
1de0a072 308 Int_t GetNewreg() const {return iNewreg;}
309 void SetNewreg(Int_t l) {iNewreg = l;}
fa3d1cc7 310
311 Double_t GetRull() const {return fRull;}
312 void SetRull(Double_t r) {fRull = r;}
313
314 Double_t GetXsco() const {return fXsco;}
315 void SetXsco(Double_t x) {fXsco = x;}
316
317 Double_t GetYsco() const {return fYsco;}
318 void SetYsco(Double_t y) {fYsco = y;}
319
320 Double_t GetZsco() const {return fZsco;}
321 void SetZsco(Double_t z) {fZsco = z;}
322
27b2f7fe 323 void SetCurrentFlukaRegion(Int_t reg) {fCurrentFlukaRegion=reg;}
324 Int_t GetCurrentFlukaRegion() const {return fCurrentFlukaRegion;}
24969d13 325
326 void SetTrackIsEntering(){fTrackIsEntering = kTRUE; fTrackIsExiting = kFALSE;}
fbf08100 327 void SetTrackIsExiting() {fTrackIsExiting = kTRUE; fTrackIsEntering = kFALSE;}
24969d13 328 void SetTrackIsInside() {fTrackIsExiting = kFALSE; fTrackIsEntering = kFALSE;}
fbf08100 329 void SetTrackIsNew(Bool_t flag=kTRUE) {fTrackIsNew = flag;}
fa3d1cc7 330
b9d0a01d 331 private:
70541a80 332 TFluka(const TFluka &mc): TVirtualMC(mc) {;}
b9d0a01d 333 TFluka & operator=(const TFluka &) {return (*this);}
e8f0734b 334
b9d0a01d 335 protected:
336 Int_t fVerbosityLevel; //Verbosity level (0 lowest - 3 highest)
e8f0734b 337
1de0a072 338 TString sInputFileName; //Name of the real input file (e.g. alice.inp)
339 TString sCoreInputFileName; //Name of the input file (e.g. corealice.inp)
e8f0734b 340
70541a80 341 Int_t fCaller; //Parameter to indicate who is the caller of the Fluka Draw
e8f0734b 342 Int_t fIcode; //Fluka Draw procedures formal parameter
1de0a072 343 Int_t iNewreg; //Fluka Draw procedures formal parameter
fa3d1cc7 344 Double_t fRull; //Fluka Draw procedures formal parameter
345 Double_t fXsco; //Fluka Draw procedures formal parameter
346 Double_t fYsco; //Fluka Draw procedures formal parameter
347 Double_t fZsco; //Fluka Draw procedures formal parameter
24969d13 348 Bool_t fTrackIsEntering; // Flag for track entering
e8f0734b 349 Bool_t fTrackIsExiting; // Flag for track exiting
fbf08100 350 Bool_t fTrackIsNew; // Flag for new track
e8f0734b 351
1de0a072 352 //variables for SetProcess and SetCut
353 Int_t iNbOfProc;
354 Int_t iProcessValue[100];
355 Char_t sProcessFlag[100][5];
356 Int_t iNbOfCut;
357 Double_t fCutValue[100];
358 Char_t sCutFlag[100][7];
2941d654 359 Int_t fDummyBoundary;
360
bf3aa28e 361 //Geometry through Geant4 for the time being!!!
bf575ea2 362 TG4GeometryManager* fGeometryManager; //Geometry manager
363 TG4DetConstruction* fDetector; //Detector
e8f0734b 364
bf575ea2 365 TClonesArray* fVolumeMediaMap; //!Transient list of volumes
366
367 Int_t fNVolumes; //!Current number of volumes
368 Int_t* fMediaByRegion; //!Media by Fluka region
369 Int_t fCurrentFlukaRegion; //Index of fluka region at each step
b9d0a01d 370 ClassDef(TFluka,1) //C++ interface to Fluka montecarlo
03ca248b 371};
372
b9d0a01d 373#endif //TFLUKA
03ca248b 374