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