]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TFluka/TFluka.h
Clean-up. (A. Gheata)
[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;
27
b9d0a01d 28
29class TFluka : public TVirtualMC {
30
03ca248b 31 public:
22229ba5 32 TFluka(const char *title, Int_t verbosity = 0, Bool_t isRootGeometrySupported = 0);
b9d0a01d 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
70541a80 105 virtual void DrawOneSpec(const char* /*name*/)
b9d0a01d 106 {printf("WARNING: DrawOneSpec not yet implemented !\n");}
70541a80 107 virtual void Gsatt(const char* /*name*/, const char* /*att*/, Int_t /*val*/)
b9d0a01d 108 {printf("WARNING: Gsatt not yet implemented !\n");}
70541a80 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*/)
b9d0a01d 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
b0d8df96 118 virtual Int_t VolId(const Text_t* volName) const;
119 virtual const char* VolName(Int_t id) const;
fee5ea25 120 virtual Int_t NofVolumes() const {return fNVolumes;}
b0d8df96 121 virtual Int_t VolId2Mate(Int_t id) const;
b9d0a01d 122 //
123 // methods for physics management
124 // ------------------------------------------------
125 //
126
127 // set methods
1de0a072 128 virtual void SetProcess(const char* flagName, Int_t flagValue);
129 virtual void SetCut(const char* cutName, Double_t cutValue);
130 virtual Double_t Xsec(char*, Double_t, Int_t, Int_t);
b9d0a01d 131
132 // particle table usage
133 virtual Int_t IdFromPDG(Int_t id) const;
b9d0a01d 134 virtual Int_t PDGFromId(Int_t pdg) const;
f9cb2fec 135 virtual void DefineParticles()
136 {printf("WARNING: DefineParticles not yet implemented !\n");}
b9d0a01d 137
138 //
139 // methods for step management
140 // ------------------------------------------------
141 //
142
143 // action methods
144 virtual void StopTrack()
145 {printf("WARNING: StopTrack not yet implemented !\n");}
146 virtual void StopEvent()
147 {printf("WARNING: StopEvent not yet implemented !\n");}
148
149 // set methods
bc021b12 150 virtual void SetMaxStep(Double_t);
151 virtual void SetMaxNStep(Int_t);
152 virtual void SetUserDecay(Int_t);
b9d0a01d 153
154 // get methods
155 // tracking volume(s)
b0d8df96 156 virtual Int_t CurrentVolID(Int_t& copyNo) const;
157 virtual Int_t CurrentVolOffID(Int_t off, Int_t& copyNo) const;
158 virtual const char* CurrentVolName() const;
159 virtual const char* CurrentVolOffName(Int_t off) const;
b9d0a01d 160 virtual Int_t CurrentMaterial(Float_t &a, Float_t &z,
b0d8df96 161 Float_t &dens, Float_t &radl, Float_t &absl) const;
b9d0a01d 162 virtual Int_t CurrentEvent() const
b0d8df96 163 {printf("WARNING: CurrentEvent not yet implemented !\n"); return -1;}
dc37cac6 164 virtual void Gmtod(Float_t* xm, Float_t* xd, Int_t iflag);
165
166 virtual void Gmtod(Double_t* xm, Double_t* xd, Int_t iflag);
167
168 virtual void Gdtom(Float_t* xd, Float_t* xm, Int_t iflag);
169
170 virtual void Gdtom(Double_t* xd, Double_t* xm, Int_t iflag);
171
b9d0a01d 172 virtual Double_t MaxStep() const
173 {printf("WARNING: MaxStep not yet implemented !\n"); return -1.;}
174 virtual Int_t GetMaxNStep() const
175 {printf("WARNING: GetMaxNStep not yet implemented !\n"); return -1;}
27b2f7fe 176 virtual Int_t GetMedium() const;
b9d0a01d 177
178 // tracking particle
179 // dynamic properties
fa3d1cc7 180 virtual void TrackPosition(TLorentzVector& position) const;
1de0a072 181 virtual void TrackPosition(Double_t& x, Double_t& y, Double_t& z) const;
fa3d1cc7 182 virtual void TrackMomentum(TLorentzVector& momentum) const;
1de0a072 183 virtual void TrackMomentum(Double_t& px, Double_t& py, Double_t& pz, Double_t& e) const;
fa3d1cc7 184 virtual Double_t TrackStep() const;
185 virtual Double_t TrackLength() const;
186 virtual Double_t TrackTime() const;
187 virtual Double_t Edep() const;
b9d0a01d 188 // static properties
fa3d1cc7 189 virtual Int_t TrackPid() const;
190 virtual Double_t TrackCharge() const;
191 virtual Double_t TrackMass() const;
192 virtual Double_t Etot() const;
b9d0a01d 193 // track status
fa3d1cc7 194 virtual Bool_t IsNewTrack() const;
195 virtual Bool_t IsTrackInside() const;
196 virtual Bool_t IsTrackEntering() const;
197 virtual Bool_t IsTrackExiting() const;
198 virtual Bool_t IsTrackOut() const;
199 virtual Bool_t IsTrackDisappeared() const;
200 virtual Bool_t IsTrackStop() const;
201 virtual Bool_t IsTrackAlive() const;
03ca248b 202
b9d0a01d 203 // secondaries
fa3d1cc7 204 virtual Int_t NSecondaries() const ;
b9d0a01d 205 virtual void GetSecondary(Int_t isec, Int_t& particleId,
fa3d1cc7 206 TLorentzVector& position, TLorentzVector& momentum);
adbc5ae1 207 virtual TMCProcess ProdProcess(Int_t iproc) const ;
70541a80 208 virtual Int_t StepProcesses(TArrayI &/*proc*/) const
b9d0a01d 209 {printf("WARNING: StepProcesses not yet implemented !\n"); return -1;}
210
211
212 //
213 // Geant3 specific methods
214 // !!! need to be transformed to common interface
215 //
216 virtual void Gdopt(const char*,const char*)
217 {printf("WARNING: Gdopt not yet implemented !\n");}
218 virtual void SetClipBox(const char*,Double_t=-9999,Double_t=0, Double_t=-9999,
219 Double_t=0,Double_t=-9999,Double_t=0)
220 {printf("WARNING: SetClipBox not yet implemented !\n");}
221 virtual void DefaultRange()
222 {printf("WARNING: DefaultRange not yet implemented !\n");}
223 virtual void Gdhead(Int_t, const char*, Double_t=0)
224 {printf("WARNING: Gdhead not yet implemented !\n");}
225 virtual void Gdman(Double_t, Double_t, const char*)
226 {printf("WARNING: Gdman not yet implemented !\n");}
227 virtual void SetColors()
228 {printf("WARNING: SetColors not yet implemented !\n");}
229 virtual void Gtreve()
230 {printf("WARNING: Gtreve not yet implemented !\n");}
231 virtual void GtreveRoot()
232 {printf("WARNING: GtreveRoot not yet implemented !\n");}
233 virtual void Gckmat(Int_t, char*)
234 {printf("WARNING: Gckmat not yet implemented !\n");}
235 virtual void InitLego()
236 {printf("WARNING: InitLego not yet implemented !\n");}
237 virtual void Gfpart(Int_t, char*, Int_t&, Float_t&, Float_t&, Float_t&)
238 {printf("WARNING: Gfpart not yet implemented !\n");}
239 virtual void Gspart(Int_t, const char*, Int_t, Double_t, Double_t, Double_t)
240 {printf("WARNING: Gspart not yet implemented !\n");}
241
a49cf58f 242 // Dummy methods
243 virtual void DefineParticle(int, const char*, TMCParticleType, double, double, double){;}
244 virtual void DefineIon(const char*, int, int, int, double, double){;}
245 virtual TString ParticleName(int) const {return "";}
246 virtual Double_t ParticleMass(int) const {return 0.;}
247 virtual Double_t ParticleCharge(int) const {return 0.;}
248 virtual Double_t ParticleLifeTime(int) const {return 0.;}
249 virtual TMCParticleType ParticleMCType(int) const {return (TMCParticleType) 0;}
b9d0a01d 250 //
251 // control methods
252 // ------------------------------------------------
253 //
254
255 virtual void Init();
1de0a072 256 virtual void InitPhysics();
bf3aa28e 257 virtual void FinishGeometry();
258 virtual void BuildPhysics();
b9d0a01d 259 virtual void ProcessEvent();
b9d0a01d 260 virtual void ProcessRun(Int_t nevent);
03ca248b 261
03ca248b 262
b9d0a01d 263 //
264 //New Getter and Setters
265 // ------------------------------------------------
266 //
1de0a072 267 // - Core input file name
268 TString GetCoreInputFileName() const {return sCoreInputFileName;}
269 void SetCoreInputFileName(const char* n) {sCoreInputFileName = n;}
270
b9d0a01d 271 // - Input file name
1de0a072 272 TString GetInputFileName() const {return sInputFileName;}
273 void SetInputFileName(const char* n) {sInputFileName = n;}
274
275 // - SetProcess and SetCut
276 Int_t GetProcessNb() const {return iNbOfProc;}
277 void SetProcessNb(Int_t l) {iNbOfProc = l;}
278 Int_t GetCutNb() const {return iNbOfProc;}
279 void SetCutNb(Int_t l) {iNbOfCut = l;}
280
b9d0a01d 281 // - Verbosity level
282 Int_t GetVerbosityLevel() const {return fVerbosityLevel;}
283 void SetVerbosityLevel(Int_t l) {fVerbosityLevel = l;}
fa3d1cc7 284
1de0a072 285 // - Fluka Draw procedures identifiers
286 // bxdraw = 1 inside
287 // bxdraw = 11 entering
288 // bxdraw = 12 exiting
289 // eedraw = 2
290 // endraw = 3
291 // mgdraw = 4
292 // sodraw = 5
293 // usdraw = 6
70541a80 294 Int_t GetCaller() const {return fCaller;}
295 void SetCaller(Int_t l) {fCaller = l;}
1de0a072 296
fa3d1cc7 297 // - Fluka Draw procedures formal parameters
70541a80 298 Int_t GetIcode() const {return fIcode;}
299 void SetIcode(Int_t l) {fIcode = l;}
300 // in the case of sodraw fIcode=0
fa3d1cc7 301
302 Int_t GetMreg() const {return fCurrentFlukaRegion;}
303 void SetMreg(Int_t l) {fCurrentFlukaRegion = l;}
304
1de0a072 305 Int_t GetNewreg() const {return iNewreg;}
306 void SetNewreg(Int_t l) {iNewreg = l;}
fa3d1cc7 307
308 Double_t GetRull() const {return fRull;}
309 void SetRull(Double_t r) {fRull = r;}
310
311 Double_t GetXsco() const {return fXsco;}
312 void SetXsco(Double_t x) {fXsco = x;}
313
314 Double_t GetYsco() const {return fYsco;}
315 void SetYsco(Double_t y) {fYsco = y;}
316
317 Double_t GetZsco() const {return fZsco;}
318 void SetZsco(Double_t z) {fZsco = z;}
319
27b2f7fe 320 void SetCurrentFlukaRegion(Int_t reg) {fCurrentFlukaRegion=reg;}
321 Int_t GetCurrentFlukaRegion() const {return fCurrentFlukaRegion;}
24969d13 322
323 void SetTrackIsEntering(){fTrackIsEntering = kTRUE; fTrackIsExiting = kFALSE;}
fbf08100 324 void SetTrackIsExiting() {fTrackIsExiting = kTRUE; fTrackIsEntering = kFALSE;}
24969d13 325 void SetTrackIsInside() {fTrackIsExiting = kFALSE; fTrackIsEntering = kFALSE;}
fbf08100 326 void SetTrackIsNew(Bool_t flag=kTRUE) {fTrackIsNew = flag;}
fa3d1cc7 327
b9d0a01d 328 private:
70541a80 329 TFluka(const TFluka &mc): TVirtualMC(mc) {;}
b9d0a01d 330 TFluka & operator=(const TFluka &) {return (*this);}
e8f0734b 331
b9d0a01d 332 protected:
333 Int_t fVerbosityLevel; //Verbosity level (0 lowest - 3 highest)
e8f0734b 334
1de0a072 335 TString sInputFileName; //Name of the real input file (e.g. alice.inp)
336 TString sCoreInputFileName; //Name of the input file (e.g. corealice.inp)
e8f0734b 337
70541a80 338 Int_t fCaller; //Parameter to indicate who is the caller of the Fluka Draw
e8f0734b 339 Int_t fIcode; //Fluka Draw procedures formal parameter
1de0a072 340 Int_t iNewreg; //Fluka Draw procedures formal parameter
fa3d1cc7 341 Double_t fRull; //Fluka Draw procedures formal parameter
342 Double_t fXsco; //Fluka Draw procedures formal parameter
343 Double_t fYsco; //Fluka Draw procedures formal parameter
344 Double_t fZsco; //Fluka Draw procedures formal parameter
24969d13 345 Bool_t fTrackIsEntering; // Flag for track entering
e8f0734b 346 Bool_t fTrackIsExiting; // Flag for track exiting
fbf08100 347 Bool_t fTrackIsNew; // Flag for new track
e8f0734b 348
1de0a072 349 //variables for SetProcess and SetCut
350 Int_t iNbOfProc;
351 Int_t iProcessValue[100];
352 Char_t sProcessFlag[100][5];
353 Int_t iNbOfCut;
354 Double_t fCutValue[100];
355 Char_t sCutFlag[100][7];
e8f0734b 356
bf3aa28e 357 //Geometry through Geant4 for the time being!!!
bf575ea2 358 TG4GeometryManager* fGeometryManager; //Geometry manager
359 TG4DetConstruction* fDetector; //Detector
e8f0734b 360
bf575ea2 361 TClonesArray* fVolumeMediaMap; //!Transient list of volumes
362
363 Int_t fNVolumes; //!Current number of volumes
364 Int_t* fMediaByRegion; //!Media by Fluka region
365 Int_t fCurrentFlukaRegion; //Index of fluka region at each step
366
b9d0a01d 367 ClassDef(TFluka,1) //C++ interface to Fluka montecarlo
03ca248b 368};
369
b9d0a01d 370#endif //TFLUKA
03ca248b 371