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