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