]>
Commit | Line | Data |
---|---|---|
2817d3e2 | 1 | // $Id$ |
2 | // Category: geometry | |
3 | // | |
499b353a | 4 | // Author: I. Hrivnacova |
5 | // | |
6 | // Class TG4GeometryOutputManager | |
7 | // ------------------------------ | |
2817d3e2 | 8 | // See the class description in the header file. |
9 | ||
10 | #include "TG4GeometryOutputManager.h" | |
3c7cd15a | 11 | #include <g4std/iostream> |
12 | #include <g4std/iomanip> | |
2817d3e2 | 13 | |
72095f7c | 14 | //_____________________________________________________________________________ |
2817d3e2 | 15 | TG4GeometryOutputManager::TG4GeometryOutputManager() { |
16 | // | |
17 | } | |
18 | ||
72095f7c | 19 | //_____________________________________________________________________________ |
2817d3e2 | 20 | TG4GeometryOutputManager::~TG4GeometryOutputManager() { |
21 | // | |
22 | } | |
23 | ||
24 | // public methods | |
25 | ||
72095f7c | 26 | //_____________________________________________________________________________ |
2817d3e2 | 27 | void TG4GeometryOutputManager::OpenFile(G4String filePath) |
28 | { | |
29 | // Opens output files. | |
30 | // --- | |
31 | ||
3c7cd15a | 32 | G4cout << "TG4GeometryOutputManager::OpenFile: " << filePath << G4endl; |
2817d3e2 | 33 | |
3c7cd15a | 34 | //fOutFile.open(filePath, ios::out, filebuf::openprot); |
35 | fOutFile.open(filePath, G4std::ios::out); //, G4std::filebuf::openprot); | |
2817d3e2 | 36 | |
37 | if (!fOutFile) { | |
38 | G4String text = "Cannot open "; | |
39 | text = text + filePath; | |
40 | TG4Globals::Warning(text); | |
41 | } | |
42 | ||
43 | // use FORTRAN compatibility output | |
3c7cd15a | 44 | fOutFile << G4std::setiosflags(G4std::ios::showpoint | G4std::ios::uppercase); |
2817d3e2 | 45 | } |
46 | ||
47 | ||
72095f7c | 48 | //_____________________________________________________________________________ |
2817d3e2 | 49 | void TG4GeometryOutputManager::CloseFile() |
50 | { | |
c58cfb90 | 51 | // Closes output files. |
2817d3e2 | 52 | // --- |
53 | ||
54 | fOutFile.close(); | |
55 | } | |
56 | ||
57 | ||
72095f7c | 58 | //_____________________________________________________________________________ |
2817d3e2 | 59 | void TG4GeometryOutputManager::WriteGsvolu( |
60 | G4String vname, G4String shape, G4int nmed, G4double* Rpar, | |
61 | G4int npar) | |
62 | { | |
63 | // from fortran (g3routines.F) | |
64 | // write(fmt,'(A,I2,A)')'(a4,1x,a6,1x,a4,1x,a4,2i5,',max(npar,1), | |
65 | //> '(1x,e16.8))' | |
66 | // write(lunlist,fmt) context, rname, name, shape, nmed, npar, | |
67 | //+ (par(k),k=1,npar) | |
68 | // --- | |
69 | ||
70 | G4String context("----"); | |
71 | G4String rname("GSVOLU"); | |
72 | G4String space(" "); | |
73 | fOutFile << context << space | |
74 | << rname << space | |
75 | << vname << space | |
76 | << shape | |
3c7cd15a | 77 | << G4std::setw(5) << nmed |
78 | << G4std::setw(5) << npar; | |
2817d3e2 | 79 | for (G4int i=0; i<npar; i++) |
3c7cd15a | 80 | fOutFile << space << G4std::setw(16) << G4std::setprecision(8) << Rpar[i]; |
2817d3e2 | 81 | fOutFile << G4endl; |
82 | } | |
83 | ||
72095f7c | 84 | //_____________________________________________________________________________ |
2817d3e2 | 85 | void TG4GeometryOutputManager::WriteGspos( |
86 | G4String vname, G4int num, G4String vmoth, G4double x, | |
87 | G4double y, G4double z, G4int irot, G4String vonly) | |
88 | { | |
89 | // from fortran (g3routines.F) | |
90 | // write(lunlist, | |
91 | //+ '(a4,1x,a6,1x,a4,i5,1x,a4,3(1x,e16.8),i5,1x,a4)') | |
92 | //+ context, rname, name, num, moth, x, y, z, irot, only | |
93 | // --- | |
94 | ||
95 | G4String context("----"); | |
96 | G4String rname("GSPOS"); | |
97 | G4String space(" "); | |
98 | fOutFile << context << space | |
99 | << rname << space | |
100 | << vname << space | |
3c7cd15a | 101 | << G4std::setw(5) << num << space |
2817d3e2 | 102 | << vmoth << space |
3c7cd15a | 103 | << G4std::setw(16) << G4std::setprecision(8) << x << space |
104 | << G4std::setw(16) << G4std::setprecision(8) << y << space | |
105 | << G4std::setw(16) << G4std::setprecision(8) << z | |
106 | << G4std::setw(5) << irot << space | |
2817d3e2 | 107 | << vonly |
108 | << G4endl; | |
109 | } | |
110 | ||
72095f7c | 111 | //_____________________________________________________________________________ |
2817d3e2 | 112 | void TG4GeometryOutputManager::WriteGsposp( |
113 | G4String vname, G4int num, G4String vmoth, G4double x, | |
114 | G4double y, G4double z, G4int irot, G4String vonly, | |
115 | G4double pars[], G4int npar) | |
116 | { | |
117 | // from fortran (g3routines.F) | |
118 | // write(fmt,'(A,A,I2,A)') | |
119 | //+ '(a4,1x,a6,1x,a4,i5,1x,a4,3(1x,e16.8),', | |
120 | //+ 'i5,1x,a4,i5,',max(npar,1),'(1x,e16.8))' | |
121 | // write(lunlist,fmt) | |
122 | //+ context, rname, name, num, moth, x, y, z, irot, only, | |
123 | //+ npar, | |
124 | //+ (par(k),k=1,npar) | |
125 | // --- | |
126 | ||
127 | G4String context("----"); | |
128 | G4String rname("GSPOSP"); | |
129 | G4String space(" "); | |
130 | fOutFile << context << space | |
131 | << rname << space | |
132 | << vname << space | |
3c7cd15a | 133 | << G4std::setw(5) << num << space |
2817d3e2 | 134 | << vmoth << space |
3c7cd15a | 135 | << G4std::setw(16) << G4std::setprecision(8) << x << space |
136 | << G4std::setw(16) << G4std::setprecision(8) << y << space | |
137 | << G4std::setw(16) << G4std::setprecision(8) << z | |
138 | << G4std::setw(5) << irot << space | |
2817d3e2 | 139 | << vonly |
3c7cd15a | 140 | << G4std::setw(5) << npar; |
2817d3e2 | 141 | for (G4int i=0; i<npar; i++) |
3c7cd15a | 142 | fOutFile << space << G4std::setw(16) << G4std::setprecision(8) << pars[i]; |
2817d3e2 | 143 | fOutFile << G4endl; |
144 | } | |
145 | ||
72095f7c | 146 | //_____________________________________________________________________________ |
2817d3e2 | 147 | void TG4GeometryOutputManager::WriteGsrotm( |
148 | G4int irot, G4double theta1, G4double phi1, | |
149 | G4double theta2, G4double phi2, G4double theta3, G4double phi3) | |
150 | { | |
151 | // from fortran (g3routines.F) | |
152 | // write(lunlist, | |
153 | //+ '(a4,1x,a6,i5,6f11.5)') | |
154 | //+ context, rname, irot, theta1, phi1, theta2, phi2, | |
155 | //+ theta3, phi3 | |
156 | // --- | |
157 | ||
158 | G4String context("----"); | |
159 | G4String rname("GSROTM"); | |
160 | G4String space(" "); | |
161 | fOutFile << context << space | |
162 | << rname << space | |
3c7cd15a | 163 | << G4std::setw(5) << irot |
164 | << G4std::setw(11) << G4std::setprecision(5) << theta1 | |
165 | << G4std::setw(11) << G4std::setprecision(5) << phi1 | |
166 | << G4std::setw(11) << G4std::setprecision(5) << theta2 | |
167 | << G4std::setw(11) << G4std::setprecision(5) << phi2 | |
168 | << G4std::setw(11) << G4std::setprecision(5) << theta3 | |
169 | << G4std::setw(11) << G4std::setprecision(5) << phi3 | |
2817d3e2 | 170 | << G4endl; |
171 | } | |
172 | ||
72095f7c | 173 | //_____________________________________________________________________________ |
2817d3e2 | 174 | void TG4GeometryOutputManager::WriteGsdvn( |
175 | G4String vname, G4String vmoth, G4int ndiv, G4int iaxis) | |
176 | { | |
177 | // from fortran (g3routines.F) | |
178 | // write(lunlist, | |
179 | //+ '(a4,1x,a6,1x,a4,1x,a4,i5,i3)') | |
180 | //+ context, rname, name, moth, ndiv, iaxis | |
181 | // --- | |
182 | ||
183 | G4String context("----"); | |
184 | G4String rname("GSDVN"); | |
185 | G4String space(" "); | |
186 | fOutFile << context << space | |
187 | << rname << space | |
188 | << vname << space | |
189 | << vmoth << space | |
3c7cd15a | 190 | << G4std::setw(5) << ndiv |
191 | << G4std::setw(5) << iaxis | |
2817d3e2 | 192 | << G4endl; |
193 | } | |
194 | ||
72095f7c | 195 | //_____________________________________________________________________________ |
2817d3e2 | 196 | void TG4GeometryOutputManager::WriteGsdvn2( |
197 | G4String vname, G4String vmoth, G4int ndiv, G4int iaxis, | |
198 | G4double c0, G4int numed) | |
199 | { | |
200 | // from fortran (g3routines.F) | |
201 | // write(lunlist, | |
202 | //+ '(a4,1x,a6,1x,a4,1x,a4,i5,i3,(1x,e16.8),i5)') | |
203 | //+ context, rname, name, moth, ndiv, iaxis, c0, numed | |
204 | // --- | |
205 | ||
206 | G4String context("----"); | |
207 | G4String rname("GSDVN2"); | |
208 | G4String space(" "); | |
209 | fOutFile << context << space | |
210 | << rname << space | |
211 | << vname << space | |
212 | << vmoth << space | |
3c7cd15a | 213 | << G4std::setw(5) << ndiv |
214 | << G4std::setw(5) << iaxis << " " | |
215 | << G4std::setw(16) << G4std::setprecision(8) << c0 | |
216 | << G4std::setw(5) << numed | |
2817d3e2 | 217 | << G4endl; |
218 | } | |
219 | ||
72095f7c | 220 | //_____________________________________________________________________________ |
2817d3e2 | 221 | void TG4GeometryOutputManager::WriteGsdvt( |
222 | G4String vname, G4String vmoth, G4double step, G4int iaxis, | |
223 | G4int numed, G4int ndvmx) | |
224 | { | |
225 | // from fortran (g3routines.F) | |
226 | // write(lunlist, | |
227 | // + '(a4,1x,a6,1x,a4,1x,a4,(1x,e16.8),3i5)') | |
228 | // + context, rname, name, moth, step, iaxis, numed, ndvmx | |
229 | // --- | |
230 | ||
231 | G4String context("----"); | |
232 | G4String rname("GSDVT"); | |
233 | G4String space(" "); | |
234 | fOutFile << context << space | |
235 | << rname << space | |
236 | << vname << space | |
237 | << vmoth << space | |
3c7cd15a | 238 | << G4std::setw(16) << G4std::setprecision(8) << step |
239 | << G4std::setw(5) << iaxis | |
240 | << G4std::setw(5) << numed | |
241 | << G4std::setw(5) << ndvmx | |
2817d3e2 | 242 | << G4endl; |
243 | } | |
244 | ||
72095f7c | 245 | //_____________________________________________________________________________ |
2817d3e2 | 246 | void TG4GeometryOutputManager::WriteGsdvt2( |
247 | G4String vname, G4String vmoth, G4double step, G4int iaxis, | |
248 | G4double c0, G4int numed, G4int ndvmx) | |
249 | { | |
250 | // from fortran (g3routines.F) | |
251 | // write(lunlist, | |
252 | //+ '(a4,1x,a6,1x,a4,1x,a4,(1x,e16.8),i3,(1x,e16.8),2i5)') | |
253 | //+ context, rname, name, moth, step, iaxis, c0, numed, ndvmx | |
254 | // --- | |
255 | ||
256 | G4String context("----"); | |
257 | G4String rname("GSDVT2"); | |
258 | G4String space(" "); | |
259 | fOutFile << context << space | |
260 | << rname << space | |
261 | << vname << space | |
262 | << vmoth << space | |
3c7cd15a | 263 | << G4std::setw(16) << G4std::setprecision(8) << step |
264 | << G4std::setw(3) << iaxis << space | |
265 | << G4std::setw(16) << G4std::setprecision(8) << c0 | |
266 | << G4std::setw(5) << numed | |
267 | << G4std::setw(5) << ndvmx | |
268 | << G4endl; | |
2817d3e2 | 269 | } |
270 | ||
72095f7c | 271 | //_____________________________________________________________________________ |
2817d3e2 | 272 | void TG4GeometryOutputManager::WriteGsdvx( |
273 | G4String name, G4String moth, G4int ndiv, G4int iaxis, | |
274 | G4double step, G4double c0, G4int numed, G4int ndvmx) | |
275 | { | |
276 | // from fortran (g3routines.F) | |
277 | // write(lunlist, | |
278 | // + '(a4,1x,a6,1x,a4,1x,a4,i5,i3,2(1x,e16.8),2i5)') | |
279 | // + context, rname, name, moth, ndiv, iaxis,step, c0, | |
280 | // + numed, ndvmx | |
281 | // --- | |
282 | ||
283 | G4String context("----"); | |
284 | G4String rname("GSDVX"); | |
285 | G4String space(" "); | |
286 | fOutFile << context << space | |
287 | << rname << space | |
288 | << name << space | |
289 | << moth << space | |
3c7cd15a | 290 | << G4std::setw(5) << ndiv |
291 | << G4std::setw(3) << iaxis << space | |
292 | << G4std::setw(16) << G4std::setprecision(8) << step << space | |
293 | << G4std::setw(16) << G4std::setprecision(8) << c0 | |
294 | << G4std::setw(5) << numed | |
295 | << G4std::setw(5) << ndvmx | |
296 | << G4endl; | |
2817d3e2 | 297 | } |
298 | ||
72095f7c | 299 | //_____________________________________________________________________________ |
2817d3e2 | 300 | void TG4GeometryOutputManager::WriteGsmate( |
301 | G4int imate, G4String name, G4double ain, G4double zin, | |
302 | G4double densin, G4double radl, G4int nwbf, G4double* ubuf) | |
303 | { | |
304 | // from fortran (g3routines.F) | |
305 | // write(fmt,'(A,I3,A)') | |
306 | //+ '(a4,1x,a6,i5,1x,''"'',a,''"'',4(1x,e16.8),i3,', | |
307 | //+ max(nwbf,1),'(1x,e16.8))' | |
308 | // write(lunlist,fmt) | |
309 | //+ context, rname, imate, name, a, z, dens, radl, | |
310 | //+ nwbf, (ubf(k), k=1,nwbf) | |
311 | // --- | |
312 | ||
313 | G4String context("----"); | |
314 | G4String rname("GSMATE"); | |
315 | G4String space(" "); | |
316 | fOutFile << context << space | |
317 | << rname << space | |
3c7cd15a | 318 | << G4std::setw(5) << imate << space |
2817d3e2 | 319 | << '"' << name << '"' << space |
3c7cd15a | 320 | << G4std::setw(16) << G4std::setprecision(8) << ain << space |
321 | << G4std::setw(16) << G4std::setprecision(8) << zin << space | |
322 | << G4std::setw(16) << G4std::setprecision(8) << densin << space | |
323 | << G4std::setw(16) << G4std::setprecision(8) << radl | |
324 | << G4std::setw(3) << nwbf; | |
2817d3e2 | 325 | for (G4int i=0; i<nwbf; i++) |
3c7cd15a | 326 | fOutFile << space << G4std::setw(16) << G4std::setprecision(8) << ubuf[i]; |
327 | fOutFile << G4endl; | |
2817d3e2 | 328 | } |
329 | ||
72095f7c | 330 | //_____________________________________________________________________________ |
2817d3e2 | 331 | void TG4GeometryOutputManager::WriteGsmixt( |
332 | G4int imate, G4String name, G4double* a, G4double* z, | |
333 | G4double dens, G4int nlmat, G4double* wmat) | |
334 | { | |
335 | // from fortran (g3routines.F) | |
336 | // write(fmt,'(A,I3,A,I3,A,I3,A)') | |
337 | //+ '(a4,1x,a6,i5,1x,''"'',a,''"'',1x,e16.8,1x,i3,', | |
338 | //+ max(nlmata,1), | |
339 | //+ '(1x,e16.8),',max(nlmata,1),'(1x,e16.8),', | |
340 | //+ max(nlmata,1),'(1x,e16.8))' | |
341 | // write(lunlist,fmt) | |
342 | //+ context, rname, imate, name, dens, | |
343 | //+ nlmat, | |
344 | //+ (a(k), k=1,abs(nlmat)), | |
345 | //+ (z(k), k=1,abs(nlmat)), | |
346 | //+ (wmat(k), k=1,abs(nlmat)) | |
347 | // --- | |
348 | ||
349 | G4String context("----"); | |
350 | G4String rname("GSMIXT"); | |
351 | G4String space(" "); | |
352 | fOutFile << context << space | |
353 | << rname << space | |
3c7cd15a | 354 | << G4std::setw(5) << imate << space |
2817d3e2 | 355 | << '"' << name << '"' << space |
3c7cd15a | 356 | << G4std::setw(16) << G4std::setprecision(8) << dens << space |
357 | << G4std::setw(3) << nlmat; | |
2817d3e2 | 358 | G4int i; |
359 | for (i=0; i<abs(nlmat); i++) | |
3c7cd15a | 360 | fOutFile << space << G4std::setw(16) << G4std::setprecision(8) << a[i]; |
2817d3e2 | 361 | for (i=0; i<abs(nlmat); i++) |
3c7cd15a | 362 | fOutFile << space << G4std::setw(16) << G4std::setprecision(8) << z[i]; |
2817d3e2 | 363 | for (i=0; i<abs(nlmat); i++) |
3c7cd15a | 364 | fOutFile << space << G4std::setw(16) << G4std::setprecision(8) << wmat[i]; |
365 | fOutFile << G4endl; | |
2817d3e2 | 366 | } |
367 | ||
72095f7c | 368 | //_____________________________________________________________________________ |
2817d3e2 | 369 | void TG4GeometryOutputManager::WriteGstmed( |
370 | G4int itmed, G4String name, G4int nmat, G4int isvol, | |
371 | G4int ifield, G4double fieldm, G4double tmaxfd, | |
372 | G4double stemax, G4double deemax, G4double epsil, | |
373 | G4double stmin, G4double* ubuf, G4int nwbuf) | |
374 | { | |
375 | // from fortran (g3routines.F) | |
376 | // write(fmt,'(A,I3,A)') | |
377 | //> '(a4,1x,a6,i5,1x,''"'',a,''"'',3i3,6(1x,e16.8),i3,', | |
378 | //> max(nwbuf,1),'(1x,e16.8))' | |
379 | // write(lunlist,fmt) | |
380 | //+ context, rname, itmed, name, nmat, isvol, ifield, fieldm, | |
381 | //+ tmaxfd, stemax, deemax, epsil, stmin, | |
382 | //+ nwbuf, (ubuf(k),k=1,nwbuf) | |
383 | // --- | |
384 | ||
385 | G4String context("----"); | |
386 | G4String rname("GSTMED"); | |
387 | G4String space(" "); | |
388 | fOutFile << context << space | |
389 | << rname << space | |
3c7cd15a | 390 | << G4std::setw(5) << itmed << space |
2817d3e2 | 391 | << '"' << name << '"' |
3c7cd15a | 392 | << G4std::setw(3) << nmat |
393 | << G4std::setw(3) << isvol | |
394 | << G4std::setw(3) << ifield << space | |
395 | << G4std::setw(16) << G4std::setprecision(8) << fieldm << space | |
396 | << G4std::setw(16) << G4std::setprecision(8) << tmaxfd << space | |
397 | << G4std::setw(16) << G4std::setprecision(8) << stemax << space | |
398 | << G4std::setw(16) << G4std::setprecision(8) << deemax << space | |
399 | << G4std::setw(16) << G4std::setprecision(8) << epsil << space | |
400 | << G4std::setw(16) << G4std::setprecision(8) << stmin << space | |
401 | << G4std::setw(3) << nwbuf; | |
2817d3e2 | 402 | for (G4int i=0; i<nwbuf; i++) |
3c7cd15a | 403 | fOutFile << space << G4std::setw(16) << G4std::setprecision(8) << ubuf[i]; |
404 | fOutFile << G4endl; | |
2817d3e2 | 405 | } |
406 | ||
72095f7c | 407 | //_____________________________________________________________________________ |
2817d3e2 | 408 | void TG4GeometryOutputManager::WriteGstpar( |
409 | G4int itmed, G4String param, G4double parval) | |
410 | { | |
411 | // from fortran (g3routines.F) | |
412 | // write(lunlist, | |
413 | //+ '(a4,1x,a6,i5,1x,a4,(1x,e16.8))') | |
414 | //+ context, rname, itmed, chpar, parval | |
415 | // --- | |
416 | ||
417 | G4String context("----"); | |
418 | G4String rname("GSTPAR"); | |
419 | G4String space(" "); | |
420 | fOutFile << context << space | |
421 | << rname << space | |
3c7cd15a | 422 | << G4std::setw(5) << itmed << space |
2817d3e2 | 423 | << param << space |
3c7cd15a | 424 | << G4std::setw(16) << G4std::setprecision(8) << parval |
425 | << G4endl; | |
2817d3e2 | 426 | } |
427 | ||
72095f7c | 428 | //_____________________________________________________________________________ |
2817d3e2 | 429 | void TG4GeometryOutputManager::WriteGgclos() |
430 | { | |
431 | // Writes GGCLOS token | |
432 | // --- | |
433 | ||
434 | G4String context("----"); | |
435 | G4String rname("GGCLOS"); | |
436 | G4String space(" "); | |
437 | fOutFile << context << space | |
438 | << rname | |
3c7cd15a | 439 | << G4endl; |
2817d3e2 | 440 | } |