4 // Author: I. Hrivnacova
6 // Class TG4GeometryOutputManager
7 // ------------------------------
8 // See the class description in the header file.
10 #include "TG4GeometryOutputManager.h"
11 #include <g4std/iostream>
12 #include <g4std/iomanip>
14 //_____________________________________________________________________________
15 TG4GeometryOutputManager::TG4GeometryOutputManager() {
19 //_____________________________________________________________________________
20 TG4GeometryOutputManager::~TG4GeometryOutputManager() {
26 //_____________________________________________________________________________
27 void TG4GeometryOutputManager::OpenFile(G4String filePath)
29 // Opens output files.
32 G4cout << "TG4GeometryOutputManager::OpenFile: " << filePath << G4endl;
34 //fOutFile.open(filePath, ios::out, filebuf::openprot);
35 fOutFile.open(filePath, G4std::ios::out); //, G4std::filebuf::openprot);
38 G4String text = "Cannot open ";
39 text = text + filePath;
40 TG4Globals::Warning(text);
43 // use FORTRAN compatibility output
44 fOutFile << G4std::setiosflags(G4std::ios::showpoint | G4std::ios::uppercase);
48 //_____________________________________________________________________________
49 void TG4GeometryOutputManager::CloseFile()
51 // Closes output files.
58 //_____________________________________________________________________________
59 void TG4GeometryOutputManager::WriteGsvolu(
60 G4String vname, G4String shape, G4int nmed, G4double* Rpar,
63 // from fortran (g3routines.F)
64 // write(fmt,'(A,I2,A)')'(a4,1x,a6,1x,a4,1x,a4,2i5,',max(npar,1),
66 // write(lunlist,fmt) context, rname, name, shape, nmed, npar,
70 G4String context("----");
71 G4String rname("GSVOLU");
73 fOutFile << context << space
77 << G4std::setw(5) << nmed
78 << G4std::setw(5) << npar;
79 for (G4int i=0; i<npar; i++)
80 fOutFile << space << G4std::setw(16) << G4std::setprecision(8) << Rpar[i];
84 //_____________________________________________________________________________
85 void TG4GeometryOutputManager::WriteGspos(
86 G4String vname, G4int num, G4String vmoth, G4double x,
87 G4double y, G4double z, G4int irot, G4String vonly)
89 // from fortran (g3routines.F)
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
95 G4String context("----");
96 G4String rname("GSPOS");
98 fOutFile << context << space
101 << G4std::setw(5) << num << space
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
111 //_____________________________________________________________________________
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)
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,
124 //+ (par(k),k=1,npar)
127 G4String context("----");
128 G4String rname("GSPOSP");
130 fOutFile << context << space
133 << G4std::setw(5) << num << space
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
140 << G4std::setw(5) << npar;
141 for (G4int i=0; i<npar; i++)
142 fOutFile << space << G4std::setw(16) << G4std::setprecision(8) << pars[i];
146 //_____________________________________________________________________________
147 void TG4GeometryOutputManager::WriteGsrotm(
148 G4int irot, G4double theta1, G4double phi1,
149 G4double theta2, G4double phi2, G4double theta3, G4double phi3)
151 // from fortran (g3routines.F)
153 //+ '(a4,1x,a6,i5,6f11.5)')
154 //+ context, rname, irot, theta1, phi1, theta2, phi2,
158 G4String context("----");
159 G4String rname("GSROTM");
161 fOutFile << context << space
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
173 //_____________________________________________________________________________
174 void TG4GeometryOutputManager::WriteGsdvn(
175 G4String vname, G4String vmoth, G4int ndiv, G4int iaxis)
177 // from fortran (g3routines.F)
179 //+ '(a4,1x,a6,1x,a4,1x,a4,i5,i3)')
180 //+ context, rname, name, moth, ndiv, iaxis
183 G4String context("----");
184 G4String rname("GSDVN");
186 fOutFile << context << space
190 << G4std::setw(5) << ndiv
191 << G4std::setw(5) << iaxis
195 //_____________________________________________________________________________
196 void TG4GeometryOutputManager::WriteGsdvn2(
197 G4String vname, G4String vmoth, G4int ndiv, G4int iaxis,
198 G4double c0, G4int numed)
200 // from fortran (g3routines.F)
202 //+ '(a4,1x,a6,1x,a4,1x,a4,i5,i3,(1x,e16.8),i5)')
203 //+ context, rname, name, moth, ndiv, iaxis, c0, numed
206 G4String context("----");
207 G4String rname("GSDVN2");
209 fOutFile << context << space
213 << G4std::setw(5) << ndiv
214 << G4std::setw(5) << iaxis << " "
215 << G4std::setw(16) << G4std::setprecision(8) << c0
216 << G4std::setw(5) << numed
220 //_____________________________________________________________________________
221 void TG4GeometryOutputManager::WriteGsdvt(
222 G4String vname, G4String vmoth, G4double step, G4int iaxis,
223 G4int numed, G4int ndvmx)
225 // from fortran (g3routines.F)
227 // + '(a4,1x,a6,1x,a4,1x,a4,(1x,e16.8),3i5)')
228 // + context, rname, name, moth, step, iaxis, numed, ndvmx
231 G4String context("----");
232 G4String rname("GSDVT");
234 fOutFile << context << space
238 << G4std::setw(16) << G4std::setprecision(8) << step
239 << G4std::setw(5) << iaxis
240 << G4std::setw(5) << numed
241 << G4std::setw(5) << ndvmx
245 //_____________________________________________________________________________
246 void TG4GeometryOutputManager::WriteGsdvt2(
247 G4String vname, G4String vmoth, G4double step, G4int iaxis,
248 G4double c0, G4int numed, G4int ndvmx)
250 // from fortran (g3routines.F)
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
256 G4String context("----");
257 G4String rname("GSDVT2");
259 fOutFile << context << space
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
271 //_____________________________________________________________________________
272 void TG4GeometryOutputManager::WriteGsdvx(
273 G4String name, G4String moth, G4int ndiv, G4int iaxis,
274 G4double step, G4double c0, G4int numed, G4int ndvmx)
276 // from fortran (g3routines.F)
278 // + '(a4,1x,a6,1x,a4,1x,a4,i5,i3,2(1x,e16.8),2i5)')
279 // + context, rname, name, moth, ndiv, iaxis,step, c0,
283 G4String context("----");
284 G4String rname("GSDVX");
286 fOutFile << context << space
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
299 //_____________________________________________________________________________
300 void TG4GeometryOutputManager::WriteGsmate(
301 G4int imate, G4String name, G4double ain, G4double zin,
302 G4double densin, G4double radl, G4int nwbf, G4double* ubuf)
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)
313 G4String context("----");
314 G4String rname("GSMATE");
316 fOutFile << context << space
318 << G4std::setw(5) << imate << space
319 << '"' << name << '"' << space
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;
325 for (G4int i=0; i<nwbf; i++)
326 fOutFile << space << G4std::setw(16) << G4std::setprecision(8) << ubuf[i];
330 //_____________________________________________________________________________
331 void TG4GeometryOutputManager::WriteGsmixt(
332 G4int imate, G4String name, G4double* a, G4double* z,
333 G4double dens, G4int nlmat, G4double* wmat)
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,',
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,
344 //+ (a(k), k=1,abs(nlmat)),
345 //+ (z(k), k=1,abs(nlmat)),
346 //+ (wmat(k), k=1,abs(nlmat))
349 G4String context("----");
350 G4String rname("GSMIXT");
352 fOutFile << context << space
354 << G4std::setw(5) << imate << space
355 << '"' << name << '"' << space
356 << G4std::setw(16) << G4std::setprecision(8) << dens << space
357 << G4std::setw(3) << nlmat;
359 for (i=0; i<abs(nlmat); i++)
360 fOutFile << space << G4std::setw(16) << G4std::setprecision(8) << a[i];
361 for (i=0; i<abs(nlmat); i++)
362 fOutFile << space << G4std::setw(16) << G4std::setprecision(8) << z[i];
363 for (i=0; i<abs(nlmat); i++)
364 fOutFile << space << G4std::setw(16) << G4std::setprecision(8) << wmat[i];
368 //_____________________________________________________________________________
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)
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)
385 G4String context("----");
386 G4String rname("GSTMED");
388 fOutFile << context << space
390 << G4std::setw(5) << itmed << space
391 << '"' << name << '"'
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;
402 for (G4int i=0; i<nwbuf; i++)
403 fOutFile << space << G4std::setw(16) << G4std::setprecision(8) << ubuf[i];
407 //_____________________________________________________________________________
408 void TG4GeometryOutputManager::WriteGstpar(
409 G4int itmed, G4String param, G4double parval)
411 // from fortran (g3routines.F)
413 //+ '(a4,1x,a6,i5,1x,a4,(1x,e16.8))')
414 //+ context, rname, itmed, chpar, parval
417 G4String context("----");
418 G4String rname("GSTPAR");
420 fOutFile << context << space
422 << G4std::setw(5) << itmed << space
424 << G4std::setw(16) << G4std::setprecision(8) << parval
428 //_____________________________________________________________________________
429 void TG4GeometryOutputManager::WriteGgclos()
431 // Writes GGCLOS token
434 G4String context("----");
435 G4String rname("GGCLOS");
437 fOutFile << context << space