1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 Revision 1.3 2002/10/22 15:12:14 alibrary
19 Introducing Riostream.h
21 Revision 1.2 2002/10/14 14:57:40 hristov
22 Merging the VirtualMC branch to the main development branch (HEAD)
24 Revision 1.1.2.8 2002/10/08 16:33:17 iglez2
25 LSOUIT is set to true before the second call to flukam.
27 Revision 1.1.2.7 2002/10/08 09:30:37 iglez2
28 Solved stupid missing ;
30 Revision 1.1.2.6 2002/10/07 13:40:22 iglez2
31 First implementations of the PDG <--> Fluka Id conversion routines
33 Revision 1.1.2.5 2002/09/26 16:26:03 iglez2
35 Call to gAlice->Generator()->Generate()
37 Revision 1.1.2.4 2002/09/26 13:22:23 iglez2
38 Naive implementation of ProcessRun and ProcessEvent
39 Opening/Closing of input file (fInputFileName) with FORTRAN unit 5 before/after the first call to flukam inside Init()
41 Revision 1.1.2.3 2002/09/20 15:35:51 iglez2
42 Modification of LFDRTR. Value is passed to FLUKA !!!
44 Revision 1.1.2.2 2002/09/18 14:34:44 iglez2
45 Revised version with all pure virtual methods implemented
47 Revision 1.1.2.1 2002/07/24 08:49:41 alibrary
48 Adding TFluka to VirtualMC
50 Revision 1.1 2002/07/05 13:10:07 morsch
51 First commit of Fluka interface.
55 #include <Riostream.h>
58 #include "TCallf77.h" //For the fortran calls
59 #include "Fdblprc.h" //(DBLPRC) fluka common
60 #include "Fiounit.h" //(IOUNIT) fluka common
61 #include "Fepisor.h" //(EPISOR) fluka common
62 #include "Fpart.h" //(PART) fluka common
63 #include "TVirtualMC.h"
65 // Fluka methods that may be needed.
67 # define flukam flukam_
68 # define fluka_openinp fluka_openinp_
69 # define fluka_closeinp fluka_closeinp_
70 # define mcihad mcihad_
71 # define mpdgha mpdgha_
73 # define flukam FLUKAM
74 # define fluka_openinp FLUKA_OPENINP
75 # define fluka_closeinp FLUKA_CLOSEINP
76 # define mcihad MCIHAD
77 # define mpdgha MPDGHA
83 // Prototypes for FLUKA functions
85 void type_of_call flukam(const int&);
86 void type_of_call fluka_openinp(const int&, DEFCHARA);
87 void type_of_call fluka_closeinp(const int&);
88 int type_of_call mcihad(const int&);
89 int type_of_call mpdgha(const int&);
93 // Class implementation for ROOT
99 //____________________________________________________________________________
106 // Default constructor
110 //____________________________________________________________________________
111 TFluka::TFluka(const char *title, Int_t verbosity)
112 :TVirtualMC("TFluka",title),
113 fVerbosityLevel(verbosity),
116 if (fVerbosityLevel >=3)
117 cout << "==> TFluka::TFluka(" << title << ") constructor called." << endl;
119 if (fVerbosityLevel >=3)
120 cout << "<== TFluka::TFluka(" << title << ") constructor called." << endl;
123 //____________________________________________________________________________
124 void TFluka::Init() {
125 if (fVerbosityLevel >=3)
126 cout << "==> TFluka::Init() called." << endl;
128 if (fVerbosityLevel >=2)
129 cout << "\t* Changing lfdrtr = (" << (GLOBAL.lfdrtr?'T':'F')
130 << ") in fluka..." << endl;
131 GLOBAL.lfdrtr = true;
133 if (fVerbosityLevel >=2)
134 cout << "\t* Opening file " << fInputFileName << endl;
135 const char* fname = fInputFileName;
136 fluka_openinp(lunin, PASSCHARA(fname));
138 if (fVerbosityLevel >=2)
139 cout << "\t* Calling flukam..." << endl;
142 if (fVerbosityLevel >=2)
143 cout << "\t* Closing file " << fInputFileName << endl;
144 fluka_closeinp(lunin);
146 if (fVerbosityLevel >=3)
147 cout << "<== TFluka::Init() called." << endl;
150 //____________________________________________________________________________
151 void TFluka::ProcessEvent() {
152 if (fVerbosityLevel >=3)
153 cout << "==> TFluka::ProcessEvent() called." << endl;
155 if (fVerbosityLevel >=3)
156 cout << "<== TFluka::ProcessEvent() called." << endl;
159 //____________________________________________________________________________
160 void TFluka::ProcessRun(Int_t nevent) {
161 if (fVerbosityLevel >=3)
162 cout << "==> TFluka::ProcessRun(" << nevent << ") called."
165 if (fVerbosityLevel >=2) {
166 cout << "\t* GLOBAL.fdrtr = " << (GLOBAL.lfdrtr?'T':'F') << endl;
167 cout << "\t* Calling flukam again..." << endl;
169 fApplication->GeneratePrimaries();
170 EPISOR.lsouit = true;
173 if (fVerbosityLevel >=3)
174 cout << "<== TFluka::ProcessRun(" << nevent << ") called."
178 //_____________________________________________________________________________
179 Int_t TFluka::IdFromPDG(Int_t pdg) const
182 // Return Fluka code from PDG and pseudo ENDF code
184 // MCIHAD() goes from pdg to fluka internal.
185 Int_t intfluka = mcihad(pdg);
186 // KPTOIP array goes from internal to official
187 return GetFlukaKPTOIP(intfluka);
190 //_____________________________________________________________________________
191 Int_t TFluka::PDGFromId(Int_t id) const
194 // Return PDG code and pseudo ENDF code from Fluka code
196 //IPTOKP array goes from official to internal
197 Int_t intfluka = GetFlukaIPTOKP(id);
198 //MPKDHA() goes from internal to PDG
199 return mpdgha(intfluka);