]>
Commit | Line | Data |
---|---|---|
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$ | |
b9d0a01d | 18 | Revision 1.1.2.8 2002/10/08 16:33:17 iglez2 |
19 | LSOUIT is set to true before the second call to flukam. | |
20 | ||
21 | Revision 1.1.2.7 2002/10/08 09:30:37 iglez2 | |
22 | Solved stupid missing ; | |
23 | ||
24 | Revision 1.1.2.6 2002/10/07 13:40:22 iglez2 | |
25 | First implementations of the PDG <--> Fluka Id conversion routines | |
26 | ||
27 | Revision 1.1.2.5 2002/09/26 16:26:03 iglez2 | |
28 | Added verbosity | |
29 | Call to gAlice->Generator()->Generate() | |
30 | ||
31 | Revision 1.1.2.4 2002/09/26 13:22:23 iglez2 | |
32 | Naive implementation of ProcessRun and ProcessEvent | |
33 | Opening/Closing of input file (fInputFileName) with FORTRAN unit 5 before/after the first call to flukam inside Init() | |
34 | ||
35 | Revision 1.1.2.3 2002/09/20 15:35:51 iglez2 | |
36 | Modification of LFDRTR. Value is passed to FLUKA !!! | |
37 | ||
38 | Revision 1.1.2.2 2002/09/18 14:34:44 iglez2 | |
39 | Revised version with all pure virtual methods implemented | |
40 | ||
41 | Revision 1.1.2.1 2002/07/24 08:49:41 alibrary | |
42 | Adding TFluka to VirtualMC | |
43 | ||
44 | Revision 1.1 2002/07/05 13:10:07 morsch | |
45 | First commit of Fluka interface. | |
46 | ||
03ca248b | 47 | */ |
48 | ||
b9d0a01d | 49 | #include <iostream.h> |
50 | ||
03ca248b | 51 | #include "TFluka.h" |
b9d0a01d | 52 | #include "TCallf77.h" //For the fortran calls |
53 | #include "Fdblprc.h" //(DBLPRC) fluka common | |
54 | #include "Fiounit.h" //(IOUNIT) fluka common | |
55 | #include "Fepisor.h" //(EPISOR) fluka common | |
56 | #include "TVirtualMC.h" | |
57 | ||
58 | // Fluka methods that may be needed. | |
59 | #ifndef WIN32 | |
60 | # define flukam flukam_ | |
61 | # define fluka_openinp fluka_openinp_ | |
62 | # define fluka_closeinp fluka_closeinp_ | |
63 | #else | |
64 | # define flukam FLUKAM | |
65 | # define fluka_openinp FLUKA_OPENINP | |
66 | # define fluka_closeinp FLUKA_CLOSEINP | |
67 | #endif | |
68 | ||
69 | extern "C" | |
70 | { | |
71 | // | |
72 | // Prototypes for FLUKA functions | |
73 | // | |
74 | void type_of_call flukam(const int&); | |
75 | void type_of_call fluka_openinp(const int&, DEFCHARA); | |
76 | void type_of_call fluka_closeinp(const int&); | |
77 | } | |
78 | ||
79 | // | |
80 | // Class implementation for ROOT | |
81 | // | |
03ca248b | 82 | ClassImp(TFluka) |
b9d0a01d | 83 | |
84 | // | |
85 | // TFluka methods. | |
86 | //____________________________________________________________________________ | |
87 | TFluka::TFluka() | |
88 | :TVirtualMC(), | |
89 | fVerbosityLevel(0), | |
90 | fInputFileName("") | |
91 | { | |
92 | // | |
93 | // Default constructor | |
94 | // | |
95 | } | |
96 | ||
97 | //____________________________________________________________________________ | |
98 | TFluka::TFluka(const char *title, Int_t verbosity) | |
99 | :TVirtualMC("TFluka",title), | |
100 | fVerbosityLevel(verbosity), | |
101 | fInputFileName("") | |
102 | { | |
103 | if (fVerbosityLevel >=3) | |
104 | cout << "==> TFluka::TFluka(" << title << ") constructor called." << endl; | |
105 | ||
106 | if (fVerbosityLevel >=3) | |
107 | cout << "<== TFluka::TFluka(" << title << ") constructor called." << endl; | |
108 | } | |
109 | ||
110 | //____________________________________________________________________________ | |
111 | void TFluka::Init() { | |
112 | if (fVerbosityLevel >=3) | |
113 | cout << "==> TFluka::Init() called." << endl; | |
114 | ||
115 | if (fVerbosityLevel >=2) | |
116 | cout << "\t* Changing lfdrtr = (" << (GLOBAL.lfdrtr?'T':'F') | |
117 | << ") in fluka..." << endl; | |
118 | GLOBAL.lfdrtr = true; | |
119 | ||
120 | if (fVerbosityLevel >=2) | |
121 | cout << "\t* Opening file " << fInputFileName << endl; | |
122 | const char* fname = fInputFileName; | |
123 | fluka_openinp(lunin, PASSCHARA(fname)); | |
124 | ||
125 | if (fVerbosityLevel >=2) | |
126 | cout << "\t* Calling flukam..." << endl; | |
127 | flukam(0); | |
128 | ||
129 | if (fVerbosityLevel >=2) | |
130 | cout << "\t* Closing file " << fInputFileName << endl; | |
131 | fluka_closeinp(lunin); | |
132 | ||
133 | if (fVerbosityLevel >=3) | |
134 | cout << "<== TFluka::Init() called." << endl; | |
135 | } | |
136 | ||
137 | //____________________________________________________________________________ | |
138 | void TFluka::ProcessEvent() { | |
139 | if (fVerbosityLevel >=3) | |
140 | cout << "==> TFluka::ProcessEvent() called." << endl; | |
141 | ||
142 | if (fVerbosityLevel >=3) | |
143 | cout << "<== TFluka::ProcessEvent() called." << endl; | |
144 | } | |
145 | ||
146 | //____________________________________________________________________________ | |
147 | void TFluka::ProcessRun(Int_t nevent) { | |
148 | if (fVerbosityLevel >=3) | |
149 | cout << "==> TFluka::ProcessRun(" << nevent << ") called." | |
150 | << endl; | |
151 | ||
152 | if (fVerbosityLevel >=2) { | |
153 | cout << "\t* GLOBAL.fdrtr = " << (GLOBAL.lfdrtr?'T':'F') << endl; | |
154 | cout << "\t* Calling flukam again..." << endl; | |
155 | } | |
156 | fApplication->GeneratePrimaries(); | |
157 | EPISOR.lsouit = true; | |
158 | flukam(0); | |
159 | ||
160 | if (fVerbosityLevel >=3) | |
161 | cout << "<== TFluka::ProcessRun(" << nevent << ") called." | |
162 | << endl; | |
163 | } | |
164 | ||
165 | //_____________________________________________________________________________ | |
166 | Int_t TFluka::IdFromPDG(Int_t pdg) const | |
167 | { | |
168 | // | |
169 | // Return Geant3 code from PDG and pseudo ENDF code | |
170 | // | |
171 | for(Int_t i=0;i<fNPDGCodes;++i) | |
172 | if(pdg==fPDGCode[i]) | |
173 | return i; | |
174 | return -99; | |
175 | } | |
176 | ||
177 | //_____________________________________________________________________________ | |
178 | Int_t TFluka::PDGFromId(Int_t id) const | |
179 | { | |
180 | // | |
181 | // Return PDG code and pseudo ENDF code from Geant3 code | |
182 | // | |
183 | if(id>0 && id<fNPDGCodes) | |
184 | return fPDGCode[id]; | |
185 | else | |
186 | return -1; | |
187 | } | |
188 | ||
189 | //_____________________________________________________________________________ | |
190 | void TFluka::DefineParticles() | |
191 | { | |
192 | // Load standard numbers for GEANT particles and PDG conversion | |
193 | fPDGCode[fNPDGCodes++]= -99; // 0 = Psudoparticle (Ray) | |
194 | fPDGCode[fNPDGCodes++]= 2212; // 1 = Proton | |
195 | fPDGCode[fNPDGCodes++]=-2212; // 2 = Anti Proton | |
196 | fPDGCode[fNPDGCodes++]= 11; // 3 = Electron | |
197 | fPDGCode[fNPDGCodes++]= -11; // 4 = Positron | |
198 | fPDGCode[fNPDGCodes++]= 12; // 5 = Electron Neutrino | |
199 | fPDGCode[fNPDGCodes++]= -12; // 6 = Electron Antineutrino | |
200 | fPDGCode[fNPDGCodes++]= 22; // 7 = Photon | |
201 | fPDGCode[fNPDGCodes++]= 2112; // 8 = Neutron | |
202 | fPDGCode[fNPDGCodes++]=-2112; // 9 = Anti Neutron | |
203 | fPDGCode[fNPDGCodes++]= -13; // 10 = Mu+ | |
204 | fPDGCode[fNPDGCodes++]= 13; // 11 = Mu- | |
205 | fPDGCode[fNPDGCodes++]= 130; // 12 = Kaon 0 long | |
206 | fPDGCode[fNPDGCodes++]= 211; // 13 = Pi+ | |
207 | fPDGCode[fNPDGCodes++]= -211; // 14 = Pi- | |
208 | fPDGCode[fNPDGCodes++]= 321; // 15 = Kaon+ | |
209 | fPDGCode[fNPDGCodes++]= -321; // 16 = Kaon- | |
210 | fPDGCode[fNPDGCodes++]= 3122; // 17 = Lambda | |
211 | fPDGCode[fNPDGCodes++]=-3122; // 18 = Anti Lambda | |
212 | fPDGCode[fNPDGCodes++]= 310; // 19 = Kaon 0 short | |
213 | fPDGCode[fNPDGCodes++]= 3112; // 20 = Sigma - | |
214 | fPDGCode[fNPDGCodes++]= 3222; // 21 = Sigma + | |
215 | fPDGCode[fNPDGCodes++]= 3212; // 22 = Sigma 0 | |
216 | fPDGCode[fNPDGCodes++]= 111; // 23 = Pi0 | |
217 | fPDGCode[fNPDGCodes++]= 311; // 24 = Kaon 0 | |
218 | fPDGCode[fNPDGCodes++]= -311; // 25 = Antikaon 0 | |
219 | fPDGCode[fNPDGCodes++]= -99; // 26 = --Reserved | |
220 | fPDGCode[fNPDGCodes++]= 14; // 27 = Muon neutrino | |
221 | fPDGCode[fNPDGCodes++]= -14; // 28 = Muon antineutrino | |
222 | fPDGCode[fNPDGCodes++]= -99; // 29 = --Reserved | |
223 | fPDGCode[fNPDGCodes++]= -99; // 30 = --Reserved | |
224 | fPDGCode[fNPDGCodes++]=-3222; // 31 = Antisigma - | |
225 | fPDGCode[fNPDGCodes++]=-3212; // 32 = Antisigma 0 | |
226 | fPDGCode[fNPDGCodes++]=-3112; // 33 = Antisigma + | |
227 | fPDGCode[fNPDGCodes++]= 3322; // 34 = Xi 0 | |
228 | fPDGCode[fNPDGCodes++]=-3322; // 35 = AntiXi 0 | |
229 | fPDGCode[fNPDGCodes++]= 3312; // 36 = Xi - | |
230 | fPDGCode[fNPDGCodes++]=-3312; // 37 = Xi + | |
231 | fPDGCode[fNPDGCodes++]= 3334; // 38 = Omega - | |
232 | fPDGCode[fNPDGCodes++]=-3334; // 39 = Antiomega | |
233 | fPDGCode[fNPDGCodes++]= -99; // 40 = --Reserved | |
234 | fPDGCode[fNPDGCodes++]= -15; // 41 = Tau+ | |
235 | fPDGCode[fNPDGCodes++]= 15; // 42 = Tau- | |
236 | fPDGCode[fNPDGCodes++]= 16; // 43 = Tau neutrino | |
237 | fPDGCode[fNPDGCodes++]= -16; // 44 = Tau antineutrino | |
238 | fPDGCode[fNPDGCodes++]= 411; // 45 = D+ | |
239 | fPDGCode[fNPDGCodes++]= -411; // 46 = D- | |
240 | fPDGCode[fNPDGCodes++]= 421; // 47 = D0 | |
241 | fPDGCode[fNPDGCodes++]= -421; // 48 = AntiD 0 | |
242 | fPDGCode[fNPDGCodes++]= 431; // 49 = D_s + | |
243 | fPDGCode[fNPDGCodes++]= -431; // 50 = D_s - | |
244 | fPDGCode[fNPDGCodes++]= 4122; // 51 = Lambda_c + | |
245 | fPDGCode[fNPDGCodes++]= 4232; // 52 = Xi_c + | |
246 | fPDGCode[fNPDGCodes++]= 4112; // 53 = Xi_c - | |
247 | fPDGCode[fNPDGCodes++]= 4322; // 54 = Xi'_c + | |
248 | fPDGCode[fNPDGCodes++]= 4312; // 55 = Xi'_c 0 | |
249 | fPDGCode[fNPDGCodes++]= 4332; // 56 = Omega_c 0 | |
250 | fPDGCode[fNPDGCodes++]=-4122; // 57 = Antilambda_c - | |
251 | fPDGCode[fNPDGCodes++]=-4232; // 58 = Antixsi_c - | |
252 | fPDGCode[fNPDGCodes++]=-4112; // 59 = Antixsi_c 0 | |
253 | fPDGCode[fNPDGCodes++]=-4322; // 60 = AntiXi'_c - | |
254 | fPDGCode[fNPDGCodes++]=-4312; // 61 = AntiXi'_c 0 | |
255 | fPDGCode[fNPDGCodes++]=-4332; // 62 = AntiOmega_c 0 | |
256 | fPDGCode[fNPDGCodes++]= -99; // 63 = --Reserved | |
257 | fPDGCode[fNPDGCodes++]= -99; // 64 = --Reserved | |
258 | } |