4 // See the class description in the header file.
6 #include "TG4XMLConvertor.h"
7 #include "TG4Polycone.h"
8 #include "TG4Polyhedra.h"
11 #include <G4LogicalVolume.hh>
12 #include <G4PVReplica.hh>
13 #include <G4Material.hh>
14 #include <G4VSolid.hh>
20 #include <G4Polycone.hh>
21 #include <G4Polyhedra.hh>
24 #include <g4std/iostream>
25 #include <g4std/iomanip>
27 const G4int TG4XMLConvertor::fgkMaxVolumeNameLength = 10;
28 const G4int TG4XMLConvertor::fgkMaxMaterialNameLength = 20;
30 TG4XMLConvertor::TG4XMLConvertor(G4std::ofstream& outFile)
33 fIndention(fBasicIndention),
39 TG4XMLConvertor::~TG4XMLConvertor() {
45 void TG4XMLConvertor::CutName(G4String& name) const
47 // Removes spaces after the name if present.
50 G4int i = name.length();
51 while (name(--i) == ' ') name = name(0,i);
54 void TG4XMLConvertor::CutName(G4String& name, G4int size) const
56 // Cuts name to given size.
59 if (name.length() > size) name = name(0, size);
62 void TG4XMLConvertor::PutName(G4String& element, G4String name,
65 // Replaces given template in string element with a give name.
71 CutName(name, fgkMaxVolumeNameLength);
72 else if (templ == "!")
73 CutName(name, fgkMaxMaterialNameLength);
75 element.replace(element.find(templ), name.size(), name);
76 element.replace(element.find(templ), 1, "\"");
77 while (element.contains(templ)) element.replace(element.find(templ), 1 , " ");
80 void TG4XMLConvertor::WriteBox(G4String lvName, const G4Box* box,
81 G4String materialName)
83 // Writes G4box solid.
87 G4double x = box->GetXHalfLength()/TG3Units::Length()*2.;
88 G4double y = box->GetYHalfLength()/TG3Units::Length()*2.;
89 G4double z = box->GetZHalfLength()/TG3Units::Length()*2.;
91 // compose element string template
92 G4String quota = "\"";
93 G4String element1 = "<box name=\"" + lvName + quota;
94 G4String element2 = "material=\"" + materialName + quota;
95 G4String element3 = "X_Y_Z=\"";
96 G4String element4 = "\" />";
97 G4String indention = fBasicIndention + fBasicIndention;
100 fOutFile << fBasicIndention << element1 << G4endl
101 << indention << element2 << G4endl
102 << indention << element3
103 << G4std::setw(7) << G4std::setprecision(2) << x << " "
104 << G4std::setw(7) << G4std::setprecision(2) << y << " "
105 << G4std::setw(7) << G4std::setprecision(2) << z
106 << element4 << G4endl << G4endl;
109 void TG4XMLConvertor::WriteTubs(G4String lvName, const G4Tubs* tubs,
110 G4String materialName)
112 // Writes G4tubs solid.
116 G4double rmin = tubs->GetInnerRadius()/TG3Units::Length();
117 G4double rmax = tubs->GetOuterRadius()/TG3Units::Length();
118 G4double hz = tubs->GetZHalfLength()/TG3Units::Length()*2.;
119 G4double sphi = tubs->GetStartPhiAngle()/TG3Units::Angle();
120 G4double dphi = tubs->GetDeltaPhiAngle()/TG3Units::Angle();
122 // compose element string template
123 G4String quota = "\"";
124 G4String element1 = "<tubs name=\"" + lvName + quota;
125 G4String element2 = "material=\"" + materialName + quota;
126 G4String element3 = "profile=\"";
127 G4String element4 = "Rio_Z =\"";
128 G4String element5 = "\" />";
129 G4String indention = fBasicIndention + fBasicIndention;
132 fOutFile << fBasicIndention << element1 << G4endl
133 << indention << element2 << G4endl
134 << indention << element3
135 << G4std::setw(7) << G4std::setprecision(2) << sphi << " "
136 << G4std::setw(7) << G4std::setprecision(2) << sphi+dphi
138 << indention << element4
139 << G4std::setw(7) << G4std::setprecision(2) << rmin << " "
140 << G4std::setw(7) << G4std::setprecision(2) << rmax << " "
141 << G4std::setw(7) << G4std::setprecision(2) << hz
142 << element5 << G4endl << G4endl;
146 void TG4XMLConvertor::WriteCons(G4String lvName, const G4Cons* cons,
147 G4String materialName)
149 // Writes G4cons solid.
153 G4double rmin1 = cons->GetInnerRadiusMinusZ()/TG3Units::Length();
154 G4double rmax1 = cons->GetOuterRadiusMinusZ()/TG3Units::Length();
155 G4double rmin2 = cons->GetInnerRadiusPlusZ()/TG3Units::Length();
156 G4double rmax2 = cons->GetOuterRadiusPlusZ()/TG3Units::Length();
157 G4double hz = cons->GetZHalfLength()/TG3Units::Length()*2.;
158 G4double sphi = cons->GetStartPhiAngle()/TG3Units::Angle();
159 G4double dphi = cons->GetDeltaPhiAngle()/TG3Units::Angle();
161 // compose element string template
162 G4String quota = "\"";
163 G4String element1 = "<cons name=\"" + lvName + quota;
164 G4String element2 = "material=\"" + materialName + quota;
165 G4String element3 = "profile=\"";
166 G4String element4 = "Rio1_Rio2_Z =\"";
167 G4String element5 = "\" />";
168 G4String indention = fBasicIndention + fBasicIndention;
171 fOutFile << fBasicIndention << element1 << G4endl
172 << indention << element2 << G4endl
173 << indention << element3
174 << G4std::setw(7) << G4std::setprecision(2) << sphi << " "
175 << G4std::setw(7) << G4std::setprecision(2) << sphi+dphi
177 << indention << element4
178 << G4std::setw(7) << G4std::setprecision(2) << rmin1 << " "
179 << G4std::setw(7) << G4std::setprecision(2) << rmax1 << " "
180 << G4std::setw(7) << G4std::setprecision(2) << rmin2 << " "
181 << G4std::setw(7) << G4std::setprecision(2) << rmax2 << " "
182 << G4std::setw(7) << G4std::setprecision(2) << hz
183 << element5 << G4endl << G4endl;
187 void TG4XMLConvertor::WriteTrd(G4String lvName, const G4Trd* trd,
188 G4String materialName)
190 // Writes G4Trd solid.
194 G4double x1 = trd->GetXHalfLength1()/TG3Units::Length()*2;
195 G4double x2 = trd->GetXHalfLength2()/TG3Units::Length()*2;
196 G4double y1 = trd->GetYHalfLength1()/TG3Units::Length()*2;
197 G4double y2 = trd->GetYHalfLength2()/TG3Units::Length()*2;
198 G4double hz = trd->GetZHalfLength()/TG3Units::Length()*2;
200 // compose element string template
201 G4String quota = "\"";
202 G4String element1 = "<trd name=\"" + lvName + quota;
203 G4String element2 = "material=\"" + materialName + quota;
204 G4String element3 = "Xmp_Ymp_Z=\"";
205 G4String element4 = "\" />";
206 G4String indention = fBasicIndention + fBasicIndention;
209 fOutFile << fBasicIndention << element1 << G4endl
210 << indention << element2 << G4endl
211 << indention << element3
212 << G4std::setw(7) << G4std::setprecision(2) << x1 << " "
213 << G4std::setw(7) << G4std::setprecision(2) << x2 << " "
214 << G4std::setw(7) << G4std::setprecision(2) << y1 << " "
215 << G4std::setw(7) << G4std::setprecision(2) << y2 << " "
216 << G4std::setw(7) << G4std::setprecision(2) << hz
217 << element4 << G4endl << G4endl;
221 void TG4XMLConvertor::WriteTrap(G4String lvName, const G4Trap* trap,
222 G4String materialName)
224 // Writes G4Trap solid.
228 G4double dz = trap->GetZHalfLength()/TG3Units::Length()*2.;
229 G4ThreeVector symAxis = trap->GetSymAxis();
230 G4double y1 = trap->GetYHalfLength1()/TG3Units::Length()*2.;
231 G4double x1 = trap->GetXHalfLength1()/TG3Units::Length()*2.;
232 G4double x2 = trap->GetXHalfLength2()/TG3Units::Length()*2.;
233 G4double tanAlpha1 = trap->GetTanAlpha1();
234 G4double y2 = trap->GetYHalfLength2()/TG3Units::Length()*2.;
235 G4double x3 = trap->GetXHalfLength3()/TG3Units::Length()*2.;
236 G4double x4 = trap->GetXHalfLength4()/TG3Units::Length()*2.;
237 G4double tanAlpha2 = trap->GetTanAlpha2();
239 // ordering of parameters in XML element
240 // Xmumdpupd_Ymp_Z: 2x2 2x1 2x4 2x3 2y2 2y1 2dz
241 // inclination: atan(symAxis.x/symAxis.z), atan(symAxis.y/symAxis.z)
242 // declination: alpha1, alpha2
245 G4double inc1 = atan(symAxis.x()/symAxis.z()) / deg;
246 G4double inc2 = atan(symAxis.y()/symAxis.z()) / deg;
247 G4double alpha1 = atan(tanAlpha1) / deg;
248 G4double alpha2 = atan(tanAlpha2) / deg;
250 // compose element string template
251 G4String quota = "\"";
252 G4String element1 = "<trap name=\"" + lvName + quota;
253 G4String element2 = "material=\"" + materialName + quota;
254 G4String element3 = "Xmumdpupd_Ymp_Z=\"";
255 G4String element4 = "inclination=\"";
256 G4String element5 = "declination=\"";
257 G4String element6 = "\" />";
258 G4String indention = fBasicIndention + fBasicIndention;
261 fOutFile << fBasicIndention << element1 << G4endl
262 << indention << element2 << G4endl
263 << indention << element3
264 << G4std::setw(7) << G4std::setprecision(2) << x2 << " "
265 << G4std::setw(7) << G4std::setprecision(2) << x1 << " "
266 << G4std::setw(7) << G4std::setprecision(2) << x4 << " "
267 << G4std::setw(7) << G4std::setprecision(2) << x3 << " "
268 << G4std::setw(7) << G4std::setprecision(2) << y2 << " "
269 << G4std::setw(7) << G4std::setprecision(2) << y1 << " "
270 << G4std::setw(7) << G4std::setprecision(2) << dz
272 << indention << element4
273 << G4std::setw(7) << G4std::setprecision(2) << inc1 << " "
274 << G4std::setw(7) << G4std::setprecision(2) << inc2
276 << indention << element5
277 << G4std::setw(7) << G4std::setprecision(2) << alpha1 << " "
278 << G4std::setw(7) << G4std::setprecision(2) << alpha2
279 << element6 << G4endl << G4endl;
282 void TG4XMLConvertor::WritePolycone(G4String lvName, const G4Polycone* polycone,
283 G4String materialName)
285 // Writes G4Polycone solid.
288 // get profile parameters
289 G4double sphi = polycone->GetStartPhi()/TG3Units::Angle();
290 G4double ephi = polycone->GetEndPhi()/TG3Units::Angle();
292 // get polycone Z planes parameters
293 TG4Polycone historicalPolycone = TG4Polycone(*polycone);
295 G4int nofZPlanes = historicalPolycone.GetNofZPlanes();
296 G4double* rminArray = historicalPolycone.GetRmin();
297 G4double* rmaxArray = historicalPolycone.GetRmax();
298 G4double* zArray = historicalPolycone.GetZ();
300 // compose element string template
301 G4String quota = "\"";
302 G4String element1 = "<pcon name=\"" + lvName + quota;
303 G4String element2 = "material=\"" + materialName + quota;
304 G4String element3 = "profile=\"";
305 G4String element4 = "\" >";
306 G4String element5 = "<polyplane Rio_Z=\"";
307 G4String element6 = "\" />";
308 G4String element7 = "</pcon>";
309 G4String indention = fBasicIndention + fBasicIndention;
311 // write pcon element
312 fOutFile << fBasicIndention << element1 << G4endl
313 << indention << element2 << G4endl
314 << indention << element3
315 << G4std::setw(7) << G4std::setprecision(2) << sphi << " "
316 << G4std::setw(7) << G4std::setprecision(2) << ephi
317 << element4 << G4endl;
319 // write polyplane elements
320 for (G4int i=0; i<nofZPlanes; i++) {
323 G4double rmin = rminArray[i]/TG3Units::Length();
324 G4double rmax = rmaxArray[i]/TG3Units::Length();
325 G4double z = zArray[i]/TG3Units::Length();
327 fOutFile << indention << element5
328 << G4std::setw(7) << G4std::setprecision(2) << rmin << " "
329 << G4std::setw(7) << G4std::setprecision(2) << rmax << " "
330 << G4std::setw(7) << G4std::setprecision(2) << z
335 // close pcon element
336 fOutFile << fBasicIndention
337 << element7 << G4endl << G4endl;
341 void TG4XMLConvertor::WritePolyhedra(G4String lvName, const G4Polyhedra* polyhedra,
342 G4String materialName)
344 // Writes G4Polycone solid.
348 G4int nofSides = polyhedra->GetNumSide();
349 G4double sphi = polyhedra->GetStartPhi()/TG3Units::Angle();
350 G4double ephi = polyhedra->GetEndPhi()/TG3Units::Angle();
352 // get polyhedra Z planes parameters
353 TG4Polyhedra historicalPolyhedra = TG4Polyhedra(*polyhedra);
355 G4int nofZPlanes = historicalPolyhedra.GetNofZPlanes();
356 G4double* rminArray = historicalPolyhedra.GetRmin();
357 G4double* rmaxArray = historicalPolyhedra.GetRmax();
358 G4double* zArray = historicalPolyhedra.GetZ();
360 // compose element string template
361 G4String quota = "\"";
362 G4String element1 = "<phedra name=\"" + lvName + quota;
363 G4String element2 = "material=\"" + materialName + quota;
364 G4String element3 = "profile=\"";
365 G4String element4 = "sides =\"";
366 G4String element5 = "Ris=\"";
367 G4String element6 = "Ros=\"";
368 G4String element7 = "Zs =\"";
369 G4String element8 = "\" />";
370 G4String indention = fBasicIndention + fBasicIndention;
373 fOutFile << fBasicIndention << element1 << G4endl
374 << indention << element2 << G4endl
375 << indention << element3
376 << G4std::setw(7) << G4std::setprecision(2) << sphi << " "
377 << G4std::setw(7) << G4std::setprecision(2) << ephi
379 << indention << element4
383 fOutFile << indention << element5;
385 for (i=0; i<nofZPlanes; i++) {
387 G4double rmin = rminArray[i]/TG3Units::Length();
388 if (i>0) fOutFile << " ";
389 fOutFile << G4std::setw(7) << G4std::setprecision(2) << rmin;
391 fOutFile << quota << G4endl;
393 fOutFile << indention << element6;
394 for (i=0; i<nofZPlanes; i++) {
396 G4double rmax = rmaxArray[i]/TG3Units::Length();
397 if (i>0) fOutFile << " ";
398 fOutFile << G4std::setw(7) << G4std::setprecision(2) << rmax;
400 fOutFile << quota << G4endl;
402 fOutFile << indention << element7;
403 for (i=0; i<nofZPlanes; i++) {
405 G4double z = zArray[i]/TG3Units::Length();
406 if (i>0) fOutFile << " ";
407 fOutFile << G4std::setw(7) << G4std::setprecision(2) << z;
409 fOutFile << element8 << G4endl << G4endl;
415 void TG4XMLConvertor::OpenMaterials(const G4String& version,
416 const G4String& date, const G4String& author,
417 const G4String dtdVersion)
419 // Writes section opening.
422 G4String element1 = "<materials version = \"";
423 G4String element2 = " date = \"";
424 G4String element3 = " author = \"";
425 G4String element4 = " DTD_version=\"";
426 G4String element5 = " >";
427 G4String quota = "\"";
430 fOutFile << element1 << version << quota << G4endl
431 << element2 << date << quota << G4endl
432 << element3 << author << quota << G4endl
433 << element4 << dtdVersion << quota
434 << element5 << G4endl;
437 void TG4XMLConvertor::OpenSection(const G4String& name, const G4String& version,
438 const G4String& date, const G4String& author,
439 const G4String& topVolume)
441 // Writes section opening.
444 G4String element1 = "<section name = \"";
445 G4String element2 = " version = \"";
446 G4String element3 = " date = \"";
447 G4String element4 = " author = \"";
448 G4String element5 = " topVolume = \"";
449 G4String element6 = " >";
450 G4String quota = "\"";
453 fOutFile << element1 << name << quota << G4endl
454 << element2 << version << quota << G4endl
455 << element3 << date << quota << G4endl
456 << element4 << author << quota << G4endl
457 << element5 << topVolume << quota
458 << element6 << G4endl;
461 void TG4XMLConvertor::OpenComposition(const G4String& name)
463 // Writes composition opening.
466 G4String element = "<composition name=\"";
467 element.append(name);
468 element.append("\">");
471 fOutFile << fIndention
475 // increase indention
479 void TG4XMLConvertor::CloseMaterials()
481 // Writes materials closing.
485 G4String element = "</materials>";
492 void TG4XMLConvertor::CloseSection()
494 // Writes section closing.
498 G4String element = "</section>";
505 void TG4XMLConvertor::CloseComposition()
507 // Writes composition closing.
510 // decrease indention
514 G4String element = "</composition>";
517 fOutFile << fIndention
522 void TG4XMLConvertor::WriteMaterial(const G4Material* material)
524 // Writes G4Material.
525 // Not yet implemented, only XML comment element is written.
528 G4String name = material->GetName();
532 G4String element1 = "<!-- material = \"";
533 G4String element2 = "\" -->";
536 fOutFile << fBasicIndention
542 void TG4XMLConvertor::WriteSolid(G4String lvName, const G4VSolid* solid,
543 G4String materialName)
545 // Finds G4Solid concrete type and calls writing function.
546 // For not yet implemented solids, only XML comment element is written.
549 // to be removed when materials are supported
550 materialName = "Hydrogen";
552 const G4Box* box = dynamic_cast<const G4Box*>(solid);
554 WriteBox(lvName, box, materialName);
558 const G4Tubs* tubs = dynamic_cast<const G4Tubs*>(solid);
560 WriteTubs(lvName, tubs, materialName);
564 const G4Cons* cons = dynamic_cast<const G4Cons*>(solid);
566 WriteCons(lvName, cons, materialName);
570 const G4Trd* trd = dynamic_cast<const G4Trd*>(solid);
572 WriteTrd(lvName, trd, materialName);
576 const G4Trap* trap = dynamic_cast<const G4Trap*>(solid);
578 WriteTrap(lvName, trap, materialName);
582 const G4Polycone* polycone = dynamic_cast<const G4Polycone*>(solid);
584 WritePolycone(lvName, polycone, materialName);
588 const G4Polyhedra* polyhedra = dynamic_cast<const G4Polyhedra*>(solid);
590 WritePolyhedra(lvName, polyhedra, materialName);
594 // write comment line in case of unsupported
598 G4String element1 = "<!-- unsupported shape name= \"";
599 G4String element2 = "\" -->";
602 fOutFile << fBasicIndention
603 << element1 << lvName
608 void TG4XMLConvertor::WriteRotation(const G4RotationMatrix* rotation)
610 // Writes G4RotationMatrix.
611 // Not yet implemented, only XML comment element is written.
614 // return if this rotation was already written
615 G4int nofRotations = fRotations.size();
617 for (G4int i=0; i<nofRotations; i++)
618 if (fRotations[i] == rotation) return;
620 fRotations.push_back(rotation);
624 G4double xx = rotation->xx();
625 G4double xy = rotation->xy();
626 G4double xz = rotation->xz();
627 G4double yx = rotation->yx();
628 G4double yy = rotation->yy();
629 G4double yz = rotation->yz();
630 G4double zx = rotation->zx();
631 G4double zy = rotation->zy();
632 G4double zz = rotation->zz();
634 TG4Globals::AppendNumberToString(id, ++fRotationCounter);
636 // compose element string template
637 G4String quota = "\"\n";
638 G4String element1 = "<rot_matrix id=\"####### XX_XY_XZ=\"";
639 G4String element2 = " YX_YY_YZ=\"";
640 G4String element3 = " ZX_ZY_ZZ=\"";
641 G4String element4 = "\" />";
644 PutName(element1, id, "#");
647 fOutFile << fBasicIndention
649 << G4std::setw(8) << G4std::setprecision(5) << xx << " "
650 << G4std::setw(8) << G4std::setprecision(5) << xy << " "
651 << G4std::setw(8) << G4std::setprecision(5) << xz << quota
654 << G4std::setw(8) << G4std::setprecision(5) << yx << " "
655 << G4std::setw(8) << G4std::setprecision(5) << yy << " "
656 << G4std::setw(8) << G4std::setprecision(5) << yz << quota
659 << G4std::setw(8) << G4std::setprecision(5) << zx << " "
660 << G4std::setw(8) << G4std::setprecision(5) << zy << " "
661 << G4std::setw(8) << G4std::setprecision(5) << zz
666 void TG4XMLConvertor::WritePosition(G4String lvName, G4ThreeVector position)
668 // Writes position without rotation with a given solid name.
672 G4double x = position.x()/TG3Units::Length();
673 G4double y = position.y()/TG3Units::Length();
674 G4double z = position.z()/TG3Units::Length();
676 // compose element string template
677 G4String element1 = "<posXYZ volume=\"########### X_Y_Z=\"";
678 G4String element2 = "\" />";
681 PutName(element1, lvName, "#");
684 fOutFile << fIndention
686 << G4std::setw(8) << G4std::setprecision(2) << x << " "
687 << G4std::setw(8) << G4std::setprecision(2) << y << " "
688 << G4std::setw(8) << G4std::setprecision(2) << z
693 void TG4XMLConvertor::WritePositionWithRotation(
694 G4String lvName, G4ThreeVector position,
695 const G4RotationMatrix* rotation)
697 // Writes position with rotation with a given solid name.
698 // Not yet implemented, only XML comment element is written.
702 G4double x = position.x()/TG3Units::Length();
703 G4double y = position.y()/TG3Units::Length();
704 G4double z = position.z()/TG3Units::Length();
705 G4double xx = rotation->xx();
706 G4double xy = rotation->xy();
707 G4double xz = rotation->xz();
708 G4double yx = rotation->yx();
709 G4double yy = rotation->yy();
710 G4double yz = rotation->yz();
711 G4double zx = rotation->zx();
712 G4double zy = rotation->zy();
713 G4double zz = rotation->zz();
718 while (i<fRotations.size() && fRotations[i] != rotation) i++;
719 if (i==fRotations.size()) {
720 G4String text = "TG4XMLConvertor::WritePositionWithRotation: ";
721 text = text + " Unknown rotation - fatal error.";
722 TG4Globals::Exception(text);
725 TG4Globals::AppendNumberToString(id, i);
728 // compose element string template
729 G4String quota = "\"\n";
730 G4String element1 = "<transform volume=\"########### pos=\"";
731 G4String element2 = " rot=\"";
732 G4String element3 = " ";
733 G4String element4 = "\" />";
736 PutName(element1, lvName, "#");
739 fOutFile << fIndention
741 << G4std::setw(8) << G4std::setprecision(2) << x << " "
742 << G4std::setw(8) << G4std::setprecision(2) << y << " "
743 << G4std::setw(8) << G4std::setprecision(2) << z << quota
746 << G4std::setw(8) << G4std::setprecision(5) << xx << " "
747 << G4std::setw(8) << G4std::setprecision(5) << xy << " "
748 << G4std::setw(8) << G4std::setprecision(5) << xz << G4endl
751 << G4std::setw(8) << G4std::setprecision(5) << yx << " "
752 << G4std::setw(8) << G4std::setprecision(5) << yy << " "
753 << G4std::setw(8) << G4std::setprecision(5) << yz << G4endl
756 << G4std::setw(8) << G4std::setprecision(5) << zx << " "
757 << G4std::setw(8) << G4std::setprecision(5) << zy << " "
758 << G4std::setw(8) << G4std::setprecision(5) << zz
763 void TG4XMLConvertor::WriteReplica(G4String lvName, G4PVReplica* pvr)
765 // Writes position without rotation with a given solid name.
774 pvr->GetReplicationData(axis, nReplicas, width, offset, consuming);
778 case kXAxis: tag = "X"; break;
779 case kYAxis: tag = "Y"; break;
780 case kZAxis: tag = "Z"; break;
781 case kRho: tag = "R"; break;
782 case kPhi: tag = "Phi"; break;
786 G4double value0 = offset;
787 G4double dValue = width;
789 value0 = value0/TG3Units::Length();
790 dValue = dValue/TG3Units::Length();
793 value0 = value0/TG3Units::Angle();
794 dValue = dValue/TG3Units::Angle();
797 // set tag and attributes names
798 G4String a0 = "mpos"; a0 = a0 + tag;
799 G4String a1 = tag; a1 = a1 + "0";
800 G4String a2 = "d"; a2 = a2 + tag;
802 // compose element string template
803 G4String element1 = "<" + a0 + " volume=\"########### ncopy=\"";
804 G4String element2 = "\" " + a1 + "=\"";
805 G4String element3 = "\" " + a2 + "=\"";
806 G4String element4 = "\" />";
809 PutName(element1, lvName, "#");
812 fOutFile << fIndention
814 << G4std::setw(8) << G4std::setprecision(2) << nReplicas
816 << G4std::setw(8) << G4std::setprecision(2) << value0
818 << G4std::setw(8) << G4std::setprecision(2) << dValue
823 void TG4XMLConvertor::WriteEmptyLine()
825 // Writes empty line.
831 void TG4XMLConvertor::IncreaseIndention()
833 // increase indention
834 fIndention.append(fBasicIndention);
837 void TG4XMLConvertor::DecreaseIndention()
839 // decrease indention
840 fIndention.replace(fIndention.find(fBasicIndention), 3 , "");