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