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