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