1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 #include <Riostream.h>
20 #include "TClonesArray.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
33 #include "TVirtualMC.h"
34 #include "TG4GeometryManager.h" //For the geometry management
35 #include "TG4DetConstruction.h" //For the detector construction
37 #include "FGeometryInit.hh"
38 #include "TLorentzVector.h"
39 #include "FlukaVolume.h"
41 // Fluka methods that may be needed.
43 # define flukam flukam_
44 # define fluka_openinp fluka_openinp_
45 # define fluka_closeinp fluka_closeinp_
46 # define mcihad mcihad_
47 # define mpdgha mpdgha_
49 # define flukam FLUKAM
50 # define fluka_openinp FLUKA_OPENINP
51 # define fluka_closeinp FLUKA_CLOSEINP
52 # define mcihad MCIHAD
53 # define mpdgha MPDGHA
59 // Prototypes for FLUKA functions
61 void type_of_call flukam(const int&);
62 void type_of_call fluka_openinp(const int&, DEFCHARA);
63 void type_of_call fluka_closeinp(const int&);
64 int type_of_call mcihad(const int&);
65 int type_of_call mpdgha(const int&);
69 // Class implementation for ROOT
74 //----------------------------------------------------------------------------
75 // TFluka constructors and destructors.
76 //____________________________________________________________________________
82 fCurrentFlukaRegion(-1)
85 // Default constructor
89 TFluka::TFluka(const char *title, Int_t verbosity, Bool_t isRootGeometrySupported)
90 :TVirtualMC("TFluka",title, isRootGeometrySupported),
91 fVerbosityLevel(verbosity),
97 fCurrentFlukaRegion(-1)
99 if (fVerbosityLevel >=3)
100 cout << "==> TFluka::TFluka(" << title << ") constructor called." << endl;
103 // create geometry manager
104 if (fVerbosityLevel >=2)
105 cout << "\t* Creating G4 Geometry manager..." << endl;
106 fGeometryManager = new TG4GeometryManager();
107 if (fVerbosityLevel >=2)
108 cout << "\t* Creating G4 Detector..." << endl;
109 fDetector = new TG4DetConstruction();
110 FGeometryInit* geominit = FGeometryInit::GetInstance();
112 geominit->setDetConstruction(fDetector);
114 cerr << "ERROR: Could not create FGeometryInit!" << endl;
115 cerr << " Exiting!!!" << endl;
119 if (fVerbosityLevel >=3)
120 cout << "<== TFluka::TFluka(" << title << ") constructor called." << endl;
122 fVolumeMediaMap = new TClonesArray("FlukaVolume",1000);
128 if (fVerbosityLevel >=3)
129 cout << "==> TFluka::~TFluka() destructor called." << endl;
131 delete fGeometryManager;
132 fVolumeMediaMap->Delete();
133 delete fVolumeMediaMap;
136 if (fVerbosityLevel >=3)
137 cout << "<== TFluka::~TFluka() destructor called." << endl;
141 //_____________________________________________________________________________
142 // TFluka control methods
143 //____________________________________________________________________________
144 void TFluka::Init() {
146 FGeometryInit* geominit = FGeometryInit::GetInstance();
147 if (fVerbosityLevel >=3)
148 cout << "==> TFluka::Init() called." << endl;
150 cout << "\t* InitPhysics() - Prepare input file to be called" << endl;
152 // now we have G4 geometry created and we have to patch alice.inp
153 // with the material mapping file FlukaMat.inp
154 InitPhysics(); // prepare input file with the current physics settings
155 cout << "\t* InitPhysics() - Prepare input file was called" << endl;
157 if (fVerbosityLevel >=2)
158 cout << "\t* Changing lfdrtr = (" << (GLOBAL.lfdrtr?'T':'F')
159 << ") in fluka..." << endl;
160 GLOBAL.lfdrtr = true;
162 if (fVerbosityLevel >=2)
163 cout << "\t* Opening file " << sInputFileName << endl;
164 const char* fname = sInputFileName;
165 fluka_openinp(lunin, PASSCHARA(fname));
167 if (fVerbosityLevel >=2)
168 cout << "\t* Calling flukam..." << endl;
171 if (fVerbosityLevel >=2)
172 cout << "\t* Closing file " << sInputFileName << endl;
173 fluka_closeinp(lunin);
177 if (fVerbosityLevel >=3)
178 cout << "<== TFluka::Init() called." << endl;
182 void TFluka::FinishGeometry() {
184 // Build-up table with region to medium correspondance
188 if (fVerbosityLevel >=3)
189 cout << "==> TFluka::FinishGeometry() called." << endl;
191 // fGeometryManager->Ggclos();
193 FGeometryInit* flugg = FGeometryInit::GetInstance();
195 fMediaByRegion = new Int_t[fNVolumes+2];
196 for (Int_t i = 0; i < fNVolumes; i++)
198 FlukaVolume* vol = dynamic_cast<FlukaVolume*>((*fVolumeMediaMap)[i]);
199 TString volName = vol->GetName();
200 Int_t media = vol->GetMedium();
201 if (fVerbosityLevel >= 3)
202 printf("Finish Geometry: volName, media %d %s %d \n", i, volName.Data(), media);
203 strcpy(tmp, volName.Data());
205 flugg->SetMediumFromName(tmp, media, i+1);
206 fMediaByRegion[i] = media;
209 flugg->BuildMediaMap();
211 if (fVerbosityLevel >=3)
212 cout << "<== TFluka::FinishGeometry() called." << endl;
215 void TFluka::BuildPhysics() {
216 if (fVerbosityLevel >=3)
217 cout << "==> TFluka::BuildPhysics() called." << endl;
220 if (fVerbosityLevel >=3)
221 cout << "<== TFluka::BuildPhysics() called." << endl;
224 void TFluka::ProcessEvent() {
225 if (fVerbosityLevel >=3)
226 cout << "==> TFluka::ProcessEvent() called." << endl;
227 fApplication->GeneratePrimaries();
228 EPISOR.lsouit = true;
230 if (fVerbosityLevel >=3)
231 cout << "<== TFluka::ProcessEvent() called." << endl;
235 void TFluka::ProcessRun(Int_t nevent) {
236 if (fVerbosityLevel >=3)
237 cout << "==> TFluka::ProcessRun(" << nevent << ") called."
240 if (fVerbosityLevel >=2) {
241 cout << "\t* GLOBAL.fdrtr = " << (GLOBAL.lfdrtr?'T':'F') << endl;
242 cout << "\t* Calling flukam again..." << endl;
244 fApplication->InitGeometry();
245 fApplication->BeginEvent();
247 fApplication->FinishEvent();
248 if (fVerbosityLevel >=3)
249 cout << "<== TFluka::ProcessRun(" << nevent << ") called."
254 //_____________________________________________________________________________
255 // methods for building/management of geometry
256 //____________________________________________________________________________
257 // functions from GCONS
258 void TFluka::Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z,
259 Float_t &dens, Float_t &radl, Float_t &absl,
260 Float_t* ubuf, Int_t& nbuf) {
262 fGeometryManager->Gfmate(imat, name, a, z, dens, radl, absl, ubuf, nbuf);
265 void TFluka::Gfmate(Int_t imat, char *name, Double_t &a, Double_t &z,
266 Double_t &dens, Double_t &radl, Double_t &absl,
267 Double_t* ubuf, Int_t& nbuf) {
269 fGeometryManager->Gfmate(imat, name, a, z, dens, radl, absl, ubuf, nbuf);
272 // detector composition
273 void TFluka::Material(Int_t& kmat, const char* name, Double_t a,
274 Double_t z, Double_t dens, Double_t radl, Double_t absl,
275 Float_t* buf, Int_t nwbuf) {
278 ->Material(kmat, name, a, z, dens, radl, absl, buf, nwbuf);
280 void TFluka::Material(Int_t& kmat, const char* name, Double_t a,
281 Double_t z, Double_t dens, Double_t radl, Double_t absl,
282 Double_t* buf, Int_t nwbuf) {
285 ->Material(kmat, name, a, z, dens, radl, absl, buf, nwbuf);
288 void TFluka::Mixture(Int_t& kmat, const char *name, Float_t *a,
289 Float_t *z, Double_t dens, Int_t nlmat, Float_t *wmat) {
292 ->Mixture(kmat, name, a, z, dens, nlmat, wmat);
294 void TFluka::Mixture(Int_t& kmat, const char *name, Double_t *a,
295 Double_t *z, Double_t dens, Int_t nlmat, Double_t *wmat) {
298 ->Mixture(kmat, name, a, z, dens, nlmat, wmat);
301 void TFluka::Medium(Int_t& kmed, const char *name, Int_t nmat,
302 Int_t isvol, Int_t ifield, Double_t fieldm, Double_t tmaxfd,
303 Double_t stemax, Double_t deemax, Double_t epsil,
304 Double_t stmin, Float_t* ubuf, Int_t nbuf) {
307 ->Medium(kmed, name, nmat, isvol, ifield, fieldm, tmaxfd, stemax, deemax,
308 epsil, stmin, ubuf, nbuf);
310 void TFluka::Medium(Int_t& kmed, const char *name, Int_t nmat,
311 Int_t isvol, Int_t ifield, Double_t fieldm, Double_t tmaxfd,
312 Double_t stemax, Double_t deemax, Double_t epsil,
313 Double_t stmin, Double_t* ubuf, Int_t nbuf) {
316 ->Medium(kmed, name, nmat, isvol, ifield, fieldm, tmaxfd, stemax, deemax,
317 epsil, stmin, ubuf, nbuf);
320 void TFluka::Matrix(Int_t& krot, Double_t thetaX, Double_t phiX,
321 Double_t thetaY, Double_t phiY, Double_t thetaZ,
325 ->Matrix(krot, thetaX, phiX, thetaY, phiY, thetaZ, phiZ);
328 void TFluka::Gstpar(Int_t itmed, const char *param, Double_t parval) {
330 fGeometryManager->Gstpar(itmed, param, parval);
333 // functions from GGEOM
334 Int_t TFluka::Gsvolu(const char *name, const char *shape, Int_t nmed,
335 Float_t *upar, Int_t np) {
337 // fVolumeMediaMap[TString(name)] = nmed;
338 if (fVerbosityLevel >= 3)
339 printf("TFluka::Gsvolu() name = %s, nmed = %d\n", name, nmed);
341 TClonesArray &lvols = *fVolumeMediaMap;
342 new(lvols[fNVolumes++])
343 FlukaVolume(name, nmed);
344 return fGeometryManager->Gsvolu(name, shape, nmed, upar, np);
346 Int_t TFluka::Gsvolu(const char *name, const char *shape, Int_t nmed,
347 Double_t *upar, Int_t np) {
349 TClonesArray &lvols = *fVolumeMediaMap;
350 new(lvols[fNVolumes++])
351 FlukaVolume(name, nmed);
353 return fGeometryManager->Gsvolu(name, shape, nmed, upar, np);
356 void TFluka::Gsdvn(const char *name, const char *mother, Int_t ndiv,
359 // The medium of the daughter is the one of the mother
360 Int_t volid = TFluka::VolId(mother);
361 Int_t med = TFluka::VolId2Mate(volid);
362 TClonesArray &lvols = *fVolumeMediaMap;
363 new(lvols[fNVolumes++])
364 FlukaVolume(name, med);
365 fGeometryManager->Gsdvn(name, mother, ndiv, iaxis);
368 void TFluka::Gsdvn2(const char *name, const char *mother, Int_t ndiv,
369 Int_t iaxis, Double_t c0i, Int_t numed) {
371 TClonesArray &lvols = *fVolumeMediaMap;
372 new(lvols[fNVolumes++])
373 FlukaVolume(name, numed);
374 fGeometryManager->Gsdvn2(name, mother, ndiv, iaxis, c0i, numed);
377 void TFluka::Gsdvt(const char *name, const char *mother, Double_t step,
378 Int_t iaxis, Int_t numed, Int_t ndvmx) {
380 TClonesArray &lvols = *fVolumeMediaMap;
381 new(lvols[fNVolumes++])
382 FlukaVolume(name, numed);
383 fGeometryManager->Gsdvt(name, mother, step, iaxis, numed, ndvmx);
386 void TFluka::Gsdvt2(const char *name, const char *mother, Double_t step,
387 Int_t iaxis, Double_t c0, Int_t numed, Int_t ndvmx) {
389 TClonesArray &lvols = *fVolumeMediaMap;
390 new(lvols[fNVolumes++])
391 FlukaVolume(name, numed);
392 fGeometryManager->Gsdvt2(name, mother, step, iaxis, c0, numed, ndvmx);
395 void TFluka::Gsord(const char *name, Int_t iax) {
397 fGeometryManager->Gsord(name, iax);
400 void TFluka::Gspos(const char *name, Int_t nr, const char *mother,
401 Double_t x, Double_t y, Double_t z, Int_t irot,
404 fGeometryManager->Gspos(name, nr, mother, x, y, z, irot, konly);
407 void TFluka::Gsposp(const char *name, Int_t nr, const char *mother,
408 Double_t x, Double_t y, Double_t z, Int_t irot,
409 const char *konly, Float_t *upar, Int_t np) {
411 fGeometryManager->Gsposp(name, nr, mother, x, y, z, irot, konly, upar, np);
413 void TFluka::Gsposp(const char *name, Int_t nr, const char *mother,
414 Double_t x, Double_t y, Double_t z, Int_t irot,
415 const char *konly, Double_t *upar, Int_t np) {
417 fGeometryManager->Gsposp(name, nr, mother, x, y, z, irot, konly, upar, np);
420 void TFluka::Gsbool(const char* onlyVolName, const char* manyVolName) {
422 fGeometryManager->Gsbool(onlyVolName, manyVolName);
425 void TFluka::SetCerenkov(Int_t itmed, Int_t npckov, Float_t *ppckov,
426 Float_t *absco, Float_t *effic, Float_t *rindex) {
428 fGeometryManager->SetCerenkov(itmed, npckov, ppckov, absco, effic, rindex);
430 void TFluka::SetCerenkov(Int_t itmed, Int_t npckov, Double_t *ppckov,
431 Double_t *absco, Double_t *effic, Double_t *rindex) {
433 fGeometryManager->SetCerenkov(itmed, npckov, ppckov, absco, effic, rindex);
437 void TFluka::WriteEuclid(const char* fileName, const char* topVol,
438 Int_t number, Int_t nlevel) {
440 fGeometryManager->WriteEuclid(fileName, topVol, number, nlevel);
445 //_____________________________________________________________________________
446 // methods needed by the stepping
447 //____________________________________________________________________________
449 Int_t TFluka::GetMedium() const {
451 // Get the medium number for the current fluka region
453 FGeometryInit* flugg = FGeometryInit::GetInstance();
454 return flugg->GetMedium(fCurrentFlukaRegion);
459 //____________________________________________________________________________
460 // particle table usage
461 // ID <--> PDG transformations
462 //_____________________________________________________________________________
463 Int_t TFluka::IdFromPDG(Int_t pdg) const
466 // Return Fluka code from PDG and pseudo ENDF code
468 // Catch the feedback photons
469 if (pdg == 50000051) return (-1);
470 // MCIHAD() goes from pdg to fluka internal.
471 Int_t intfluka = mcihad(pdg);
472 // KPTOIP array goes from internal to official
473 return GetFlukaKPTOIP(intfluka);
476 Int_t TFluka::PDGFromId(Int_t id) const
479 // Return PDG code and pseudo ENDF code from Fluka code
481 // IPTOKP array goes from official to internal
485 if (fVerbosityLevel >= 1)
486 printf("\n PDGFromId: Cerenkov Photon \n");
491 if (fVerbosityLevel >= 1)
492 printf("PDGFromId: Error id = 0\n");
496 Int_t intfluka = GetFlukaIPTOKP(id);
498 if (fVerbosityLevel >= 1)
499 printf("PDGFromId: Error intfluka = 0: %d\n", id);
501 } else if (intfluka < 0) {
502 if (fVerbosityLevel >= 1)
503 printf("PDGFromId: Error intfluka < 0: %d\n", id);
506 if (fVerbosityLevel >= 3)
507 printf("mpdgha called with %d %d \n", id, intfluka);
508 // MPDGHA() goes from fluka internal to pdg.
509 return mpdgha(intfluka);
512 //_____________________________________________________________________________
513 // methods for physics management
514 //____________________________________________________________________________
519 void TFluka::SetProcess(const char* flagName, Int_t flagValue)
522 if (iNbOfProc < 100) {
523 for (i=0; i<iNbOfProc; i++) {
524 if (strcmp(&sProcessFlag[i][0],flagName) == 0) {
525 iProcessValue[iNbOfProc] = flagValue;
529 strcpy(&sProcessFlag[iNbOfProc][0],flagName);
530 iProcessValue[iNbOfProc++] = flagValue;
533 cout << "Nb of SetProcess calls exceeds 100 - ignored" << endl;
535 iNbOfProc = iNbOfProc;
538 void TFluka::SetCut(const char* cutName, Double_t cutValue)
541 if (iNbOfCut < 100) {
542 for (i=0; i<iNbOfCut; i++) {
543 if (strcmp(&sCutFlag[i][0],cutName) == 0) {
544 fCutValue[iNbOfCut] = cutValue;
548 strcpy(&sCutFlag[iNbOfCut][0],cutName);
549 fCutValue[iNbOfCut++] = cutValue;
552 cout << "Nb of SetCut calls exceeds 100 - ignored" << endl;
557 Double_t TFluka::Xsec(char*, Double_t, Int_t, Int_t)
559 printf("WARNING: Xsec not yet implemented !\n"); return -1.;
563 void TFluka::InitPhysics()
567 Double_t zero, one, two, three;
568 FILE *pAliceCoreInp, *pAliceFlukaMat, *pAliceInp;
575 FGeometryInit* geominit = FGeometryInit::GetInstance();
576 Float_t fLastMaterial = geominit->GetLastMaterialIndex();
577 printf(" last FLUKA material is %g\n", fLastMaterial);
579 // construct file names
580 TString sAliceCoreInp = getenv("ALICE_ROOT");
581 sAliceCoreInp +="/TFluka/input/";
582 TString sAliceTmp = "flukaMat.inp";
583 TString sAliceInp = GetInputFileName();
584 sAliceCoreInp += GetCoreInputFileName();
586 if ((pAliceCoreInp = fopen(sAliceCoreInp.Data(),"r")) == NULL) {
587 printf("\nCannot open file %s\n",sAliceCoreInp.Data());
590 if ((pAliceFlukaMat = fopen(sAliceTmp.Data(),"r")) == NULL) {
591 printf("\nCannot open file %s\n",sAliceTmp.Data());
594 if ((pAliceInp = fopen(sAliceInp.Data(),"w")) == NULL) {
595 printf("\nCannot open file %s\n",sAliceInp.Data());
599 // copy core input file
601 Float_t fEventsPerRun;
603 while ((fgets(sLine,255,pAliceCoreInp)) != NULL) {
604 if (strncmp(sLine,"GEOEND",6) != 0)
605 fprintf(pAliceInp,"%s",sLine); // copy until GEOEND card
607 fprintf(pAliceInp,"GEOEND\n"); // add GEOEND card
610 } // end of while until GEOEND card
613 while ((fgets(sLine,255,pAliceFlukaMat)) != NULL) { // copy flukaMat.inp file
614 fprintf(pAliceInp,"%s\n",sLine);
617 while ((fgets(sLine,255,pAliceCoreInp)) != NULL) {
618 if (strncmp(sLine,"START",5) != 0)
619 fprintf(pAliceInp,"%s\n",sLine);
621 sscanf(sLine+10,"%10f",&fEventsPerRun);
624 } //end of while until START card
627 // in G3 the process control values meaning can be different for
628 // different processes, but for most of them is:
629 // 0 process is not activated
630 // 1 process is activated WITH generation of secondaries
631 // 2 process is activated WITHOUT generation of secondaries
632 // if process does not generate secondaries => 1 same as 2
641 // Loop over number of SetProcess calls
642 fprintf(pAliceInp,"*----------------------------------------------------------------------------- \n");
643 fprintf(pAliceInp,"*----- The following data are generated from SetProcess and SetCut calls ----- \n");
644 fprintf(pAliceInp,"*----------------------------------------------------------------------------- \n");
645 for (i=0; i<iNbOfProc; i++) {
648 // G3 default value: 1
649 // G4 processes: G4eplusAnnihilation/G4IeplusAnnihilation
652 // flag = 0 no annihilation
653 // flag = 1 annihilation, decays processed
654 // flag = 2 annihilation, no decay product stored
655 // gMC ->SetProcess("ANNI",1); // EMFCUT -1. 0. 0. 3. lastmat 0. ANNH-THR
656 if (strncmp(&sProcessFlag[i][0],"ANNI",4) == 0) {
657 if (iProcessValue[i] == 1 || iProcessValue[i] == 2) {
658 fprintf(pAliceInp,"*\n*Kinetic energy threshold (GeV) for e+ annihilation - resets to default=0.\n");
659 fprintf(pAliceInp,"*Generated from call: SetProcess('ANNI',1) or SetProcess('ANNI',2)\n");
660 // -one = kinetic energy threshold (GeV) for e+ annihilation (resets to default=0)
663 // three = lower bound of the material indices in which the respective thresholds apply
664 // fLastMaterial = upper bound of the material indices in which the respective thresholds apply
665 // one = step length in assigning indices
667 fprintf(pAliceInp,"EMFCUT %10.1f%10.1f%10.1f%10.1f%10.1f%10.1fANNH-THR\n",-one,zero,zero,three,fLastMaterial,one);
669 else if (iProcessValue[i] == 0) {
670 fprintf(pAliceInp,"*\n*No annihilation - no FLUKA card generated\n");
671 fprintf(pAliceInp,"*Generated from call: SetProcess('ANNI',0)\n");
674 fprintf(pAliceInp,"*\n*Illegal flag value in SetProcess('ANNI',?) call.\n");
675 fprintf(pAliceInp,"*No FLUKA card generated\n");
679 // bremsstrahlung and pair production are both activated
680 // G3 default value: 1
681 // G4 processes: G4eBremsstrahlung/G4IeBremsstrahlung,
682 // G4MuBremsstrahlung/G4IMuBremsstrahlung,
683 // G4LowEnergyBremstrahlung
684 // Particles: e-/e+; mu+/mu-
686 // flag = 0 no bremsstrahlung
687 // flag = 1 bremsstrahlung, photon processed
688 // flag = 2 bremsstrahlung, no photon stored
689 // gMC ->SetProcess("BREM",1); // PAIRBREM 2. 0. 0. 3. lastmat
690 // EMFCUT -1. 0. 0. 3. lastmat 0. ELPO-THR
691 // G3 default value: 1
692 // G4 processes: G4GammaConversion,
693 // G4MuPairProduction/G4IMuPairProduction
694 // G4LowEnergyGammaConversion
695 // Particles: gamma, mu
697 // flag = 0 no delta rays
698 // flag = 1 delta rays, secondaries processed
699 // flag = 2 delta rays, no secondaries stored
700 // gMC ->SetProcess("PAIR",1); // PAIRBREM 1. 0. 0. 3. lastmat
701 // EMFCUT 0. 0. -1. 3. lastmat 0. PHOT-THR
702 else if ((strncmp(&sProcessFlag[i][0],"PAIR",4) == 0) && (iProcessValue[i] == 1 || iProcessValue[i] == 2)) {
703 for (j=0; j<iNbOfProc; j++) {
704 if ((strncmp(&sProcessFlag[j][0],"BREM",4) == 0) && (iProcessValue[j] == 1 || iProcessValue[j] == 2)) {
705 fprintf(pAliceInp,"*\n*Bremsstrahlung and pair production by muons and charged hadrons both activated\n");
706 fprintf(pAliceInp,"*Generated from call: SetProcess('BREM',1) and SetProcess('PAIR',1)\n");
707 fprintf(pAliceInp,"*Energy threshold set by call SetCut('BCUTM',cut) or set to 0.\n");
708 fprintf(pAliceInp,"*Energy threshold set by call SetCut('PPCUTM',cut) or set to 0.\n");
709 // three = bremsstrahlung and pair production by muons and charged hadrons both are activated
710 fprintf(pAliceInp,"PAIRBREM %10.1f",three);
711 // direct pair production by muons
712 // G4 particles: "e-", "e+"
713 // G3 default value: 0.01 GeV
714 //gMC ->SetCut("PPCUTM",cut); // total energy cut for direct pair prod. by muons
716 for (k=0; k<iNbOfCut; k++) {
717 if (strncmp(&sCutFlag[k][0],"PPCUTM",6) == 0) fCut = fCutValue[k];
719 fprintf(pAliceInp,"%10.4g",fCut);
720 // fCut; = e+, e- kinetic energy threshold (in GeV) for explicit pair production.
721 // muon and hadron bremsstrahlung
722 // G4 particles: "gamma"
723 // G3 default value: CUTGAM=0.001 GeV
724 //gMC ->SetCut("BCUTM",cut); // cut for muon and hadron bremsstrahlung
726 for (k=0; k<iNbOfCut; k++) {
727 if (strncmp(&sCutFlag[k][0],"BCUTM",5) == 0) fCut = fCutValue[k];
729 fprintf(pAliceInp,"%10.4g%10.1f%10.1f\n",fCut,three,fLastMaterial);
730 // fCut = photon energy threshold (GeV) for explicit bremsstrahlung production
731 // three = lower bound of the material indices in which the respective thresholds apply
732 // fLastMaterial = upper bound of the material indices in which the respective thresholds apply
735 fprintf(pAliceInp,"*\n*Kinetic energy threshold (GeV) for e+/e- bremsstrahlung - resets to default=0.\n");
736 fprintf(pAliceInp,"*Generated from call: SetProcess('BREM',1);\n");
738 for (k=0; k<iNbOfCut; k++) {
739 if (strncmp(&sCutFlag[k][0],"BCUTE",5) == 0) fCut = fCutValue[k];
741 //fCut = kinetic energy threshold (GeV) for e+/e- bremsstrahlung (resets to default=0)
744 // three = lower bound of the material indices in which the respective thresholds apply
745 // fLastMaterial = upper bound of the material indices in which the respective thresholds apply
746 // one = step length in assigning indices
748 fprintf(pAliceInp,"EMFCUT %10.4g%10.1f%10.1f%10.1f%10.1f%10.1fELPO-THR\n",fCut,zero,zero,three,fLastMaterial,one);
751 fprintf(pAliceInp,"*\n*Pair production by electrons is activated\n");
752 fprintf(pAliceInp,"*Generated from call: SetProcess('PAIR',1);\n");
754 for (j=0; j<iNbOfCut; j++) {
755 if (strncmp(&sCutFlag[j][0],"CUTGAM",6) == 0) fCut = fCutValue[j];
757 // fCut = energy threshold (GeV) for gamma pair production (< 0.0 : resets to default, = 0.0 : ignored)
758 // three = lower bound of the material indices in which the respective thresholds apply
759 // fLastMaterial = upper bound of the material indices in which the respective thresholds apply
760 // one = step length in assigning indices
761 fprintf(pAliceInp,"EMFCUT %10.1f%10.1f%10.4g%10.1f%10.1f%10.1fPHOT-THR\n",zero,zero,fCut,three,fLastMaterial,one);
763 } // end of if for BREM
764 } // end of loop for BREM
766 // only pair production by muons and charged hadrons is activated
767 fprintf(pAliceInp,"*\n*Pair production by muons and charged hadrons is activated\n");
768 fprintf(pAliceInp,"*Generated from call: SetProcess('PAIR',1) or SetProcess('PAIR',2)\n");
769 fprintf(pAliceInp,"*Energy threshold set by call SetCut('PPCUTM',cut) or set to 0.\n");
770 // direct pair production by muons
771 // G4 particles: "e-", "e+"
772 // G3 default value: 0.01 GeV
773 //gMC ->SetCut("PPCUTM",cut); // total energy cut for direct pair prod. by muons
774 // one = pair production by muons and charged hadrons is activated
775 // zero = e+, e- kinetic energy threshold (in GeV) for explicit pair production.
776 // zero = no explicit bremsstrahlung production is simulated
777 // three = lower bound of the material indices in which the respective thresholds apply
778 // fLastMaterial = upper bound of the material indices in which the respective thresholds apply
779 fprintf(pAliceInp,"PAIRBREM %10.1f%10.1f%10.1f%10.1f%10.1f\n",one,zero,zero,three,fLastMaterial);
782 fprintf(pAliceInp,"*\n*Pair production by electrons is activated\n");
783 fprintf(pAliceInp,"*Generated from call: SetProcess('PAIR',1) or SetProcess('PAIR',2)\n");
785 for (j=0; j<iNbOfCut; j++) {
786 if (strncmp(&sCutFlag[j][0],"CUTGAM",6) == 0) fCut = fCutValue[j];
788 // zero = energy threshold (GeV) for Compton scattering (= 0.0 : ignored)
789 // zero = energy threshold (GeV) for Photoelectric (= 0.0 : ignored)
790 // fCut = energy threshold (GeV) for gamma pair production (< 0.0 : resets to default, = 0.0 : ignored)
791 // three = lower bound of the material indices in which the respective thresholds apply
792 // fLastMaterial = upper bound of the material indices in which the respective thresholds apply
793 // one = step length in assigning indices
794 fprintf(pAliceInp,"EMFCUT %10.1f%10.1f%10.4g%10.1f%10.1f%10.1fPHOT-THR\n",zero,zero,fCut,three,fLastMaterial,one);
798 } // end of if for PAIR
803 // G3 default value: 1
804 // G4 processes: G4eBremsstrahlung/G4IeBremsstrahlung,
805 // G4MuBremsstrahlung/G4IMuBremsstrahlung,
806 // G4LowEnergyBremstrahlung
807 // Particles: e-/e+; mu+/mu-
809 // flag = 0 no bremsstrahlung
810 // flag = 1 bremsstrahlung, photon processed
811 // flag = 2 bremsstrahlung, no photon stored
812 // gMC ->SetProcess("BREM",1); // PAIRBREM 2. 0. 0. 3. lastmat
813 // EMFCUT -1. 0. 0. 3. lastmat 0. ELPO-THR
814 else if (strncmp(&sProcessFlag[i][0],"BREM",4) == 0) {
815 for (j=0; j<iNbOfProc; j++) {
816 if ((strncmp(&sProcessFlag[j][0],"PAIR",4) == 0) && iProcessValue[j] == 1) goto NOBREM;
818 if (iProcessValue[i] == 1 || iProcessValue[i] == 2) {
819 fprintf(pAliceInp,"*\n*Bremsstrahlung by muons and charged hadrons is activated\n");
820 fprintf(pAliceInp,"*Generated from call: SetProcess('BREM',1) or SetProcess('BREM',2)\n");
821 fprintf(pAliceInp,"*Energy threshold set by call SetCut('BCUTM',cut) or set to 0.\n");
822 // two = bremsstrahlung by muons and charged hadrons is activated
824 // muon and hadron bremsstrahlung
825 // G4 particles: "gamma"
826 // G3 default value: CUTGAM=0.001 GeV
827 //gMC ->SetCut("BCUTM",cut); // cut for muon and hadron bremsstrahlung
829 for (j=0; j<iNbOfCut; j++) {
830 if (strncmp(&sCutFlag[j][0],"BCUTM",5) == 0) fCut = fCutValue[j];
832 // fCut = photon energy threshold (GeV) for explicit bremsstrahlung production
833 // three = lower bound of the material indices in which the respective thresholds apply
834 // fLastMaterial = upper bound of the material indices in which the respective thresholds apply
835 fprintf(pAliceInp,"PAIRBREM %10.1f%10.1f%10.4g%10.1f%10.1f\n",two,zero,fCut,three,fLastMaterial);
838 fprintf(pAliceInp,"*\n*Kinetic energy threshold (GeV) for e+/e- bremsstrahlung - resets to default=0.\n");
839 fprintf(pAliceInp,"*Generated from call: SetProcess('BREM',1);");
840 // - one = kinetic energy threshold (GeV) for e+/e- bremsstrahlung (resets to default=0)
843 // three = lower bound of the material indices in which the respective thresholds apply
844 // fLastMaterial = upper bound of the material indices in which the respective thresholds apply
845 // one = step length in assigning indices
847 fprintf(pAliceInp,"EMFCUT %10.1f%10.1f%10.1f%10.1f%10.1f%10.1fELPO-THR\n",-one,zero,zero,three,fLastMaterial,one);
849 else if (iProcessValue[i] == 0) {
850 fprintf(pAliceInp,"*\n*No bremsstrahlung - no FLUKA card generated\n");
851 fprintf(pAliceInp,"*Generated from call: SetProcess('BREM',0)\n");
854 fprintf(pAliceInp,"*\n*Illegal flag value in SetProcess('BREM',?) call.\n");
855 fprintf(pAliceInp,"*No FLUKA card generated\n");
859 } // end of else if (strncmp(&sProcessFlag[i][0],"BREM",4) == 0)
862 // Cerenkov photon generation
863 // G3 default value: 0
864 // G4 process: G4Cerenkov
866 // Particles: charged
868 // flag = 0 no Cerenkov photon generation
869 // flag = 1 Cerenkov photon generation
870 // flag = 2 Cerenkov photon generation with primary stopped at each step
871 //xx gMC ->SetProcess("CKOV",1); // ??? Cerenkov photon generation
872 else if (strncmp(&sProcessFlag[i][0],"CKOV",4) == 0) {
873 if (iProcessValue[i] == 1 || iProcessValue[i] == 2) {
874 fprintf(pAliceInp,"*\n*Cerenkov photon generation\n");
875 fprintf(pAliceInp,"*Generated from call: SetProcess('CKOV',1) or SetProcess('CKOV',2)\n");
876 Double_t emin = 2.07e-9; // minimum Cerenkov photon emission energy (in GeV!). Default: 2.07E-9 GeV (corresponding to 600 nm)
877 Double_t emax = 4.96e-9; // maximum Cerenkov photon emission energy (in GeV!). Default: 4.96E-9 GeV (corresponding to 250 nm)
878 fprintf(pAliceInp,"OPT-PROD %10.4g%10.4g%10.1f%10.1f%10.1f%10.1fCERENKOV\n",emin,emax,zero,three,fLastMaterial,one);
880 else if (iProcessValue[i] == 0) {
881 fprintf(pAliceInp,"*\n*No Cerenkov photon generation\n");
882 fprintf(pAliceInp,"*Generated from call: SetProcess('CKOV',0)\n");
886 // three = lower bound of the material indices in which the respective thresholds apply
887 // fLastMaterial = upper bound of the material indices in which the respective thresholds apply
888 // one = step length in assigning indices
890 fprintf(pAliceInp,"OPT-PROD %10.1f%10.1f%10.1f%10.1f%10.1f%10.1fCERE-OFF\n",zero,zero,zero,three,fLastMaterial,one);
893 fprintf(pAliceInp,"*\n*Illegal flag value in SetProcess('CKOV',?) call.\n");
894 fprintf(pAliceInp,"*No FLUKA card generated\n");
896 } // end of else if (strncmp(&sProcessFlag[i][0],"CKOV",4) == 0)
899 // Compton scattering
900 // G3 default value: 1
901 // G4 processes: G4ComptonScattering,
902 // G4LowEnergyCompton,
903 // G4PolarizedComptonScattering
906 // flag = 0 no Compton scattering
907 // flag = 1 Compton scattering, electron processed
908 // flag = 2 Compton scattering, no electron stored
909 // gMC ->SetProcess("COMP",1); // EMFCUT -1. 0. 0. 3. lastmat 0. PHOT-THR
910 else if (strncmp(&sProcessFlag[i][0],"COMP",4) == 0) {
911 if (iProcessValue[i] == 1 || iProcessValue[i] == 2) {
912 fprintf(pAliceInp,"*\n*Energy threshold (GeV) for Compton scattering - resets to default=0.\n");
913 fprintf(pAliceInp,"*Generated from call: SetProcess('COMP',1);\n");
914 // - one = energy threshold (GeV) for Compton scattering - resets to default=0.
917 // three = lower bound of the material indices in which the respective thresholds apply
918 // fLastMaterial = upper bound of the material indices in which the respective thresholds apply
919 // one = step length in assigning indices
921 fprintf(pAliceInp,"EMFCUT %10.1f%10.1f%10.1f%10.1f%10.1f%10.1fPHOT-THR\n",-one,zero,zero,three,fLastMaterial,one);
923 else if (iProcessValue[i] == 0) {
924 fprintf(pAliceInp,"*\n*No Compton scattering - no FLUKA card generated\n");
925 fprintf(pAliceInp,"*Generated from call: SetProcess('COMP',0)\n");
928 fprintf(pAliceInp,"*\n*Illegal flag value in SetProcess('COMP',?) call.\n");
929 fprintf(pAliceInp,"*No FLUKA card generated\n");
931 } // end of else if (strncmp(&sProcessFlag[i][0],"COMP",4) == 0)
934 // G3 default value: 1
935 // G4 process: G4Decay
937 // Particles: all which decay is applicable for
939 // flag = 0 no decays
940 // flag = 1 decays, secondaries processed
941 // flag = 2 decays, no secondaries stored
942 //gMC ->SetProcess("DCAY",1); // not available
943 else if ((strncmp(&sProcessFlag[i][0],"DCAY",4) == 0) && iProcessValue[i] == 1)
944 cout << "SetProcess for flag=" << &sProcessFlag[i][0] << " value=" << iProcessValue[i] << " not avaliable!" << endl;
947 // G3 default value: 2
948 // !! G4 treats delta rays in different way
949 // G4 processes: G4eIonisation/G4IeIonization,
950 // G4MuIonisation/G4IMuIonization,
951 // G4hIonisation/G4IhIonisation
952 // Particles: charged
954 // flag = 0 no energy loss
955 // flag = 1 restricted energy loss fluctuations
956 // flag = 2 complete energy loss fluctuations
957 // flag = 3 same as 1
958 // flag = 4 no energy loss fluctuations
959 // gMC ->SetProcess("DRAY",0); // DELTARAY 1.E+6 0. 0. 3. lastmat 0.
960 else if (strncmp(&sProcessFlag[i][0],"DRAY",4) == 0) {
961 if (iProcessValue[i] == 0 || iProcessValue[i] == 4) {
962 fprintf(pAliceInp,"*\n*Kinetic energy threshold (GeV) for delta ray production\n");
963 fprintf(pAliceInp,"*Generated from call: SetProcess('DRAY',0) or SetProcess('DRAY',4)\n");
964 fprintf(pAliceInp,"*No delta ray production by muons - threshold set artificially high\n");
965 Double_t emin = 1.0e+6; // kinetic energy threshold (GeV) for delta ray production (discrete energy transfer)
968 // three = lower bound of the material indices in which the respective thresholds apply
969 // fLastMaterial = upper bound of the material indices in which the respective thresholds apply
970 // one = step length in assigning indices
971 fprintf(pAliceInp,"DELTARAY %10.4g%10.1f%10.1f%10.1f%10.1f%10.1f\n",emin,zero,zero,three,fLastMaterial,one);
973 else if (iProcessValue[i] == 1 || iProcessValue[i] == 2 || iProcessValue[i] == 3) {
974 fprintf(pAliceInp,"*\n*Kinetic energy threshold (GeV) for delta ray production\n");
975 fprintf(pAliceInp,"*Generated from call: SetProcess('DRAY',flag), flag=1,2,3\n");
976 fprintf(pAliceInp,"*Delta ray production by muons switched on\n");
977 fprintf(pAliceInp,"*Energy threshold set by call SetCut('DCUTM',cut) or set to 1.0e+6.\n");
979 for (j=0; j<iNbOfCut; j++) {
980 if (strncmp(&sCutFlag[j][0],"DCUTM",5) == 0) fCut = fCutValue[j];
982 // fCut = kinetic energy threshold (GeV) for delta ray production (discrete energy transfer)
985 // three = lower bound of the material indices in which the respective thresholds apply
986 // fLastMaterial = upper bound of the material indices in which the respective thresholds apply
987 // one = step length in assigning indices
988 fprintf(pAliceInp,"DELTARAY %10.4g%10.1f%10.1f%10.1f%10.1f%10.1f\n",fCut,zero,zero,three,fLastMaterial,one);
991 fprintf(pAliceInp,"*\n*Illegal flag value in SetProcess('DRAY',?) call.\n");
992 fprintf(pAliceInp,"*No FLUKA card generated\n");
994 } // end of else if (strncmp(&sProcessFlag[i][0],"DRAY",4) == 0)
997 // G3 default value: 1
998 // G4 processes: all defined by TG4PhysicsConstructorHadron
1000 // Particles: hadrons
1002 // flag = 0 no multiple scattering
1003 // flag = 1 hadronic interactions, secondaries processed
1004 // flag = 2 hadronic interactions, no secondaries stored
1005 // gMC ->SetProcess("HADR",1); // ??? hadronic process
1006 //Select pure GEANH (HADR 1) or GEANH/NUCRIN (HADR 3) ?????
1007 else if (strncmp(&sProcessFlag[i][0],"HADR",4) == 0) {
1008 if (iProcessValue[i] == 1 || iProcessValue[i] == 2) {
1009 fprintf(pAliceInp,"*\n*Hadronic interaction is ON by default in FLUKA\n");
1010 fprintf(pAliceInp,"*No FLUKA card generated\n");
1012 else if (iProcessValue[i] == 0) {
1013 fprintf(pAliceInp,"*\n*Hadronic interaction is set OFF\n");
1014 fprintf(pAliceInp,"*Generated from call: SetProcess('HADR',0);\n");
1016 // three = multiple scattering for hadrons and muons is completely suppressed
1017 // zero = no spin-relativistic corrections
1018 // three = lower bound of the material indices in which the respective thresholds apply
1019 // fLastMaterial = upper bound of the material indices in which the respective thresholds apply
1020 fprintf(pAliceInp,"MULSOPT %10.1f%10.1f%10.1f%10.1f%10.1f\n",zero,three,zero,three,fLastMaterial);
1024 fprintf(pAliceInp,"*\n*Illegal flag value in SetProcess('HADR',?) call.\n");
1025 fprintf(pAliceInp,"*No FLUKA card generated\n");
1027 } // end of else if (strncmp(&sProcessFlag[i][0],"HADR",4) == 0)
1031 // G3 default value: 2
1032 // G4 processes: G4eIonisation/G4IeIonization,
1033 // G4MuIonisation/G4IMuIonization,
1034 // G4hIonisation/G4IhIonisation
1036 // Particles: charged
1038 // flag=0 no energy loss
1039 // flag=1 restricted energy loss fluctuations
1040 // flag=2 complete energy loss fluctuations
1042 // flag=4 no energy loss fluctuations
1043 // If the value ILOSS is changed, then (in G3) cross-sections and energy
1044 // loss tables must be recomputed via the command 'PHYSI'
1045 // gMC ->SetProcess("LOSS",2); // ??? IONFLUCT ? energy loss
1046 else if (strncmp(&sProcessFlag[i][0],"LOSS",4) == 0) {
1047 if (iProcessValue[i] == 2) { // complete energy loss fluctuations
1048 fprintf(pAliceInp,"*\n*Complete energy loss fluctuations do not exist in FLUKA\n");
1049 fprintf(pAliceInp,"*Generated from call: SetProcess('LOSS',2);\n");
1050 fprintf(pAliceInp,"*flag=2=complete energy loss fluctuations\n");
1051 fprintf(pAliceInp,"*No FLUKA card generated\n");
1053 else if (iProcessValue[i] == 1 || iProcessValue[i] == 3) { // restricted energy loss fluctuations
1054 fprintf(pAliceInp,"*\n*Restricted energy loss fluctuations\n");
1055 fprintf(pAliceInp,"*Generated from call: SetProcess('LOSS',1) or SetProcess('LOSS',3)\n");
1056 // one = restricted energy loss fluctuations (for hadrons and muons) switched on
1057 // one = restricted energy loss fluctuations (for e+ and e-) switched on
1058 // one = minimal accuracy
1059 // three = lower bound of the material indices in which the respective thresholds apply
1060 // upper bound of the material indices in which the respective thresholds apply
1061 fprintf(pAliceInp,"IONFLUCT %10.1f%10.1f%10.1f%10.1f%10.1f\n",one,one,one,three,fLastMaterial);
1063 else if (iProcessValue[i] == 4) { // no energy loss fluctuations
1064 fprintf(pAliceInp,"*\n*No energy loss fluctuations\n");
1065 fprintf(pAliceInp,"*\n*Generated from call: SetProcess('LOSS',4)\n");
1066 // - one = restricted energy loss fluctuations (for hadrons and muons) switched off
1067 // - one = restricted energy loss fluctuations (for e+ and e-) switched off
1068 // one = minimal accuracy
1069 // three = lower bound of the material indices in which the respective thresholds apply
1070 // fLastMaterial = upper bound of the material indices in which the respective thresholds apply
1071 fprintf(pAliceInp,"IONFLUCT %10.1f%10.1f%10.1f%10.1f%10.1f\n",-one,-one,one,three,fLastMaterial);
1074 fprintf(pAliceInp,"*\n*Illegal flag value in SetProcess('LOSS',?) call.\n");
1075 fprintf(pAliceInp,"*No FLUKA card generated\n");
1077 } // end of else if (strncmp(&sProcessFlag[i][0],"LOSS",4) == 0)
1080 // multiple scattering
1081 // G3 default value: 1
1082 // G4 process: G4MultipleScattering/G4IMultipleScattering
1084 // Particles: charged
1086 // flag = 0 no multiple scattering
1087 // flag = 1 Moliere or Coulomb scattering
1088 // flag = 2 Moliere or Coulomb scattering
1089 // flag = 3 Gaussian scattering
1090 // gMC ->SetProcess("MULS",1); // MULSOPT multiple scattering
1091 else if (strncmp(&sProcessFlag[i][0],"MULS",4) == 0) {
1092 if (iProcessValue[i] == 1 || iProcessValue[i] == 2 || iProcessValue[i] == 3) {
1093 fprintf(pAliceInp,"*\n*Multiple scattering is ON by default for e+e- and for hadrons/muons\n");
1094 fprintf(pAliceInp,"*No FLUKA card generated\n");
1096 else if (iProcessValue[i] == 0) {
1097 fprintf(pAliceInp,"*\n*Multiple scattering is set OFF\n");
1098 fprintf(pAliceInp,"*Generated from call: SetProcess('MULS',0);\n");
1100 // three = multiple scattering for hadrons and muons is completely suppressed
1101 // three = multiple scattering for e+ and e- is completely suppressed
1102 // three = lower bound of the material indices in which the respective thresholds apply
1103 // fLastMaterial = upper bound of the material indices in which the respective thresholds apply
1104 fprintf(pAliceInp,"MULSOPT %10.1f%10.1f%10.1f%10.1f%10.1f\n",zero,three,three,three,fLastMaterial);
1107 fprintf(pAliceInp,"*\n*Illegal flag value in SetProcess('MULS',?) call.\n");
1108 fprintf(pAliceInp,"*No FLUKA card generated\n");
1110 } // end of else if (strncmp(&sProcessFlag[i][0],"MULS",4) == 0)
1113 // muon nuclear interaction
1114 // G3 default value: 0
1115 // G4 processes: G4MuNuclearInteraction,
1116 // G4MuonMinusCaptureAtRest
1120 // flag = 0 no muon-nuclear interaction
1121 // flag = 1 nuclear interaction, secondaries processed
1122 // flag = 2 nuclear interaction, secondaries not processed
1123 // gMC ->SetProcess("MUNU",1); // MUPHOTON 1. 0. 0. 3. lastmat
1124 else if (strncmp(&sProcessFlag[i][0],"MUNU",4) == 0) {
1125 if (iProcessValue[i] == 1) {
1126 fprintf(pAliceInp,"*\n*Muon nuclear interactions with production of secondary hadrons\n");
1127 fprintf(pAliceInp,"*Generated from call: SetProcess('MUNU',1);\n");
1128 // one = full simulation of muon nuclear interactions and production of secondary hadrons
1129 // zero = ratio of longitudinal to transverse virtual photon cross-section - Default = 0.25.
1130 // zero = fraction of rho-like interactions ( must be < 1) - Default = 0.75.
1131 // three = lower bound of the material indices in which the respective thresholds apply
1132 // fLastMaterial = upper bound of the material indices in which the respective thresholds apply
1133 fprintf(pAliceInp,"MUPHOTON %10.1f%10.1f%10.1f%10.1f%10.1f\n",one,zero,zero,three,fLastMaterial);
1135 else if (iProcessValue[i] == 2) {
1136 fprintf(pAliceInp,"*\n*Muon nuclear interactions without production of secondary hadrons\n");
1137 fprintf(pAliceInp,"*Generated from call: SetProcess('MUNU',2);\n");
1138 // two = full simulation of muon nuclear interactions and production of secondary hadrons
1139 // zero = ratio of longitudinal to transverse virtual photon cross-section - Default = 0.25.
1140 // zero = fraction of rho-like interactions ( must be < 1) - Default = 0.75.
1141 // three = lower bound of the material indices in which the respective thresholds apply
1142 // fLastMaterial = upper bound of the material indices in which the respective thresholds apply
1143 fprintf(pAliceInp,"MUPHOTON %10.1f%10.1f%10.1f%10.1f%10.1f\n",two,zero,zero,three,fLastMaterial);
1145 else if (iProcessValue[i] == 0) {
1146 fprintf(pAliceInp,"*\n*No muon nuclear interaction - no FLUKA card generated\n");
1147 fprintf(pAliceInp,"*Generated from call: SetProcess('MUNU',0)\n");
1150 fprintf(pAliceInp,"*\n*Illegal flag value in SetProcess('MUNU',?) call.\n");
1151 fprintf(pAliceInp,"*No FLUKA card generated\n");
1153 } // end of else if (strncmp(&sProcessFlag[i][0],"MUNU",4) == 0)
1157 // G3 default value: 0
1162 // gMC ->SetProcess("PFIS",0); // PHOTONUC -1. 0. 0. 3. lastmat 0.
1163 // flag = 0 no photon fission
1164 // flag = 1 photon fission, secondaries processed
1165 // flag = 2 photon fission, no secondaries stored
1166 else if (strncmp(&sProcessFlag[i][0],"PFIS",4) == 0) {
1167 if (iProcessValue[i] == 0) {
1168 fprintf(pAliceInp,"*\n*No photonuclear interactions\n");
1169 fprintf(pAliceInp,"*Generated from call: SetProcess('PFIS',0);\n");
1170 // - one = no photonuclear interactions
1173 // three = lower bound of the material indices in which the respective thresholds apply
1174 // fLastMaterial = upper bound of the material indices in which the respective thresholds apply
1175 fprintf(pAliceInp,"PHOTONUC %10.1f%10.1f%10.1f%10.1f%10.1f\n",-one,zero,zero,three,fLastMaterial);
1177 else if (iProcessValue[i] == 1) {
1178 fprintf(pAliceInp,"*\n*Photon nuclear interactions are activated at all energies\n");
1179 fprintf(pAliceInp,"*Generated from call: SetProcess('PFIS',1);\n");
1180 // one = photonuclear interactions are activated at all energies
1183 // three = lower bound of the material indices in which the respective thresholds apply
1184 // fLastMaterial = upper bound of the material indices in which the respective thresholds apply
1185 fprintf(pAliceInp,"PHOTONUC %10.1f%10.1f%10.1f%10.1f%10.1f\n",one,zero,zero,three,fLastMaterial);
1187 else if (iProcessValue[i] == 0) {
1188 fprintf(pAliceInp,"*\n*No photofission - no FLUKA card generated\n");
1189 fprintf(pAliceInp,"*Generated from call: SetProcess('PFIS',0)\n");
1192 fprintf(pAliceInp,"*\n*Illegal flag value in SetProcess('PFIS',?) call.\n");
1193 fprintf(pAliceInp,"*No FLUKA card generated\n");
1198 // photo electric effect
1199 // G3 default value: 1
1200 // G4 processes: G4PhotoElectricEffect
1201 // G4LowEnergyPhotoElectric
1204 // flag = 0 no photo electric effect
1205 // flag = 1 photo electric effect, electron processed
1206 // flag = 2 photo electric effect, no electron stored
1207 // gMC ->SetProcess("PHOT",1); // EMFCUT 0. -1. 0. 3. lastmat 0. PHOT-THR
1208 else if (strncmp(&sProcessFlag[i][0],"PHOT",4) == 0) {
1209 if (iProcessValue[i] == 1 || iProcessValue[i] == 2) {
1210 fprintf(pAliceInp,"*\n*Photo electric effect is activated\n");
1211 fprintf(pAliceInp,"*Generated from call: SetProcess('PHOT',1);\n");
1213 // - one = resets to default=0.
1215 // three = lower bound of the material indices in which the respective thresholds apply
1216 // fLastMaterial = upper bound of the material indices in which the respective thresholds apply
1217 // one = step length in assigning indices
1219 fprintf(pAliceInp,"EMFCUT %10.1f%10.1f%10.1f%10.1f%10.1f%10.1fPHOT-THR\n",zero,-one,zero,three,fLastMaterial,one);
1221 else if (iProcessValue[i] == 0) {
1222 fprintf(pAliceInp,"*\n*No photo electric effect - no FLUKA card generated\n");
1223 fprintf(pAliceInp,"*Generated from call: SetProcess('PHOT',0)\n");
1226 fprintf(pAliceInp,"*\n*Illegal flag value in SetProcess('PHOT',?) call.\n");
1227 fprintf(pAliceInp,"*No FLUKA card generated\n");
1229 } // else if (strncmp(&sProcessFlag[i][0],"PHOT",4) == 0)
1232 // Rayleigh scattering
1233 // G3 default value: 0
1234 // G4 process: G4OpRayleigh
1236 // Particles: optical photon
1238 // flag = 0 Rayleigh scattering off
1239 // flag = 1 Rayleigh scattering on
1240 //xx gMC ->SetProcess("RAYL",1);
1241 else if (strncmp(&sProcessFlag[i][0],"RAYL",4) == 0) {
1242 if (iProcessValue[i] == 1) {
1243 fprintf(pAliceInp,"*\n*Rayleigh scattering is ON by default in FLUKA\n");
1244 fprintf(pAliceInp,"*No FLUKA card generated\n");
1246 else if (iProcessValue[i] == 0) {
1247 fprintf(pAliceInp,"*\n*Rayleigh scattering is set OFF\n");
1248 fprintf(pAliceInp,"*Generated from call: SetProcess('RAYL',0);\n");
1249 // - one = no Rayleigh scattering and no binding corrections for Compton
1250 // three = lower bound of the material indices in which the respective thresholds apply
1251 // fLastMaterial = upper bound of the material indices in which the respective thresholds apply
1252 fprintf(pAliceInp,"EMFRAY %10.1f%10.1f%10.1f%10.1f\n",-one,three,three,fLastMaterial);
1255 fprintf(pAliceInp,"*\n*Illegal flag value in SetProcess('RAYL',?) call.\n");
1256 fprintf(pAliceInp,"*No FLUKA card generated\n");
1258 } // end of else if (strncmp(&sProcessFlag[i][0],"RAYL",4) == 0)
1261 // synchrotron radiation in magnetic field
1262 // G3 default value: 0
1263 // G4 process: G4SynchrotronRadiation
1267 // flag = 0 no synchrotron radiation
1268 // flag = 1 synchrotron radiation
1269 //xx gMC ->SetProcess("SYNC",1); // synchrotron radiation generation
1270 else if (strncmp(&sProcessFlag[i][0],"SYNC",4) == 0) {
1271 fprintf(pAliceInp,"*\n*Synchrotron radiation generation is NOT implemented in FLUKA\n");
1272 fprintf(pAliceInp,"*No FLUKA card generated\n");
1276 // Automatic calculation of tracking medium parameters
1277 // flag = 0 no automatic calculation
1278 // flag = 1 automatic calculation
1279 //xx gMC ->SetProcess("AUTO",1); // ??? automatic computation of the tracking medium parameters
1280 else if (strncmp(&sProcessFlag[i][0],"AUTO",4) == 0) {
1281 fprintf(pAliceInp,"*\n*Automatic calculation of tracking medium parameters is always ON in FLUKA\n");
1282 fprintf(pAliceInp,"*No FLUKA card generated\n");
1286 // To control energy loss fluctuation model
1287 // flag = 0 Urban model
1288 // flag = 1 PAI model
1289 // flag = 2 PAI+ASHO model (not active at the moment)
1290 //xx gMC ->SetProcess("STRA",1); // ??? energy fluctuation model
1291 else if (strncmp(&sProcessFlag[i][0],"STRA",4) == 0) {
1292 if (iProcessValue[i] == 0 || iProcessValue[i] == 2 || iProcessValue[i] == 3) {
1293 fprintf(pAliceInp,"*\n*Ionization energy losses calculation is activated\n");
1294 fprintf(pAliceInp,"*Generated from call: SetProcess('STRA',n);, n=0,1,2\n");
1295 // one = restricted energy loss fluctuations (for hadrons and muons) switched on
1296 // one = restricted energy loss fluctuations (for e+ and e-) switched on
1297 // one = minimal accuracy
1298 // three = lower bound of the material indices in which the respective thresholds apply
1299 // fLastMaterial = upper bound of the material indices in which the respective thresholds apply
1300 fprintf(pAliceInp,"IONFLUCT %10.1f%10.1f%10.1f%10.1f%10.1f\n",one,one,one,three,fLastMaterial);
1303 fprintf(pAliceInp,"*\n*Illegal flag value in SetProcess('STRA',?) call.\n");
1304 fprintf(pAliceInp,"*No FLUKA card generated\n");
1306 } // else if (strncmp(&sProcessFlag[i][0],"STRA",4) == 0)
1311 else { // processes not yet treated
1313 // light photon absorption (Cerenkov photons)
1314 // it is turned on when Cerenkov process is turned on
1315 // G3 default value: 0
1316 // G4 process: G4OpAbsorption, G4OpBoundaryProcess
1318 // Particles: optical photon
1320 // flag = 0 no absorption of Cerenkov photons
1321 // flag = 1 absorption of Cerenkov photons
1322 // gMC ->SetProcess("LABS",2); // ??? Cerenkov light absorption
1326 cout << "SetProcess for flag=" << &sProcessFlag[i][0] << " value=" << iProcessValue[i] << " not yet implemented!" << endl;
1328 } //end of loop number of SetProcess calls
1331 // Loop over number of SetCut calls
1332 for (Int_t i=0; i<iNbOfCut; i++) {
1334 // cuts used in SetProcess calls
1335 if (strncmp(&sCutFlag[i][0],"BCUTM",5) == 0) continue;
1336 else if (strncmp(&sCutFlag[i][0],"BCUTE",5) == 0) continue;
1337 else if (strncmp(&sCutFlag[i][0],"DCUTM",5) == 0) continue;
1338 else if (strncmp(&sCutFlag[i][0],"PPCUTM",6) == 0) continue;
1341 // G4 particles: "gamma"
1342 // G3 default value: 0.001 GeV
1343 //gMC ->SetCut("CUTGAM",cut); // cut for gammas
1344 else if (strncmp(&sCutFlag[i][0],"CUTGAM",6) == 0) {
1345 fprintf(pAliceInp,"*\n*Cut for gamma\n");
1346 fprintf(pAliceInp,"*Generated from call: SetCut('CUTGAM',cut);\n");
1348 // 7.0 = lower bound of the particle id-numbers to which the cut-off
1349 fprintf(pAliceInp,"PART-THR %10.4g%10.1f\n",-fCutValue[i],7.0);
1353 // G4 particles: "e-"
1355 // G3 default value: 0.001 GeV
1356 //gMC ->SetCut("CUTELE",cut); // cut for e+,e-
1357 else if (strncmp(&sCutFlag[i][0],"CUTELE",6) == 0) {
1358 fprintf(pAliceInp,"*\n*Cut for electrons\n");
1359 fprintf(pAliceInp,"*Generated from call: SetCut('CUTELE',cut);\n");
1361 // three = lower bound of the particle id-numbers to which the cut-off
1362 // 4.0 = upper bound of the particle id-numbers to which the cut-off
1363 // one = step length in assigning numbers
1364 fprintf(pAliceInp,"PART-THR %10.4g%10.1f%10.1f%10.1f\n",-fCutValue[i],three,4.0,one);
1368 // G4 particles: of type "baryon", "meson", "nucleus" with zero charge
1369 // G3 default value: 0.01 GeV
1370 //gMC ->SetCut("CUTNEU",cut); // cut for neutral hadrons
1371 else if (strncmp(&sCutFlag[i][0],"CUTNEU",6) == 0) {
1372 fprintf(pAliceInp,"*\n*Cut for neutral hadrons\n");
1373 fprintf(pAliceInp,"*Generated from call: SetCut('CUTNEU',cut);\n");
1376 // 9.0 = Antineutron
1377 fprintf(pAliceInp,"PART-THR %10.4g%10.1f%10.1f\n",-fCutValue[i],8.0,9.0);
1379 // 12.0 = Kaon zero long
1380 // 12.0 = Kaon zero long
1381 fprintf(pAliceInp,"PART-THR %10.4g%10.1f%10.1f\n",-fCutValue[i],12.0,12.0);
1383 // 17.0 = Lambda, 18.0 = Antilambda
1384 // 19.0 = Kaon zero short
1385 fprintf(pAliceInp,"PART-THR %10.4g%10.1f%10.1f\n",-fCutValue[i],17.0,19.0);
1387 // 22.0 = Sigma zero, Pion zero, Kaon zero
1388 // 25.0 = Antikaon zero
1389 fprintf(pAliceInp,"PART-THR %10.4g%10.1f%10.1f\n",-fCutValue[i],22.0,25.0);
1391 // 32.0 = Antisigma zero
1392 // 32.0 = Antisigma zero
1393 fprintf(pAliceInp,"PART-THR %10.4g%10.1f%10.1f\n",-fCutValue[i],32.0,32.0);
1396 // 35.0 = AntiXi zero
1397 fprintf(pAliceInp,"PART-THR %10.4g%10.1f%10.1f\n",-fCutValue[i],34.0,35.0);
1400 // 48.0 = AntiD zero
1401 fprintf(pAliceInp,"PART-THR %10.4g%10.1f%10.1f\n",-fCutValue[i],47.0,48.0);
1405 fprintf(pAliceInp,"PART-THR %10.4g%10.1f%10.1f\n",-fCutValue[i],53.0,53.0);
1407 // 55.0 = Xi'_c zero
1408 // 56.0 = Omega_c zero
1409 fprintf(pAliceInp,"PART-THR %10.4g%10.1f%10.1f\n",-fCutValue[i],55.0,56.0);
1411 // 59.0 = AntiXi_c zero
1412 // 59.0 = AntiXi_c zero
1413 fprintf(pAliceInp,"PART-THR %10.4g%10.1f%10.1f\n",-fCutValue[i],59.0,59.0);
1415 // 61.0 = AntiXi'_c zero
1416 // 62.0 = AntiOmega_c zero
1417 fprintf(pAliceInp,"PART-THR %10.4g%10.1f%10.1f\n",-fCutValue[i],61.0,62.0);
1421 // G4 particles: of type "baryon", "meson", "nucleus" with non-zero charge
1422 // G3 default value: 0.01 GeV
1423 //gMC ->SetCut("CUTHAD",cut); // cut for charged hadrons
1424 else if (strncmp(&sCutFlag[i][0],"CUTHAD",6) == 0) {
1425 fprintf(pAliceInp,"*\n*Cut for charged hadrons\n");
1426 fprintf(pAliceInp,"*Generated from call: SetCut('CUTHAD',cut);\n");
1430 fprintf(pAliceInp,"PART-THR %10.4g%10.1f%10.1f\n",-fCutValue[i],1.0,2.0);
1432 // 13.0 = Positive Pion, Negative Pion, Positive Kaon
1433 // 16.0 = Negative Kaon
1434 fprintf(pAliceInp,"PART-THR %10.4g%10.1f%10.1f\n",-fCutValue[i],13.0,16.0);
1436 // 20.0 = Negative Sigma
1437 // 21.0 = Positive Sigma
1438 fprintf(pAliceInp,"PART-THR %10.4g%10.1f%10.1f\n",-fCutValue[i],20.0,21.0);
1440 // 31.0 = Antisigma minus
1441 // 33.0 = Antisigma plus
1442 // 2.0 = step length
1443 fprintf(pAliceInp,"PART-THR %10.4g%10.1f%10.1f%10.1f\n",-fCutValue[i],31.0,33.0,2.0);
1445 // 36.0 = Negative Xi, Positive Xi, Omega minus
1447 fprintf(pAliceInp,"PART-THR %10.4g%10.1f%10.1f\n",-fCutValue[i],36.0,39.0);
1451 fprintf(pAliceInp,"PART-THR %10.4g%10.1f%10.1f\n",-fCutValue[i],45.0,46.0);
1453 // 49.0 = D_s plus, D_s minus, Lambda_c plus
1455 fprintf(pAliceInp,"PART-THR %10.4g%10.1f%10.1f\n",-fCutValue[i],49.0,52.0);
1457 // 54.0 = Xi'_c plus
1458 // 60.0 = AntiXi'_c minus
1459 // 6.0 = step length
1460 fprintf(pAliceInp,"PART-THR %10.4g%10.1f%10.1f%10.1f\n",-fCutValue[i],54.0,60.0,6.0);
1462 // 57.0 = Antilambda_c minus
1463 // 58.0 = AntiXi_c minus
1464 fprintf(pAliceInp,"PART-THR %10.4g%10.1f%10.1f\n",-fCutValue[i],57.0,58.0);
1468 // G4 particles: "mu+", "mu-"
1469 // G3 default value: 0.01 GeV
1470 //gMC ->SetCut("CUTMUO",cut); // cut for mu+, mu-
1471 else if (strncmp(&sCutFlag[i][0],"CUTMUO",6) == 0) {
1472 fprintf(pAliceInp,"*\n*Cut for muons\n");
1473 fprintf(pAliceInp,"*Generated from call: SetCut('CUTMUO',cut);\n");
1476 fprintf(pAliceInp,"PART-THR %10.4g%10.1f%10.1f\n",-fCutValue[i],10.0,11.0);
1479 // delta-rays by electrons
1480 // G4 particles: "e-"
1481 // G3 default value: 10**4 GeV
1482 // gMC ->SetCut("DCUTE",cut); // cut for deltarays by electrons ???????????????
1483 else if (strncmp(&sCutFlag[i][0],"DCUTE",5) == 0) {
1484 fprintf(pAliceInp,"*\n*Cut for delta rays by electrons ????????????\n");
1485 fprintf(pAliceInp,"*Generated from call: SetCut('DCUTE',cut);\n");
1489 // three = lower bound of the material indices in which the respective thresholds apply
1490 // fLastMaterial = upper bound of the material indices in which the respective thresholds apply
1491 fprintf(pAliceInp,"EMFCUT %10.4g%10.1f%10.1f%10.1f%10.1f\n",-fCutValue[i],zero,zero,three,fLastMaterial);
1495 // time of flight cut in seconds
1496 // G4 particles: all
1497 // G3 default value: 0.01 GeV
1498 //gMC ->SetCut("TOFMAX",tofmax); // time of flight cuts in seconds
1499 else if (strncmp(&sCutFlag[i][0],"TOFMAX",6) == 0) {
1500 fprintf(pAliceInp,"*\n*Time of flight cuts in seconds\n");
1501 fprintf(pAliceInp,"*Generated from call: SetCut('TOFMAX',tofmax);\n");
1504 // -6.0 = lower bound of the particle numbers for which the transport time cut-off and/or the start signal is to be applied
1505 // 64.0 = upper bound of the particle numbers for which the transport time cut-off and/or the start signal is to be applied
1506 fprintf(pAliceInp,"TIME-CUT %10.4g%10.1f%10.1f%10.1f%10.1f\n",fCutValue[i]*1.e9,zero,zero,-6.0,64.0);
1510 cout << "SetCut for flag=" << &sCutFlag[i][0] << " value=" << fCutValue[i] << " not yet implemented!" << endl;
1512 } //end of loop over SetCut calls
1514 // Add START and STOP card
1515 fprintf(pAliceInp,"START %10.1f\n",fEventsPerRun);
1516 fprintf(pAliceInp,"STOP \n");
1518 } // end of InitPhysics
1521 void TFluka::SetMaxStep(Double_t)
1523 // SetMaxStep is dummy procedure in TFluka !
1524 if (fVerbosityLevel >=3)
1525 cout << "SetMaxStep is dummy procedure in TFluka !" << endl;
1528 void TFluka::SetMaxNStep(Int_t)
1530 // SetMaxNStep is dummy procedure in TFluka !
1531 if (fVerbosityLevel >=3)
1532 cout << "SetMaxNStep is dummy procedure in TFluka !" << endl;
1535 void TFluka::SetUserDecay(Int_t)
1537 // SetUserDecay is dummy procedure in TFluka !
1538 if (fVerbosityLevel >=3)
1539 cout << "SetUserDecay is dummy procedure in TFluka !" << endl;
1543 // dynamic properties
1545 void TFluka::TrackPosition(TLorentzVector& position) const
1547 // Return the current position in the master reference frame of the
1548 // track being transported
1549 // TRACKR.atrack = age of the particle
1550 // TRACKR.xtrack = x-position of the last point
1551 // TRACKR.ytrack = y-position of the last point
1552 // TRACKR.ztrack = z-position of the last point
1553 Int_t caller = GetCaller();
1554 if (caller == 3 || caller == 6 || caller == 11 || caller == 12) { //bxdraw,endraw,usdraw
1555 position.SetX(GetXsco());
1556 position.SetY(GetYsco());
1557 position.SetZ(GetZsco());
1558 position.SetT(TRACKR.atrack);
1560 else if (caller == 4) { // mgdraw
1561 position.SetX(TRACKR.xtrack[TRACKR.ntrack]);
1562 position.SetY(TRACKR.ytrack[TRACKR.ntrack]);
1563 position.SetZ(TRACKR.ztrack[TRACKR.ntrack]);
1564 position.SetT(TRACKR.atrack);
1566 else if (caller == 5) { // sodraw
1567 position.SetX(TRACKR.xtrack[TRACKR.ntrack]);
1568 position.SetY(TRACKR.ytrack[TRACKR.ntrack]);
1569 position.SetZ(TRACKR.ztrack[TRACKR.ntrack]);
1573 Warning("TrackPosition","position not available");
1577 void TFluka::TrackPosition(Double_t& x, Double_t& y, Double_t& z) const
1579 // Return the current position in the master reference frame of the
1580 // track being transported
1581 // TRACKR.atrack = age of the particle
1582 // TRACKR.xtrack = x-position of the last point
1583 // TRACKR.ytrack = y-position of the last point
1584 // TRACKR.ztrack = z-position of the last point
1585 Int_t caller = GetCaller();
1586 if (caller == 3 || caller == 6 || caller == 11 || caller == 12) { //bxdraw,endraw,usdraw
1591 else if (caller == 4 || caller == 5) { // mgdraw, sodraw
1592 x = TRACKR.xtrack[TRACKR.ntrack];
1593 y = TRACKR.ytrack[TRACKR.ntrack];
1594 z = TRACKR.ztrack[TRACKR.ntrack];
1597 Warning("TrackPosition","position not available");
1600 void TFluka::TrackMomentum(TLorentzVector& momentum) const
1602 // Return the direction and the momentum (GeV/c) of the track
1603 // currently being transported
1604 // TRACKR.ptrack = momentum of the particle (not always defined, if
1605 // < 0 must be obtained from etrack)
1606 // TRACKR.cx,y,ztrck = direction cosines of the current particle
1607 // TRACKR.etrack = total energy of the particle
1608 // TRACKR.jtrack = identity number of the particle
1609 // PAPROP.am[TRACKR.jtrack] = particle mass in gev
1610 Int_t caller = GetCaller();
1611 if (caller != 2) { // not eedraw
1612 if (TRACKR.ptrack >= 0) {
1613 momentum.SetPx(TRACKR.ptrack*TRACKR.cxtrck);
1614 momentum.SetPy(TRACKR.ptrack*TRACKR.cytrck);
1615 momentum.SetPz(TRACKR.ptrack*TRACKR.cztrck);
1616 momentum.SetE(TRACKR.etrack);
1620 Double_t p = sqrt(TRACKR.etrack*TRACKR.etrack - PAPROP.am[TRACKR.jtrack+6]*PAPROP.am[TRACKR.jtrack+6]);
1621 momentum.SetPx(p*TRACKR.cxtrck);
1622 momentum.SetPy(p*TRACKR.cytrck);
1623 momentum.SetPz(p*TRACKR.cztrck);
1624 momentum.SetE(TRACKR.etrack);
1629 Warning("TrackMomentum","momentum not available");
1632 void TFluka::TrackMomentum(Double_t& px, Double_t& py, Double_t& pz, Double_t& e) const
1634 // Return the direction and the momentum (GeV/c) of the track
1635 // currently being transported
1636 // TRACKR.ptrack = momentum of the particle (not always defined, if
1637 // < 0 must be obtained from etrack)
1638 // TRACKR.cx,y,ztrck = direction cosines of the current particle
1639 // TRACKR.etrack = total energy of the particle
1640 // TRACKR.jtrack = identity number of the particle
1641 // PAPROP.am[TRACKR.jtrack] = particle mass in gev
1642 Int_t caller = GetCaller();
1643 if (caller != 2) { // not eedraw
1644 if (TRACKR.ptrack >= 0) {
1645 px = TRACKR.ptrack*TRACKR.cxtrck;
1646 py = TRACKR.ptrack*TRACKR.cytrck;
1647 pz = TRACKR.ptrack*TRACKR.cztrck;
1652 Double_t p = sqrt(TRACKR.etrack*TRACKR.etrack - PAPROP.am[TRACKR.jtrack+6]*PAPROP.am[TRACKR.jtrack+6]);
1653 px = p*TRACKR.cxtrck;
1654 py = p*TRACKR.cytrck;
1655 pz = p*TRACKR.cztrck;
1661 Warning("TrackMomentum","momentum not available");
1664 Double_t TFluka::TrackStep() const
1666 // Return the length in centimeters of the current step
1667 // TRACKR.ctrack = total curved path
1668 Int_t caller = GetCaller();
1669 if (caller == 11 || caller==12 || caller == 3 || caller == 6) //bxdraw,endraw,usdraw
1671 else if (caller == 4) //mgdraw
1672 return TRACKR.ctrack;
1677 Double_t TFluka::TrackLength() const
1679 // TRACKR.cmtrck = cumulative curved path since particle birth
1680 Int_t caller = GetCaller();
1681 if (caller == 11 || caller==12 || caller == 3 || caller == 4 || caller == 6) //bxdraw,endraw,mgdraw,usdraw
1682 return TRACKR.cmtrck;
1687 Double_t TFluka::TrackTime() const
1689 // Return the current time of flight of the track being transported
1690 // TRACKR.atrack = age of the particle
1691 Int_t caller = GetCaller();
1692 if (caller == 11 || caller==12 || caller == 3 || caller == 4 || caller == 6) //bxdraw,endraw,mgdraw,usdraw
1693 return TRACKR.atrack;
1698 Double_t TFluka::Edep() const
1700 // Energy deposition
1701 // if TRACKR.ntrack = 0, TRACKR.mtrack = 0:
1702 // -->local energy deposition (the value and the point are not recorded in TRACKR)
1703 // but in the variable "rull" of the procedure "endraw.cxx"
1704 // if TRACKR.ntrack > 0, TRACKR.mtrack = 0:
1705 // -->no energy loss along the track
1706 // if TRACKR.ntrack > 0, TRACKR.mtrack > 0:
1707 // -->energy loss distributed along the track
1708 // TRACKR.dtrack = energy deposition of the jth deposition even
1710 // If coming from bxdraw we have 2 steps of 0 length and 0 edep
1711 Int_t caller = GetCaller();
1712 if (caller == 11 || caller==12) return 0.0;
1714 for ( Int_t j=0;j<TRACKR.mtrack;j++) {
1715 sum +=TRACKR.dtrack[j];
1717 if (TRACKR.ntrack == 0 && TRACKR.mtrack == 0)
1724 Int_t TFluka::TrackPid() const
1726 // Return the id of the particle transported
1727 // TRACKR.jtrack = identity number of the particle
1728 Int_t caller = GetCaller();
1729 if (caller != 2) // not eedraw
1730 return PDGFromId(TRACKR.jtrack);
1735 Double_t TFluka::TrackCharge() const
1737 // Return charge of the track currently transported
1738 // PAPROP.ichrge = electric charge of the particle
1739 // TRACKR.jtrack = identity number of the particle
1740 Int_t caller = GetCaller();
1741 if (caller != 2) // not eedraw
1742 return PAPROP.ichrge[TRACKR.jtrack+6];
1747 Double_t TFluka::TrackMass() const
1749 // PAPROP.am = particle mass in GeV
1750 // TRACKR.jtrack = identity number of the particle
1751 Int_t caller = GetCaller();
1752 if (caller != 2) { // not eedraw
1753 // cout << "JTRACK=" << TRACKR.jtrack << " mass=" << PAPROP.am[TRACKR.jtrack+6] << endl;
1754 return PAPROP.am[TRACKR.jtrack+6];
1760 Double_t TFluka::Etot() const
1762 // TRACKR.etrack = total energy of the particle
1763 Int_t caller = GetCaller();
1764 if (caller != 2) // not eedraw
1765 return TRACKR.etrack;
1773 Bool_t TFluka::IsNewTrack() const
1775 // Return true for the first call of Stepping()
1779 Bool_t TFluka::IsTrackInside() const
1781 // True if the track is not at the boundary of the current volume
1782 // In Fluka a step is always inside one kind of material
1783 // If the step would go behind the region of one material,
1784 // it will be shortened to reach only the boundary.
1785 // Therefore IsTrackInside() is always true.
1786 Int_t caller = GetCaller();
1787 if (caller == 11 || caller==12) // bxdraw
1793 Bool_t TFluka::IsTrackEntering() const
1795 // True if this is the first step of the track in the current volume
1797 Int_t caller = GetCaller();
1798 if (caller == 11) // bxdraw entering
1803 Bool_t TFluka::IsTrackExiting() const
1805 Int_t caller = GetCaller();
1806 if (caller == 12) // bxdraw exiting
1811 Bool_t TFluka::IsTrackOut() const
1813 // True if the track is out of the setup
1815 // Icode = 14: escape - call from Kaskad
1816 // Icode = 23: escape - call from Emfsco
1817 // Icode = 32: escape - call from Kasneu
1818 // Icode = 40: escape - call from Kashea
1819 // Icode = 51: escape - call from Kasoph
1824 fIcode == 51) return 1;
1828 Bool_t TFluka::IsTrackDisappeared() const
1830 // means all inelastic interactions and decays
1831 // fIcode from usdraw
1832 if (fIcode == 101 || // inelastic interaction
1833 fIcode == 102 || // particle decay
1834 fIcode == 214 || // in-flight annihilation
1835 fIcode == 215 || // annihilation at rest
1836 fIcode == 217 || // pair production
1837 fIcode == 221) return 1;
1841 Bool_t TFluka::IsTrackStop() const
1843 // True if the track energy has fallen below the threshold
1844 // means stopped by signal or below energy threshold
1845 // Icode = 12: stopping particle - call from Kaskad
1846 // Icode = 15: time kill - call from Kaskad
1847 // Icode = 21: below threshold, iarg=1 - call from Emfsco
1848 // Icode = 22: below threshold, iarg=2 - call from Emfsco
1849 // Icode = 24: time kill - call from Emfsco
1850 // Icode = 31: below threshold - call from Kasneu
1851 // Icode = 33: time kill - call from Kasneu
1852 // Icode = 41: time kill - call from Kashea
1853 // Icode = 52: time kill - call from Kasoph
1862 fIcode == 52) return 1;
1866 Bool_t TFluka::IsTrackAlive() const
1868 // means not disappeared or not out
1869 if (IsTrackDisappeared() || IsTrackOut() ) return 0;
1877 Int_t TFluka::NSecondaries() const
1878 // Number of secondary particles generated in the current step
1879 // FINUC.np = number of secondaries except light and heavy ions
1880 // FHEAVY.npheav = number of secondaries for light and heavy secondary ions
1882 Int_t caller = GetCaller();
1883 if (caller == 6) // valid only after usdraw
1884 return FINUC.np + FHEAVY.npheav;
1887 } // end of NSecondaries
1889 void TFluka::GetSecondary(Int_t isec, Int_t& particleId,
1890 TLorentzVector& position, TLorentzVector& momentum)
1892 Int_t caller = GetCaller();
1893 if (caller == 6) { // valid only after usdraw
1894 if (isec >= 0 && isec < FINUC.np) {
1895 particleId = PDGFromId(FINUC.kpart[isec]);
1896 position.SetX(fXsco);
1897 position.SetY(fYsco);
1898 position.SetZ(fZsco);
1899 position.SetT(TRACKR.atrack);
1900 momentum.SetPx(FINUC.plr[isec]*FINUC.cxr[isec]);
1901 momentum.SetPy(FINUC.plr[isec]*FINUC.cyr[isec]);
1902 momentum.SetPz(FINUC.plr[isec]*FINUC.czr[isec]);
1903 momentum.SetE(FINUC.tki[isec] + PAPROP.am[FINUC.kpart[isec]+6]);
1905 else if (isec >= FINUC.np && isec < FINUC.np + FHEAVY.npheav) {
1906 Int_t jsec = isec - FINUC.np;
1907 particleId = FHEAVY.kheavy[jsec]; // this is Fluka id !!!
1908 position.SetX(fXsco);
1909 position.SetY(fYsco);
1910 position.SetZ(fZsco);
1911 position.SetT(TRACKR.atrack);
1912 momentum.SetPx(FHEAVY.pheavy[jsec]*FHEAVY.cxheav[jsec]);
1913 momentum.SetPy(FHEAVY.pheavy[jsec]*FHEAVY.cyheav[jsec]);
1914 momentum.SetPz(FHEAVY.pheavy[jsec]*FHEAVY.czheav[jsec]);
1915 if (FHEAVY.tkheav[jsec] >= 3 && FHEAVY.tkheav[jsec] <= 6)
1916 momentum.SetE(FHEAVY.tkheav[jsec] + PAPROP.am[jsec+6]);
1917 else if (FHEAVY.tkheav[jsec] > 6)
1918 momentum.SetE(FHEAVY.tkheav[jsec] + FHEAVY.amnhea[jsec]); // to be checked !!!
1921 Warning("GetSecondary","isec out of range");
1924 Warning("GetSecondary","no secondaries available");
1925 } // end of GetSecondary
1927 TMCProcess TFluka::ProdProcess(Int_t) const
1928 // Name of the process that has produced the secondary particles
1929 // in the current step
1931 const TMCProcess kIpNoProc = kPNoProcess;
1932 const TMCProcess kIpPDecay = kPDecay;
1933 const TMCProcess kIpPPair = kPPair;
1934 // const TMCProcess kIpPPairFromPhoton = kPPairFromPhoton;
1935 // const TMCProcess kIpPPairFromVirtualPhoton = kPPairFromVirtualPhoton;
1936 const TMCProcess kIpPCompton = kPCompton;
1937 const TMCProcess kIpPPhotoelectric = kPPhotoelectric;
1938 const TMCProcess kIpPBrem = kPBrem;
1939 // const TMCProcess kIpPBremFromHeavy = kPBremFromHeavy;
1940 // const TMCProcess kIpPBremFromElectronOrPositron = kPBremFromElectronOrPositron;
1941 const TMCProcess kIpPDeltaRay = kPDeltaRay;
1942 // const TMCProcess kIpPMoller = kPMoller;
1943 // const TMCProcess kIpPBhabha = kPBhabha;
1944 const TMCProcess kIpPAnnihilation = kPAnnihilation;
1945 // const TMCProcess kIpPAnnihilInFlight = kPAnnihilInFlight;
1946 // const TMCProcess kIpPAnnihilAtRest = kPAnnihilAtRest;
1947 const TMCProcess kIpPHadronic = kPHadronic;
1948 const TMCProcess kIpPMuonNuclear = kPMuonNuclear;
1949 const TMCProcess kIpPPhotoFission = kPPhotoFission;
1950 const TMCProcess kIpPRayleigh = kPRayleigh;
1951 // const TMCProcess kIpPCerenkov = kPCerenkov;
1952 // const TMCProcess kIpPSynchrotron = kPSynchrotron;
1954 Int_t mugamma = TRACKR.jtrack == 7 || TRACKR.jtrack == 10 || TRACKR.jtrack == 11;
1955 if (fIcode == 102) return kIpPDecay;
1956 else if (fIcode == 104 || fIcode == 217) return kIpPPair;
1957 // else if (fIcode == 104) return kIpPairFromPhoton;
1958 // else if (fIcode == 217) return kIpPPairFromVirtualPhoton;
1959 else if (fIcode == 219) return kIpPCompton;
1960 else if (fIcode == 221) return kIpPPhotoelectric;
1961 else if (fIcode == 105 || fIcode == 208) return kIpPBrem;
1962 // else if (fIcode == 105) return kIpPBremFromHeavy;
1963 // else if (fIcode == 208) return kPBremFromElectronOrPositron;
1964 else if (fIcode == 103 || fIcode == 400) return kIpPDeltaRay;
1965 else if (fIcode == 210 || fIcode == 212) return kIpPDeltaRay;
1966 // else if (fIcode == 210) return kIpPMoller;
1967 // else if (fIcode == 212) return kIpPBhabha;
1968 else if (fIcode == 214 || fIcode == 215) return kIpPAnnihilation;
1969 // else if (fIcode == 214) return kIpPAnnihilInFlight;
1970 // else if (fIcode == 215) return kIpPAnnihilAtRest;
1971 else if (fIcode == 101) return kIpPHadronic;
1972 else if (fIcode == 101) {
1973 if (!mugamma) return kIpPHadronic;
1974 else if (TRACKR.jtrack == 7) return kIpPPhotoFission;
1975 else return kIpPMuonNuclear;
1977 else if (fIcode == 225) return kIpPRayleigh;
1978 // Fluka codes 100, 300 and 400 still to be investigasted
1979 else return kIpNoProc;
1982 //Int_t StepProcesses(TArrayI &proc) const
1983 // Return processes active in the current step
1985 //ck = total energy of the particl ????????????????
1989 Int_t TFluka::VolId2Mate(Int_t id) const
1992 // Returns the material number for a given volume ID
1994 if (fVerbosityLevel >= 3)
1995 printf("VolId2Mate %d %d\n", id, fMediaByRegion[id-1]);
1996 return fMediaByRegion[id-1];
1999 const char* TFluka::VolName(Int_t id) const
2002 // Returns the volume name for a given volume ID
2004 FlukaVolume* vol = dynamic_cast<FlukaVolume*>((*fVolumeMediaMap)[id-1]);
2005 const char* name = vol->GetName();
2006 if (fVerbosityLevel >= 3)
2007 printf("VolName %d %s \n", id, name);
2011 Int_t TFluka::VolId(const Text_t* volName) const
2014 // Converts from volume name to volume ID.
2015 // Time consuming. (Only used during set-up)
2016 // Could be replaced by hash-table
2020 for (i = 0; i < fNVolumes; i++)
2022 FlukaVolume* vol = dynamic_cast<FlukaVolume*>((*fVolumeMediaMap)[i]);
2023 TString name = vol->GetName();
2024 strcpy(tmp, name.Data());
2026 if (!strcmp(tmp, volName)) break;
2034 Int_t TFluka::CurrentVolID(Int_t& copyNo) const
2037 // Return the logical id and copy number corresponding to the current fluka region
2039 int ir = fCurrentFlukaRegion;
2040 int id = (FGeometryInit::GetInstance())->CurrentVolID(ir, copyNo);
2042 if (fVerbosityLevel >= 3)
2043 printf("CurrentVolID: %d %d %d \n", ir, id, copyNo);
2047 Int_t TFluka::CurrentVolOffID(Int_t off, Int_t& copyNo) const
2050 // Return the logical id and copy number of off'th mother
2051 // corresponding to the current fluka region
2054 return CurrentVolID(copyNo);
2056 int ir = fCurrentFlukaRegion;
2057 int id = (FGeometryInit::GetInstance())->CurrentVolOffID(ir, off, copyNo);
2059 if (fVerbosityLevel >= 3)
2060 printf("CurrentVolOffID: %d %d %d \n", ir, id, copyNo);
2062 if (fVerbosityLevel >= 0)
2063 printf("CurrentVolOffID: Warning Mother not found !!!\n");
2068 const char* TFluka::CurrentVolName() const
2071 // Return the current volume name
2074 Int_t id = TFluka::CurrentVolID(copy);
2075 const char* name = TFluka::VolName(id);
2076 if (fVerbosityLevel >= 3)
2077 printf("CurrentVolumeName: %d %s \n", fCurrentFlukaRegion, name);
2081 const char* TFluka::CurrentVolOffName(Int_t off) const
2084 // Return the volume name of the off'th mother of the current volume
2087 Int_t id = TFluka::CurrentVolOffID(off, copy);
2088 const char* name = TFluka::VolName(id);
2089 if (fVerbosityLevel >= 3)
2090 printf("CurrentVolumeOffName: %d %s \n", fCurrentFlukaRegion, name);
2094 Int_t TFluka::CurrentMaterial(Float_t & /*a*/, Float_t & /*z*/,
2095 Float_t & /*dens*/, Float_t & /*radl*/, Float_t & /*absl*/) const
2098 // Return the current medium number
2101 Int_t id = TFluka::CurrentVolID(copy);
2102 Int_t med = TFluka::VolId2Mate(id);
2103 if (fVerbosityLevel >= 3)
2104 printf("CurrentMaterial: %d %d \n", fCurrentFlukaRegion, med);
2108 void TFluka::Gmtod(Float_t* xm, Float_t* xd, Int_t iflag)
2110 // Transforms a position from the world reference frame
2111 // to the current volume reference frame.
2113 // Geant3 desription:
2114 // ==================
2115 // Computes coordinates XD (in DRS)
2116 // from known coordinates XM in MRS
2117 // The local reference system can be initialized by
2118 // - the tracking routines and GMTOD used in GUSTEP
2119 // - a call to GMEDIA(XM,NUMED)
2120 // - a call to GLVOLU(NLEVEL,NAMES,NUMBER,IER)
2121 // (inverse routine is GDTOM)
2123 // If IFLAG=1 convert coordinates
2124 // IFLAG=2 convert direction cosinus
2127 Double_t xmD[3], xdD[3];
2128 xmD[0] = xm[0]; xmD[1] = xm[1]; xmD[2] = xm[2];
2129 (FGeometryInit::GetInstance())->Gmtod(xmD, xdD, iflag);
2130 xd[0] = xdD[0]; xd[1] = xdD[1]; xd[2] = xdD[2];
2134 void TFluka::Gmtod(Double_t* xm, Double_t* xd, Int_t iflag)
2136 // Transforms a position from the world reference frame
2137 // to the current volume reference frame.
2139 // Geant3 desription:
2140 // ==================
2141 // Computes coordinates XD (in DRS)
2142 // from known coordinates XM in MRS
2143 // The local reference system can be initialized by
2144 // - the tracking routines and GMTOD used in GUSTEP
2145 // - a call to GMEDIA(XM,NUMED)
2146 // - a call to GLVOLU(NLEVEL,NAMES,NUMBER,IER)
2147 // (inverse routine is GDTOM)
2149 // If IFLAG=1 convert coordinates
2150 // IFLAG=2 convert direction cosinus
2153 (FGeometryInit::GetInstance())->Gmtod(xm, xd, iflag);
2156 void TFluka::Gdtom(Float_t* xd, Float_t* xm, Int_t iflag)
2158 // Transforms a position from the current volume reference frame
2159 // to the world reference frame.
2161 // Geant3 desription:
2162 // ==================
2163 // Computes coordinates XM (Master Reference System
2164 // knowing the coordinates XD (Detector Ref System)
2165 // The local reference system can be initialized by
2166 // - the tracking routines and GDTOM used in GUSTEP
2167 // - a call to GSCMED(NLEVEL,NAMES,NUMBER)
2168 // (inverse routine is GMTOD)
2170 // If IFLAG=1 convert coordinates
2171 // IFLAG=2 convert direction cosinus
2174 Double_t xmD[3], xdD[3];
2175 xdD[0] = xd[0]; xdD[1] = xd[1]; xdD[2] = xd[2];
2176 (FGeometryInit::GetInstance())->Gdtom(xdD, xmD, iflag);
2177 xm[0] = xmD[0]; xm[1] = xmD[1]; xm[2] = xmD[2];
2179 void TFluka::Gdtom(Double_t* xd, Double_t* xm, Int_t iflag)
2181 // Transforms a position from the current volume reference frame
2182 // to the world reference frame.
2184 // Geant3 desription:
2185 // ==================
2186 // Computes coordinates XM (Master Reference System
2187 // knowing the coordinates XD (Detector Ref System)
2188 // The local reference system can be initialized by
2189 // - the tracking routines and GDTOM used in GUSTEP
2190 // - a call to GSCMED(NLEVEL,NAMES,NUMBER)
2191 // (inverse routine is GMTOD)
2193 // If IFLAG=1 convert coordinates
2194 // IFLAG=2 convert direction cosinus
2198 (FGeometryInit::GetInstance())->Gdtom(xd, xm, iflag);
2201 // ===============================================================