4 // See the class description in the header file.
6 #include "TG4GeometryOutputManager.h"
7 #include <g4std/iostream>
8 #include <g4std/iomanip>
10 TG4GeometryOutputManager::TG4GeometryOutputManager() {
14 TG4GeometryOutputManager::~TG4GeometryOutputManager() {
20 void TG4GeometryOutputManager::OpenFile(G4String filePath)
22 // Opens output files.
25 G4cout << "TG4GeometryOutputManager::OpenFile: " << filePath << G4endl;
27 //fOutFile.open(filePath, ios::out, filebuf::openprot);
28 fOutFile.open(filePath, G4std::ios::out); //, G4std::filebuf::openprot);
31 G4String text = "Cannot open ";
32 text = text + filePath;
33 TG4Globals::Warning(text);
36 // use FORTRAN compatibility output
37 fOutFile << G4std::setiosflags(G4std::ios::showpoint | G4std::ios::uppercase);
41 void TG4GeometryOutputManager::CloseFile()
43 // Closess output files.
50 void TG4GeometryOutputManager::WriteGsvolu(
51 G4String vname, G4String shape, G4int nmed, G4double* Rpar,
54 // from fortran (g3routines.F)
55 // write(fmt,'(A,I2,A)')'(a4,1x,a6,1x,a4,1x,a4,2i5,',max(npar,1),
57 // write(lunlist,fmt) context, rname, name, shape, nmed, npar,
61 G4String context("----");
62 G4String rname("GSVOLU");
64 fOutFile << context << space
68 << G4std::setw(5) << nmed
69 << G4std::setw(5) << npar;
70 for (G4int i=0; i<npar; i++)
71 fOutFile << space << G4std::setw(16) << G4std::setprecision(8) << Rpar[i];
76 void TG4GeometryOutputManager::WriteGspos(
77 G4String vname, G4int num, G4String vmoth, G4double x,
78 G4double y, G4double z, G4int irot, G4String vonly)
80 // from fortran (g3routines.F)
82 //+ '(a4,1x,a6,1x,a4,i5,1x,a4,3(1x,e16.8),i5,1x,a4)')
83 //+ context, rname, name, num, moth, x, y, z, irot, only
86 G4String context("----");
87 G4String rname("GSPOS");
89 fOutFile << context << space
92 << G4std::setw(5) << num << space
94 << G4std::setw(16) << G4std::setprecision(8) << x << space
95 << G4std::setw(16) << G4std::setprecision(8) << y << space
96 << G4std::setw(16) << G4std::setprecision(8) << z
97 << G4std::setw(5) << irot << space
103 void TG4GeometryOutputManager::WriteGsposp(
104 G4String vname, G4int num, G4String vmoth, G4double x,
105 G4double y, G4double z, G4int irot, G4String vonly,
106 G4double pars[], G4int npar)
108 // from fortran (g3routines.F)
109 // write(fmt,'(A,A,I2,A)')
110 //+ '(a4,1x,a6,1x,a4,i5,1x,a4,3(1x,e16.8),',
111 //+ 'i5,1x,a4,i5,',max(npar,1),'(1x,e16.8))'
112 // write(lunlist,fmt)
113 //+ context, rname, name, num, moth, x, y, z, irot, only,
115 //+ (par(k),k=1,npar)
118 G4String context("----");
119 G4String rname("GSPOSP");
121 fOutFile << context << space
124 << G4std::setw(5) << num << space
126 << G4std::setw(16) << G4std::setprecision(8) << x << space
127 << G4std::setw(16) << G4std::setprecision(8) << y << space
128 << G4std::setw(16) << G4std::setprecision(8) << z
129 << G4std::setw(5) << irot << space
131 << G4std::setw(5) << npar;
132 for (G4int i=0; i<npar; i++)
133 fOutFile << space << G4std::setw(16) << G4std::setprecision(8) << pars[i];
138 void TG4GeometryOutputManager::WriteGsrotm(
139 G4int irot, G4double theta1, G4double phi1,
140 G4double theta2, G4double phi2, G4double theta3, G4double phi3)
142 // from fortran (g3routines.F)
144 //+ '(a4,1x,a6,i5,6f11.5)')
145 //+ context, rname, irot, theta1, phi1, theta2, phi2,
149 G4String context("----");
150 G4String rname("GSROTM");
152 fOutFile << context << space
154 << G4std::setw(5) << irot
155 << G4std::setw(11) << G4std::setprecision(5) << theta1
156 << G4std::setw(11) << G4std::setprecision(5) << phi1
157 << G4std::setw(11) << G4std::setprecision(5) << theta2
158 << G4std::setw(11) << G4std::setprecision(5) << phi2
159 << G4std::setw(11) << G4std::setprecision(5) << theta3
160 << G4std::setw(11) << G4std::setprecision(5) << phi3
165 void TG4GeometryOutputManager::WriteGsdvn(
166 G4String vname, G4String vmoth, G4int ndiv, G4int iaxis)
168 // from fortran (g3routines.F)
170 //+ '(a4,1x,a6,1x,a4,1x,a4,i5,i3)')
171 //+ context, rname, name, moth, ndiv, iaxis
174 G4String context("----");
175 G4String rname("GSDVN");
177 fOutFile << context << space
181 << G4std::setw(5) << ndiv
182 << G4std::setw(5) << iaxis
187 void TG4GeometryOutputManager::WriteGsdvn2(
188 G4String vname, G4String vmoth, G4int ndiv, G4int iaxis,
189 G4double c0, G4int numed)
191 // from fortran (g3routines.F)
193 //+ '(a4,1x,a6,1x,a4,1x,a4,i5,i3,(1x,e16.8),i5)')
194 //+ context, rname, name, moth, ndiv, iaxis, c0, numed
197 G4String context("----");
198 G4String rname("GSDVN2");
200 fOutFile << context << space
204 << G4std::setw(5) << ndiv
205 << G4std::setw(5) << iaxis << " "
206 << G4std::setw(16) << G4std::setprecision(8) << c0
207 << G4std::setw(5) << numed
212 void TG4GeometryOutputManager::WriteGsdvt(
213 G4String vname, G4String vmoth, G4double step, G4int iaxis,
214 G4int numed, G4int ndvmx)
216 // from fortran (g3routines.F)
218 // + '(a4,1x,a6,1x,a4,1x,a4,(1x,e16.8),3i5)')
219 // + context, rname, name, moth, step, iaxis, numed, ndvmx
222 G4String context("----");
223 G4String rname("GSDVT");
225 fOutFile << context << space
229 << G4std::setw(16) << G4std::setprecision(8) << step
230 << G4std::setw(5) << iaxis
231 << G4std::setw(5) << numed
232 << G4std::setw(5) << ndvmx
237 void TG4GeometryOutputManager::WriteGsdvt2(
238 G4String vname, G4String vmoth, G4double step, G4int iaxis,
239 G4double c0, G4int numed, G4int ndvmx)
241 // from fortran (g3routines.F)
243 //+ '(a4,1x,a6,1x,a4,1x,a4,(1x,e16.8),i3,(1x,e16.8),2i5)')
244 //+ context, rname, name, moth, step, iaxis, c0, numed, ndvmx
247 G4String context("----");
248 G4String rname("GSDVT2");
250 fOutFile << context << space
254 << G4std::setw(16) << G4std::setprecision(8) << step
255 << G4std::setw(3) << iaxis << space
256 << G4std::setw(16) << G4std::setprecision(8) << c0
257 << G4std::setw(5) << numed
258 << G4std::setw(5) << ndvmx
263 void TG4GeometryOutputManager::WriteGsdvx(
264 G4String name, G4String moth, G4int ndiv, G4int iaxis,
265 G4double step, G4double c0, G4int numed, G4int ndvmx)
267 // from fortran (g3routines.F)
269 // + '(a4,1x,a6,1x,a4,1x,a4,i5,i3,2(1x,e16.8),2i5)')
270 // + context, rname, name, moth, ndiv, iaxis,step, c0,
274 G4String context("----");
275 G4String rname("GSDVX");
277 fOutFile << context << space
281 << G4std::setw(5) << ndiv
282 << G4std::setw(3) << iaxis << space
283 << G4std::setw(16) << G4std::setprecision(8) << step << space
284 << G4std::setw(16) << G4std::setprecision(8) << c0
285 << G4std::setw(5) << numed
286 << G4std::setw(5) << ndvmx
291 void TG4GeometryOutputManager::WriteGsmate(
292 G4int imate, G4String name, G4double ain, G4double zin,
293 G4double densin, G4double radl, G4int nwbf, G4double* ubuf)
295 // from fortran (g3routines.F)
296 // write(fmt,'(A,I3,A)')
297 //+ '(a4,1x,a6,i5,1x,''"'',a,''"'',4(1x,e16.8),i3,',
298 //+ max(nwbf,1),'(1x,e16.8))'
299 // write(lunlist,fmt)
300 //+ context, rname, imate, name, a, z, dens, radl,
301 //+ nwbf, (ubf(k), k=1,nwbf)
304 G4String context("----");
305 G4String rname("GSMATE");
307 fOutFile << context << space
309 << G4std::setw(5) << imate << space
310 << '"' << name << '"' << space
311 << G4std::setw(16) << G4std::setprecision(8) << ain << space
312 << G4std::setw(16) << G4std::setprecision(8) << zin << space
313 << G4std::setw(16) << G4std::setprecision(8) << densin << space
314 << G4std::setw(16) << G4std::setprecision(8) << radl
315 << G4std::setw(3) << nwbf;
316 for (G4int i=0; i<nwbf; i++)
317 fOutFile << space << G4std::setw(16) << G4std::setprecision(8) << ubuf[i];
322 void TG4GeometryOutputManager::WriteGsmixt(
323 G4int imate, G4String name, G4double* a, G4double* z,
324 G4double dens, G4int nlmat, G4double* wmat)
326 // from fortran (g3routines.F)
327 // write(fmt,'(A,I3,A,I3,A,I3,A)')
328 //+ '(a4,1x,a6,i5,1x,''"'',a,''"'',1x,e16.8,1x,i3,',
330 //+ '(1x,e16.8),',max(nlmata,1),'(1x,e16.8),',
331 //+ max(nlmata,1),'(1x,e16.8))'
332 // write(lunlist,fmt)
333 //+ context, rname, imate, name, dens,
335 //+ (a(k), k=1,abs(nlmat)),
336 //+ (z(k), k=1,abs(nlmat)),
337 //+ (wmat(k), k=1,abs(nlmat))
340 G4String context("----");
341 G4String rname("GSMIXT");
343 fOutFile << context << space
345 << G4std::setw(5) << imate << space
346 << '"' << name << '"' << space
347 << G4std::setw(16) << G4std::setprecision(8) << dens << space
348 << G4std::setw(3) << nlmat;
350 for (i=0; i<abs(nlmat); i++)
351 fOutFile << space << G4std::setw(16) << G4std::setprecision(8) << a[i];
352 for (i=0; i<abs(nlmat); i++)
353 fOutFile << space << G4std::setw(16) << G4std::setprecision(8) << z[i];
354 for (i=0; i<abs(nlmat); i++)
355 fOutFile << space << G4std::setw(16) << G4std::setprecision(8) << wmat[i];
360 void TG4GeometryOutputManager::WriteGstmed(
361 G4int itmed, G4String name, G4int nmat, G4int isvol,
362 G4int ifield, G4double fieldm, G4double tmaxfd,
363 G4double stemax, G4double deemax, G4double epsil,
364 G4double stmin, G4double* ubuf, G4int nwbuf)
366 // from fortran (g3routines.F)
367 // write(fmt,'(A,I3,A)')
368 //> '(a4,1x,a6,i5,1x,''"'',a,''"'',3i3,6(1x,e16.8),i3,',
369 //> max(nwbuf,1),'(1x,e16.8))'
370 // write(lunlist,fmt)
371 //+ context, rname, itmed, name, nmat, isvol, ifield, fieldm,
372 //+ tmaxfd, stemax, deemax, epsil, stmin,
373 //+ nwbuf, (ubuf(k),k=1,nwbuf)
376 G4String context("----");
377 G4String rname("GSTMED");
379 fOutFile << context << space
381 << G4std::setw(5) << itmed << space
382 << '"' << name << '"'
383 << G4std::setw(3) << nmat
384 << G4std::setw(3) << isvol
385 << G4std::setw(3) << ifield << space
386 << G4std::setw(16) << G4std::setprecision(8) << fieldm << space
387 << G4std::setw(16) << G4std::setprecision(8) << tmaxfd << space
388 << G4std::setw(16) << G4std::setprecision(8) << stemax << space
389 << G4std::setw(16) << G4std::setprecision(8) << deemax << space
390 << G4std::setw(16) << G4std::setprecision(8) << epsil << space
391 << G4std::setw(16) << G4std::setprecision(8) << stmin << space
392 << G4std::setw(3) << nwbuf;
393 for (G4int i=0; i<nwbuf; i++)
394 fOutFile << space << G4std::setw(16) << G4std::setprecision(8) << ubuf[i];
399 void TG4GeometryOutputManager::WriteGstpar(
400 G4int itmed, G4String param, G4double parval)
402 // from fortran (g3routines.F)
404 //+ '(a4,1x,a6,i5,1x,a4,(1x,e16.8))')
405 //+ context, rname, itmed, chpar, parval
408 G4String context("----");
409 G4String rname("GSTPAR");
411 fOutFile << context << space
413 << G4std::setw(5) << itmed << space
415 << G4std::setw(16) << G4std::setprecision(8) << parval
420 void TG4GeometryOutputManager::WriteGgclos()
422 // Writes GGCLOS token
425 G4String context("----");
426 G4String rname("GGCLOS");
428 fOutFile << context << space