4 // See the class description in the header file.
6 #include "TG4GeometryOutputManager.h"
10 TG4GeometryOutputManager::TG4GeometryOutputManager() {
14 TG4GeometryOutputManager::~TG4GeometryOutputManager() {
20 void TG4GeometryOutputManager::OpenFile(G4String filePath)
22 // Opens output files.
25 G4cout << "TG4GeometryOutputManager::OpenFile: " << filePath << endl;
27 fOutFile.open(filePath, ios::out, filebuf::openprot);
30 G4String text = "Cannot open ";
31 text = text + filePath;
32 TG4Globals::Warning(text);
35 // use FORTRAN compatibility output
36 fOutFile << setiosflags(ios::showpoint | ios::uppercase);
40 void TG4GeometryOutputManager::CloseFile()
42 // Closess output files.
49 void TG4GeometryOutputManager::WriteGsvolu(
50 G4String vname, G4String shape, G4int nmed, G4double* Rpar,
53 // from fortran (g3routines.F)
54 // write(fmt,'(A,I2,A)')'(a4,1x,a6,1x,a4,1x,a4,2i5,',max(npar,1),
56 // write(lunlist,fmt) context, rname, name, shape, nmed, npar,
60 G4String context("----");
61 G4String rname("GSVOLU");
63 fOutFile << context << space
69 for (G4int i=0; i<npar; i++)
70 fOutFile << space << setw(16) << setprecision(8) << Rpar[i];
75 void TG4GeometryOutputManager::WriteGspos(
76 G4String vname, G4int num, G4String vmoth, G4double x,
77 G4double y, G4double z, G4int irot, G4String vonly)
79 // from fortran (g3routines.F)
81 //+ '(a4,1x,a6,1x,a4,i5,1x,a4,3(1x,e16.8),i5,1x,a4)')
82 //+ context, rname, name, num, moth, x, y, z, irot, only
85 G4String context("----");
86 G4String rname("GSPOS");
88 fOutFile << context << space
91 << setw(5) << num << space
93 << setw(16) << setprecision(8) << x << space
94 << setw(16) << setprecision(8) << y << space
95 << setw(16) << setprecision(8) << z
96 << setw(5) << irot << space
102 void TG4GeometryOutputManager::WriteGsposp(
103 G4String vname, G4int num, G4String vmoth, G4double x,
104 G4double y, G4double z, G4int irot, G4String vonly,
105 G4double pars[], G4int npar)
107 // from fortran (g3routines.F)
108 // write(fmt,'(A,A,I2,A)')
109 //+ '(a4,1x,a6,1x,a4,i5,1x,a4,3(1x,e16.8),',
110 //+ 'i5,1x,a4,i5,',max(npar,1),'(1x,e16.8))'
111 // write(lunlist,fmt)
112 //+ context, rname, name, num, moth, x, y, z, irot, only,
114 //+ (par(k),k=1,npar)
117 G4String context("----");
118 G4String rname("GSPOSP");
120 fOutFile << context << space
123 << setw(5) << num << space
125 << setw(16) << setprecision(8) << x << space
126 << setw(16) << setprecision(8) << y << space
127 << setw(16) << setprecision(8) << z
128 << setw(5) << irot << space
131 for (G4int i=0; i<npar; i++)
132 fOutFile << space << setw(16) << setprecision(8) << pars[i];
137 void TG4GeometryOutputManager::WriteGsrotm(
138 G4int irot, G4double theta1, G4double phi1,
139 G4double theta2, G4double phi2, G4double theta3, G4double phi3)
141 // from fortran (g3routines.F)
143 //+ '(a4,1x,a6,i5,6f11.5)')
144 //+ context, rname, irot, theta1, phi1, theta2, phi2,
148 G4String context("----");
149 G4String rname("GSROTM");
151 fOutFile << context << space
154 << setw(11) << setprecision(5) << theta1
155 << setw(11) << setprecision(5) << phi1
156 << setw(11) << setprecision(5) << theta2
157 << setw(11) << setprecision(5) << phi2
158 << setw(11) << setprecision(5) << theta3
159 << setw(11) << setprecision(5) << phi3
164 void TG4GeometryOutputManager::WriteGsdvn(
165 G4String vname, G4String vmoth, G4int ndiv, G4int iaxis)
167 // from fortran (g3routines.F)
169 //+ '(a4,1x,a6,1x,a4,1x,a4,i5,i3)')
170 //+ context, rname, name, moth, ndiv, iaxis
173 G4String context("----");
174 G4String rname("GSDVN");
176 fOutFile << context << space
186 void TG4GeometryOutputManager::WriteGsdvn2(
187 G4String vname, G4String vmoth, G4int ndiv, G4int iaxis,
188 G4double c0, G4int numed)
190 // from fortran (g3routines.F)
192 //+ '(a4,1x,a6,1x,a4,1x,a4,i5,i3,(1x,e16.8),i5)')
193 //+ context, rname, name, moth, ndiv, iaxis, c0, numed
196 G4String context("----");
197 G4String rname("GSDVN2");
199 fOutFile << context << space
204 << setw(5) << iaxis << " "
205 << setw(16) << setprecision(8) << c0
211 void TG4GeometryOutputManager::WriteGsdvt(
212 G4String vname, G4String vmoth, G4double step, G4int iaxis,
213 G4int numed, G4int ndvmx)
215 // from fortran (g3routines.F)
217 // + '(a4,1x,a6,1x,a4,1x,a4,(1x,e16.8),3i5)')
218 // + context, rname, name, moth, step, iaxis, numed, ndvmx
221 G4String context("----");
222 G4String rname("GSDVT");
224 fOutFile << context << space
228 << setw(16) << setprecision(8) << step
236 void TG4GeometryOutputManager::WriteGsdvt2(
237 G4String vname, G4String vmoth, G4double step, G4int iaxis,
238 G4double c0, G4int numed, G4int ndvmx)
240 // from fortran (g3routines.F)
242 //+ '(a4,1x,a6,1x,a4,1x,a4,(1x,e16.8),i3,(1x,e16.8),2i5)')
243 //+ context, rname, name, moth, step, iaxis, c0, numed, ndvmx
246 G4String context("----");
247 G4String rname("GSDVT2");
249 fOutFile << context << space
253 << setw(16) << setprecision(8) << step
254 << setw(3) << iaxis << space
255 << setw(16) << setprecision(8) << c0
262 void TG4GeometryOutputManager::WriteGsdvx(
263 G4String name, G4String moth, G4int ndiv, G4int iaxis,
264 G4double step, G4double c0, G4int numed, G4int ndvmx)
266 // from fortran (g3routines.F)
268 // + '(a4,1x,a6,1x,a4,1x,a4,i5,i3,2(1x,e16.8),2i5)')
269 // + context, rname, name, moth, ndiv, iaxis,step, c0,
273 G4String context("----");
274 G4String rname("GSDVX");
276 fOutFile << context << space
281 << setw(3) << iaxis << space
282 << setw(16) << setprecision(8) << step << space
283 << setw(16) << setprecision(8) << c0
290 void TG4GeometryOutputManager::WriteGsmate(
291 G4int imate, G4String name, G4double ain, G4double zin,
292 G4double densin, G4double radl, G4int nwbf, G4double* ubuf)
294 // from fortran (g3routines.F)
295 // write(fmt,'(A,I3,A)')
296 //+ '(a4,1x,a6,i5,1x,''"'',a,''"'',4(1x,e16.8),i3,',
297 //+ max(nwbf,1),'(1x,e16.8))'
298 // write(lunlist,fmt)
299 //+ context, rname, imate, name, a, z, dens, radl,
300 //+ nwbf, (ubf(k), k=1,nwbf)
303 G4String context("----");
304 G4String rname("GSMATE");
306 fOutFile << context << space
308 << setw(5) << imate << space
309 << '"' << name << '"' << space
310 << setw(16) << setprecision(8) << ain << space
311 << setw(16) << setprecision(8) << zin << space
312 << setw(16) << setprecision(8) << densin << space
313 << setw(16) << setprecision(8) << radl
315 for (G4int i=0; i<nwbf; i++)
316 fOutFile << space << setw(16) << setprecision(8) << ubuf[i];
321 void TG4GeometryOutputManager::WriteGsmixt(
322 G4int imate, G4String name, G4double* a, G4double* z,
323 G4double dens, G4int nlmat, G4double* wmat)
325 // from fortran (g3routines.F)
326 // write(fmt,'(A,I3,A,I3,A,I3,A)')
327 //+ '(a4,1x,a6,i5,1x,''"'',a,''"'',1x,e16.8,1x,i3,',
329 //+ '(1x,e16.8),',max(nlmata,1),'(1x,e16.8),',
330 //+ max(nlmata,1),'(1x,e16.8))'
331 // write(lunlist,fmt)
332 //+ context, rname, imate, name, dens,
334 //+ (a(k), k=1,abs(nlmat)),
335 //+ (z(k), k=1,abs(nlmat)),
336 //+ (wmat(k), k=1,abs(nlmat))
339 G4String context("----");
340 G4String rname("GSMIXT");
342 fOutFile << context << space
344 << setw(5) << imate << space
345 << '"' << name << '"' << space
346 << setw(16) << setprecision(8) << dens << space
349 for (i=0; i<abs(nlmat); i++)
350 fOutFile << space << setw(16) << setprecision(8) << a[i];
351 for (i=0; i<abs(nlmat); i++)
352 fOutFile << space << setw(16) << setprecision(8) << z[i];
353 for (i=0; i<abs(nlmat); i++)
354 fOutFile << space << setw(16) << setprecision(8) << wmat[i];
359 void TG4GeometryOutputManager::WriteGstmed(
360 G4int itmed, G4String name, G4int nmat, G4int isvol,
361 G4int ifield, G4double fieldm, G4double tmaxfd,
362 G4double stemax, G4double deemax, G4double epsil,
363 G4double stmin, G4double* ubuf, G4int nwbuf)
365 // from fortran (g3routines.F)
366 // write(fmt,'(A,I3,A)')
367 //> '(a4,1x,a6,i5,1x,''"'',a,''"'',3i3,6(1x,e16.8),i3,',
368 //> max(nwbuf,1),'(1x,e16.8))'
369 // write(lunlist,fmt)
370 //+ context, rname, itmed, name, nmat, isvol, ifield, fieldm,
371 //+ tmaxfd, stemax, deemax, epsil, stmin,
372 //+ nwbuf, (ubuf(k),k=1,nwbuf)
375 G4String context("----");
376 G4String rname("GSTMED");
378 fOutFile << context << space
380 << setw(5) << itmed << space
381 << '"' << name << '"'
384 << setw(3) << ifield << space
385 << setw(16) << setprecision(8) << fieldm << space
386 << setw(16) << setprecision(8) << tmaxfd << space
387 << setw(16) << setprecision(8) << stemax << space
388 << setw(16) << setprecision(8) << deemax << space
389 << setw(16) << setprecision(8) << epsil << space
390 << setw(16) << setprecision(8) << stmin << space
392 for (G4int i=0; i<nwbuf; i++)
393 fOutFile << space << setw(16) << setprecision(8) << ubuf[i];
398 void TG4GeometryOutputManager::WriteGstpar(
399 G4int itmed, G4String param, G4double parval)
401 // from fortran (g3routines.F)
403 //+ '(a4,1x,a6,i5,1x,a4,(1x,e16.8))')
404 //+ context, rname, itmed, chpar, parval
407 G4String context("----");
408 G4String rname("GSTPAR");
410 fOutFile << context << space
412 << setw(5) << itmed << space
414 << setw(16) << setprecision(8) << parval
419 void TG4GeometryOutputManager::WriteGgclos()
421 // Writes GGCLOS token
424 G4String context("----");
425 G4String rname("GGCLOS");
427 fOutFile << context << space