]>
Commit | Line | Data |
---|---|---|
829fb838 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
17 | ||
18 | // | |
19 | // Realisation of the TVirtualMC interface for the FLUKA code | |
20 | // (See official web side http://www.fluka.org/). | |
21 | // | |
22 | // This implementation makes use of the TGeo geometry modeller. | |
23 | // User configuration is via automatic generation of FLUKA input cards. | |
24 | // | |
25 | // Authors: | |
26 | // A. Fasso | |
27 | // E. Futo | |
28 | // A. Gheata | |
29 | // A. Morsch | |
30 | // | |
31 | ||
32 | #include <Riostream.h> | |
33 | ||
829fb838 | 34 | #include "TFluka.h" |
35 | #include "TCallf77.h" //For the fortran calls | |
36 | #include "Fdblprc.h" //(DBLPRC) fluka common | |
37 | #include "Fepisor.h" //(EPISOR) fluka common | |
38 | #include "Ffinuc.h" //(FINUC) fluka common | |
39 | #include "Fiounit.h" //(IOUNIT) fluka common | |
40 | #include "Fpaprop.h" //(PAPROP) fluka common | |
41 | #include "Fpart.h" //(PART) fluka common | |
42 | #include "Ftrackr.h" //(TRACKR) fluka common | |
43 | #include "Fpaprop.h" //(PAPROP) fluka common | |
44 | #include "Ffheavy.h" //(FHEAVY) fluka common | |
3a625972 | 45 | #include "Fopphst.h" //(OPPHST) fluka common |
bd3d5c8a | 46 | #include "Fstack.h" //(STACK) fluka common |
829fb838 | 47 | |
48 | #include "TVirtualMC.h" | |
3a625972 | 49 | #include "TMCProcess.h" |
829fb838 | 50 | #include "TGeoManager.h" |
51 | #include "TGeoMaterial.h" | |
52 | #include "TGeoMedium.h" | |
53 | #include "TFlukaMCGeometry.h" | |
6f5667d1 | 54 | #include "TGeoMCGeometry.h" |
829fb838 | 55 | #include "TFlukaCerenkov.h" |
1df5fa54 | 56 | #include "TFlukaConfigOption.h" |
b496f27c | 57 | #include "TFlukaScoringOption.h" |
829fb838 | 58 | #include "TLorentzVector.h" |
b496f27c | 59 | #include "TArrayI.h" |
829fb838 | 60 | |
61 | // Fluka methods that may be needed. | |
62 | #ifndef WIN32 | |
63 | # define flukam flukam_ | |
64 | # define fluka_openinp fluka_openinp_ | |
65 | # define fluka_closeinp fluka_closeinp_ | |
66 | # define mcihad mcihad_ | |
67 | # define mpdgha mpdgha_ | |
68 | #else | |
69 | # define flukam FLUKAM | |
70 | # define fluka_openinp FLUKA_OPENINP | |
71 | # define fluka_closeinp FLUKA_CLOSEINP | |
72 | # define mcihad MCIHAD | |
73 | # define mpdgha MPDGHA | |
74 | #endif | |
75 | ||
76 | extern "C" | |
77 | { | |
78 | // | |
79 | // Prototypes for FLUKA functions | |
80 | // | |
81 | void type_of_call flukam(const int&); | |
82 | void type_of_call fluka_openinp(const int&, DEFCHARA); | |
83 | void type_of_call fluka_closeinp(const int&); | |
84 | int type_of_call mcihad(const int&); | |
85 | int type_of_call mpdgha(const int&); | |
86 | } | |
87 | ||
88 | // | |
89 | // Class implementation for ROOT | |
90 | // | |
91 | ClassImp(TFluka) | |
92 | ||
93 | // | |
94 | //---------------------------------------------------------------------------- | |
95 | // TFluka constructors and destructors. | |
96 | //______________________________________________________________________________ | |
97 | TFluka::TFluka() | |
98 | :TVirtualMC(), | |
99 | fVerbosityLevel(0), | |
1df5fa54 | 100 | fInputFileName(""), |
101 | fProcesses(0), | |
102 | fCuts(0), | |
103 | fUserScore(0) | |
829fb838 | 104 | { |
105 | // | |
106 | // Default constructor | |
107 | // | |
108 | fGeneratePemf = kFALSE; | |
109 | fNVolumes = 0; | |
110 | fCurrentFlukaRegion = -1; | |
111 | fGeom = 0; | |
112 | fMCGeo = 0; | |
113 | fMaterials = 0; | |
114 | fDummyBoundary = 0; | |
115 | fFieldFlag = 1; | |
bd3d5c8a | 116 | fStopped = 0; |
b496f27c | 117 | fStopEvent = 0; |
118 | fStopRun = 0; | |
119 | fNEvent = 0; | |
829fb838 | 120 | } |
121 | ||
122 | //______________________________________________________________________________ | |
123 | TFluka::TFluka(const char *title, Int_t verbosity, Bool_t isRootGeometrySupported) | |
124 | :TVirtualMC("TFluka",title, isRootGeometrySupported), | |
125 | fVerbosityLevel(verbosity), | |
126 | fInputFileName(""), | |
127 | fTrackIsEntering(0), | |
128 | fTrackIsExiting(0), | |
1df5fa54 | 129 | fTrackIsNew(0), |
130 | fProcesses(new TObjArray(100)), | |
131 | fCuts(new TObjArray(100)), | |
132 | fUserScore(new TObjArray(100)) | |
829fb838 | 133 | { |
134 | // create geometry interface | |
7f13be31 | 135 | if (fVerbosityLevel >=3) |
136 | cout << "<== TFluka::TFluka(" << title << ") constructor called." << endl; | |
137 | SetCoreInputFileName(); | |
138 | SetInputFileName(); | |
139 | SetGeneratePemf(kFALSE); | |
829fb838 | 140 | fNVolumes = 0; |
141 | fCurrentFlukaRegion = -1; | |
142 | fDummyBoundary = 0; | |
143 | fFieldFlag = 1; | |
144 | fGeneratePemf = kFALSE; | |
145 | fMCGeo = new TGeoMCGeometry("MCGeo", "TGeo Implementation of VirtualMCGeometry", kTRUE); | |
3b8c325d | 146 | fGeom = new TFlukaMCGeometry("geom", "FLUKA VMC Geometry"); |
829fb838 | 147 | if (verbosity > 2) fGeom->SetDebugMode(kTRUE); |
148 | fMaterials = 0; | |
bd3d5c8a | 149 | fStopped = 0; |
b496f27c | 150 | fStopEvent = 0; |
151 | fStopRun = 0; | |
152 | fNEvent = 0; | |
829fb838 | 153 | } |
154 | ||
155 | //______________________________________________________________________________ | |
156 | TFluka::~TFluka() { | |
157 | // Destructor | |
1df5fa54 | 158 | if (fVerbosityLevel >=3) |
159 | cout << "<== TFluka::~TFluka() destructor called." << endl; | |
160 | ||
161 | delete fGeom; | |
162 | delete fMCGeo; | |
163 | ||
164 | if (fCuts) { | |
165 | fCuts->Delete(); | |
166 | delete fCuts; | |
167 | } | |
168 | ||
169 | if (fProcesses) { | |
170 | fProcesses->Delete(); | |
171 | delete fProcesses; | |
172 | } | |
173 | ||
174 | ||
829fb838 | 175 | } |
176 | ||
177 | // | |
178 | //______________________________________________________________________________ | |
179 | // TFluka control methods | |
180 | //______________________________________________________________________________ | |
181 | void TFluka::Init() { | |
182 | // | |
183 | // Geometry initialisation | |
184 | // | |
185 | if (fVerbosityLevel >=3) cout << "==> TFluka::Init() called." << endl; | |
186 | ||
187 | if (!gGeoManager) new TGeoManager("geom", "FLUKA geometry"); | |
188 | fApplication->ConstructGeometry(); | |
189 | TGeoVolume *top = (TGeoVolume*)gGeoManager->GetListOfVolumes()->First(); | |
190 | gGeoManager->SetTopVolume(top); | |
191 | gGeoManager->CloseGeometry("di"); | |
192 | gGeoManager->DefaultColors(); // to be removed | |
193 | fNVolumes = fGeom->NofVolumes(); | |
194 | fGeom->CreateFlukaMatFile("flukaMat.inp"); | |
195 | if (fVerbosityLevel >=3) { | |
196 | printf("== Number of volumes: %i\n ==", fNVolumes); | |
197 | cout << "\t* InitPhysics() - Prepare input file to be called" << endl; | |
198 | } | |
3b8c325d | 199 | // now we have TGeo geometry created and we have to patch FlukaVmc.inp |
829fb838 | 200 | // with the material mapping file FlukaMat.inp |
201 | } | |
202 | ||
203 | ||
204 | //______________________________________________________________________________ | |
205 | void TFluka::FinishGeometry() { | |
206 | // | |
207 | // Build-up table with region to medium correspondance | |
208 | // | |
209 | if (fVerbosityLevel >=3) { | |
210 | cout << "==> TFluka::FinishGeometry() called." << endl; | |
211 | printf("----FinishGeometry - nothing to do with TGeo\n"); | |
212 | cout << "<== TFluka::FinishGeometry() called." << endl; | |
213 | } | |
214 | } | |
215 | ||
216 | //______________________________________________________________________________ | |
217 | void TFluka::BuildPhysics() { | |
218 | // | |
219 | // Prepare FLUKA input files and call FLUKA physics initialisation | |
220 | // | |
221 | ||
222 | if (fVerbosityLevel >=3) | |
223 | cout << "==> TFluka::BuildPhysics() called." << endl; | |
224 | // Prepare input file with the current physics settings | |
225 | InitPhysics(); | |
226 | cout << "\t* InitPhysics() - Prepare input file was called" << endl; | |
227 | ||
228 | if (fVerbosityLevel >=2) | |
229 | cout << "\t* Changing lfdrtr = (" << (GLOBAL.lfdrtr?'T':'F') | |
230 | << ") in fluka..." << endl; | |
231 | GLOBAL.lfdrtr = true; | |
232 | ||
233 | if (fVerbosityLevel >=2) | |
234 | cout << "\t* Opening file " << fInputFileName << endl; | |
235 | const char* fname = fInputFileName; | |
236 | fluka_openinp(lunin, PASSCHARA(fname)); | |
237 | ||
238 | if (fVerbosityLevel >=2) | |
239 | cout << "\t* Calling flukam..." << endl; | |
240 | flukam(1); | |
241 | ||
242 | if (fVerbosityLevel >=2) | |
243 | cout << "\t* Closing file " << fInputFileName << endl; | |
244 | fluka_closeinp(lunin); | |
245 | ||
246 | FinishGeometry(); | |
247 | ||
248 | if (fVerbosityLevel >=3) | |
249 | cout << "<== TFluka::Init() called." << endl; | |
250 | ||
251 | ||
252 | if (fVerbosityLevel >=3) | |
253 | cout << "<== TFluka::BuildPhysics() called." << endl; | |
254 | } | |
255 | ||
256 | //______________________________________________________________________________ | |
257 | void TFluka::ProcessEvent() { | |
258 | // | |
259 | // Process one event | |
260 | // | |
b496f27c | 261 | if (fStopRun) { |
262 | printf("User Run Abortion: No more events handled !\n"); | |
263 | fNEvent += 1; | |
264 | return; | |
265 | } | |
266 | ||
267 | if (fVerbosityLevel >=3) | |
268 | cout << "==> TFluka::ProcessEvent() called." << endl; | |
269 | fApplication->GeneratePrimaries(); | |
270 | EPISOR.lsouit = true; | |
271 | flukam(1); | |
272 | if (fVerbosityLevel >=3) | |
273 | cout << "<== TFluka::ProcessEvent() called." << endl; | |
274 | // | |
275 | // Increase event number | |
276 | // | |
277 | fNEvent += 1; | |
829fb838 | 278 | } |
279 | ||
280 | //______________________________________________________________________________ | |
281 | Bool_t TFluka::ProcessRun(Int_t nevent) { | |
282 | // | |
283 | // Run steering | |
284 | // | |
285 | ||
286 | if (fVerbosityLevel >=3) | |
287 | cout << "==> TFluka::ProcessRun(" << nevent << ") called." | |
288 | << endl; | |
289 | ||
290 | if (fVerbosityLevel >=2) { | |
291 | cout << "\t* GLOBAL.fdrtr = " << (GLOBAL.lfdrtr?'T':'F') << endl; | |
292 | cout << "\t* Calling flukam again..." << endl; | |
293 | } | |
294 | ||
295 | fApplication->InitGeometry(); | |
296 | Int_t todo = TMath::Abs(nevent); | |
297 | for (Int_t ev = 0; ev < todo; ev++) { | |
298 | fApplication->BeginEvent(); | |
299 | ProcessEvent(); | |
300 | fApplication->FinishEvent(); | |
301 | } | |
302 | ||
303 | if (fVerbosityLevel >=3) | |
304 | cout << "<== TFluka::ProcessRun(" << nevent << ") called." | |
305 | << endl; | |
306 | return kTRUE; | |
307 | } | |
308 | ||
309 | //_____________________________________________________________________________ | |
310 | // methods for building/management of geometry | |
311 | ||
312 | // functions from GCONS | |
313 | //____________________________________________________________________________ | |
314 | void TFluka::Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z, | |
315 | Float_t &dens, Float_t &radl, Float_t &absl, | |
316 | Float_t* /*ubuf*/, Int_t& /*nbuf*/) { | |
317 | // | |
318 | TGeoMaterial *mat; | |
319 | TIter next (gGeoManager->GetListOfMaterials()); | |
320 | while ((mat = (TGeoMaterial*)next())) { | |
321 | if (mat->GetUniqueID() == (UInt_t)imat) break; | |
322 | } | |
323 | if (!mat) { | |
324 | Error("Gfmate", "no material with index %i found", imat); | |
325 | return; | |
326 | } | |
327 | sprintf(name, "%s", mat->GetName()); | |
328 | a = mat->GetA(); | |
329 | z = mat->GetZ(); | |
330 | dens = mat->GetDensity(); | |
331 | radl = mat->GetRadLen(); | |
332 | absl = mat->GetIntLen(); | |
333 | } | |
334 | ||
335 | //______________________________________________________________________________ | |
336 | void TFluka::Gfmate(Int_t imat, char *name, Double_t &a, Double_t &z, | |
337 | Double_t &dens, Double_t &radl, Double_t &absl, | |
338 | Double_t* /*ubuf*/, Int_t& /*nbuf*/) { | |
339 | // | |
340 | TGeoMaterial *mat; | |
341 | TIter next (gGeoManager->GetListOfMaterials()); | |
342 | while ((mat = (TGeoMaterial*)next())) { | |
343 | if (mat->GetUniqueID() == (UInt_t)imat) break; | |
344 | } | |
345 | if (!mat) { | |
346 | Error("Gfmate", "no material with index %i found", imat); | |
347 | return; | |
348 | } | |
349 | sprintf(name, "%s", mat->GetName()); | |
350 | a = mat->GetA(); | |
351 | z = mat->GetZ(); | |
352 | dens = mat->GetDensity(); | |
353 | radl = mat->GetRadLen(); | |
354 | absl = mat->GetIntLen(); | |
355 | } | |
356 | ||
357 | // detector composition | |
358 | //______________________________________________________________________________ | |
359 | void TFluka::Material(Int_t& kmat, const char* name, Double_t a, | |
360 | Double_t z, Double_t dens, Double_t radl, Double_t absl, | |
361 | Float_t* buf, Int_t nwbuf) { | |
362 | // | |
363 | Double_t* dbuf = fGeom->CreateDoubleArray(buf, nwbuf); | |
364 | Material(kmat, name, a, z, dens, radl, absl, dbuf, nwbuf); | |
365 | delete [] dbuf; | |
366 | } | |
367 | ||
368 | //______________________________________________________________________________ | |
369 | void TFluka::Material(Int_t& kmat, const char* name, Double_t a, | |
370 | Double_t z, Double_t dens, Double_t radl, Double_t absl, | |
371 | Double_t* /*buf*/, Int_t /*nwbuf*/) { | |
372 | // | |
373 | TGeoMaterial *mat; | |
374 | kmat = gGeoManager->GetListOfMaterials()->GetSize(); | |
375 | if ((z-Int_t(z)) > 1E-3) { | |
376 | mat = fGeom->GetMakeWrongMaterial(z); | |
377 | if (mat) { | |
378 | mat->SetRadLen(radl,absl); | |
379 | mat->SetUniqueID(kmat); | |
380 | return; | |
381 | } | |
382 | } | |
383 | gGeoManager->Material(name, a, z, dens, kmat, radl, absl); | |
384 | } | |
385 | ||
386 | //______________________________________________________________________________ | |
387 | void TFluka::Mixture(Int_t& kmat, const char *name, Float_t *a, | |
388 | Float_t *z, Double_t dens, Int_t nlmat, Float_t *wmat) { | |
389 | // | |
390 | Double_t* da = fGeom->CreateDoubleArray(a, TMath::Abs(nlmat)); | |
391 | Double_t* dz = fGeom->CreateDoubleArray(z, TMath::Abs(nlmat)); | |
392 | Double_t* dwmat = fGeom->CreateDoubleArray(wmat, TMath::Abs(nlmat)); | |
393 | ||
394 | Mixture(kmat, name, da, dz, dens, nlmat, dwmat); | |
395 | for (Int_t i=0; i<nlmat; i++) { | |
396 | a[i] = da[i]; z[i] = dz[i]; wmat[i] = dwmat[i]; | |
397 | } | |
398 | ||
399 | delete [] da; | |
400 | delete [] dz; | |
401 | delete [] dwmat; | |
402 | } | |
403 | ||
404 | //______________________________________________________________________________ | |
405 | void TFluka::Mixture(Int_t& kmat, const char *name, Double_t *a, | |
406 | Double_t *z, Double_t dens, Int_t nlmat, Double_t *wmat) { | |
407 | // | |
408 | // Defines mixture OR COMPOUND IMAT as composed by | |
409 | // THE BASIC NLMAT materials defined by arrays A,Z and WMAT | |
410 | // | |
411 | // If NLMAT > 0 then wmat contains the proportion by | |
412 | // weights of each basic material in the mixture. | |
413 | // | |
414 | // If nlmat < 0 then WMAT contains the number of atoms | |
415 | // of a given kind into the molecule of the COMPOUND | |
416 | // In this case, WMAT in output is changed to relative | |
417 | // weigths. | |
418 | // | |
419 | Int_t i,j; | |
420 | if (nlmat < 0) { | |
421 | nlmat = - nlmat; | |
422 | Double_t amol = 0; | |
423 | for (i=0;i<nlmat;i++) { | |
424 | amol += a[i]*wmat[i]; | |
425 | } | |
426 | for (i=0;i<nlmat;i++) { | |
427 | wmat[i] *= a[i]/amol; | |
428 | } | |
429 | } | |
430 | kmat = gGeoManager->GetListOfMaterials()->GetSize(); | |
431 | // Check if we have elements with fractional Z | |
432 | TGeoMaterial *mat = 0; | |
433 | TGeoMixture *mix = 0; | |
434 | Bool_t mixnew = kFALSE; | |
435 | for (i=0; i<nlmat; i++) { | |
436 | if (z[i]-Int_t(z[i]) < 1E-3) continue; | |
437 | // We have found an element with fractional Z -> loop mixtures to look for it | |
438 | for (j=0; j<kmat; j++) { | |
439 | mat = (TGeoMaterial*)gGeoManager->GetListOfMaterials()->At(j); | |
440 | if (!mat) break; | |
441 | if (!mat->IsMixture()) continue; | |
442 | mix = (TGeoMixture*)mat; | |
443 | if (TMath::Abs(z[i]-mix->GetZ()) >1E-3) continue; | |
444 | // printf(" FOUND component %i as mixture %s\n", i, mat->GetName()); | |
445 | mixnew = kTRUE; | |
446 | break; | |
447 | } | |
448 | if (!mixnew) Warning("Mixture","%s : cannot find component %i with fractional Z=%f\n", name, i, z[i]); | |
449 | break; | |
450 | } | |
451 | if (mixnew) { | |
452 | Int_t nlmatnew = nlmat+mix->GetNelements()-1; | |
453 | Double_t *anew = new Double_t[nlmatnew]; | |
454 | Double_t *znew = new Double_t[nlmatnew]; | |
455 | Double_t *wmatnew = new Double_t[nlmatnew]; | |
456 | Int_t ind=0; | |
457 | for (j=0; j<nlmat; j++) { | |
458 | if (j==i) continue; | |
459 | anew[ind] = a[j]; | |
460 | znew[ind] = z[j]; | |
461 | wmatnew[ind] = wmat[j]; | |
462 | ind++; | |
463 | } | |
464 | for (j=0; j<mix->GetNelements(); j++) { | |
465 | anew[ind] = mix->GetAmixt()[j]; | |
466 | znew[ind] = mix->GetZmixt()[j]; | |
467 | wmatnew[ind] = wmat[i]*mix->GetWmixt()[j]; | |
468 | ind++; | |
469 | } | |
470 | Mixture(kmat, name, anew, znew, dens, nlmatnew, wmatnew); | |
471 | delete [] anew; | |
472 | delete [] znew; | |
473 | delete [] wmatnew; | |
474 | return; | |
475 | } | |
476 | // Now we need to compact identical elements within the mixture | |
477 | // First check if this happens | |
478 | mixnew = kFALSE; | |
479 | for (i=0; i<nlmat-1; i++) { | |
480 | for (j=i+1; j<nlmat; j++) { | |
481 | if (z[i] == z[j]) { | |
482 | mixnew = kTRUE; | |
483 | break; | |
484 | } | |
485 | } | |
486 | if (mixnew) break; | |
487 | } | |
488 | if (mixnew) { | |
489 | Int_t nlmatnew = 0; | |
490 | Double_t *anew = new Double_t[nlmat]; | |
491 | Double_t *znew = new Double_t[nlmat]; | |
492 | memset(znew, 0, nlmat*sizeof(Double_t)); | |
493 | Double_t *wmatnew = new Double_t[nlmat]; | |
494 | Bool_t skipi; | |
495 | for (i=0; i<nlmat; i++) { | |
496 | skipi = kFALSE; | |
497 | for (j=0; j<nlmatnew; j++) { | |
498 | if (z[i] == z[j]) { | |
499 | wmatnew[j] += wmat[i]; | |
500 | skipi = kTRUE; | |
501 | break; | |
502 | } | |
503 | } | |
504 | if (skipi) continue; | |
505 | anew[nlmatnew] = a[i]; | |
506 | znew[nlmatnew] = z[i]; | |
507 | wmatnew[nlmatnew] = wmat[i]; | |
508 | nlmatnew++; | |
509 | } | |
510 | Mixture(kmat, name, anew, znew, dens, nlmatnew, wmatnew); | |
511 | delete [] anew; | |
512 | delete [] znew; | |
513 | delete [] wmatnew; | |
514 | return; | |
515 | } | |
516 | gGeoManager->Mixture(name, a, z, dens, nlmat, wmat, kmat); | |
517 | } | |
518 | ||
519 | //______________________________________________________________________________ | |
520 | void TFluka::Medium(Int_t& kmed, const char *name, Int_t nmat, | |
521 | Int_t isvol, Int_t ifield, Double_t fieldm, Double_t tmaxfd, | |
522 | Double_t stemax, Double_t deemax, Double_t epsil, | |
523 | Double_t stmin, Float_t* ubuf, Int_t nbuf) { | |
524 | // | |
525 | kmed = gGeoManager->GetListOfMedia()->GetSize()+1; | |
526 | fMCGeo->Medium(kmed, name, nmat, isvol, ifield, fieldm, tmaxfd, stemax, deemax, | |
527 | epsil, stmin, ubuf, nbuf); | |
528 | } | |
529 | ||
530 | //______________________________________________________________________________ | |
531 | void TFluka::Medium(Int_t& kmed, const char *name, Int_t nmat, | |
532 | Int_t isvol, Int_t ifield, Double_t fieldm, Double_t tmaxfd, | |
533 | Double_t stemax, Double_t deemax, Double_t epsil, | |
534 | Double_t stmin, Double_t* ubuf, Int_t nbuf) { | |
535 | // | |
536 | kmed = gGeoManager->GetListOfMedia()->GetSize()+1; | |
537 | fMCGeo->Medium(kmed, name, nmat, isvol, ifield, fieldm, tmaxfd, stemax, deemax, | |
538 | epsil, stmin, ubuf, nbuf); | |
539 | } | |
540 | ||
541 | //______________________________________________________________________________ | |
542 | void TFluka::Matrix(Int_t& krot, Double_t thetaX, Double_t phiX, | |
543 | Double_t thetaY, Double_t phiY, Double_t thetaZ, | |
544 | Double_t phiZ) { | |
545 | // | |
546 | krot = gGeoManager->GetListOfMatrices()->GetEntriesFast(); | |
547 | fMCGeo->Matrix(krot, thetaX, phiX, thetaY, phiY, thetaZ, phiZ); | |
548 | } | |
549 | ||
550 | //______________________________________________________________________________ | |
551 | void TFluka::Gstpar(Int_t itmed, const char* param, Double_t parval) { | |
552 | // | |
553 | // | |
554 | ||
555 | if (fVerbosityLevel >=3) printf("Gstpar called with %6d %5s %12.4e %6d\n", itmed, param, parval, fGeom->GetFlukaMaterial(itmed)); | |
556 | ||
557 | Bool_t process = kFALSE; | |
558 | if (strncmp(param, "DCAY", 4) == 0 || | |
559 | strncmp(param, "PAIR", 4) == 0 || | |
560 | strncmp(param, "COMP", 4) == 0 || | |
561 | strncmp(param, "PHOT", 4) == 0 || | |
562 | strncmp(param, "PFIS", 4) == 0 || | |
563 | strncmp(param, "DRAY", 4) == 0 || | |
564 | strncmp(param, "ANNI", 4) == 0 || | |
565 | strncmp(param, "BREM", 4) == 0 || | |
566 | strncmp(param, "MUNU", 4) == 0 || | |
567 | strncmp(param, "CKOV", 4) == 0 || | |
568 | strncmp(param, "HADR", 4) == 0 || | |
569 | strncmp(param, "LOSS", 4) == 0 || | |
570 | strncmp(param, "MULS", 4) == 0 || | |
571 | strncmp(param, "RAYL", 4) == 0) | |
572 | { | |
573 | process = kTRUE; | |
574 | } | |
575 | if (process) { | |
576 | SetProcess(param, Int_t (parval), fGeom->GetFlukaMaterial(itmed)); | |
577 | } else { | |
578 | SetCut(param, parval, fGeom->GetFlukaMaterial(itmed)); | |
579 | } | |
580 | } | |
581 | ||
582 | // functions from GGEOM | |
583 | //_____________________________________________________________________________ | |
584 | void TFluka::Gsatt(const char *name, const char *att, Int_t val) | |
585 | { | |
6f5667d1 | 586 | // Set visualisation attributes for one volume |
829fb838 | 587 | char vname[5]; |
588 | fGeom->Vname(name,vname); | |
589 | char vatt[5]; | |
590 | fGeom->Vname(att,vatt); | |
591 | gGeoManager->SetVolumeAttribute(vname, vatt, val); | |
592 | } | |
593 | ||
594 | //______________________________________________________________________________ | |
595 | Int_t TFluka::Gsvolu(const char *name, const char *shape, Int_t nmed, | |
596 | Float_t *upar, Int_t np) { | |
597 | // | |
598 | return fMCGeo->Gsvolu(name, shape, nmed, upar, np); | |
599 | } | |
600 | ||
601 | //______________________________________________________________________________ | |
602 | Int_t TFluka::Gsvolu(const char *name, const char *shape, Int_t nmed, | |
603 | Double_t *upar, Int_t np) { | |
604 | // | |
605 | return fMCGeo->Gsvolu(name, shape, nmed, upar, np); | |
606 | } | |
607 | ||
608 | //______________________________________________________________________________ | |
609 | void TFluka::Gsdvn(const char *name, const char *mother, Int_t ndiv, | |
610 | Int_t iaxis) { | |
611 | // | |
612 | fMCGeo->Gsdvn(name, mother, ndiv, iaxis); | |
613 | } | |
614 | ||
615 | //______________________________________________________________________________ | |
616 | void TFluka::Gsdvn2(const char *name, const char *mother, Int_t ndiv, | |
617 | Int_t iaxis, Double_t c0i, Int_t numed) { | |
618 | // | |
619 | fMCGeo->Gsdvn2(name, mother, ndiv, iaxis, c0i, numed); | |
620 | } | |
621 | ||
622 | //______________________________________________________________________________ | |
623 | void TFluka::Gsdvt(const char *name, const char *mother, Double_t step, | |
624 | Int_t iaxis, Int_t numed, Int_t ndvmx) { | |
625 | // | |
626 | fMCGeo->Gsdvt(name, mother, step, iaxis, numed, ndvmx); | |
627 | } | |
628 | ||
629 | //______________________________________________________________________________ | |
630 | void TFluka::Gsdvt2(const char *name, const char *mother, Double_t step, | |
631 | Int_t iaxis, Double_t c0, Int_t numed, Int_t ndvmx) { | |
632 | // | |
633 | fMCGeo->Gsdvt2(name, mother, step, iaxis, c0, numed, ndvmx); | |
634 | } | |
635 | ||
636 | //______________________________________________________________________________ | |
637 | void TFluka::Gsord(const char * /*name*/, Int_t /*iax*/) { | |
638 | // | |
639 | // Nothing to do with TGeo | |
640 | } | |
641 | ||
642 | //______________________________________________________________________________ | |
643 | void TFluka::Gspos(const char *name, Int_t nr, const char *mother, | |
644 | Double_t x, Double_t y, Double_t z, Int_t irot, | |
645 | const char *konly) { | |
646 | // | |
647 | fMCGeo->Gspos(name, nr, mother, x, y, z, irot, konly); | |
648 | } | |
649 | ||
650 | //______________________________________________________________________________ | |
651 | void TFluka::Gsposp(const char *name, Int_t nr, const char *mother, | |
652 | Double_t x, Double_t y, Double_t z, Int_t irot, | |
653 | const char *konly, Float_t *upar, Int_t np) { | |
654 | // | |
655 | fMCGeo->Gsposp(name, nr, mother, x, y, z, irot, konly, upar, np); | |
656 | } | |
657 | ||
658 | //______________________________________________________________________________ | |
659 | void TFluka::Gsposp(const char *name, Int_t nr, const char *mother, | |
660 | Double_t x, Double_t y, Double_t z, Int_t irot, | |
661 | const char *konly, Double_t *upar, Int_t np) { | |
662 | // | |
663 | fMCGeo->Gsposp(name, nr, mother, x, y, z, irot, konly, upar, np); | |
664 | } | |
665 | ||
666 | //______________________________________________________________________________ | |
667 | void TFluka::Gsbool(const char* /*onlyVolName*/, const char* /*manyVolName*/) { | |
668 | // | |
669 | // Nothing to do with TGeo | |
670 | } | |
671 | ||
672 | //______________________________________________________________________________ | |
673 | void TFluka::SetCerenkov(Int_t itmed, Int_t npckov, Float_t* ppckov, | |
674 | Float_t* absco, Float_t* effic, Float_t* rindex) { | |
675 | // | |
676 | // Set Cerenkov properties for medium itmed | |
677 | // | |
678 | // npckov: number of sampling points | |
679 | // ppckov: energy values | |
680 | // absco: absorption length | |
681 | // effic: quantum efficiency | |
682 | // rindex: refraction index | |
683 | // | |
684 | // | |
685 | // | |
686 | // Create object holding Cerenkov properties | |
687 | // | |
688 | TFlukaCerenkov* cerenkovProperties = new TFlukaCerenkov(npckov, ppckov, absco, effic, rindex); | |
689 | // | |
690 | // Pass object to medium | |
691 | TGeoMedium* medium = gGeoManager->GetMedium(itmed); | |
692 | medium->SetCerenkovProperties(cerenkovProperties); | |
693 | } | |
694 | ||
695 | //______________________________________________________________________________ | |
696 | void TFluka::SetCerenkov(Int_t /*itmed*/, Int_t /*npckov*/, Double_t * /*ppckov*/, | |
697 | Double_t * /*absco*/, Double_t * /*effic*/, Double_t * /*rindex*/) { | |
698 | // | |
699 | // Not implemented with TGeo - what G4 did ? Any FLUKA card generated? | |
700 | Warning("SetCerenkov", "Not implemented with TGeo"); | |
701 | } | |
702 | ||
703 | // Euclid | |
704 | //______________________________________________________________________________ | |
705 | void TFluka::WriteEuclid(const char* /*fileName*/, const char* /*topVol*/, | |
706 | Int_t /*number*/, Int_t /*nlevel*/) { | |
707 | // | |
708 | // Not with TGeo | |
709 | Warning("WriteEuclid", "Not implemented with TGeo"); | |
710 | } | |
711 | ||
712 | ||
713 | ||
714 | //_____________________________________________________________________________ | |
715 | // methods needed by the stepping | |
716 | //____________________________________________________________________________ | |
717 | ||
718 | Int_t TFluka::GetMedium() const { | |
719 | // | |
720 | // Get the medium number for the current fluka region | |
721 | // | |
722 | return fGeom->GetMedium(); // this I need to check due to remapping !!! | |
723 | } | |
724 | ||
725 | ||
726 | ||
727 | //____________________________________________________________________________ | |
728 | // particle table usage | |
729 | // ID <--> PDG transformations | |
730 | //_____________________________________________________________________________ | |
731 | Int_t TFluka::IdFromPDG(Int_t pdg) const | |
732 | { | |
733 | // | |
734 | // Return Fluka code from PDG and pseudo ENDF code | |
735 | ||
736 | // Catch the feedback photons | |
737 | if (pdg == 50000051) return (-1); | |
738 | // MCIHAD() goes from pdg to fluka internal. | |
739 | Int_t intfluka = mcihad(pdg); | |
740 | // KPTOIP array goes from internal to official | |
741 | return GetFlukaKPTOIP(intfluka); | |
742 | } | |
743 | ||
744 | //______________________________________________________________________________ | |
745 | Int_t TFluka::PDGFromId(Int_t id) const | |
746 | { | |
747 | // | |
748 | // Return PDG code and pseudo ENDF code from Fluka code | |
f926898e | 749 | // Alpha He3 Triton Deuteron gen. ion opt. photon |
750 | Int_t idSpecial[6] = {10020040, 10020030, 10010030, 10010020, 10000000, 50000050}; | |
829fb838 | 751 | // IPTOKP array goes from official to internal |
752 | ||
753 | if (id == -1) { | |
754 | // Cerenkov photon | |
bd3d5c8a | 755 | if (fVerbosityLevel >= 3) |
829fb838 | 756 | printf("\n PDGFromId: Cerenkov Photon \n"); |
757 | return 50000050; | |
758 | } | |
759 | // Error id | |
760 | if (id == 0 || id < -6 || id > 250) { | |
f926898e | 761 | if (fVerbosityLevel >= 3) |
829fb838 | 762 | printf("PDGFromId: Error id = 0\n"); |
763 | return -1; | |
764 | } | |
765 | // Good id | |
f926898e | 766 | if (id > 0) { |
767 | Int_t intfluka = GetFlukaIPTOKP(id); | |
768 | if (intfluka == 0) { | |
769 | if (fVerbosityLevel >= 3) | |
770 | printf("PDGFromId: Error intfluka = 0: %d\n", id); | |
771 | return -1; | |
772 | } else if (intfluka < 0) { | |
773 | if (fVerbosityLevel >= 3) | |
774 | printf("PDGFromId: Error intfluka < 0: %d\n", id); | |
775 | return -1; | |
776 | } | |
777 | if (fVerbosityLevel >= 3) | |
778 | printf("mpdgha called with %d %d \n", id, intfluka); | |
779 | // MPDGHA() goes from fluka internal to pdg. | |
780 | return mpdgha(intfluka); | |
781 | } else { | |
782 | // ions and optical photons | |
783 | return idSpecial[id + 6]; | |
829fb838 | 784 | } |
829fb838 | 785 | } |
786 | ||
bd3d5c8a | 787 | void TFluka::StopTrack() |
788 | { | |
789 | // Set stopping conditions | |
790 | // Works for photons and charged particles | |
791 | fStopped = kTRUE; | |
792 | } | |
793 | ||
829fb838 | 794 | //_____________________________________________________________________________ |
795 | // methods for physics management | |
796 | //____________________________________________________________________________ | |
797 | // | |
798 | // set methods | |
799 | // | |
800 | ||
1df5fa54 | 801 | void TFluka::SetProcess(const char* flagName, Int_t flagValue, Int_t imed) |
829fb838 | 802 | { |
803 | // Set process user flag for material imat | |
804 | // | |
1df5fa54 | 805 | TFlukaConfigOption* proc = new TFlukaConfigOption(flagName, flagValue, imed); |
806 | fProcesses->Add(proc); | |
829fb838 | 807 | } |
808 | ||
809 | //______________________________________________________________________________ | |
810 | Bool_t TFluka::SetProcess(const char* flagName, Int_t flagValue) | |
811 | { | |
812 | // Set process user flag | |
1df5fa54 | 813 | // |
814 | // | |
815 | // Update if already in the list | |
829fb838 | 816 | // |
817 | ||
1df5fa54 | 818 | TIter next(fProcesses); |
819 | TFlukaConfigOption* proc; | |
820 | while((proc = (TFlukaConfigOption*)next())) | |
821 | { | |
822 | if (strcmp(proc->GetName(), flagName) == 0) { | |
823 | proc->SetFlag(flagValue); | |
824 | proc->SetMedium(-1); | |
825 | return kTRUE; | |
829fb838 | 826 | } |
1df5fa54 | 827 | } |
828 | // | |
829 | // If not create a new process | |
830 | // | |
831 | ||
832 | proc = new TFlukaConfigOption(flagName, flagValue); | |
833 | fProcesses->Add(proc); | |
834 | ||
835 | return kTRUE; | |
829fb838 | 836 | } |
837 | ||
838 | //______________________________________________________________________________ | |
839 | void TFluka::SetCut(const char* cutName, Double_t cutValue, Int_t imed) | |
840 | { | |
841 | // Set user cut value for material imed | |
842 | // | |
1df5fa54 | 843 | TFlukaConfigOption* cut = new TFlukaConfigOption(cutName, cutValue, imed); |
844 | fCuts->Add(cut); | |
829fb838 | 845 | } |
846 | ||
847 | //______________________________________________________________________________ | |
848 | Bool_t TFluka::SetCut(const char* cutName, Double_t cutValue) | |
849 | { | |
850 | // Set user cut value | |
851 | // | |
1df5fa54 | 852 | // |
853 | // Update if already in the list | |
854 | // | |
855 | ||
856 | TIter next(fCuts); | |
857 | TFlukaConfigOption* cut; | |
858 | while((cut = (TFlukaConfigOption*)next())) | |
859 | { | |
860 | if (strcmp(cut->GetName(), cutName) == 0) { | |
861 | cut->SetCut(cutValue); | |
862 | return kTRUE; | |
829fb838 | 863 | } |
1df5fa54 | 864 | } |
865 | // | |
866 | // If not create a new process | |
867 | // | |
868 | ||
869 | cut = new TFlukaConfigOption(cutName, cutValue); | |
870 | fCuts->Add(cut); | |
871 | ||
872 | return kTRUE; | |
829fb838 | 873 | } |
874 | ||
b496f27c | 875 | void TFluka::SetUserScoring(const char* option, Int_t npar, Float_t what[12]) |
876 | { | |
877 | // | |
878 | // Ads a user scoring option to th list | |
879 | // | |
880 | TFlukaScoringOption* opt = new TFlukaScoringOption(option, "User Scoring", npar, what); | |
881 | fUserScore->Add(opt); | |
882 | } | |
883 | ||
884 | ||
829fb838 | 885 | //______________________________________________________________________________ |
886 | Double_t TFluka::Xsec(char*, Double_t, Int_t, Int_t) | |
887 | { | |
888 | printf("WARNING: Xsec not yet implemented !\n"); return -1.; | |
889 | } | |
890 | ||
891 | ||
892 | //______________________________________________________________________________ | |
893 | void TFluka::InitPhysics() | |
894 | { | |
895 | // | |
896 | // Physics initialisation with preparation of FLUKA input cards | |
897 | // | |
1df5fa54 | 898 | printf("=>InitPhysics\n"); |
899 | Int_t j, k; | |
829fb838 | 900 | Double_t fCut; |
901 | ||
3b8c325d | 902 | FILE *pFlukaVmcCoreInp, *pFlukaVmcFlukaMat, *pFlukaVmcInp; |
829fb838 | 903 | |
904 | Double_t zero = 0.0; | |
905 | Double_t one = 1.0; | |
906 | Double_t two = 2.0; | |
907 | Double_t three = 3.0; | |
908 | ||
909 | Float_t fLastMaterial = fGeom->GetLastMaterialIndex(); | |
910 | if (fVerbosityLevel >= 3) printf(" last FLUKA material is %g\n", fLastMaterial); | |
911 | ||
912 | // Prepare Cerenkov | |
913 | TObjArray *matList = GetFlukaMaterials(); | |
914 | Int_t nmaterial = matList->GetEntriesFast(); | |
915 | fMaterials = new Int_t[nmaterial+3]; | |
916 | ||
917 | // construct file names | |
918 | ||
3b8c325d | 919 | TString sFlukaVmcCoreInp = getenv("ALICE_ROOT"); |
920 | sFlukaVmcCoreInp +="/TFluka/input/"; | |
921 | TString sFlukaVmcTmp = "flukaMat.inp"; | |
922 | TString sFlukaVmcInp = GetInputFileName(); | |
923 | sFlukaVmcCoreInp += GetCoreInputFileName(); | |
829fb838 | 924 | |
925 | // open files | |
926 | ||
3b8c325d | 927 | if ((pFlukaVmcCoreInp = fopen(sFlukaVmcCoreInp.Data(),"r")) == NULL) { |
928 | printf("\nCannot open file %s\n",sFlukaVmcCoreInp.Data()); | |
829fb838 | 929 | exit(1); |
930 | } | |
3b8c325d | 931 | if ((pFlukaVmcFlukaMat = fopen(sFlukaVmcTmp.Data(),"r")) == NULL) { |
932 | printf("\nCannot open file %s\n",sFlukaVmcTmp.Data()); | |
829fb838 | 933 | exit(1); |
934 | } | |
3b8c325d | 935 | if ((pFlukaVmcInp = fopen(sFlukaVmcInp.Data(),"w")) == NULL) { |
936 | printf("\nCannot open file %s\n",sFlukaVmcInp.Data()); | |
829fb838 | 937 | exit(1); |
938 | } | |
939 | ||
940 | // copy core input file | |
941 | Char_t sLine[255]; | |
942 | Float_t fEventsPerRun; | |
943 | ||
3b8c325d | 944 | while ((fgets(sLine,255,pFlukaVmcCoreInp)) != NULL) { |
829fb838 | 945 | if (strncmp(sLine,"GEOEND",6) != 0) |
3b8c325d | 946 | fprintf(pFlukaVmcInp,"%s",sLine); // copy until GEOEND card |
829fb838 | 947 | else { |
3b8c325d | 948 | fprintf(pFlukaVmcInp,"GEOEND\n"); // add GEOEND card |
829fb838 | 949 | goto flukamat; |
950 | } | |
951 | } // end of while until GEOEND card | |
952 | ||
953 | ||
954 | flukamat: | |
3b8c325d | 955 | while ((fgets(sLine,255,pFlukaVmcFlukaMat)) != NULL) { // copy flukaMat.inp file |
956 | fprintf(pFlukaVmcInp,"%s\n",sLine); | |
829fb838 | 957 | } |
958 | ||
3b8c325d | 959 | while ((fgets(sLine,255,pFlukaVmcCoreInp)) != NULL) { |
829fb838 | 960 | if (strncmp(sLine,"START",5) != 0) |
3b8c325d | 961 | fprintf(pFlukaVmcInp,"%s\n",sLine); |
829fb838 | 962 | else { |
963 | sscanf(sLine+10,"%10f",&fEventsPerRun); | |
964 | goto fin; | |
965 | } | |
966 | } //end of while until START card | |
967 | ||
968 | fin: | |
969 | // in G3 the process control values meaning can be different for | |
970 | // different processes, but for most of them is: | |
971 | // 0 process is not activated | |
972 | // 1 process is activated WITH generation of secondaries | |
973 | // 2 process is activated WITHOUT generation of secondaries | |
974 | // if process does not generate secondaries => 1 same as 2 | |
975 | // | |
976 | // Exceptions: | |
977 | // MULS: also 3 | |
978 | // LOSS: also 3, 4 | |
979 | // RAYL: only 0,1 | |
980 | // HADR: may be > 2 | |
981 | // | |
982 | ||
983 | // Loop over number of SetProcess calls | |
3b8c325d | 984 | fprintf(pFlukaVmcInp,"*----------------------------------------------------------------------------- \n"); |
985 | fprintf(pFlukaVmcInp,"*----- The following data are generated from SetProcess and SetCut calls ----- \n"); | |
986 | fprintf(pFlukaVmcInp,"*----------------------------------------------------------------------------- \n"); | |
829fb838 | 987 | |
1df5fa54 | 988 | // Outer loop over processes |
989 | TIter next(fProcesses); | |
990 | TFlukaConfigOption *proc; | |
991 | // Inner loop over processes | |
992 | TIter nextp(fProcesses); | |
993 | TFlukaConfigOption *procp; | |
994 | // Loop over cuts | |
995 | TIter nextc(fCuts); | |
996 | TFlukaConfigOption *cut = 0x0; | |
997 | ||
998 | while((proc = (TFlukaConfigOption*)next())) { | |
829fb838 | 999 | Float_t matMin = three; |
1000 | Float_t matMax = fLastMaterial; | |
1001 | Bool_t global = kTRUE; | |
1df5fa54 | 1002 | if (proc->Medium() != -1) { |
1003 | matMin = Float_t(proc->Medium()); | |
829fb838 | 1004 | matMax = matMin; |
1005 | global = kFALSE; | |
1006 | } | |
1007 | ||
1008 | // annihilation | |
1009 | // G3 default value: 1 | |
1010 | // G4 processes: G4eplusAnnihilation/G4IeplusAnnihilation | |
1011 | // Particles: e+ | |
1012 | // Physics: EM | |
1013 | // flag = 0 no annihilation | |
1014 | // flag = 1 annihilation, decays processed | |
1015 | // flag = 2 annihilation, no decay product stored | |
1016 | // gMC ->SetProcess("ANNI",1); // EMFCUT -1. 0. 0. 3. lastmat 0. ANNH-THR | |
1df5fa54 | 1017 | if (strncmp(proc->GetName(),"ANNI",4) == 0) { |
1018 | if (proc->Flag() == 1 || proc->Flag() == 2) { | |
3b8c325d | 1019 | fprintf(pFlukaVmcInp,"*\n*Kinetic energy threshold (GeV) for e+ annihilation - resets to default=0.\n"); |
1020 | fprintf(pFlukaVmcInp,"*Generated from call: SetProcess('ANNI',1) or SetProcess('ANNI',2)\n"); | |
829fb838 | 1021 | // -one = kinetic energy threshold (GeV) for e+ annihilation (resets to default=0) |
1022 | // zero = not used | |
1023 | // zero = not used | |
1024 | // matMin = lower bound of the material indices in which the respective thresholds apply | |
1025 | // matMax = upper bound of the material indices in which the respective thresholds apply | |
1026 | // one = step length in assigning indices | |
1027 | // "ANNH-THR"; | |
3b8c325d | 1028 | fprintf(pFlukaVmcInp,"EMFCUT %10.1f%10.1f%10.1f%10.1f%10.1f%10.1fANNH-THR\n",-one,zero,zero,matMin,matMax,one); |
829fb838 | 1029 | } |
1df5fa54 | 1030 | else if (proc->Flag() == 0) { |
3b8c325d | 1031 | fprintf(pFlukaVmcInp,"*\n*No annihilation - no FLUKA card generated\n"); |
1032 | fprintf(pFlukaVmcInp,"*Generated from call: SetProcess('ANNI',0)\n"); | |
829fb838 | 1033 | } |
1034 | else { | |
3b8c325d | 1035 | fprintf(pFlukaVmcInp,"*\n*Illegal flag value in SetProcess('ANNI',?) call.\n"); |
1036 | fprintf(pFlukaVmcInp,"*No FLUKA card generated\n"); | |
829fb838 | 1037 | } |
1038 | } | |
1039 | ||
1040 | // bremsstrahlung and pair production are both activated | |
1041 | // G3 default value: 1 | |
1042 | // G4 processes: G4eBremsstrahlung/G4IeBremsstrahlung, | |
1043 | // G4MuBremsstrahlung/G4IMuBremsstrahlung, | |
1044 | // G4LowEnergyBremstrahlung | |
1045 | // Particles: e-/e+; mu+/mu- | |
1046 | // Physics: EM | |
1047 | // flag = 0 no bremsstrahlung | |
1048 | // flag = 1 bremsstrahlung, photon processed | |
1049 | // flag = 2 bremsstrahlung, no photon stored | |
1050 | // gMC ->SetProcess("BREM",1); // PAIRBREM 2. 0. 0. 3. lastmat | |
1051 | // EMFCUT -1. 0. 0. 3. lastmat 0. ELPO-THR | |
1052 | // G3 default value: 1 | |
1053 | // G4 processes: G4GammaConversion, | |
1054 | // G4MuPairProduction/G4IMuPairProduction | |
1055 | // G4LowEnergyGammaConversion | |
1056 | // Particles: gamma, mu | |
1057 | // Physics: EM | |
1058 | // flag = 0 no delta rays | |
1059 | // flag = 1 delta rays, secondaries processed | |
1060 | // flag = 2 delta rays, no secondaries stored | |
1061 | // gMC ->SetProcess("PAIR",1); // PAIRBREM 1. 0. 0. 3. lastmat | |
1062 | // EMFCUT 0. 0. -1. 3. lastmat 0. PHOT-THR | |
1df5fa54 | 1063 | else if ((strncmp(proc->GetName(),"PAIR",4) == 0) && (proc->Flag() == 1 || proc->Flag() == 2)) { |
829fb838 | 1064 | |
1df5fa54 | 1065 | nextp.Reset(); |
1066 | ||
1067 | while ((procp = (TFlukaConfigOption*)nextp())) { | |
1068 | if ((strncmp(procp->GetName(),"BREM",4) == 0) && | |
1069 | (proc->Flag() == 1 || procp->Flag() == 2) && | |
1070 | (procp->Medium() == proc->Medium())) { | |
3b8c325d | 1071 | fprintf(pFlukaVmcInp,"*\n*Bremsstrahlung and pair production by muons and charged hadrons both activated\n"); |
1072 | fprintf(pFlukaVmcInp,"*Generated from call: SetProcess('BREM',1) and SetProcess('PAIR',1)\n"); | |
1073 | fprintf(pFlukaVmcInp,"*Energy threshold set by call SetCut('BCUTM',cut) or set to 0.\n"); | |
1074 | fprintf(pFlukaVmcInp,"*Energy threshold set by call SetCut('PPCUTM',cut) or set to 0.\n"); | |
829fb838 | 1075 | // three = bremsstrahlung and pair production by muons and charged hadrons both are activated |
3b8c325d | 1076 | fprintf(pFlukaVmcInp,"PAIRBREM %10.1f",three); |
829fb838 | 1077 | // direct pair production by muons |
1078 | // G4 particles: "e-", "e+" | |
1079 | // G3 default value: 0.01 GeV | |
1080 | //gMC ->SetCut("PPCUTM",cut); // total energy cut for direct pair prod. by muons | |
1081 | fCut = 0.0; | |
1df5fa54 | 1082 | nextc.Reset(); |
1083 | while ((cut = (TFlukaConfigOption*)nextc())) { | |
1084 | if (strncmp(cut->GetName(), "PPCUTM", 6) == 0 && | |
1085 | (cut->Medium() == proc->Medium())) fCut = cut->Cut(); | |
829fb838 | 1086 | } |
3b8c325d | 1087 | fprintf(pFlukaVmcInp,"%10.4g",fCut); |
829fb838 | 1088 | // fCut; = e+, e- kinetic energy threshold (in GeV) for explicit pair production. |
1089 | // muon and hadron bremsstrahlung | |
1090 | // G4 particles: "gamma" | |
1091 | // G3 default value: CUTGAM=0.001 GeV | |
1092 | //gMC ->SetCut("BCUTM",cut); // cut for muon and hadron bremsstrahlung | |
1093 | fCut = 0.0; | |
1df5fa54 | 1094 | nextc.Reset(); |
1095 | while ((cut = (TFlukaConfigOption*)nextc())) { | |
1096 | if (strncmp(cut->GetName(), "BCUTM", 5) == 0 && | |
1097 | (cut->Medium() == proc->Medium())) fCut = cut->Cut(); | |
829fb838 | 1098 | } |
3b8c325d | 1099 | fprintf(pFlukaVmcInp,"%10.4g%10.1f%10.1f\n",fCut,matMin,matMax); |
829fb838 | 1100 | // fCut = photon energy threshold (GeV) for explicit bremsstrahlung production |
1101 | // matMin = lower bound of the material indices in which the respective thresholds apply | |
1102 | // matMax = upper bound of the material indices in which the respective thresholds apply | |
1103 | ||
1104 | // for e+ and e- | |
3b8c325d | 1105 | fprintf(pFlukaVmcInp,"*\n*Kinetic energy threshold (GeV) for e+/e- bremsstrahlung - resets to default=0.\n"); |
1106 | fprintf(pFlukaVmcInp,"*Generated from call: SetProcess('BREM',1);\n"); | |
829fb838 | 1107 | fCut = -1.0; |
1df5fa54 | 1108 | nextc.Reset(); |
1109 | while ((cut = (TFlukaConfigOption*)nextc())) { | |
1110 | if (strncmp(cut->GetName(), "BCUTE", 5) == 0 && | |
1111 | (cut->Medium() == proc->Medium())) fCut = cut->Cut(); | |
829fb838 | 1112 | } |
1113 | //fCut = kinetic energy threshold (GeV) for e+/e- bremsstrahlung (resets to default=0) | |
1114 | // zero = not used | |
1115 | // zero = not used | |
1116 | // matMin = lower bound of the material indices in which the respective thresholds apply | |
1117 | // matMax = upper bound of the material indices in which the respective thresholds apply | |
1118 | // one = step length in assigning indices | |
1119 | // "ELPO-THR"; | |
3b8c325d | 1120 | fprintf(pFlukaVmcInp,"EMFCUT %10.4g%10.1f%10.1f%10.1f%10.1f%10.1fELPO-THR\n",fCut,zero,zero,matMin,matMax,one); |
829fb838 | 1121 | |
1122 | // for e+ and e- | |
3b8c325d | 1123 | fprintf(pFlukaVmcInp,"*\n*Pair production by electrons is activated\n"); |
1124 | fprintf(pFlukaVmcInp,"*Generated from call: SetProcess('PAIR',1);\n"); | |
829fb838 | 1125 | fCut = -1.0; |
1df5fa54 | 1126 | nextc.Reset(); |
1127 | while ((cut = (TFlukaConfigOption*)nextc())) { | |
1128 | if (strncmp(cut->GetName(), "CUTGAM", 6) == 0 && | |
1129 | (cut->Medium() == proc->Medium())) fCut = cut->Cut(); | |
829fb838 | 1130 | } |
1131 | // fCut = energy threshold (GeV) for gamma pair production (< 0.0 : resets to default, = 0.0 : ignored) | |
1132 | // matMin = lower bound of the material indices in which the respective thresholds apply | |
1133 | // matMax = upper bound of the material indices in which the respective thresholds apply | |
1134 | // one = step length in assigning indices | |
3b8c325d | 1135 | fprintf(pFlukaVmcInp,"EMFCUT %10.1f%10.1f%10.4g%10.1f%10.1f%10.1fPHOT-THR\n",zero,zero,fCut,matMin,matMax,one); |
829fb838 | 1136 | goto BOTH; |
1137 | } // end of if for BREM | |
1138 | } // end of loop for BREM | |
1139 | ||
1140 | // only pair production by muons and charged hadrons is activated | |
3b8c325d | 1141 | fprintf(pFlukaVmcInp,"*\n*Pair production by muons and charged hadrons is activated\n"); |
1142 | fprintf(pFlukaVmcInp,"*Generated from call: SetProcess('PAIR',1) or SetProcess('PAIR',2)\n"); | |
1143 | fprintf(pFlukaVmcInp,"*Energy threshold set by call SetCut('PPCUTM',cut) or set to 0.\n"); | |
829fb838 | 1144 | // direct pair production by muons |
1145 | // G4 particles: "e-", "e+" | |
1146 | // G3 default value: 0.01 GeV | |
1147 | //gMC ->SetCut("PPCUTM",cut); // total energy cut for direct pair prod. by muons | |
1148 | // one = pair production by muons and charged hadrons is activated | |
1149 | // zero = e+, e- kinetic energy threshold (in GeV) for explicit pair production. | |
1150 | // zero = no explicit bremsstrahlung production is simulated | |
1151 | // matMin = lower bound of the material indices in which the respective thresholds apply | |
1152 | // matMax = upper bound of the material indices in which the respective thresholds apply | |
3b8c325d | 1153 | fprintf(pFlukaVmcInp,"PAIRBREM %10.1f%10.1f%10.1f%10.1f%10.1f\n",one,zero,zero,matMin,matMax); |
829fb838 | 1154 | |
1155 | // for e+ and e- | |
3b8c325d | 1156 | fprintf(pFlukaVmcInp,"*\n*Pair production by electrons is activated\n"); |
1157 | fprintf(pFlukaVmcInp,"*Generated from call: SetProcess('PAIR',1) or SetProcess('PAIR',2)\n"); | |
829fb838 | 1158 | fCut = -1.0; |
1df5fa54 | 1159 | nextc.Reset(); |
1160 | while ((cut = (TFlukaConfigOption*)nextc())) { | |
1161 | if (strncmp(cut->GetName(), "CUTGAM", 6) == 0 && | |
1162 | (cut->Medium() == proc->Medium())) fCut = cut->Cut(); | |
829fb838 | 1163 | } |
1164 | // zero = energy threshold (GeV) for Compton scattering (= 0.0 : ignored) | |
1165 | // zero = energy threshold (GeV) for Photoelectric (= 0.0 : ignored) | |
1166 | // fCut = energy threshold (GeV) for gamma pair production (< 0.0 : resets to default, = 0.0 : ignored) | |
1167 | // matMin = lower bound of the material indices in which the respective thresholds apply | |
1168 | // matMax = upper bound of the material indices in which the respective thresholds apply | |
1169 | // one = step length in assigning indices | |
3b8c325d | 1170 | fprintf(pFlukaVmcInp,"EMFCUT %10.1f%10.1f%10.4g%10.1f%10.1f%10.1fPHOT-THR\n",zero,zero,fCut,matMin,matMax,one); |
829fb838 | 1171 | |
1172 | BOTH: | |
1173 | k = 0; | |
1174 | } // end of if for PAIR | |
1175 | ||
1176 | ||
1177 | ||
1178 | // bremsstrahlung | |
1179 | // G3 default value: 1 | |
1180 | // G4 processes: G4eBremsstrahlung/G4IeBremsstrahlung, | |
1181 | // G4MuBremsstrahlung/G4IMuBremsstrahlung, | |
1182 | // G4LowEnergyBremstrahlung | |
1183 | // Particles: e-/e+; mu+/mu- | |
1184 | // Physics: EM | |
1185 | // flag = 0 no bremsstrahlung | |
1186 | // flag = 1 bremsstrahlung, photon processed | |
1187 | // flag = 2 bremsstrahlung, no photon stored | |
1188 | // gMC ->SetProcess("BREM",1); // PAIRBREM 2. 0. 0. 3. lastmat | |
1189 | // EMFCUT -1. 0. 0. 3. lastmat 0. ELPO-THR | |
1df5fa54 | 1190 | else if (strncmp(proc->GetName(),"BREM",4) == 0) { |
1191 | nextp.Reset(); | |
1192 | while((procp = (TFlukaConfigOption*)nextp())) { | |
1193 | if ((strncmp(procp->GetName(),"PAIR",4) == 0) && | |
1194 | procp->Flag() == 1 && | |
1195 | (procp->Medium() == proc->Medium())) goto NOBREM; | |
829fb838 | 1196 | } |
1df5fa54 | 1197 | if (proc->Flag() == 1 || proc->Flag() == 2) { |
3b8c325d | 1198 | fprintf(pFlukaVmcInp,"*\n*Bremsstrahlung by muons and charged hadrons is activated\n"); |
1199 | fprintf(pFlukaVmcInp,"*Generated from call: SetProcess('BREM',1) or SetProcess('BREM',2)\n"); | |
1200 | fprintf(pFlukaVmcInp,"*Energy threshold set by call SetCut('BCUTM',cut) or set to 0.\n"); | |
829fb838 | 1201 | // two = bremsstrahlung by muons and charged hadrons is activated |
1202 | // zero = no meaning | |
1203 | // muon and hadron bremsstrahlung | |
1204 | // G4 particles: "gamma" | |
1205 | // G3 default value: CUTGAM=0.001 GeV | |
1206 | //gMC ->SetCut("BCUTM",cut); // cut for muon and hadron bremsstrahlung | |
1207 | fCut = 0.0; | |
1df5fa54 | 1208 | nextc.Reset(); |
1209 | while ((cut = (TFlukaConfigOption*)nextc())) { | |
1210 | if (strncmp(cut->GetName(), "BCUTM", 5) == 0 && | |
1211 | (cut->Medium() == proc->Medium())) fCut = cut->Cut(); | |
829fb838 | 1212 | } |
1213 | // fCut = photon energy threshold (GeV) for explicit bremsstrahlung production | |
1214 | // matMin = lower bound of the material indices in which the respective thresholds apply | |
1215 | // matMax = upper bound of the material indices in which the respective thresholds apply | |
3b8c325d | 1216 | fprintf(pFlukaVmcInp,"PAIRBREM %10.1f%10.1f%10.4g%10.1f%10.1f\n",two,zero,fCut,matMin,matMax); |
829fb838 | 1217 | |
1218 | // for e+ and e- | |
3b8c325d | 1219 | fprintf(pFlukaVmcInp,"*\n*Kinetic energy threshold (GeV) for e+/e- bremsstrahlung - resets to default=0.\n"); |
1220 | fprintf(pFlukaVmcInp,"*Generated from call: SetProcess('BREM',1);"); | |
829fb838 | 1221 | // - one = kinetic energy threshold (GeV) for e+/e- bremsstrahlung (resets to default=0) |
1222 | // zero = not used | |
1223 | // zero = not used | |
1224 | // matMin = lower bound of the material indices in which the respective thresholds apply | |
1225 | // matMax = upper bound of the material indices in which the respective thresholds apply | |
1226 | // one = step length in assigning indices | |
1227 | //"ELPO-THR"; | |
3b8c325d | 1228 | fprintf(pFlukaVmcInp,"EMFCUT %10.1f%10.1f%10.1f%10.1f%10.1f%10.1fELPO-THR\n",-one,zero,zero,matMin,matMax,one); |
829fb838 | 1229 | } |
1df5fa54 | 1230 | else if (proc->Flag() == 0) { |
3b8c325d | 1231 | fprintf(pFlukaVmcInp,"*\n*No bremsstrahlung - no FLUKA card generated\n"); |
1232 | fprintf(pFlukaVmcInp,"*Generated from call: SetProcess('BREM',0)\n"); | |
829fb838 | 1233 | } |
1234 | else { | |
3b8c325d | 1235 | fprintf(pFlukaVmcInp,"*\n*Illegal flag value in SetProcess('BREM',?) call.\n"); |
1236 | fprintf(pFlukaVmcInp,"*No FLUKA card generated\n"); | |
829fb838 | 1237 | } |
1238 | NOBREM: | |
1239 | j = 0; | |
1df5fa54 | 1240 | } // end of else if (strncmp(proc->GetName(),"BREM",4) == 0) |
829fb838 | 1241 | |
1242 | // Cerenkov photon generation | |
1243 | // G3 default value: 0 | |
1244 | // G4 process: G4Cerenkov | |
1245 | // | |
1246 | // Particles: charged | |
1247 | // Physics: Optical | |
1248 | // flag = 0 no Cerenkov photon generation | |
1249 | // flag = 1 Cerenkov photon generation | |
1250 | // flag = 2 Cerenkov photon generation with primary stopped at each step | |
1251 | //xx gMC ->SetProcess("CKOV",1); // ??? Cerenkov photon generation | |
1252 | ||
1df5fa54 | 1253 | else if (strncmp(proc->GetName(),"CKOV",4) == 0) { |
1254 | if ((proc->Flag() == 1 || proc->Flag() == 2) && global) { | |
829fb838 | 1255 | // Write comments |
3b8c325d | 1256 | fprintf(pFlukaVmcInp, "* \n"); |
1257 | fprintf(pFlukaVmcInp, "*Cerenkov photon generation\n"); | |
1258 | fprintf(pFlukaVmcInp, "*Generated from call: SetProcess('CKOV',1) or SetProcess('CKOV',2)\n"); | |
829fb838 | 1259 | // Loop over media |
1260 | for (Int_t im = 0; im < nmaterial; im++) | |
1261 | { | |
1262 | TGeoMaterial* material = dynamic_cast<TGeoMaterial*> (matList->At(im)); | |
1263 | Int_t idmat = material->GetIndex(); | |
1264 | ||
1df5fa54 | 1265 | if (!global && idmat != proc->Medium()) continue; |
829fb838 | 1266 | |
1267 | fMaterials[idmat] = im; | |
1268 | // Skip media with no Cerenkov properties | |
1269 | TFlukaCerenkov* cerenkovProp; | |
1270 | if (!(cerenkovProp = dynamic_cast<TFlukaCerenkov*>(material->GetCerenkovProperties()))) continue; | |
1271 | // | |
1272 | // This medium has Cerenkov properties | |
1273 | // | |
1274 | // | |
1275 | // Write OPT-PROD card for each medium | |
1276 | Float_t emin = cerenkovProp->GetMinimumEnergy(); | |
1277 | Float_t emax = cerenkovProp->GetMaximumEnergy(); | |
3b8c325d | 1278 | fprintf(pFlukaVmcInp, "OPT-PROD %10.4g%10.4g%10.4g%10.4g%10.4g%10.4gCERENKOV\n", emin, emax, 0., |
829fb838 | 1279 | Float_t(idmat), Float_t(idmat), 0.); |
1280 | // | |
1281 | // Write OPT-PROP card for each medium | |
1282 | // Forcing FLUKA to call user routines (queffc.cxx, rflctv.cxx, rfrndx.cxx) | |
1283 | // | |
3b8c325d | 1284 | fprintf(pFlukaVmcInp, "OPT-PROP %10.4g%10.4g%10.4g%10.1f%10.1f%10.1fWV-LIMIT\n", |
829fb838 | 1285 | cerenkovProp->GetMinimumWavelength(), |
1286 | cerenkovProp->GetMaximumWavelength(), | |
1287 | cerenkovProp->GetMaximumWavelength(), | |
1288 | Float_t(idmat), Float_t(idmat), 0.0); | |
1289 | ||
1290 | if (cerenkovProp->IsMetal()) { | |
3b8c325d | 1291 | fprintf(pFlukaVmcInp, "OPT-PROP %10.1f%10.1f%10.1f%10.1f%10.1f%10.1fMETAL\n", |
829fb838 | 1292 | -100., -100., -100., |
1293 | Float_t(idmat), Float_t(idmat), 0.0); | |
1294 | } else { | |
3b8c325d | 1295 | fprintf(pFlukaVmcInp, "OPT-PROP %10.1f%10.1f%10.1f%10.1f%10.1f%10.1f\n", |
829fb838 | 1296 | -100., -100., -100., |
1297 | Float_t(idmat), Float_t(idmat), 0.0); | |
1298 | } | |
1299 | ||
1300 | ||
1301 | for (Int_t j = 0; j < 3; j++) { | |
3b8c325d | 1302 | fprintf(pFlukaVmcInp, "OPT-PROP %10.1f%10.1f%10.1f%10.1f%10.1f%10.1f&\n", |
829fb838 | 1303 | -100., -100., -100., |
1304 | Float_t(idmat), Float_t(idmat), 0.0); | |
1305 | } | |
1306 | // Photon detection efficiency user defined | |
1307 | ||
1308 | if (cerenkovProp->IsSensitive()) | |
3b8c325d | 1309 | fprintf(pFlukaVmcInp, "OPT-PROP %10.1f%10.1f%10.1f%10.1f%10.1f%10.1fSENSITIV\n", |
829fb838 | 1310 | -100., -100., -100., |
1311 | Float_t(idmat), Float_t(idmat), 0.0); | |
1312 | ||
1313 | } // materials | |
1df5fa54 | 1314 | } else if (proc->Flag() == 0) { |
3b8c325d | 1315 | fprintf(pFlukaVmcInp,"*\n*No Cerenkov photon generation\n"); |
1316 | fprintf(pFlukaVmcInp,"*Generated from call: SetProcess('CKOV',0)\n"); | |
829fb838 | 1317 | // zero = not used |
1318 | // zero = not used | |
1319 | // zero = not used | |
1320 | // matMin = lower bound of the material indices in which the respective thresholds apply | |
1321 | // matMax = upper bound of the material indices in which the respective thresholds apply | |
1322 | // one = step length in assigning indices | |
1323 | //"CERE-OFF"; | |
3b8c325d | 1324 | fprintf(pFlukaVmcInp,"OPT-PROD %10.1f%10.1f%10.1f%10.1f%10.1f%10.1fCERE-OFF\n",zero,zero,zero,matMin,matMax,one); |
829fb838 | 1325 | } |
1326 | else { | |
3b8c325d | 1327 | fprintf(pFlukaVmcInp,"*\n*Illegal flag value in SetProcess('CKOV',?) call.\n"); |
1328 | fprintf(pFlukaVmcInp,"*No FLUKA card generated\n"); | |
829fb838 | 1329 | } |
1df5fa54 | 1330 | } // end of else if (strncmp(proc->GetName(),"CKOV",4) == 0) |
829fb838 | 1331 | |
1332 | // Compton scattering | |
1333 | // G3 default value: 1 | |
1334 | // G4 processes: G4ComptonScattering, | |
1335 | // G4LowEnergyCompton, | |
1336 | // G4PolarizedComptonScattering | |
1337 | // Particles: gamma | |
1338 | // Physics: EM | |
1339 | // flag = 0 no Compton scattering | |
1340 | // flag = 1 Compton scattering, electron processed | |
1341 | // flag = 2 Compton scattering, no electron stored | |
1342 | // gMC ->SetProcess("COMP",1); // EMFCUT -1. 0. 0. 3. lastmat 0. PHOT-THR | |
1df5fa54 | 1343 | else if (strncmp(proc->GetName(),"COMP",4) == 0) { |
1344 | if (proc->Flag() == 1 || proc->Flag() == 2) { | |
3b8c325d | 1345 | fprintf(pFlukaVmcInp,"*\n*Energy threshold (GeV) for Compton scattering - resets to default=0.\n"); |
1346 | fprintf(pFlukaVmcInp,"*Generated from call: SetProcess('COMP',1);\n"); | |
829fb838 | 1347 | // - one = energy threshold (GeV) for Compton scattering - resets to default=0. |
1348 | // zero = not used | |
1349 | // zero = not used | |
1350 | // matMin = lower bound of the material indices in which the respective thresholds apply | |
1351 | // matMax = upper bound of the material indices in which the respective thresholds apply | |
1352 | // one = step length in assigning indices | |
1353 | //"PHOT-THR"; | |
3b8c325d | 1354 | fprintf(pFlukaVmcInp,"EMFCUT %10.1f%10.1f%10.1f%10.1f%10.1f%10.1fPHOT-THR\n",-one,zero,zero,matMin,matMax,one); |
829fb838 | 1355 | } |
1df5fa54 | 1356 | else if (proc->Flag() == 0) { |
3b8c325d | 1357 | fprintf(pFlukaVmcInp,"*\n*No Compton scattering - no FLUKA card generated\n"); |
1358 | fprintf(pFlukaVmcInp,"*Generated from call: SetProcess('COMP',0)\n"); | |
829fb838 | 1359 | } |
1360 | else { | |
3b8c325d | 1361 | fprintf(pFlukaVmcInp,"*\n*Illegal flag value in SetProcess('COMP',?) call.\n"); |
1362 | fprintf(pFlukaVmcInp,"*No FLUKA card generated\n"); | |
829fb838 | 1363 | } |
1df5fa54 | 1364 | } // end of else if (strncmp(proc->GetName(),"COMP",4) == 0) |
829fb838 | 1365 | |
1366 | // decay | |
1367 | // G3 default value: 1 | |
1368 | // G4 process: G4Decay | |
1369 | // | |
1370 | // Particles: all which decay is applicable for | |
1371 | // Physics: General | |
1372 | // flag = 0 no decays | |
1373 | // flag = 1 decays, secondaries processed | |
1374 | // flag = 2 decays, no secondaries stored | |
7f13be31 | 1375 | //gMC ->SetProcess("DCAY",0); // not available |
83ec523a | 1376 | else if ((strncmp(proc->GetName(),"DCAY",4) == 0) && proc->Flag() == 0) |
7f13be31 | 1377 | cout << "SetProcess for flag =" << proc->GetName() << " value=" << proc->Flag() << " not avaliable!" << endl; |
1378 | else if ((strncmp(proc->GetName(),"DCAY",4) == 0) && proc->Flag() == 1) { | |
1379 | // Nothing to do decays are switched on by default | |
1380 | } | |
1381 | ||
829fb838 | 1382 | |
1383 | // delta-ray | |
1384 | // G3 default value: 2 | |
1385 | // !! G4 treats delta rays in different way | |
1386 | // G4 processes: G4eIonisation/G4IeIonization, | |
1387 | // G4MuIonisation/G4IMuIonization, | |
1388 | // G4hIonisation/G4IhIonisation | |
1389 | // Particles: charged | |
1390 | // Physics: EM | |
1391 | // flag = 0 no energy loss | |
1392 | // flag = 1 restricted energy loss fluctuations | |
1393 | // flag = 2 complete energy loss fluctuations | |
1394 | // flag = 3 same as 1 | |
1395 | // flag = 4 no energy loss fluctuations | |
1396 | // gMC ->SetProcess("DRAY",0); // DELTARAY 1.E+6 0. 0. 3. lastmat 0. | |
1df5fa54 | 1397 | else if (strncmp(proc->GetName(),"DRAY",4) == 0) { |
1398 | if (proc->Flag() == 0 || proc->Flag() == 4) { | |
3b8c325d | 1399 | fprintf(pFlukaVmcInp,"*\n*Kinetic energy threshold (GeV) for delta ray production\n"); |
1400 | fprintf(pFlukaVmcInp,"*Generated from call: SetProcess('DRAY',0) or SetProcess('DRAY',4)\n"); | |
1401 | fprintf(pFlukaVmcInp,"*No delta ray production by muons - threshold set artificially high\n"); | |
829fb838 | 1402 | Double_t emin = 1.0e+6; // kinetic energy threshold (GeV) for delta ray production (discrete energy transfer) |
1403 | // zero = ignored | |
1404 | // zero = ignored | |
1405 | // matMin = lower bound of the material indices in which the respective thresholds apply | |
1406 | // matMax = upper bound of the material indices in which the respective thresholds apply | |
1407 | // one = step length in assigning indices | |
3b8c325d | 1408 | fprintf(pFlukaVmcInp,"DELTARAY %10.4g%10.1f%10.1f%10.1f%10.1f%10.1f\n",emin,zero,zero,matMin,matMax,one); |
829fb838 | 1409 | } |
1df5fa54 | 1410 | else if (proc->Flag() == 1 || proc->Flag() == 2 || proc->Flag() == 3) { |
3b8c325d | 1411 | fprintf(pFlukaVmcInp,"*\n*Kinetic energy threshold (GeV) for delta ray production\n"); |
1412 | fprintf(pFlukaVmcInp,"*Generated from call: SetProcess('DRAY',flag), flag=1,2,3\n"); | |
1413 | fprintf(pFlukaVmcInp,"*Delta ray production by muons switched on\n"); | |
1414 | fprintf(pFlukaVmcInp,"*Energy threshold set by call SetCut('DCUTM',cut) or set to 1.0e+6.\n"); | |
829fb838 | 1415 | fCut = 1.0e+6; |
1df5fa54 | 1416 | nextc.Reset(); |
1417 | while ((cut = (TFlukaConfigOption*)nextc())) { | |
1418 | if (strncmp(cut->GetName(), "DCUTM", 5) == 0 && | |
1419 | cut->Medium() == proc->Medium()) fCut = cut->Cut(); | |
829fb838 | 1420 | } |
1421 | // fCut = kinetic energy threshold (GeV) for delta ray production (discrete energy transfer) | |
1422 | // zero = ignored | |
1423 | // zero = ignored | |
1424 | // matMin = lower bound of the material indices in which the respective thresholds apply | |
1425 | // matMax = upper bound of the material indices in which the respective thresholds apply | |
1426 | // one = step length in assigning indices | |
3b8c325d | 1427 | fprintf(pFlukaVmcInp,"DELTARAY %10.4g%10.1f%10.1f%10.1f%10.1f%10.1f\n",fCut,zero,zero,matMin,matMax,one); |
829fb838 | 1428 | } |
1429 | else { | |
3b8c325d | 1430 | fprintf(pFlukaVmcInp,"*\n*Illegal flag value in SetProcess('DRAY',?) call.\n"); |
1431 | fprintf(pFlukaVmcInp,"*No FLUKA card generated\n"); | |
829fb838 | 1432 | } |
1df5fa54 | 1433 | } // end of else if (strncmp(proc->GetName(),"DRAY",4) == 0) |
829fb838 | 1434 | |
1435 | // hadronic process | |
1436 | // G3 default value: 1 | |
1437 | // G4 processes: all defined by TG4PhysicsConstructorHadron | |
1438 | // | |
1439 | // Particles: hadrons | |
1440 | // Physics: Hadron | |
1441 | // flag = 0 no multiple scattering | |
1442 | // flag = 1 hadronic interactions, secondaries processed | |
1443 | // flag = 2 hadronic interactions, no secondaries stored | |
1444 | // gMC ->SetProcess("HADR",1); // ??? hadronic process | |
1445 | //Select pure GEANH (HADR 1) or GEANH/NUCRIN (HADR 3) ????? | |
1df5fa54 | 1446 | else if (strncmp(proc->GetName(),"HADR",4) == 0) { |
1447 | if (proc->Flag() == 1 || proc->Flag() == 2) { | |
3b8c325d | 1448 | fprintf(pFlukaVmcInp,"*\n*Hadronic interaction is ON by default in FLUKA\n"); |
1449 | fprintf(pFlukaVmcInp,"*No FLUKA card generated\n"); | |
829fb838 | 1450 | } |
1df5fa54 | 1451 | else if (proc->Flag() == 0) { |
3b8c325d | 1452 | fprintf(pFlukaVmcInp,"*\n*Hadronic interaction is set OFF\n"); |
1453 | fprintf(pFlukaVmcInp,"*Generated from call: SetProcess('HADR',0);\n"); | |
1454 | fprintf(pFlukaVmcInp,"*Switching off hadronic interactions not foreseen in FLUKA\n"); | |
1455 | fprintf(pFlukaVmcInp,"THRESHOL %10.1f%10.1f%10.1f%10.1e%10.1f\n",zero, zero, zero, 1.e10, zero); | |
829fb838 | 1456 | } |
1457 | else { | |
3b8c325d | 1458 | fprintf(pFlukaVmcInp,"*\n*Illegal flag value in SetProcess('HADR',?) call.\n"); |
1459 | fprintf(pFlukaVmcInp,"*No FLUKA card generated\n"); | |
829fb838 | 1460 | } |
1df5fa54 | 1461 | } // end of else if (strncmp(proc->GetName(),"HADR",4) == 0) |
829fb838 | 1462 | |
1463 | ||
1464 | // energy loss | |
1465 | // G3 default value: 2 | |
1466 | // G4 processes: G4eIonisation/G4IeIonization, | |
1467 | // G4MuIonisation/G4IMuIonization, | |
1468 | // G4hIonisation/G4IhIonisation | |
1469 | // | |
1470 | // Particles: charged | |
1471 | // Physics: EM | |
1472 | // flag=0 no energy loss | |
1473 | // flag=1 restricted energy loss fluctuations | |
1474 | // flag=2 complete energy loss fluctuations | |
1475 | // flag=3 same as 1 | |
1476 | // flag=4 no energy loss fluctuations | |
1477 | // If the value ILOSS is changed, then (in G3) cross-sections and energy | |
1478 | // loss tables must be recomputed via the command 'PHYSI' | |
1479 | // gMC ->SetProcess("LOSS",2); // ??? IONFLUCT ? energy loss | |
1df5fa54 | 1480 | else if (strncmp(proc->GetName(),"LOSS",4) == 0) { |
1481 | if (proc->Flag() == 2) { // complete energy loss fluctuations | |
3b8c325d | 1482 | fprintf(pFlukaVmcInp,"*\n*Complete energy loss fluctuations do not exist in FLUKA\n"); |
1483 | fprintf(pFlukaVmcInp,"*Generated from call: SetProcess('LOSS',2);\n"); | |
1484 | fprintf(pFlukaVmcInp,"*flag=2=complete energy loss fluctuations\n"); | |
1485 | fprintf(pFlukaVmcInp,"*No FLUKA card generated\n"); | |
829fb838 | 1486 | } |
1df5fa54 | 1487 | else if (proc->Flag() == 1 || proc->Flag() == 3) { // restricted energy loss fluctuations |
3b8c325d | 1488 | fprintf(pFlukaVmcInp,"*\n*Restricted energy loss fluctuations\n"); |
1489 | fprintf(pFlukaVmcInp,"*Generated from call: SetProcess('LOSS',1) or SetProcess('LOSS',3)\n"); | |
829fb838 | 1490 | // one = restricted energy loss fluctuations (for hadrons and muons) switched on |
1491 | // one = restricted energy loss fluctuations (for e+ and e-) switched on | |
1492 | // one = minimal accuracy | |
1493 | // matMin = lower bound of the material indices in which the respective thresholds apply | |
1494 | // upper bound of the material indices in which the respective thresholds apply | |
3b8c325d | 1495 | fprintf(pFlukaVmcInp,"IONFLUCT %10.1f%10.1f%10.1f%10.1f%10.1f\n",one,one,one,matMin,matMax); |
829fb838 | 1496 | } |
1df5fa54 | 1497 | else if (proc->Flag() == 4) { // no energy loss fluctuations |
3b8c325d | 1498 | fprintf(pFlukaVmcInp,"*\n*No energy loss fluctuations\n"); |
1499 | fprintf(pFlukaVmcInp,"*\n*Generated from call: SetProcess('LOSS',4)\n"); | |
829fb838 | 1500 | // - one = restricted energy loss fluctuations (for hadrons and muons) switched off |
1501 | // - one = restricted energy loss fluctuations (for e+ and e-) switched off | |
1502 | // one = minimal accuracy | |
1503 | // matMin = lower bound of the material indices in which the respective thresholds apply | |
1504 | // matMax = upper bound of the material indices in which the respective thresholds apply | |
3b8c325d | 1505 | fprintf(pFlukaVmcInp,"IONFLUCT %10.1f%10.1f%10.1f%10.1f%10.1f\n",-one,-one,one,matMin,matMax); |
829fb838 | 1506 | } |
1507 | else { | |
3b8c325d | 1508 | fprintf(pFlukaVmcInp,"*\n*Illegal flag value in SetProcess('LOSS',?) call.\n"); |
1509 | fprintf(pFlukaVmcInp,"*No FLUKA card generated\n"); | |
829fb838 | 1510 | } |
1df5fa54 | 1511 | } // end of else if (strncmp(proc->GetName(),"LOSS",4) == 0) |
829fb838 | 1512 | |
1513 | ||
1514 | // multiple scattering | |
1515 | // G3 default value: 1 | |
1516 | // G4 process: G4MultipleScattering/G4IMultipleScattering | |
1517 | // | |
1518 | // Particles: charged | |
1519 | // Physics: EM | |
1520 | // flag = 0 no multiple scattering | |
1521 | // flag = 1 Moliere or Coulomb scattering | |
1522 | // flag = 2 Moliere or Coulomb scattering | |
1523 | // flag = 3 Gaussian scattering | |
1524 | // gMC ->SetProcess("MULS",1); // MULSOPT multiple scattering | |
1df5fa54 | 1525 | else if (strncmp(proc->GetName(),"MULS",4) == 0) { |
1526 | if (proc->Flag() == 1 || proc->Flag() == 2 || proc->Flag() == 3) { | |
3b8c325d | 1527 | fprintf(pFlukaVmcInp,"*\n*Multiple scattering is ON by default for e+e- and for hadrons/muons\n"); |
1528 | fprintf(pFlukaVmcInp,"*No FLUKA card generated\n"); | |
829fb838 | 1529 | } |
1df5fa54 | 1530 | else if (proc->Flag() == 0) { |
3b8c325d | 1531 | fprintf(pFlukaVmcInp,"*\n*Multiple scattering is set OFF\n"); |
1532 | fprintf(pFlukaVmcInp,"*Generated from call: SetProcess('MULS',0);\n"); | |
829fb838 | 1533 | // zero = ignored |
1534 | // three = multiple scattering for hadrons and muons is completely suppressed | |
1535 | // three = multiple scattering for e+ and e- is completely suppressed | |
1536 | // matMin = lower bound of the material indices in which the respective thresholds apply | |
1537 | // matMax = upper bound of the material indices in which the respective thresholds apply | |
3b8c325d | 1538 | fprintf(pFlukaVmcInp,"MULSOPT %10.1f%10.1f%10.1f%10.1f%10.1f\n",zero,three,three,matMin,matMax); |
829fb838 | 1539 | } |
1540 | else { | |
3b8c325d | 1541 | fprintf(pFlukaVmcInp,"*\n*Illegal flag value in SetProcess('MULS',?) call.\n"); |
1542 | fprintf(pFlukaVmcInp,"*No FLUKA card generated\n"); | |
829fb838 | 1543 | } |
1df5fa54 | 1544 | } // end of else if (strncmp(proc->GetName(),"MULS",4) == 0) |
829fb838 | 1545 | |
1546 | ||
1547 | // muon nuclear interaction | |
1548 | // G3 default value: 0 | |
1549 | // G4 processes: G4MuNuclearInteraction, | |
1550 | // G4MuonMinusCaptureAtRest | |
1551 | // | |
1552 | // Particles: mu | |
1553 | // Physics: Not set | |
1554 | // flag = 0 no muon-nuclear interaction | |
1555 | // flag = 1 nuclear interaction, secondaries processed | |
1556 | // flag = 2 nuclear interaction, secondaries not processed | |
1557 | // gMC ->SetProcess("MUNU",1); // MUPHOTON 1. 0. 0. 3. lastmat | |
1df5fa54 | 1558 | else if (strncmp(proc->GetName(),"MUNU",4) == 0) { |
1559 | if (proc->Flag() == 1) { | |
3b8c325d | 1560 | fprintf(pFlukaVmcInp,"*\n*Muon nuclear interactions with production of secondary hadrons\n"); |
1561 | fprintf(pFlukaVmcInp,"*\n*Generated from call: SetProcess('MUNU',1);\n"); | |
829fb838 | 1562 | // one = full simulation of muon nuclear interactions and production of secondary hadrons |
1563 | // zero = ratio of longitudinal to transverse virtual photon cross-section - Default = 0.25. | |
1564 | // zero = fraction of rho-like interactions ( must be < 1) - Default = 0.75. | |
1565 | // matMin = lower bound of the material indices in which the respective thresholds apply | |
1566 | // matMax = upper bound of the material indices in which the respective thresholds apply | |
3b8c325d | 1567 | fprintf(pFlukaVmcInp,"MUPHOTON %10.1f%10.1f%10.1f%10.1f%10.1f\n",one,zero,zero,matMin,matMax); |
829fb838 | 1568 | } |
1df5fa54 | 1569 | else if (proc->Flag() == 2) { |
3b8c325d | 1570 | fprintf(pFlukaVmcInp,"*\n*Muon nuclear interactions without production of secondary hadrons\n"); |
1571 | fprintf(pFlukaVmcInp,"*Generated from call: SetProcess('MUNU',2);\n"); | |
829fb838 | 1572 | // two = full simulation of muon nuclear interactions and production of secondary hadrons |
1573 | // zero = ratio of longitudinal to transverse virtual photon cross-section - Default = 0.25. | |
1574 | // zero = fraction of rho-like interactions ( must be < 1) - Default = 0.75. | |
1575 | // matMin = lower bound of the material indices in which the respective thresholds apply | |
1576 | // matMax = upper bound of the material indices in which the respective thresholds apply | |
3b8c325d | 1577 | fprintf(pFlukaVmcInp,"MUPHOTON %10.1f%10.1f%10.1f%10.1f%10.1f\n",two,zero,zero,matMin,matMax); |
829fb838 | 1578 | } |
1df5fa54 | 1579 | else if (proc->Flag() == 0) { |
3b8c325d | 1580 | fprintf(pFlukaVmcInp,"*\n*No muon nuclear interaction - no FLUKA card generated\n"); |
1581 | fprintf(pFlukaVmcInp,"*Generated from call: SetProcess('MUNU',0)\n"); | |
829fb838 | 1582 | } |
1583 | else { | |
3b8c325d | 1584 | fprintf(pFlukaVmcInp,"*\n*Illegal flag value in SetProcess('MUNU',?) call.\n"); |
1585 | fprintf(pFlukaVmcInp,"*No FLUKA card generated\n"); | |
829fb838 | 1586 | } |
1df5fa54 | 1587 | } // end of else if (strncmp(proc->GetName(),"MUNU",4) == 0) |
829fb838 | 1588 | |
1589 | ||
1590 | // photofission | |
1591 | // G3 default value: 0 | |
1592 | // G4 process: ?? | |
1593 | // | |
1594 | // Particles: gamma | |
1595 | // Physics: ?? | |
1596 | // gMC ->SetProcess("PFIS",0); // PHOTONUC -1. 0. 0. 3. lastmat 0. | |
1597 | // flag = 0 no photon fission | |
1598 | // flag = 1 photon fission, secondaries processed | |
1599 | // flag = 2 photon fission, no secondaries stored | |
1df5fa54 | 1600 | else if (strncmp(proc->GetName(),"PFIS",4) == 0) { |
1601 | if (proc->Flag() == 0) { | |
3b8c325d | 1602 | fprintf(pFlukaVmcInp,"*\n*No photonuclear interactions\n"); |
1603 | fprintf(pFlukaVmcInp,"*Generated from call: SetProcess('PFIS',0);\n"); | |
829fb838 | 1604 | // - one = no photonuclear interactions |
1605 | // zero = not used | |
1606 | // zero = not used | |
1607 | // matMin = lower bound of the material indices in which the respective thresholds apply | |
1608 | // matMax = upper bound of the material indices in which the respective thresholds apply | |
3b8c325d | 1609 | fprintf(pFlukaVmcInp,"PHOTONUC %10.1f%10.1f%10.1f%10.1f%10.1f\n",-one,zero,zero,matMin,matMax); |
829fb838 | 1610 | } |
1df5fa54 | 1611 | else if (proc->Flag() == 1) { |
3b8c325d | 1612 | fprintf(pFlukaVmcInp,"*\n*Photon nuclear interactions are activated at all energies\n"); |
1613 | fprintf(pFlukaVmcInp,"*Generated from call: SetProcess('PFIS',1);\n"); | |
829fb838 | 1614 | // one = photonuclear interactions are activated at all energies |
1615 | // zero = not used | |
1616 | // zero = not used | |
1617 | // matMin = lower bound of the material indices in which the respective thresholds apply | |
1618 | // matMax = upper bound of the material indices in which the respective thresholds apply | |
3b8c325d | 1619 | fprintf(pFlukaVmcInp,"PHOTONUC %10.1f%10.1f%10.1f%10.1f%10.1f\n",one,zero,zero,matMin,matMax); |
829fb838 | 1620 | } |
1df5fa54 | 1621 | else if (proc->Flag() == 0) { |
3b8c325d | 1622 | fprintf(pFlukaVmcInp,"*\n*No photofission - no FLUKA card generated\n"); |
1623 | fprintf(pFlukaVmcInp,"*Generated from call: SetProcess('PFIS',0)\n"); | |
829fb838 | 1624 | } |
1625 | else { | |
3b8c325d | 1626 | fprintf(pFlukaVmcInp,"*\n*Illegal flag value in SetProcess('PFIS',?) call.\n"); |
1627 | fprintf(pFlukaVmcInp,"*No FLUKA card generated\n"); | |
829fb838 | 1628 | } |
1629 | } | |
1630 | ||
1631 | ||
1632 | // photo electric effect | |
1633 | // G3 default value: 1 | |
1634 | // G4 processes: G4PhotoElectricEffect | |
1635 | // G4LowEnergyPhotoElectric | |
1636 | // Particles: gamma | |
1637 | // Physics: EM | |
1638 | // flag = 0 no photo electric effect | |
1639 | // flag = 1 photo electric effect, electron processed | |
1640 | // flag = 2 photo electric effect, no electron stored | |
1641 | // gMC ->SetProcess("PHOT",1); // EMFCUT 0. -1. 0. 3. lastmat 0. PHOT-THR | |
1df5fa54 | 1642 | else if (strncmp(proc->GetName(),"PHOT",4) == 0) { |
1643 | if (proc->Flag() == 1 || proc->Flag() == 2) { | |
3b8c325d | 1644 | fprintf(pFlukaVmcInp,"*\n*Photo electric effect is activated\n"); |
1645 | fprintf(pFlukaVmcInp,"*Generated from call: SetProcess('PHOT',1);\n"); | |
829fb838 | 1646 | // zero = ignored |
1647 | // - one = resets to default=0. | |
1648 | // zero = ignored | |
1649 | // matMin = lower bound of the material indices in which the respective thresholds apply | |
1650 | // matMax = upper bound of the material indices in which the respective thresholds apply | |
1651 | // one = step length in assigning indices | |
1652 | //"PHOT-THR"; | |
3b8c325d | 1653 | fprintf(pFlukaVmcInp,"EMFCUT %10.1f%10.1f%10.1f%10.1f%10.1f%10.1fPHOT-THR\n",zero,-one,zero,matMin,matMax,one); |
829fb838 | 1654 | } |
1df5fa54 | 1655 | else if (proc->Flag() == 0) { |
3b8c325d | 1656 | fprintf(pFlukaVmcInp,"*\n*No photo electric effect - no FLUKA card generated\n"); |
1657 | fprintf(pFlukaVmcInp,"*Generated from call: SetProcess('PHOT',0)\n"); | |
829fb838 | 1658 | } |
1659 | else { | |
3b8c325d | 1660 | fprintf(pFlukaVmcInp,"*\n*Illegal flag value in SetProcess('PHOT',?) call.\n"); |
1661 | fprintf(pFlukaVmcInp,"*No FLUKA card generated\n"); | |
829fb838 | 1662 | } |
1df5fa54 | 1663 | } // else if (strncmp(proc->GetName(),"PHOT",4) == 0) |
829fb838 | 1664 | |
1665 | ||
1666 | // Rayleigh scattering | |
1667 | // G3 default value: 0 | |
1668 | // G4 process: G4OpRayleigh | |
1669 | // | |
1670 | // Particles: optical photon | |
1671 | // Physics: Optical | |
1672 | // flag = 0 Rayleigh scattering off | |
1673 | // flag = 1 Rayleigh scattering on | |
1674 | //xx gMC ->SetProcess("RAYL",1); | |
1df5fa54 | 1675 | else if (strncmp(proc->GetName(),"RAYL",4) == 0) { |
1676 | if (proc->Flag() == 1) { | |
3b8c325d | 1677 | fprintf(pFlukaVmcInp,"*\n*Rayleigh scattering is ON by default in FLUKA\n"); |
1678 | fprintf(pFlukaVmcInp,"*No FLUKA card generated\n"); | |
829fb838 | 1679 | } |
1df5fa54 | 1680 | else if (proc->Flag() == 0) { |
3b8c325d | 1681 | fprintf(pFlukaVmcInp,"*\n*Rayleigh scattering is set OFF\n"); |
1682 | fprintf(pFlukaVmcInp,"*Generated from call: SetProcess('RAYL',0);\n"); | |
829fb838 | 1683 | // - one = no Rayleigh scattering and no binding corrections for Compton |
1684 | // matMin = lower bound of the material indices in which the respective thresholds apply | |
1685 | // matMax = upper bound of the material indices in which the respective thresholds apply | |
3b8c325d | 1686 | fprintf(pFlukaVmcInp,"EMFRAY %10.1f%10.1f%10.1f%10.1f\n",-one,three,matMin,matMax); |
829fb838 | 1687 | } |
1688 | else { | |
3b8c325d | 1689 | fprintf(pFlukaVmcInp,"*\n*Illegal flag value in SetProcess('RAYL',?) call.\n"); |
1690 | fprintf(pFlukaVmcInp,"*No FLUKA card generated\n"); | |
829fb838 | 1691 | } |
1df5fa54 | 1692 | } // end of else if (strncmp(proc->GetName(),"RAYL",4) == 0) |
829fb838 | 1693 | |
1694 | ||
1695 | // synchrotron radiation in magnetic field | |
1696 | // G3 default value: 0 | |
1697 | // G4 process: G4SynchrotronRadiation | |
1698 | // | |
1699 | // Particles: ?? | |
1700 | // Physics: Not set | |
1701 | // flag = 0 no synchrotron radiation | |
1702 | // flag = 1 synchrotron radiation | |
1703 | //xx gMC ->SetProcess("SYNC",1); // synchrotron radiation generation | |
1df5fa54 | 1704 | else if (strncmp(proc->GetName(),"SYNC",4) == 0) { |
3b8c325d | 1705 | fprintf(pFlukaVmcInp,"*\n*Synchrotron radiation generation is NOT implemented in FLUKA\n"); |
1706 | fprintf(pFlukaVmcInp,"*No FLUKA card generated\n"); | |
829fb838 | 1707 | } |
1708 | ||
1709 | ||
1710 | // Automatic calculation of tracking medium parameters | |
1711 | // flag = 0 no automatic calculation | |
1712 | // flag = 1 automatic calculation | |
1713 | //xx gMC ->SetProcess("AUTO",1); // ??? automatic computation of the tracking medium parameters | |
1df5fa54 | 1714 | else if (strncmp(proc->GetName(),"AUTO",4) == 0) { |
3b8c325d | 1715 | fprintf(pFlukaVmcInp,"*\n*Automatic calculation of tracking medium parameters is always ON in FLUKA\n"); |
1716 | fprintf(pFlukaVmcInp,"*No FLUKA card generated\n"); | |
829fb838 | 1717 | } |
1718 | ||
1719 | ||
1720 | // To control energy loss fluctuation model | |
1721 | // flag = 0 Urban model | |
1722 | // flag = 1 PAI model | |
1723 | // flag = 2 PAI+ASHO model (not active at the moment) | |
1724 | //xx gMC ->SetProcess("STRA",1); // ??? energy fluctuation model | |
1df5fa54 | 1725 | else if (strncmp(proc->GetName(),"STRA",4) == 0) { |
1726 | if (proc->Flag() == 0 || proc->Flag() == 2 || proc->Flag() == 3) { | |
3b8c325d | 1727 | fprintf(pFlukaVmcInp,"*\n*Ionization energy losses calculation is activated\n"); |
1728 | fprintf(pFlukaVmcInp,"*Generated from call: SetProcess('STRA',n);, n=0,1,2\n"); | |
829fb838 | 1729 | // one = restricted energy loss fluctuations (for hadrons and muons) switched on |
1730 | // one = restricted energy loss fluctuations (for e+ and e-) switched on | |
1731 | // one = minimal accuracy | |
1732 | // matMin = lower bound of the material indices in which the respective thresholds apply | |
1733 | // matMax = upper bound of the material indices in which the respective thresholds apply | |
3b8c325d | 1734 | fprintf(pFlukaVmcInp,"IONFLUCT %10.1f%10.1f%10.1f%10.1f%10.1f\n",one,one,one,matMin,matMax); |
829fb838 | 1735 | } |
1736 | else { | |
3b8c325d | 1737 | fprintf(pFlukaVmcInp,"*\n*Illegal flag value in SetProcess('STRA',?) call.\n"); |
1738 | fprintf(pFlukaVmcInp,"*No FLUKA card generated\n"); | |
829fb838 | 1739 | } |
1df5fa54 | 1740 | } // else if (strncmp(proc->GetName(),"STRA",4) == 0) |
829fb838 | 1741 | |
1742 | ||
1743 | ||
1744 | ||
1745 | else { // processes not yet treated | |
1746 | ||
1747 | // light photon absorption (Cerenkov photons) | |
1748 | // it is turned on when Cerenkov process is turned on | |
1749 | // G3 default value: 0 | |
1750 | // G4 process: G4OpAbsorption, G4OpBoundaryProcess | |
1751 | // | |
1752 | // Particles: optical photon | |
1753 | // Physics: Optical | |
1754 | // flag = 0 no absorption of Cerenkov photons | |
1755 | // flag = 1 absorption of Cerenkov photons | |
1756 | // gMC ->SetProcess("LABS",2); // ??? Cerenkov light absorption | |
1757 | ||
1758 | ||
1759 | ||
1df5fa54 | 1760 | cout << "SetProcess for flag=" << proc->GetName() << " value=" << proc->Flag() << " not yet implemented!" << endl; |
829fb838 | 1761 | } |
1762 | } //end of loop number of SetProcess calls | |
1763 | ||
1764 | ||
1765 | // Loop over number of SetCut calls | |
1df5fa54 | 1766 | |
1767 | nextc.Reset(); | |
1768 | while ((cut = (TFlukaConfigOption*)nextc())) { | |
829fb838 | 1769 | Float_t matMin = three; |
1770 | Float_t matMax = fLastMaterial; | |
1771 | Bool_t global = kTRUE; | |
1df5fa54 | 1772 | if (cut->Medium() != -1) { |
1773 | matMin = Float_t(cut->Medium()); | |
829fb838 | 1774 | matMax = matMin; |
1775 | global = kFALSE; | |
1776 | } | |
1777 | ||
1778 | // cuts handled in SetProcess calls | |
1df5fa54 | 1779 | if (strncmp(cut->GetName(),"BCUTM",5) == 0) continue; |
1780 | else if (strncmp(cut->GetName(),"BCUTE",5) == 0) continue; | |
1781 | else if (strncmp(cut->GetName(),"DCUTM",5) == 0) continue; | |
1782 | else if (strncmp(cut->GetName(),"PPCUTM",6) == 0) continue; | |
829fb838 | 1783 | |
1784 | // delta-rays by electrons | |
1785 | // G4 particles: "e-" | |
1786 | // G3 default value: 10**4 GeV | |
1787 | // gMC ->SetCut("DCUTE",cut); // cut for deltarays by electrons | |
1df5fa54 | 1788 | else if (strncmp(cut->GetName(),"DCUTE",5) == 0) { |
3b8c325d | 1789 | fprintf(pFlukaVmcInp,"*\n*Cut for delta rays by electrons\n"); |
1790 | fprintf(pFlukaVmcInp,"*Generated from call: SetCut('DCUTE',cut);\n"); | |
1df5fa54 | 1791 | // -cut->Cut(); |
829fb838 | 1792 | // zero = ignored |
1793 | // zero = ignored | |
1794 | // matMin = lower bound of the material indices in which the respective thresholds apply | |
1795 | // matMax = upper bound of the material indices in which the respective thresholds apply | |
1796 | // loop over materials for EMFCUT FLUKA cards | |
1797 | for (j=0; j < matMax-matMin+1; j++) { | |
1798 | Int_t nreg, imat, *reglist; | |
1799 | Float_t ireg; | |
1800 | imat = (Int_t) matMin + j; | |
1801 | reglist = fGeom->GetMaterialList(imat, nreg); | |
1802 | // loop over regions of a given material | |
1803 | for (k=0; k<nreg; k++) { | |
1804 | ireg = reglist[k]; | |
3b8c325d | 1805 | fprintf(pFlukaVmcInp,"EMFCUT %10.4g%10.1f%10.1f%10.1f%10.1f\n",-cut->Cut(),zero,zero,ireg,ireg); |
829fb838 | 1806 | } |
1807 | } | |
3b8c325d | 1808 | fprintf(pFlukaVmcInp,"DELTARAY %10.4g%10.3f%10.3f%10.1f%10.1f%10.1f\n",cut->Cut(), 100., 1.03, matMin, matMax, 1.0); |
829fb838 | 1809 | } // end of if for delta-rays by electrons |
1810 | ||
1811 | ||
1812 | // gammas | |
1813 | // G4 particles: "gamma" | |
1814 | // G3 default value: 0.001 GeV | |
1815 | // gMC ->SetCut("CUTGAM",cut); // cut for gammas | |
1816 | ||
1df5fa54 | 1817 | else if (strncmp(cut->GetName(),"CUTGAM",6) == 0 && global) { |
3b8c325d | 1818 | fprintf(pFlukaVmcInp,"*\n*Cut for gamma\n"); |
1819 | fprintf(pFlukaVmcInp,"*Generated from call: SetCut('CUTGAM',cut);\n"); | |
1df5fa54 | 1820 | // -cut->Cut(); |
829fb838 | 1821 | // 7.0 = lower bound of the particle id-numbers to which the cut-off |
3b8c325d | 1822 | fprintf(pFlukaVmcInp,"PART-THR %10.4g%10.1f\n",-cut->Cut(),7.0); |
829fb838 | 1823 | } |
1df5fa54 | 1824 | else if (strncmp(cut->GetName(),"CUTGAM",6) == 0 && !global) { |
3b8c325d | 1825 | fprintf(pFlukaVmcInp,"*\n*Cut specific to material for gamma\n"); |
1826 | fprintf(pFlukaVmcInp,"*Generated from call: SetCut('CUTGAM',cut);\n"); | |
1df5fa54 | 1827 | // cut->Cut(); |
829fb838 | 1828 | // loop over materials for EMFCUT FLUKA cards |
1829 | for (j=0; j < matMax-matMin+1; j++) { | |
1830 | Int_t nreg, imat, *reglist; | |
1831 | Float_t ireg; | |
1832 | imat = (Int_t) matMin + j; | |
1833 | reglist = fGeom->GetMaterialList(imat, nreg); | |
1834 | // loop over regions of a given material | |
1835 | for (Int_t k=0; k<nreg; k++) { | |
1836 | ireg = reglist[k]; | |
3b8c325d | 1837 | fprintf(pFlukaVmcInp,"EMFCUT %10.4g%10.4g%10.1f%10.1f%10.1f%10.1f\n", zero, cut->Cut(), zero, ireg, ireg, one); |
829fb838 | 1838 | } |
1839 | } | |
1840 | } // end of else if for gamma | |
1841 | ||
1842 | ||
1843 | // electrons | |
1844 | // G4 particles: "e-" | |
1845 | // ?? positrons | |
1846 | // G3 default value: 0.001 GeV | |
1847 | //gMC ->SetCut("CUTELE",cut); // cut for e+,e- | |
1df5fa54 | 1848 | else if (strncmp(cut->GetName(),"CUTELE",6) == 0 && global) { |
3b8c325d | 1849 | fprintf(pFlukaVmcInp,"*\n*Cut for electrons\n"); |
1850 | fprintf(pFlukaVmcInp,"*Generated from call: SetCut('CUTELE',cut);\n"); | |
1df5fa54 | 1851 | // -cut->Cut(); |
829fb838 | 1852 | // three = lower bound of the particle id-numbers to which the cut-off |
1853 | // 4.0 = upper bound of the particle id-numbers to which the cut-off | |
1854 | // one = step length in assigning numbers | |
3b8c325d | 1855 | fprintf(pFlukaVmcInp,"PART-THR %10.4g%10.1f%10.1f%10.1f\n",-cut->Cut(),three,4.0,one); |
829fb838 | 1856 | } |
1df5fa54 | 1857 | else if (strncmp(cut->GetName(),"CUTELE",6) == 0 && !global) { |
3b8c325d | 1858 | fprintf(pFlukaVmcInp,"*\n*Cut specific to material for electrons\n"); |
1859 | fprintf(pFlukaVmcInp,"*Generated from call: SetCut('CUTELE',cut);\n"); | |
1df5fa54 | 1860 | // -cut->Cut(); |
829fb838 | 1861 | // loop over materials for EMFCUT FLUKA cards |
1862 | for (j=0; j < matMax-matMin+1; j++) { | |
1863 | Int_t nreg, imat, *reglist; | |
1864 | Float_t ireg; | |
1865 | imat = (Int_t) matMin + j; | |
1866 | reglist = fGeom->GetMaterialList(imat, nreg); | |
1867 | // loop over regions of a given material | |
1868 | for (k=0; k<nreg; k++) { | |
1869 | ireg = reglist[k]; | |
3b8c325d | 1870 | fprintf(pFlukaVmcInp,"EMFCUT %10.4g%10.4g%10.1f%10.1f%10.1f%10.1f\n", -cut->Cut(), zero, zero, ireg, ireg, one); |
829fb838 | 1871 | } |
1872 | } | |
1873 | } // end of else if for electrons | |
1874 | ||
1875 | ||
1876 | // neutral hadrons | |
1877 | // G4 particles: of type "baryon", "meson", "nucleus" with zero charge | |
1878 | // G3 default value: 0.01 GeV | |
1879 | //gMC ->SetCut("CUTNEU",cut); // cut for neutral hadrons | |
1df5fa54 | 1880 | else if (strncmp(cut->GetName(),"CUTNEU",6) == 0 && global) { |
3b8c325d | 1881 | fprintf(pFlukaVmcInp,"*\n*Cut for neutral hadrons\n"); |
1882 | fprintf(pFlukaVmcInp,"*Generated from call: SetCut('CUTNEU',cut);\n"); | |
829fb838 | 1883 | |
1884 | // 8.0 = Neutron | |
1885 | // 9.0 = Antineutron | |
3b8c325d | 1886 | fprintf(pFlukaVmcInp,"PART-THR %10.4g%10.1f%10.1f\n",-cut->Cut(),8.0,9.0); |
829fb838 | 1887 | |
1888 | // 12.0 = Kaon zero long | |
1889 | // 12.0 = Kaon zero long | |
3b8c325d | 1890 | fprintf(pFlukaVmcInp,"PART-THR %10.4g%10.1f%10.1f\n",-cut->Cut(),12.0,12.0); |
829fb838 | 1891 | |
1892 | // 17.0 = Lambda, 18.0 = Antilambda | |
1893 | // 19.0 = Kaon zero short | |
3b8c325d | 1894 | fprintf(pFlukaVmcInp,"PART-THR %10.4g%10.1f%10.1f\n",-cut->Cut(),17.0,19.0); |
829fb838 | 1895 | |
1896 | // 22.0 = Sigma zero, Pion zero, Kaon zero | |
1897 | // 25.0 = Antikaon zero | |
3b8c325d | 1898 | fprintf(pFlukaVmcInp,"PART-THR %10.4g%10.1f%10.1f\n",-cut->Cut(),22.0,25.0); |
829fb838 | 1899 | |
1900 | // 32.0 = Antisigma zero | |
1901 | // 32.0 = Antisigma zero | |
3b8c325d | 1902 | fprintf(pFlukaVmcInp,"PART-THR %10.4g%10.1f%10.1f\n",-cut->Cut(),32.0,32.0); |
829fb838 | 1903 | |
1904 | // 34.0 = Xi zero | |
1905 | // 35.0 = AntiXi zero | |
3b8c325d | 1906 | fprintf(pFlukaVmcInp,"PART-THR %10.4g%10.1f%10.1f\n",-cut->Cut(),34.0,35.0); |
829fb838 | 1907 | |
1908 | // 47.0 = D zero | |
1909 | // 48.0 = AntiD zero | |
3b8c325d | 1910 | fprintf(pFlukaVmcInp,"PART-THR %10.4g%10.1f%10.1f\n",-cut->Cut(),47.0,48.0); |
829fb838 | 1911 | |
1912 | // 53.0 = Xi_c zero | |
1913 | // 53.0 = Xi_c zero | |
3b8c325d | 1914 | fprintf(pFlukaVmcInp,"PART-THR %10.4g%10.1f%10.1f\n",-cut->Cut(),53.0,53.0); |
829fb838 | 1915 | |
1916 | // 55.0 = Xi'_c zero | |
1917 | // 56.0 = Omega_c zero | |
3b8c325d | 1918 | fprintf(pFlukaVmcInp,"PART-THR %10.4g%10.1f%10.1f\n",-cut->Cut(),55.0,56.0); |
829fb838 | 1919 | |
1920 | // 59.0 = AntiXi_c zero | |
1921 | // 59.0 = AntiXi_c zero | |
3b8c325d | 1922 | fprintf(pFlukaVmcInp,"PART-THR %10.4g%10.1f%10.1f\n",-cut->Cut(),59.0,59.0); |
829fb838 | 1923 | |
1924 | // 61.0 = AntiXi'_c zero | |
1925 | // 62.0 = AntiOmega_c zero | |
3b8c325d | 1926 | fprintf(pFlukaVmcInp,"PART-THR %10.4g%10.1f%10.1f\n",-cut->Cut(),61.0,62.0); |
829fb838 | 1927 | } |
1928 | ||
1929 | // charged hadrons | |
1930 | // G4 particles: of type "baryon", "meson", "nucleus" with non-zero charge | |
1931 | // G3 default value: 0.01 GeV | |
1932 | //gMC ->SetCut("CUTHAD",cut); // cut for charged hadrons | |
1df5fa54 | 1933 | else if (strncmp(cut->GetName(),"CUTHAD",6) == 0 && global) { |
3b8c325d | 1934 | fprintf(pFlukaVmcInp,"*\n*Cut for charged hadrons\n"); |
1935 | fprintf(pFlukaVmcInp,"*Generated from call: SetCut('CUTHAD',cut);\n"); | |
829fb838 | 1936 | |
1937 | // 1.0 = Proton | |
1938 | // 2.0 = Antiproton | |
3b8c325d | 1939 | fprintf(pFlukaVmcInp,"PART-THR %10.4g%10.1f%10.1f\n",-cut->Cut(),1.0,2.0); |
829fb838 | 1940 | |
1941 | // 13.0 = Positive Pion, Negative Pion, Positive Kaon | |
1942 | // 16.0 = Negative Kaon | |
3b8c325d | 1943 | fprintf(pFlukaVmcInp,"PART-THR %10.4g%10.1f%10.1f\n",-cut->Cut(),13.0,16.0); |
829fb838 | 1944 | |
1945 | // 20.0 = Negative Sigma | |
1946 | // 21.0 = Positive Sigma | |
3b8c325d | 1947 | fprintf(pFlukaVmcInp,"PART-THR %10.4g%10.1f%10.1f\n",-cut->Cut(),20.0,21.0); |
829fb838 | 1948 | |
1949 | // 31.0 = Antisigma minus | |
1950 | // 33.0 = Antisigma plus | |
1951 | // 2.0 = step length | |
3b8c325d | 1952 | fprintf(pFlukaVmcInp,"PART-THR %10.4g%10.1f%10.1f%10.1f\n",-cut->Cut(),31.0,33.0,2.0); |
829fb838 | 1953 | |
1954 | // 36.0 = Negative Xi, Positive Xi, Omega minus | |
1955 | // 39.0 = Antiomega | |
3b8c325d | 1956 | fprintf(pFlukaVmcInp,"PART-THR %10.4g%10.1f%10.1f\n",-cut->Cut(),36.0,39.0); |
829fb838 | 1957 | |
1958 | // 45.0 = D plus | |
1959 | // 46.0 = D minus | |
3b8c325d | 1960 | fprintf(pFlukaVmcInp,"PART-THR %10.4g%10.1f%10.1f\n",-cut->Cut(),45.0,46.0); |
829fb838 | 1961 | |
1962 | // 49.0 = D_s plus, D_s minus, Lambda_c plus | |
1963 | // 52.0 = Xi_c plus | |
3b8c325d | 1964 | fprintf(pFlukaVmcInp,"PART-THR %10.4g%10.1f%10.1f\n",-cut->Cut(),49.0,52.0); |
829fb838 | 1965 | |
1966 | // 54.0 = Xi'_c plus | |
1967 | // 60.0 = AntiXi'_c minus | |
1968 | // 6.0 = step length | |
3b8c325d | 1969 | fprintf(pFlukaVmcInp,"PART-THR %10.4g%10.1f%10.1f%10.1f\n",-cut->Cut(),54.0,60.0,6.0); |
829fb838 | 1970 | |
1971 | // 57.0 = Antilambda_c minus | |
1972 | // 58.0 = AntiXi_c minus | |
3b8c325d | 1973 | fprintf(pFlukaVmcInp,"PART-THR %10.4g%10.1f%10.1f\n",-cut->Cut(),57.0,58.0); |
829fb838 | 1974 | } |
1975 | ||
1976 | // muons | |
1977 | // G4 particles: "mu+", "mu-" | |
1978 | // G3 default value: 0.01 GeV | |
1979 | //gMC ->SetCut("CUTMUO",cut); // cut for mu+, mu- | |
1df5fa54 | 1980 | else if (strncmp(cut->GetName(),"CUTMUO",6)== 0 && global) { |
3b8c325d | 1981 | fprintf(pFlukaVmcInp,"*\n*Cut for muons\n"); |
1982 | fprintf(pFlukaVmcInp,"*Generated from call: SetCut('CUTMUO',cut);\n"); | |
829fb838 | 1983 | // 10.0 = Muon+ |
1984 | // 11.0 = Muon- | |
3b8c325d | 1985 | fprintf(pFlukaVmcInp,"PART-THR %10.4g%10.1f%10.1f\n",-cut->Cut(),10.0,11.0); |
829fb838 | 1986 | } |
1987 | ||
1988 | // | |
1989 | // time of flight cut in seconds | |
1990 | // G4 particles: all | |
1991 | // G3 default value: 0.01 GeV | |
1992 | //gMC ->SetCut("TOFMAX",tofmax); // time of flight cuts in seconds | |
1df5fa54 | 1993 | else if (strncmp(cut->GetName(),"TOFMAX",6) == 0) { |
3b8c325d | 1994 | fprintf(pFlukaVmcInp,"*\n*Time of flight cuts in seconds\n"); |
1995 | fprintf(pFlukaVmcInp,"*Generated from call: SetCut('TOFMAX',tofmax);\n"); | |
829fb838 | 1996 | // zero = ignored |
1997 | // zero = ignored | |
1998 | // -6.0 = lower bound of the particle numbers for which the transport time cut-off and/or the start signal is to be applied | |
1999 | // 64.0 = upper bound of the particle numbers for which the transport time cut-off and/or the start signal is to be applied | |
3b8c325d | 2000 | fprintf(pFlukaVmcInp,"TIME-CUT %10.4g%10.1f%10.1f%10.1f%10.1f\n",cut->Cut()*1.e9,zero,zero,-6.0,64.0); |
829fb838 | 2001 | } |
2002 | ||
2003 | else if (global){ | |
1df5fa54 | 2004 | cout << "SetCut for flag=" << cut->GetName() << " value=" << cut->Cut() << " not yet implemented!" << endl; |
829fb838 | 2005 | } |
2006 | else { | |
1df5fa54 | 2007 | cout << "SetCut for flag=" << cut->GetName() << " value=" << cut->Cut() << " (material specific) not yet implemented!" << endl; |
829fb838 | 2008 | } |
2009 | ||
2010 | } //end of loop over SetCut calls | |
2011 | ||
2012 | // Add START and STOP card | |
3b8c325d | 2013 | fprintf(pFlukaVmcInp,"START %10.1f\n",fEventsPerRun); |
2014 | fprintf(pFlukaVmcInp,"STOP \n"); | |
829fb838 | 2015 | |
2016 | ||
2017 | // Close files | |
2018 | ||
3b8c325d | 2019 | fclose(pFlukaVmcCoreInp); |
2020 | fclose(pFlukaVmcFlukaMat); | |
2021 | fclose(pFlukaVmcInp); | |
829fb838 | 2022 | |
2023 | } // end of InitPhysics | |
2024 | ||
2025 | ||
2026 | //______________________________________________________________________________ | |
2027 | void TFluka::SetMaxStep(Double_t) | |
2028 | { | |
2029 | // SetMaxStep is dummy procedure in TFluka ! | |
2030 | if (fVerbosityLevel >=3) | |
2031 | cout << "SetMaxStep is dummy procedure in TFluka !" << endl; | |
2032 | } | |
2033 | ||
2034 | //______________________________________________________________________________ | |
2035 | void TFluka::SetMaxNStep(Int_t) | |
2036 | { | |
2037 | // SetMaxNStep is dummy procedure in TFluka ! | |
2038 | if (fVerbosityLevel >=3) | |
2039 | cout << "SetMaxNStep is dummy procedure in TFluka !" << endl; | |
2040 | } | |
2041 | ||
2042 | //______________________________________________________________________________ | |
2043 | void TFluka::SetUserDecay(Int_t) | |
2044 | { | |
2045 | // SetUserDecay is dummy procedure in TFluka ! | |
2046 | if (fVerbosityLevel >=3) | |
2047 | cout << "SetUserDecay is dummy procedure in TFluka !" << endl; | |
2048 | } | |
2049 | ||
2050 | // | |
2051 | // dynamic properties | |
2052 | // | |
2053 | //______________________________________________________________________________ | |
2054 | void TFluka::TrackPosition(TLorentzVector& position) const | |
2055 | { | |
2056 | // Return the current position in the master reference frame of the | |
2057 | // track being transported | |
2058 | // TRACKR.atrack = age of the particle | |
2059 | // TRACKR.xtrack = x-position of the last point | |
2060 | // TRACKR.ytrack = y-position of the last point | |
2061 | // TRACKR.ztrack = z-position of the last point | |
2062 | Int_t caller = GetCaller(); | |
2063 | if (caller == 3 || caller == 6 || caller == 11 || caller == 12) { //bxdraw,endraw,usdraw | |
2064 | position.SetX(GetXsco()); | |
2065 | position.SetY(GetYsco()); | |
2066 | position.SetZ(GetZsco()); | |
2067 | position.SetT(TRACKR.atrack); | |
2068 | } | |
2069 | else if (caller == 4) { // mgdraw | |
2070 | position.SetX(TRACKR.xtrack[TRACKR.ntrack]); | |
2071 | position.SetY(TRACKR.ytrack[TRACKR.ntrack]); | |
2072 | position.SetZ(TRACKR.ztrack[TRACKR.ntrack]); | |
2073 | position.SetT(TRACKR.atrack); | |
2074 | } | |
2075 | else if (caller == 5) { // sodraw | |
2076 | position.SetX(TRACKR.xtrack[TRACKR.ntrack]); | |
2077 | position.SetY(TRACKR.ytrack[TRACKR.ntrack]); | |
2078 | position.SetZ(TRACKR.ztrack[TRACKR.ntrack]); | |
2079 | position.SetT(0); | |
2080 | } | |
2081 | else | |
2082 | Warning("TrackPosition","position not available"); | |
2083 | } | |
2084 | ||
2085 | //______________________________________________________________________________ | |
2086 | void TFluka::TrackPosition(Double_t& x, Double_t& y, Double_t& z) const | |
2087 | { | |
2088 | // Return the current position in the master reference frame of the | |
2089 | // track being transported | |
2090 | // TRACKR.atrack = age of the particle | |
2091 | // TRACKR.xtrack = x-position of the last point | |
2092 | // TRACKR.ytrack = y-position of the last point | |
2093 | // TRACKR.ztrack = z-position of the last point | |
2094 | Int_t caller = GetCaller(); | |
2095 | if (caller == 3 || caller == 6 || caller == 11 || caller == 12) { //bxdraw,endraw,usdraw | |
2096 | x = GetXsco(); | |
2097 | y = GetYsco(); | |
2098 | z = GetZsco(); | |
2099 | } | |
2100 | else if (caller == 4 || caller == 5) { // mgdraw, sodraw | |
2101 | x = TRACKR.xtrack[TRACKR.ntrack]; | |
2102 | y = TRACKR.ytrack[TRACKR.ntrack]; | |
2103 | z = TRACKR.ztrack[TRACKR.ntrack]; | |
2104 | } | |
2105 | else | |
2106 | Warning("TrackPosition","position not available"); | |
2107 | } | |
2108 | ||
2109 | //______________________________________________________________________________ | |
2110 | void TFluka::TrackMomentum(TLorentzVector& momentum) const | |
2111 | { | |
2112 | // Return the direction and the momentum (GeV/c) of the track | |
2113 | // currently being transported | |
2114 | // TRACKR.ptrack = momentum of the particle (not always defined, if | |
2115 | // < 0 must be obtained from etrack) | |
2116 | // TRACKR.cx,y,ztrck = direction cosines of the current particle | |
2117 | // TRACKR.etrack = total energy of the particle | |
2118 | // TRACKR.jtrack = identity number of the particle | |
2119 | // PAPROP.am[TRACKR.jtrack] = particle mass in gev | |
2120 | Int_t caller = GetCaller(); | |
2121 | if (caller != 2) { // not eedraw | |
2122 | if (TRACKR.ptrack >= 0) { | |
2123 | momentum.SetPx(TRACKR.ptrack*TRACKR.cxtrck); | |
2124 | momentum.SetPy(TRACKR.ptrack*TRACKR.cytrck); | |
2125 | momentum.SetPz(TRACKR.ptrack*TRACKR.cztrck); | |
2126 | momentum.SetE(TRACKR.etrack); | |
2127 | return; | |
2128 | } | |
2129 | else { | |
2130 | Double_t p = sqrt(TRACKR.etrack*TRACKR.etrack - PAPROP.am[TRACKR.jtrack+6]*PAPROP.am[TRACKR.jtrack+6]); | |
2131 | momentum.SetPx(p*TRACKR.cxtrck); | |
2132 | momentum.SetPy(p*TRACKR.cytrck); | |
2133 | momentum.SetPz(p*TRACKR.cztrck); | |
2134 | momentum.SetE(TRACKR.etrack); | |
2135 | return; | |
2136 | } | |
2137 | } | |
2138 | else | |
2139 | Warning("TrackMomentum","momentum not available"); | |
2140 | } | |
2141 | ||
2142 | //______________________________________________________________________________ | |
2143 | void TFluka::TrackMomentum(Double_t& px, Double_t& py, Double_t& pz, Double_t& e) const | |
2144 | { | |
2145 | // Return the direction and the momentum (GeV/c) of the track | |
2146 | // currently being transported | |
2147 | // TRACKR.ptrack = momentum of the particle (not always defined, if | |
2148 | // < 0 must be obtained from etrack) | |
2149 | // TRACKR.cx,y,ztrck = direction cosines of the current particle | |
2150 | // TRACKR.etrack = total energy of the particle | |
2151 | // TRACKR.jtrack = identity number of the particle | |
2152 | // PAPROP.am[TRACKR.jtrack] = particle mass in gev | |
2153 | Int_t caller = GetCaller(); | |
2154 | if (caller != 2) { // not eedraw | |
2155 | if (TRACKR.ptrack >= 0) { | |
2156 | px = TRACKR.ptrack*TRACKR.cxtrck; | |
2157 | py = TRACKR.ptrack*TRACKR.cytrck; | |
2158 | pz = TRACKR.ptrack*TRACKR.cztrck; | |
2159 | e = TRACKR.etrack; | |
2160 | return; | |
2161 | } | |
2162 | else { | |
2163 | Double_t p = sqrt(TRACKR.etrack*TRACKR.etrack - PAPROP.am[TRACKR.jtrack+6]*PAPROP.am[TRACKR.jtrack+6]); | |
2164 | px = p*TRACKR.cxtrck; | |
2165 | py = p*TRACKR.cytrck; | |
2166 | pz = p*TRACKR.cztrck; | |
2167 | e = TRACKR.etrack; | |
2168 | return; | |
2169 | } | |
2170 | } | |
2171 | else | |
2172 | Warning("TrackMomentum","momentum not available"); | |
2173 | } | |
2174 | ||
2175 | //______________________________________________________________________________ | |
2176 | Double_t TFluka::TrackStep() const | |
2177 | { | |
2178 | // Return the length in centimeters of the current step | |
2179 | // TRACKR.ctrack = total curved path | |
2180 | Int_t caller = GetCaller(); | |
2181 | if (caller == 11 || caller==12 || caller == 3 || caller == 6) //bxdraw,endraw,usdraw | |
2182 | return 0.0; | |
2183 | else if (caller == 4) //mgdraw | |
2184 | return TRACKR.ctrack; | |
2185 | else | |
2186 | return -1.0; | |
2187 | } | |
2188 | ||
2189 | //______________________________________________________________________________ | |
2190 | Double_t TFluka::TrackLength() const | |
2191 | { | |
2192 | // TRACKR.cmtrck = cumulative curved path since particle birth | |
2193 | Int_t caller = GetCaller(); | |
2194 | if (caller == 11 || caller==12 || caller == 3 || caller == 4 || caller == 6) //bxdraw,endraw,mgdraw,usdraw | |
2195 | return TRACKR.cmtrck; | |
2196 | else | |
2197 | return -1.0; | |
2198 | } | |
2199 | ||
2200 | //______________________________________________________________________________ | |
2201 | Double_t TFluka::TrackTime() const | |
2202 | { | |
2203 | // Return the current time of flight of the track being transported | |
2204 | // TRACKR.atrack = age of the particle | |
2205 | Int_t caller = GetCaller(); | |
2206 | if (caller == 11 || caller==12 || caller == 3 || caller == 4 || caller == 6) //bxdraw,endraw,mgdraw,usdraw | |
2207 | return TRACKR.atrack; | |
2208 | else | |
2209 | return -1; | |
2210 | } | |
2211 | ||
2212 | //______________________________________________________________________________ | |
2213 | Double_t TFluka::Edep() const | |
2214 | { | |
2215 | // Energy deposition | |
2216 | // if TRACKR.ntrack = 0, TRACKR.mtrack = 0: | |
2217 | // -->local energy deposition (the value and the point are not recorded in TRACKR) | |
2218 | // but in the variable "rull" of the procedure "endraw.cxx" | |
2219 | // if TRACKR.ntrack > 0, TRACKR.mtrack = 0: | |
2220 | // -->no energy loss along the track | |
2221 | // if TRACKR.ntrack > 0, TRACKR.mtrack > 0: | |
2222 | // -->energy loss distributed along the track | |
2223 | // TRACKR.dtrack = energy deposition of the jth deposition even | |
2224 | ||
2225 | // If coming from bxdraw we have 2 steps of 0 length and 0 edep | |
2226 | Int_t caller = GetCaller(); | |
2227 | if (caller == 11 || caller==12) return 0.0; | |
2228 | Double_t sum = 0; | |
2229 | for ( Int_t j=0;j<TRACKR.mtrack;j++) { | |
2230 | sum +=TRACKR.dtrack[j]; | |
2231 | } | |
2232 | if (TRACKR.ntrack == 0 && TRACKR.mtrack == 0) | |
2233 | return fRull + sum; | |
2234 | else { | |
2235 | return sum; | |
2236 | } | |
2237 | } | |
2238 | ||
2239 | //______________________________________________________________________________ | |
2240 | Int_t TFluka::TrackPid() const | |
2241 | { | |
2242 | // Return the id of the particle transported | |
2243 | // TRACKR.jtrack = identity number of the particle | |
2244 | Int_t caller = GetCaller(); | |
f926898e | 2245 | if (caller != 2) { // not eedraw |
2246 | return PDGFromId(TRACKR.jtrack); | |
2247 | } | |
829fb838 | 2248 | else |
2249 | return -1000; | |
2250 | } | |
2251 | ||
2252 | //______________________________________________________________________________ | |
2253 | Double_t TFluka::TrackCharge() const | |
2254 | { | |
2255 | // Return charge of the track currently transported | |
2256 | // PAPROP.ichrge = electric charge of the particle | |
2257 | // TRACKR.jtrack = identity number of the particle | |
2258 | Int_t caller = GetCaller(); | |
2259 | if (caller != 2) // not eedraw | |
2260 | return PAPROP.ichrge[TRACKR.jtrack+6]; | |
2261 | else | |
2262 | return -1000.0; | |
2263 | } | |
2264 | ||
2265 | //______________________________________________________________________________ | |
2266 | Double_t TFluka::TrackMass() const | |
2267 | { | |
2268 | // PAPROP.am = particle mass in GeV | |
2269 | // TRACKR.jtrack = identity number of the particle | |
2270 | Int_t caller = GetCaller(); | |
2271 | if (caller != 2) // not eedraw | |
2272 | return PAPROP.am[TRACKR.jtrack+6]; | |
2273 | else | |
2274 | return -1000.0; | |
2275 | } | |
2276 | ||
2277 | //______________________________________________________________________________ | |
2278 | Double_t TFluka::Etot() const | |
2279 | { | |
2280 | // TRACKR.etrack = total energy of the particle | |
2281 | Int_t caller = GetCaller(); | |
2282 | if (caller != 2) // not eedraw | |
2283 | return TRACKR.etrack; | |
2284 | else | |
2285 | return -1000.0; | |
2286 | } | |
2287 | ||
2288 | // | |
2289 | // track status | |
2290 | // | |
2291 | //______________________________________________________________________________ | |
2292 | Bool_t TFluka::IsNewTrack() const | |
2293 | { | |
2294 | // Return true for the first call of Stepping() | |
2295 | return fTrackIsNew; | |
2296 | } | |
2297 | ||
0dabe425 | 2298 | void TFluka::SetTrackIsNew(Bool_t flag) |
2299 | { | |
2300 | // Return true for the first call of Stepping() | |
2301 | fTrackIsNew = flag; | |
2302 | ||
2303 | } | |
2304 | ||
2305 | ||
829fb838 | 2306 | //______________________________________________________________________________ |
2307 | Bool_t TFluka::IsTrackInside() const | |
2308 | { | |
2309 | // True if the track is not at the boundary of the current volume | |
2310 | // In Fluka a step is always inside one kind of material | |
2311 | // If the step would go behind the region of one material, | |
2312 | // it will be shortened to reach only the boundary. | |
2313 | // Therefore IsTrackInside() is always true. | |
2314 | Int_t caller = GetCaller(); | |
2315 | if (caller == 11 || caller==12) // bxdraw | |
2316 | return 0; | |
2317 | else | |
2318 | return 1; | |
2319 | } | |
2320 | ||
2321 | //______________________________________________________________________________ | |
2322 | Bool_t TFluka::IsTrackEntering() const | |
2323 | { | |
2324 | // True if this is the first step of the track in the current volume | |
2325 | ||
2326 | Int_t caller = GetCaller(); | |
2327 | if (caller == 11) // bxdraw entering | |
2328 | return 1; | |
2329 | else return 0; | |
2330 | } | |
2331 | ||
2332 | //______________________________________________________________________________ | |
2333 | Bool_t TFluka::IsTrackExiting() const | |
2334 | { | |
2335 | // True if track is exiting volume | |
2336 | // | |
2337 | Int_t caller = GetCaller(); | |
2338 | if (caller == 12) // bxdraw exiting | |
2339 | return 1; | |
2340 | else return 0; | |
2341 | } | |
2342 | ||
2343 | //______________________________________________________________________________ | |
2344 | Bool_t TFluka::IsTrackOut() const | |
2345 | { | |
2346 | // True if the track is out of the setup | |
2347 | // means escape | |
2348 | // Icode = 14: escape - call from Kaskad | |
2349 | // Icode = 23: escape - call from Emfsco | |
2350 | // Icode = 32: escape - call from Kasneu | |
2351 | // Icode = 40: escape - call from Kashea | |
2352 | // Icode = 51: escape - call from Kasoph | |
2353 | if (fIcode == 14 || | |
2354 | fIcode == 23 || | |
2355 | fIcode == 32 || | |
2356 | fIcode == 40 || | |
2357 | fIcode == 51) return 1; | |
2358 | else return 0; | |
2359 | } | |
2360 | ||
2361 | //______________________________________________________________________________ | |
2362 | Bool_t TFluka::IsTrackDisappeared() const | |
2363 | { | |
2364 | // means all inelastic interactions and decays | |
2365 | // fIcode from usdraw | |
2366 | if (fIcode == 101 || // inelastic interaction | |
2367 | fIcode == 102 || // particle decay | |
0dabe425 | 2368 | fIcode == 103 || // delta ray generation by hadron |
2369 | fIcode == 104 || // direct pair production | |
2370 | fIcode == 105 || // bremsstrahlung (muon) | |
2371 | fIcode == 208 || // bremsstrahlung (electron) | |
829fb838 | 2372 | fIcode == 214 || // in-flight annihilation |
2373 | fIcode == 215 || // annihilation at rest | |
2374 | fIcode == 217 || // pair production | |
0dabe425 | 2375 | fIcode == 219 || // Compton scattering |
2376 | fIcode == 221 || // Photoelectric effect | |
2377 | fIcode == 300 || // hadronic interaction | |
2378 | fIcode == 400 // delta-ray | |
2379 | ) return 1; | |
829fb838 | 2380 | else return 0; |
2381 | } | |
2382 | ||
2383 | //______________________________________________________________________________ | |
2384 | Bool_t TFluka::IsTrackStop() const | |
2385 | { | |
2386 | // True if the track energy has fallen below the threshold | |
2387 | // means stopped by signal or below energy threshold | |
2388 | // Icode = 12: stopping particle - call from Kaskad | |
2389 | // Icode = 15: time kill - call from Kaskad | |
2390 | // Icode = 21: below threshold, iarg=1 - call from Emfsco | |
2391 | // Icode = 22: below threshold, iarg=2 - call from Emfsco | |
2392 | // Icode = 24: time kill - call from Emfsco | |
2393 | // Icode = 31: below threshold - call from Kasneu | |
2394 | // Icode = 33: time kill - call from Kasneu | |
2395 | // Icode = 41: time kill - call from Kashea | |
2396 | // Icode = 52: time kill - call from Kasoph | |
2397 | if (fIcode == 12 || | |
2398 | fIcode == 15 || | |
2399 | fIcode == 21 || | |
2400 | fIcode == 22 || | |
2401 | fIcode == 24 || | |
2402 | fIcode == 31 || | |
2403 | fIcode == 33 || | |
2404 | fIcode == 41 || | |
2405 | fIcode == 52) return 1; | |
2406 | else return 0; | |
2407 | } | |
2408 | ||
2409 | //______________________________________________________________________________ | |
2410 | Bool_t TFluka::IsTrackAlive() const | |
2411 | { | |
2412 | // means not disappeared or not out | |
2413 | if (IsTrackDisappeared() || IsTrackOut() ) return 0; | |
2414 | else return 1; | |
2415 | } | |
2416 | ||
2417 | // | |
2418 | // secondaries | |
2419 | // | |
2420 | ||
2421 | //______________________________________________________________________________ | |
2422 | Int_t TFluka::NSecondaries() const | |
2423 | ||
2424 | { | |
2425 | // Number of secondary particles generated in the current step | |
2426 | // FINUC.np = number of secondaries except light and heavy ions | |
2427 | // FHEAVY.npheav = number of secondaries for light and heavy secondary ions | |
2428 | Int_t caller = GetCaller(); | |
2429 | if (caller == 6) // valid only after usdraw | |
2430 | return FINUC.np + FHEAVY.npheav; | |
2431 | else | |
2432 | return 0; | |
2433 | } // end of NSecondaries | |
2434 | ||
2435 | //______________________________________________________________________________ | |
2436 | void TFluka::GetSecondary(Int_t isec, Int_t& particleId, | |
2437 | TLorentzVector& position, TLorentzVector& momentum) | |
2438 | { | |
2439 | // Copy particles from secondary stack to vmc stack | |
2440 | // | |
2441 | ||
2442 | Int_t caller = GetCaller(); | |
2443 | if (caller == 6) { // valid only after usdraw | |
2444 | if (isec >= 0 && isec < FINUC.np) { | |
2445 | particleId = PDGFromId(FINUC.kpart[isec]); | |
2446 | position.SetX(fXsco); | |
2447 | position.SetY(fYsco); | |
2448 | position.SetZ(fZsco); | |
2449 | position.SetT(TRACKR.atrack); | |
2450 | momentum.SetPx(FINUC.plr[isec]*FINUC.cxr[isec]); | |
2451 | momentum.SetPy(FINUC.plr[isec]*FINUC.cyr[isec]); | |
2452 | momentum.SetPz(FINUC.plr[isec]*FINUC.czr[isec]); | |
2453 | momentum.SetE(FINUC.tki[isec] + PAPROP.am[FINUC.kpart[isec]+6]); | |
2454 | } | |
2455 | else if (isec >= FINUC.np && isec < FINUC.np + FHEAVY.npheav) { | |
2456 | Int_t jsec = isec - FINUC.np; | |
2457 | particleId = FHEAVY.kheavy[jsec]; // this is Fluka id !!! | |
2458 | position.SetX(fXsco); | |
2459 | position.SetY(fYsco); | |
2460 | position.SetZ(fZsco); | |
2461 | position.SetT(TRACKR.atrack); | |
2462 | momentum.SetPx(FHEAVY.pheavy[jsec]*FHEAVY.cxheav[jsec]); | |
2463 | momentum.SetPy(FHEAVY.pheavy[jsec]*FHEAVY.cyheav[jsec]); | |
2464 | momentum.SetPz(FHEAVY.pheavy[jsec]*FHEAVY.czheav[jsec]); | |
2465 | if (FHEAVY.tkheav[jsec] >= 3 && FHEAVY.tkheav[jsec] <= 6) | |
2466 | momentum.SetE(FHEAVY.tkheav[jsec] + PAPROP.am[jsec+6]); | |
2467 | else if (FHEAVY.tkheav[jsec] > 6) | |
2468 | momentum.SetE(FHEAVY.tkheav[jsec] + FHEAVY.amnhea[jsec]); // to be checked !!! | |
2469 | } | |
2470 | else | |
2471 | Warning("GetSecondary","isec out of range"); | |
2472 | } | |
2473 | else | |
2474 | Warning("GetSecondary","no secondaries available"); | |
2475 | } // end of GetSecondary | |
2476 | ||
2477 | //______________________________________________________________________________ | |
2478 | TMCProcess TFluka::ProdProcess(Int_t) const | |
2479 | ||
2480 | { | |
2481 | // Name of the process that has produced the secondary particles | |
2482 | // in the current step | |
0dabe425 | 2483 | |
2484 | Int_t mugamma = (TRACKR.jtrack == 7 || TRACKR.jtrack == 10 || TRACKR.jtrack == 11); | |
2485 | ||
b496f27c | 2486 | if (fIcode == 102) return kPDecay; |
0dabe425 | 2487 | else if (fIcode == 104 || fIcode == 217) return kPPair; |
b496f27c | 2488 | else if (fIcode == 219) return kPCompton; |
2489 | else if (fIcode == 221) return kPPhotoelectric; | |
0dabe425 | 2490 | else if (fIcode == 105 || fIcode == 208) return kPBrem; |
2491 | else if (fIcode == 103 || fIcode == 400) return kPDeltaRay; | |
2492 | else if (fIcode == 210 || fIcode == 212) return kPDeltaRay; | |
2493 | else if (fIcode == 214 || fIcode == 215) return kPAnnihilation; | |
b496f27c | 2494 | else if (fIcode == 101) return kPHadronic; |
829fb838 | 2495 | else if (fIcode == 101) { |
b496f27c | 2496 | if (!mugamma) return kPHadronic; |
2497 | else if (TRACKR.jtrack == 7) return kPPhotoFission; | |
2498 | else return kPMuonNuclear; | |
829fb838 | 2499 | } |
b496f27c | 2500 | else if (fIcode == 225) return kPRayleigh; |
829fb838 | 2501 | // Fluka codes 100, 300 and 400 still to be investigasted |
b496f27c | 2502 | else return kPNoProcess; |
829fb838 | 2503 | } |
2504 | ||
829fb838 | 2505 | |
b496f27c | 2506 | Int_t TFluka::StepProcesses(TArrayI &proc) const |
2507 | { | |
2508 | // | |
2509 | // Return processes active in the current step | |
2510 | // | |
2511 | proc.Set(1); | |
2512 | TMCProcess iproc; | |
2513 | switch (fIcode) { | |
2514 | case 15: | |
2515 | case 24: | |
2516 | case 33: | |
2517 | case 41: | |
2518 | case 52: | |
2519 | iproc = kPTOFlimit; | |
2520 | break; | |
2521 | case 12: | |
2522 | case 14: | |
2523 | case 21: | |
2524 | case 22: | |
2525 | case 23: | |
2526 | case 31: | |
2527 | case 32: | |
2528 | case 40: | |
2529 | case 51: | |
2530 | iproc = kPStop; | |
2531 | break; | |
2532 | case 50: | |
2533 | iproc = kPLightAbsorption; | |
2534 | break; | |
2535 | case 20: | |
2536 | iproc = kPPhotoelectric; | |
2537 | break; | |
2538 | default: | |
2539 | iproc = ProdProcess(0); | |
2540 | } | |
2541 | return 1; | |
2542 | } | |
829fb838 | 2543 | //______________________________________________________________________________ |
2544 | Int_t TFluka::VolId2Mate(Int_t id) const | |
2545 | { | |
2546 | // | |
2547 | // Returns the material number for a given volume ID | |
2548 | // | |
2549 | return fMCGeo->VolId2Mate(id); | |
2550 | } | |
2551 | ||
2552 | //______________________________________________________________________________ | |
2553 | const char* TFluka::VolName(Int_t id) const | |
2554 | { | |
2555 | // | |
2556 | // Returns the volume name for a given volume ID | |
2557 | // | |
2558 | return fMCGeo->VolName(id); | |
2559 | } | |
2560 | ||
2561 | //______________________________________________________________________________ | |
2562 | Int_t TFluka::VolId(const Text_t* volName) const | |
2563 | { | |
2564 | // | |
2565 | // Converts from volume name to volume ID. | |
2566 | // Time consuming. (Only used during set-up) | |
2567 | // Could be replaced by hash-table | |
2568 | // | |
2569 | return fMCGeo->VolId(volName); | |
2570 | } | |
2571 | ||
2572 | //______________________________________________________________________________ | |
2573 | Int_t TFluka::CurrentVolID(Int_t& copyNo) const | |
2574 | { | |
2575 | // | |
2576 | // Return the logical id and copy number corresponding to the current fluka region | |
2577 | // | |
2578 | if (gGeoManager->IsOutside()) return 0; | |
2579 | TGeoNode *node = gGeoManager->GetCurrentNode(); | |
2580 | copyNo = node->GetNumber(); | |
2581 | Int_t id = node->GetVolume()->GetNumber(); | |
2582 | return id; | |
2583 | } | |
2584 | ||
2585 | //______________________________________________________________________________ | |
2586 | Int_t TFluka::CurrentVolOffID(Int_t off, Int_t& copyNo) const | |
2587 | { | |
2588 | // | |
2589 | // Return the logical id and copy number of off'th mother | |
2590 | // corresponding to the current fluka region | |
2591 | // | |
2592 | if (off<0 || off>gGeoManager->GetLevel()) return 0; | |
2593 | if (off==0) return CurrentVolID(copyNo); | |
2594 | TGeoNode *node = gGeoManager->GetMother(off); | |
2595 | if (!node) return 0; | |
2596 | copyNo = node->GetNumber(); | |
2597 | return node->GetVolume()->GetNumber(); | |
2598 | } | |
2599 | ||
2600 | //______________________________________________________________________________ | |
2601 | const char* TFluka::CurrentVolName() const | |
2602 | { | |
2603 | // | |
2604 | // Return the current volume name | |
2605 | // | |
2606 | if (gGeoManager->IsOutside()) return 0; | |
2607 | return gGeoManager->GetCurrentVolume()->GetName(); | |
2608 | } | |
2609 | ||
2610 | //______________________________________________________________________________ | |
2611 | const char* TFluka::CurrentVolOffName(Int_t off) const | |
2612 | { | |
2613 | // | |
2614 | // Return the volume name of the off'th mother of the current volume | |
2615 | // | |
2616 | if (off<0 || off>gGeoManager->GetLevel()) return 0; | |
2617 | if (off==0) return CurrentVolName(); | |
2618 | TGeoNode *node = gGeoManager->GetMother(off); | |
2619 | if (!node) return 0; | |
2620 | return node->GetVolume()->GetName(); | |
2621 | } | |
2622 | ||
2623 | //______________________________________________________________________________ | |
2624 | Int_t TFluka::CurrentMaterial(Float_t & /*a*/, Float_t & /*z*/, | |
2625 | Float_t & /*dens*/, Float_t & /*radl*/, Float_t & /*absl*/) const | |
2626 | { | |
2627 | // | |
2628 | // Return the current medium number ??? what about material properties | |
2629 | // | |
2630 | Int_t copy; | |
2631 | Int_t id = TFluka::CurrentVolID(copy); | |
2632 | Int_t med = TFluka::VolId2Mate(id); | |
2633 | return med; | |
2634 | } | |
2635 | ||
2636 | //______________________________________________________________________________ | |
2637 | void TFluka::Gmtod(Float_t* xm, Float_t* xd, Int_t iflag) | |
2638 | { | |
2639 | // Transforms a position from the world reference frame | |
2640 | // to the current volume reference frame. | |
2641 | // | |
2642 | // Geant3 desription: | |
2643 | // ================== | |
2644 | // Computes coordinates XD (in DRS) | |
2645 | // from known coordinates XM in MRS | |
2646 | // The local reference system can be initialized by | |
2647 | // - the tracking routines and GMTOD used in GUSTEP | |
2648 | // - a call to GMEDIA(XM,NUMED) | |
2649 | // - a call to GLVOLU(NLEVEL,NAMES,NUMBER,IER) | |
2650 | // (inverse routine is GDTOM) | |
2651 | // | |
2652 | // If IFLAG=1 convert coordinates | |
2653 | // IFLAG=2 convert direction cosinus | |
2654 | // | |
2655 | // --- | |
2656 | Double_t xmL[3], xdL[3]; | |
2657 | Int_t i; | |
2658 | for (i=0;i<3;i++) xmL[i]=xm[i]; | |
2659 | if (iflag == 1) gGeoManager->MasterToLocal(xmL,xdL); | |
2660 | else gGeoManager->MasterToLocalVect(xmL,xdL); | |
2661 | for (i=0;i<3;i++) xd[i] = xdL[i]; | |
2662 | } | |
2663 | ||
2664 | //______________________________________________________________________________ | |
2665 | void TFluka::Gmtod(Double_t* xm, Double_t* xd, Int_t iflag) | |
2666 | { | |
2667 | if (iflag == 1) gGeoManager->MasterToLocal(xm,xd); | |
2668 | else gGeoManager->MasterToLocalVect(xm,xd); | |
2669 | } | |
2670 | ||
2671 | //______________________________________________________________________________ | |
2672 | void TFluka::Gdtom(Float_t* xd, Float_t* xm, Int_t iflag) | |
2673 | { | |
2674 | // Transforms a position from the current volume reference frame | |
2675 | // to the world reference frame. | |
2676 | // | |
2677 | // Geant3 desription: | |
2678 | // ================== | |
2679 | // Computes coordinates XM (Master Reference System | |
2680 | // knowing the coordinates XD (Detector Ref System) | |
2681 | // The local reference system can be initialized by | |
2682 | // - the tracking routines and GDTOM used in GUSTEP | |
2683 | // - a call to GSCMED(NLEVEL,NAMES,NUMBER) | |
2684 | // (inverse routine is GMTOD) | |
2685 | // | |
2686 | // If IFLAG=1 convert coordinates | |
2687 | // IFLAG=2 convert direction cosinus | |
2688 | // | |
2689 | // --- | |
2690 | Double_t xmL[3], xdL[3]; | |
2691 | Int_t i; | |
2692 | for (i=0;i<3;i++) xdL[i] = xd[i]; | |
2693 | if (iflag == 1) gGeoManager->LocalToMaster(xdL,xmL); | |
2694 | else gGeoManager->LocalToMasterVect(xdL,xmL); | |
2695 | for (i=0;i<3;i++) xm[i]=xmL[i]; | |
2696 | } | |
2697 | ||
2698 | //______________________________________________________________________________ | |
2699 | void TFluka::Gdtom(Double_t* xd, Double_t* xm, Int_t iflag) | |
2700 | { | |
2701 | if (iflag == 1) gGeoManager->LocalToMaster(xd,xm); | |
2702 | else gGeoManager->LocalToMasterVect(xd,xm); | |
2703 | } | |
2704 | ||
2705 | //______________________________________________________________________________ | |
2706 | TObjArray *TFluka::GetFlukaMaterials() | |
2707 | { | |
2708 | return fGeom->GetMatList(); | |
2709 | } | |
2710 | ||
2711 | //______________________________________________________________________________ | |
2712 | void TFluka::SetMreg(Int_t l) | |
2713 | { | |
2714 | // Set current fluka region | |
2715 | fCurrentFlukaRegion = l; | |
2716 | fGeom->SetMreg(l); | |
2717 | } | |
2718 | ||
2719 | ||
b496f27c | 2720 | |
2721 | ||
2722 | TString TFluka::ParticleName(Int_t pdg) const | |
2723 | { | |
2724 | // Return particle name for particle with pdg code pdg. | |
2725 | Int_t ifluka = IdFromPDG(pdg); | |
2726 | return TString((CHPPRP.btype[ifluka+6]), 8); | |
2727 | } | |
2728 | ||
2729 | ||
2730 | Double_t TFluka::ParticleMass(Int_t pdg) const | |
2731 | { | |
2732 | // Return particle mass for particle with pdg code pdg. | |
2733 | Int_t ifluka = IdFromPDG(pdg); | |
2734 | return (PAPROP.am[ifluka+6]); | |
2735 | } | |
2736 | ||
2737 | Double_t TFluka::ParticleCharge(Int_t pdg) const | |
2738 | { | |
2739 | // Return particle charge for particle with pdg code pdg. | |
2740 | Int_t ifluka = IdFromPDG(pdg); | |
2741 | return Double_t(PAPROP.ichrge[ifluka+6]); | |
2742 | } | |
2743 | ||
2744 | Double_t TFluka::ParticleLifeTime(Int_t pdg) const | |
2745 | { | |
2746 | // Return particle lifetime for particle with pdg code pdg. | |
2747 | Int_t ifluka = IdFromPDG(pdg); | |
2748 | return (PAPROP.thalf[ifluka+6]); | |
2749 | } | |
2750 | ||
2751 | void TFluka::Gfpart(Int_t pdg, char* name, Int_t& type, Float_t& mass, Float_t& charge, Float_t& tlife) | |
2752 | { | |
2753 | // Retrieve particle properties for particle with pdg code pdg. | |
2754 | ||
2755 | strcpy(name, ParticleName(pdg).Data()); | |
2756 | type = ParticleMCType(pdg); | |
2757 | mass = ParticleMass(pdg); | |
2758 | charge = ParticleCharge(pdg); | |
2759 | tlife = ParticleLifeTime(pdg); | |
2760 | } | |
2761 | ||
2762 | ||
2763 | ||
3a625972 | 2764 | #define pushcerenkovphoton pushcerenkovphoton_ |
2765 | ||
2766 | ||
2767 | extern "C" { | |
2768 | void pushcerenkovphoton(Double_t & px, Double_t & py, Double_t & pz, Double_t & e, | |
2769 | Double_t & vx, Double_t & vy, Double_t & vz, Double_t & tof, | |
2770 | Double_t & polx, Double_t & poly, Double_t & polz, Double_t & wgt, Int_t& ntr) | |
2771 | { | |
2772 | // | |
2773 | // Pushes one cerenkov photon to the stack | |
2774 | // | |
2775 | ||
2776 | TFluka* fluka = (TFluka*) gMC; | |
2777 | TVirtualMCStack* cppstack = fluka->GetStack(); | |
bd3d5c8a | 2778 | Int_t parent = TRACKR.ispusr[mkbmx2-1]; |
921e0994 | 2779 | cppstack->PushTrack(0, parent, 50000050, |
3a625972 | 2780 | px, py, pz, e, |
2781 | vx, vy, vz, tof, | |
2782 | polx, poly, polz, | |
2783 | kPCerenkov, ntr, wgt, 0); | |
2784 | } | |
2785 | } | |
829fb838 | 2786 |