]>
Commit | Line | Data |
---|---|---|
6f5667d1 | 1 | #ifndef TFLUKA_H |
2 | #define TFLUKA_H | |
829fb838 | 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" | |
829fb838 | 18 | |
19 | //Forward declaration | |
6f5667d1 | 20 | class TGeoMCGeometry; |
829fb838 | 21 | class TFlukaMCGeometry; |
22 | class TGeoMaterial; | |
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 | // | |
b496f27c | 32 | // Methods for building/management of geometry |
829fb838 | 33 | // ------------------------------------------------ |
34 | // | |
35 | ||
b496f27c | 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 | |
829fb838 | 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); | |
b496f27c | 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, | |
829fb838 | 80 | Int_t iaxis, Double_t c0, Int_t numed, Int_t ndvmx); |
b496f27c | 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, | |
829fb838 | 84 | const char *konly="ONLY"); |
b496f27c | 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");} | |
829fb838 | 107 | |
108 | // Euclid | |
b496f27c | 109 | virtual void WriteEuclid(const char*, const char*, Int_t, Int_t); |
829fb838 | 110 | |
b496f27c | 111 | // Getters |
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; | |
829fb838 | 116 | // |
b496f27c | 117 | // Methods for physics management |
829fb838 | 118 | // ------------------------------------------------ |
119 | // | |
120 | ||
b496f27c | 121 | // User configuration |
b2129742 | 122 | virtual Bool_t SetProcess(const char* flagName, Int_t flagValue); |
123 | virtual void SetProcess(const char* flagName, Int_t flagValue, Int_t imed); | |
124 | virtual Bool_t SetCut(const char* cutName, Double_t cutValue); | |
125 | virtual void SetCut(const char* cutName, Double_t cutValue, Int_t imed); | |
126 | virtual TObjArray* GetListOfProceses() {return fProcesses;} | |
127 | virtual TObjArray* GetListOfCuts() {return fCuts;} | |
128 | virtual Double_t Xsec(char*, Double_t, Int_t, Int_t); | |
829fb838 | 129 | |
b496f27c | 130 | // Particle table usage |
131 | virtual Int_t IdFromPDG(Int_t id) const; | |
132 | virtual Int_t PDGFromId(Int_t pdg) const; | |
133 | virtual void DefineParticles() | |
829fb838 | 134 | {printf("WARNING: DefineParticles not yet implemented !\n");} |
135 | ||
136 | // | |
137 | // methods for step management | |
138 | // ------------------------------------------------ | |
139 | // | |
140 | ||
b496f27c | 141 | // Action methods |
bd3d5c8a | 142 | virtual void StopTrack(); |
143 | virtual void ResetStoppingCondition() {fStopped = kFALSE;} | |
eb49ba4d | 144 | virtual Bool_t GetStoppingCondition() const {return fStopped;} |
bd3d5c8a | 145 | |
b496f27c | 146 | virtual void StopEvent() {fStopEvent = kTRUE;} |
147 | virtual void StopRun() {fStopEvent = kTRUE; fStopRun = kTRUE;} | |
eb49ba4d | 148 | virtual Bool_t EventIsStopped() const {return fStopEvent;} |
b496f27c | 149 | virtual void SetStopEvent(Bool_t flag) {fStopEvent = flag;} |
829fb838 | 150 | |
b496f27c | 151 | // Set methods |
07f5b33e | 152 | virtual void SetMaxStep (Double_t step); |
829fb838 | 153 | virtual void SetMaxNStep(Int_t); |
154 | virtual void SetUserDecay(Int_t); | |
155 | ||
b496f27c | 156 | // Get methods |
157 | // Tracking volume(s) | |
829fb838 | 158 | virtual Int_t CurrentVolID(Int_t& copyNo) const; |
159 | virtual Int_t CurrentVolOffID(Int_t off, Int_t& copyNo) const; | |
160 | virtual const char* CurrentVolName() const; | |
161 | virtual const char* CurrentVolOffName(Int_t off) const; | |
162 | virtual Int_t CurrentMaterial(Float_t &a, Float_t &z, | |
163 | Float_t &dens, Float_t &radl, Float_t &absl) const; | |
b496f27c | 164 | virtual Int_t CurrentEvent() const {return fNEvent;} |
165 | ||
829fb838 | 166 | virtual void Gmtod(Float_t* xm, Float_t* xd, Int_t iflag); |
167 | ||
168 | virtual void Gmtod(Double_t* xm, Double_t* xd, Int_t iflag); | |
169 | ||
170 | virtual void Gdtom(Float_t* xd, Float_t* xm, Int_t iflag); | |
171 | ||
172 | virtual void Gdtom(Double_t* xd, Double_t* xm, Int_t iflag); | |
173 | ||
2f09b80e | 174 | virtual Double_t MaxStep() const; |
829fb838 | 175 | virtual Int_t GetMaxNStep() const |
2f09b80e | 176 | {printf("WARNING: GetMaxNStep not yet implemented !\n"); return -1;} |
829fb838 | 177 | virtual Int_t GetMedium() const; |
178 | ||
b496f27c | 179 | // Tracking particle |
829fb838 | 180 | // dynamic properties |
181 | virtual void TrackPosition(TLorentzVector& position) const; | |
182 | virtual void TrackPosition(Double_t& x, Double_t& y, Double_t& z) const; | |
183 | virtual void TrackMomentum(TLorentzVector& momentum) const; | |
184 | virtual void TrackMomentum(Double_t& px, Double_t& py, Double_t& pz, Double_t& e) const; | |
185 | virtual Double_t TrackStep() const; | |
186 | virtual Double_t TrackLength() const; | |
187 | virtual Double_t TrackTime() const; | |
188 | virtual Double_t Edep() const; | |
b496f27c | 189 | // Static properties |
829fb838 | 190 | virtual Int_t TrackPid() const; |
191 | virtual Double_t TrackCharge() const; | |
192 | virtual Double_t TrackMass() const; | |
193 | virtual Double_t Etot() const; | |
b496f27c | 194 | // Track status |
829fb838 | 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; | |
203 | ||
b496f27c | 204 | // Secondaries |
7b203b6e | 205 | virtual Int_t NSecondaries() const; |
206 | virtual void SetNCerenkov(Int_t nc) {fNCerenkov = nc;} | |
207 | ||
829fb838 | 208 | virtual void GetSecondary(Int_t isec, Int_t& particleId, |
209 | TLorentzVector& position, TLorentzVector& momentum); | |
bd3d5c8a | 210 | virtual Bool_t SecondariesAreOrdered() const {return kFALSE;} |
829fb838 | 211 | virtual TMCProcess ProdProcess(Int_t iproc) const ; |
b496f27c | 212 | virtual Int_t StepProcesses(TArrayI & proc) const; |
829fb838 | 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");} | |
b496f27c | 238 | // |
239 | virtual void Gfpart(Int_t pdg, char* name, Int_t& type, Float_t& mass, Float_t& charge, Float_t& tlife); | |
829fb838 | 240 | virtual void Gspart(Int_t, const char*, Int_t, Double_t, Double_t, Double_t) |
b496f27c | 241 | {printf("WARNING: Gspart not yet implemented !\n");} |
242 | ||
243 | ||
244 | // | |
245 | // FLUKA Scoring specific methods | |
246 | // ------------------------------ | |
247 | // | |
248 | virtual void SetUserScoring(const char* option, Int_t npar, Float_t* what); | |
249 | // | |
250 | // Particle Properties | |
251 | // ------------------- | |
252 | // | |
253 | virtual Bool_t DefineParticle(int, const char*, TMCParticleType, double, double, double) {return kFALSE;} | |
254 | virtual Bool_t DefineIon(const char*, int, int, int, double, double) {return kFALSE;} | |
255 | virtual TString ParticleName(int pdg) const; | |
256 | virtual Double_t ParticleMass(int pdg) const; | |
257 | virtual Double_t ParticleCharge(int pdg) const; | |
258 | virtual Double_t ParticleLifeTime(int pdg) const; | |
259 | virtual TMCParticleType ParticleMCType(int) const {return (TMCParticleType) 9;} | |
829fb838 | 260 | // |
b496f27c | 261 | // Control methods |
829fb838 | 262 | // ------------------------------------------------ |
263 | // | |
264 | ||
265 | virtual void Init(); | |
266 | virtual void InitPhysics(); | |
267 | virtual void FinishGeometry(); | |
268 | virtual void BuildPhysics(); | |
269 | virtual void ProcessEvent(); | |
270 | virtual Bool_t ProcessRun(Int_t nevent); | |
271 | ||
272 | // | |
b496f27c | 273 | // New Getter and Setters |
829fb838 | 274 | // ------------------------------------------------ |
275 | // | |
276 | // - Core input file name | |
277 | TString GetCoreInputFileName() const {return fCoreInputFileName;} | |
3b8c325d | 278 | void SetCoreInputFileName(const char* file = "coreFlukaVmc.inp") {fCoreInputFileName = file;} |
829fb838 | 279 | |
280 | // - Input file name | |
281 | TString GetInputFileName() const {return fInputFileName;} | |
3b8c325d | 282 | void SetInputFileName(const char* file = "FlukaVmc.inp") {fInputFileName = file;} |
829fb838 | 283 | |
829fb838 | 284 | // - Verbosity level |
285 | Int_t GetVerbosityLevel() const {return fVerbosityLevel;} | |
286 | void SetVerbosityLevel(Int_t l) {fVerbosityLevel = l;} | |
287 | ||
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 | |
297 | Int_t GetCaller() const {return fCaller;} | |
298 | void SetCaller(Int_t l) {fCaller = l;} | |
299 | ||
300 | // - Fluka Draw procedures formal parameters | |
301 | Int_t GetIcode() const {return fIcode;} | |
302 | void SetIcode(Int_t l) {fIcode = l;} | |
303 | // in the case of sodraw fIcode=0 | |
304 | ||
305 | Int_t GetMreg() const {return fCurrentFlukaRegion;} | |
306 | void SetMreg(Int_t l); | |
307 | ||
308 | Int_t GetNewreg() const {return fNewReg;} | |
309 | void SetNewreg(Int_t l) {fNewReg = l;} | |
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 | ||
323 | void SetCurrentFlukaRegion(Int_t reg) {fCurrentFlukaRegion=reg;} | |
324 | Int_t GetCurrentFlukaRegion() const {return fCurrentFlukaRegion;} | |
325 | ||
326 | void SetDummyBoundary(Int_t mode) {fDummyBoundary = mode;} | |
327 | Int_t GetDummyBoundary() const {return fDummyBoundary;} | |
328 | Bool_t IsDummyBoundary() const {return (fDummyBoundary==0)?kFALSE:kTRUE;} | |
329 | ||
7f13be31 | 330 | void SetGeneratePemf(Bool_t flag = kTRUE) {fGeneratePemf = flag;} |
829fb838 | 331 | Bool_t IsGeneratePemf() const {return fGeneratePemf;} |
332 | ||
333 | void EnableField(Bool_t flag=kTRUE) {fFieldFlag = flag;} | |
334 | Bool_t IsFieldEnabled() const {return fFieldFlag;} | |
335 | void SetTrackIsEntering(){fTrackIsEntering = kTRUE; fTrackIsExiting = kFALSE;} | |
336 | void SetTrackIsExiting() {fTrackIsExiting = kTRUE; fTrackIsEntering = kFALSE;} | |
337 | void SetTrackIsInside() {fTrackIsExiting = kFALSE; fTrackIsEntering = kFALSE;} | |
7cad64b7 | 338 | void SetTrackIsNew(Bool_t flag = kTRUE); |
339 | ||
6f5667d1 | 340 | Int_t GetMaterialIndex(Int_t idmat) const {return fMaterials[idmat];} |
829fb838 | 341 | TObjArray *GetFlukaMaterials(); |
b496f27c | 342 | private: |
829fb838 | 343 | TFluka(const TFluka &mc): TVirtualMC(mc) {;} |
344 | TFluka & operator=(const TFluka &) {return (*this);} | |
345 | ||
346 | ||
347 | Int_t fVerbosityLevel; //Verbosity level (0 lowest - 3 highest) | |
b496f27c | 348 | Int_t fNEvent; //Current event number |
3b8c325d | 349 | TString fInputFileName; //Name of the real input file |
350 | TString fCoreInputFileName; //Name of the input file | |
829fb838 | 351 | |
352 | Int_t fCaller; //Parameter to indicate who is the caller of the Fluka Draw | |
353 | Int_t fIcode; //Fluka Draw procedures formal parameter | |
354 | Int_t fNewReg; //Fluka Draw procedures formal parameter | |
355 | Double_t fRull; //Fluka Draw procedures formal parameter | |
356 | Double_t fXsco; //Fluka Draw procedures formal parameter | |
357 | Double_t fYsco; //Fluka Draw procedures formal parameter | |
358 | Double_t fZsco; //Fluka Draw procedures formal parameter | |
359 | Bool_t fTrackIsEntering; // Flag for track entering | |
360 | Bool_t fTrackIsExiting; // Flag for track exiting | |
361 | Bool_t fTrackIsNew; // Flag for new track | |
362 | Bool_t fFieldFlag; // Flag for magnetic field | |
363 | Bool_t fGeneratePemf; // Flag for automatic .pemf generation | |
364 | Int_t fDummyBoundary; // Flag for crossing dummy boundaries | |
bd3d5c8a | 365 | Bool_t fStopped; // Flag for stopping |
b496f27c | 366 | Bool_t fStopEvent; // Flag for stopped event |
367 | Bool_t fStopRun; // Flag for stopped run | |
bd3d5c8a | 368 | |
b496f27c | 369 | // |
829fb838 | 370 | //Geometry through TGeo |
b496f27c | 371 | // |
372 | Int_t* fMaterials; //!Array of indices | |
829fb838 | 373 | Int_t fNVolumes; //!Current number of volumes |
7b203b6e | 374 | Int_t fCurrentFlukaRegion; // Index of fluka region at each step |
375 | Int_t fNCerenkov; // Number of cerekov photons | |
829fb838 | 376 | TFlukaMCGeometry *fGeom; // TGeo-FLUKA interface |
377 | TGeoMCGeometry *fMCGeo; // Interface to TGeo builder | |
378 | ||
1df5fa54 | 379 | // SetProcess, SetCut and user Scoring dynamic storage |
380 | TObjArray* fProcesses; // List of processes | |
381 | TObjArray* fCuts; // List of cuts | |
382 | TObjArray* fUserScore; // List of user scoring options | |
383 | ||
829fb838 | 384 | ClassDef(TFluka,1) //C++ interface to Fluka montecarlo |
385 | }; | |
386 | ||
387 | #endif //TFLUKA | |
388 |