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