4 // See the class description in the header file.
6 #include "TG4XMLConvertor.h"
7 #include "TG4Polycone.h"
8 #include "TG4Polyhedra.h"
11 #include <G4PVReplica.hh>
12 #include <G4Material.hh>
13 #include <G4VSolid.hh>
19 #include <G4Polycone.hh>
20 #include <G4Polyhedra.hh>
22 #include <g4std/iostream>
23 #include <g4std/iomanip>
25 const G4int TG4XMLConvertor::fgkMaxVolumeNameLength = 10;
26 const G4int TG4XMLConvertor::fgkMaxMaterialNameLength = 20;
28 TG4XMLConvertor::TG4XMLConvertor(G4std::ofstream& outFile)
30 fkBasicIndention(" "),
31 fIndention(fkBasicIndention),
37 TG4XMLConvertor::~TG4XMLConvertor() {
43 void TG4XMLConvertor::CutName(G4String& name) const
45 // Removes spaces after the name if present.
48 G4int i = name.length();
49 while (name(--i) == ' ') name = name(0,i);
52 void TG4XMLConvertor::CutName(G4String& name, G4int size) const
54 // Cuts name to given size.
57 if (name.length() > size) name = name(0, size);
60 void TG4XMLConvertor::PutName(G4String& element, G4String name,
63 // Replaces given template in string element with a give name.
69 CutName(name, fgkMaxVolumeNameLength);
70 else if (templ == "!")
71 CutName(name, fgkMaxMaterialNameLength);
73 element.replace(element.find(templ), name.size(), name);
74 element.replace(element.find(templ), 1, "\"");
75 while (element.contains(templ)) element.replace(element.find(templ), 1 , " ");
78 void TG4XMLConvertor::WriteBox(G4String lvName, const G4Box* box,
79 G4String materialName)
81 // Writes G4box solid.
85 G4double x = box->GetXHalfLength()/TG3Units::Length()*2.;
86 G4double y = box->GetYHalfLength()/TG3Units::Length()*2.;
87 G4double z = box->GetZHalfLength()/TG3Units::Length()*2.;
89 // compose element string template
90 G4String quota = "\"";
91 G4String element1 = "<box name=\"" + lvName + quota;
92 G4String element2 = "material=\"" + materialName + quota;
93 G4String element3 = "X_Y_Z=\"";
94 G4String element4 = "\" />";
95 G4String indention = fkBasicIndention + fkBasicIndention;
98 fOutFile << fkBasicIndention << element1 << G4endl
99 << indention << element2 << G4endl
100 << indention << element3
101 << G4std::setw(7) << G4std::setprecision(2) << x << " "
102 << G4std::setw(7) << G4std::setprecision(2) << y << " "
103 << G4std::setw(7) << G4std::setprecision(2) << z
104 << element4 << G4endl << G4endl;
107 void TG4XMLConvertor::WriteTubs(G4String lvName, const G4Tubs* tubs,
108 G4String materialName)
110 // Writes G4tubs solid.
114 G4double rmin = tubs->GetInnerRadius()/TG3Units::Length();
115 G4double rmax = tubs->GetOuterRadius()/TG3Units::Length();
116 G4double hz = tubs->GetZHalfLength()/TG3Units::Length()*2.;
117 G4double sphi = tubs->GetStartPhiAngle()/TG3Units::Angle();
118 G4double dphi = tubs->GetDeltaPhiAngle()/TG3Units::Angle();
120 // compose element string template
121 G4String quota = "\"";
122 G4String element1 = "<tubs name=\"" + lvName + quota;
123 G4String element2 = "material=\"" + materialName + quota;
124 G4String element3 = "profile=\"";
125 G4String element4 = "Rio_Z =\"";
126 G4String element5 = "\" />";
127 G4String indention = fkBasicIndention + fkBasicIndention;
130 fOutFile << fkBasicIndention << element1 << G4endl
131 << indention << element2 << G4endl
132 << indention << element3
133 << G4std::setw(7) << G4std::setprecision(2) << sphi << " "
134 << G4std::setw(7) << G4std::setprecision(2) << sphi+dphi
136 << indention << element4
137 << G4std::setw(7) << G4std::setprecision(2) << rmin << " "
138 << G4std::setw(7) << G4std::setprecision(2) << rmax << " "
139 << G4std::setw(7) << G4std::setprecision(2) << hz
140 << element5 << G4endl << G4endl;
144 void TG4XMLConvertor::WriteCons(G4String lvName, const G4Cons* cons,
145 G4String materialName)
147 // Writes G4cons solid.
151 G4double rmin1 = cons->GetInnerRadiusMinusZ()/TG3Units::Length();
152 G4double rmax1 = cons->GetOuterRadiusMinusZ()/TG3Units::Length();
153 G4double rmin2 = cons->GetInnerRadiusPlusZ()/TG3Units::Length();
154 G4double rmax2 = cons->GetOuterRadiusPlusZ()/TG3Units::Length();
155 G4double hz = cons->GetZHalfLength()/TG3Units::Length()*2.;
156 G4double sphi = cons->GetStartPhiAngle()/TG3Units::Angle();
157 G4double dphi = cons->GetDeltaPhiAngle()/TG3Units::Angle();
159 // compose element string template
160 G4String quota = "\"";
161 G4String element1 = "<cons name=\"" + lvName + quota;
162 G4String element2 = "material=\"" + materialName + quota;
163 G4String element3 = "profile=\"";
164 G4String element4 = "Rio1_Rio2_Z =\"";
165 G4String element5 = "\" />";
166 G4String indention = fkBasicIndention + fkBasicIndention;
169 fOutFile << fkBasicIndention << element1 << G4endl
170 << indention << element2 << G4endl
171 << indention << element3
172 << G4std::setw(7) << G4std::setprecision(2) << sphi << " "
173 << G4std::setw(7) << G4std::setprecision(2) << sphi+dphi
175 << indention << element4
176 << G4std::setw(7) << G4std::setprecision(2) << rmin1 << " "
177 << G4std::setw(7) << G4std::setprecision(2) << rmax1 << " "
178 << G4std::setw(7) << G4std::setprecision(2) << rmin2 << " "
179 << G4std::setw(7) << G4std::setprecision(2) << rmax2 << " "
180 << G4std::setw(7) << G4std::setprecision(2) << hz
181 << element5 << G4endl << G4endl;
185 void TG4XMLConvertor::WriteTrd(G4String lvName, const G4Trd* trd,
186 G4String materialName)
188 // Writes G4Trd solid.
192 G4double x1 = trd->GetXHalfLength1()/TG3Units::Length()*2;
193 G4double x2 = trd->GetXHalfLength2()/TG3Units::Length()*2;
194 G4double y1 = trd->GetYHalfLength1()/TG3Units::Length()*2;
195 G4double y2 = trd->GetYHalfLength2()/TG3Units::Length()*2;
196 G4double hz = trd->GetZHalfLength()/TG3Units::Length()*2;
198 // compose element string template
199 G4String quota = "\"";
200 G4String element1 = "<trd name=\"" + lvName + quota;
201 G4String element2 = "material=\"" + materialName + quota;
202 G4String element3 = "Xmp_Ymp_Z=\"";
203 G4String element4 = "\" />";
204 G4String indention = fkBasicIndention + fkBasicIndention;
207 fOutFile << fkBasicIndention << element1 << G4endl
208 << indention << element2 << G4endl
209 << indention << element3
210 << G4std::setw(7) << G4std::setprecision(2) << x1 << " "
211 << G4std::setw(7) << G4std::setprecision(2) << x2 << " "
212 << G4std::setw(7) << G4std::setprecision(2) << y1 << " "
213 << G4std::setw(7) << G4std::setprecision(2) << y2 << " "
214 << G4std::setw(7) << G4std::setprecision(2) << hz
215 << element4 << G4endl << G4endl;
219 void TG4XMLConvertor::WriteTrap(G4String lvName, const G4Trap* trap,
220 G4String materialName)
222 // Writes G4Trap solid.
226 G4double dz = trap->GetZHalfLength()/TG3Units::Length()*2.;
227 G4ThreeVector symAxis = trap->GetSymAxis();
228 G4double y1 = trap->GetYHalfLength1()/TG3Units::Length()*2.;
229 G4double x1 = trap->GetXHalfLength1()/TG3Units::Length()*2.;
230 G4double x2 = trap->GetXHalfLength2()/TG3Units::Length()*2.;
231 G4double tanAlpha1 = trap->GetTanAlpha1();
232 G4double y2 = trap->GetYHalfLength2()/TG3Units::Length()*2.;
233 G4double x3 = trap->GetXHalfLength3()/TG3Units::Length()*2.;
234 G4double x4 = trap->GetXHalfLength4()/TG3Units::Length()*2.;
235 G4double tanAlpha2 = trap->GetTanAlpha2();
237 // ordering of parameters in XML element
238 // Xmumdpupd_Ymp_Z: 2x2 2x1 2x4 2x3 2y2 2y1 2dz
239 // inclination: atan(symAxis.x/symAxis.z), atan(symAxis.y/symAxis.z)
240 // declination: alpha1, alpha2
243 G4double inc1 = atan(symAxis.x()/symAxis.z()) / deg;
244 G4double inc2 = atan(symAxis.y()/symAxis.z()) / deg;
245 G4double alpha1 = atan(tanAlpha1) / deg;
246 G4double alpha2 = atan(tanAlpha2) / deg;
248 // compose element string template
249 G4String quota = "\"";
250 G4String element1 = "<trap name=\"" + lvName + quota;
251 G4String element2 = "material=\"" + materialName + quota;
252 G4String element3 = "Xmumdpupd_Ymp_Z=\"";
253 G4String element4 = "inclination=\"";
254 G4String element5 = "declination=\"";
255 G4String element6 = "\" />";
256 G4String indention = fkBasicIndention + fkBasicIndention;
259 fOutFile << fkBasicIndention << element1 << G4endl
260 << indention << element2 << G4endl
261 << indention << element3
262 << G4std::setw(7) << G4std::setprecision(2) << x2 << " "
263 << G4std::setw(7) << G4std::setprecision(2) << x1 << " "
264 << G4std::setw(7) << G4std::setprecision(2) << x4 << " "
265 << G4std::setw(7) << G4std::setprecision(2) << x3 << " "
266 << G4std::setw(7) << G4std::setprecision(2) << y2 << " "
267 << G4std::setw(7) << G4std::setprecision(2) << y1 << " "
268 << G4std::setw(7) << G4std::setprecision(2) << dz
270 << indention << element4
271 << G4std::setw(7) << G4std::setprecision(2) << inc1 << " "
272 << G4std::setw(7) << G4std::setprecision(2) << inc2
274 << indention << element5
275 << G4std::setw(7) << G4std::setprecision(2) << alpha1 << " "
276 << G4std::setw(7) << G4std::setprecision(2) << alpha2
277 << element6 << G4endl << G4endl;
280 void TG4XMLConvertor::WritePolycone(G4String lvName, const G4Polycone* polycone,
281 G4String materialName)
283 // Writes G4Polycone solid.
286 // get profile parameters
287 G4double sphi = polycone->GetStartPhi()/TG3Units::Angle();
288 G4double ephi = polycone->GetEndPhi()/TG3Units::Angle();
290 // get polycone Z planes parameters
291 TG4Polycone historicalPolycone = TG4Polycone(*polycone);
293 G4int nofZPlanes = historicalPolycone.GetNofZPlanes();
294 G4double* rminArray = historicalPolycone.GetRmin();
295 G4double* rmaxArray = historicalPolycone.GetRmax();
296 G4double* zArray = historicalPolycone.GetZ();
298 // compose element string template
299 G4String quota = "\"";
300 G4String element1 = "<pcon name=\"" + lvName + quota;
301 G4String element2 = "material=\"" + materialName + quota;
302 G4String element3 = "profile=\"";
303 G4String element4 = "\" >";
304 G4String element5 = "<polyplane Rio_Z=\"";
305 G4String element6 = "\" />";
306 G4String element7 = "</pcon>";
307 G4String indention = fkBasicIndention + fkBasicIndention;
309 // write pcon element
310 fOutFile << fkBasicIndention << element1 << G4endl
311 << indention << element2 << G4endl
312 << indention << element3
313 << G4std::setw(7) << G4std::setprecision(2) << sphi << " "
314 << G4std::setw(7) << G4std::setprecision(2) << ephi
315 << element4 << G4endl;
317 // write polyplane elements
318 for (G4int i=0; i<nofZPlanes; i++) {
321 G4double rmin = rminArray[i]/TG3Units::Length();
322 G4double rmax = rmaxArray[i]/TG3Units::Length();
323 G4double z = zArray[i]/TG3Units::Length();
325 fOutFile << indention << element5
326 << G4std::setw(7) << G4std::setprecision(2) << rmin << " "
327 << G4std::setw(7) << G4std::setprecision(2) << rmax << " "
328 << G4std::setw(7) << G4std::setprecision(2) << z
333 // close pcon element
334 fOutFile << fkBasicIndention
335 << element7 << G4endl << G4endl;
339 void TG4XMLConvertor::WritePolyhedra(G4String lvName, const G4Polyhedra* polyhedra,
340 G4String materialName)
342 // Writes G4Polycone solid.
346 G4int nofSides = polyhedra->GetNumSide();
347 G4double sphi = polyhedra->GetStartPhi()/TG3Units::Angle();
348 G4double ephi = polyhedra->GetEndPhi()/TG3Units::Angle();
350 // get polyhedra Z planes parameters
351 TG4Polyhedra historicalPolyhedra = TG4Polyhedra(*polyhedra);
353 G4int nofZPlanes = historicalPolyhedra.GetNofZPlanes();
354 G4double* rminArray = historicalPolyhedra.GetRmin();
355 G4double* rmaxArray = historicalPolyhedra.GetRmax();
356 G4double* zArray = historicalPolyhedra.GetZ();
358 // compose element string template
359 G4String quota = "\"";
360 G4String element1 = "<phedra name=\"" + lvName + quota;
361 G4String element2 = "material=\"" + materialName + quota;
362 G4String element3 = "profile=\"";
363 G4String element4 = "sides =\"";
364 G4String element5 = "Ris=\"";
365 G4String element6 = "Ros=\"";
366 G4String element7 = "Zs =\"";
367 G4String element8 = "\" />";
368 G4String indention = fkBasicIndention + fkBasicIndention;
371 fOutFile << fkBasicIndention << element1 << G4endl
372 << indention << element2 << G4endl
373 << indention << element3
374 << G4std::setw(7) << G4std::setprecision(2) << sphi << " "
375 << G4std::setw(7) << G4std::setprecision(2) << ephi
377 << indention << element4
381 fOutFile << indention << element5;
383 for (i=0; i<nofZPlanes; i++) {
385 G4double rmin = rminArray[i]/TG3Units::Length();
386 if (i>0) fOutFile << " ";
387 fOutFile << G4std::setw(7) << G4std::setprecision(2) << rmin;
389 fOutFile << quota << G4endl;
391 fOutFile << indention << element6;
392 for (i=0; i<nofZPlanes; i++) {
394 G4double rmax = rmaxArray[i]/TG3Units::Length();
395 if (i>0) fOutFile << " ";
396 fOutFile << G4std::setw(7) << G4std::setprecision(2) << rmax;
398 fOutFile << quota << G4endl;
400 fOutFile << indention << element7;
401 for (i=0; i<nofZPlanes; i++) {
403 G4double z = zArray[i]/TG3Units::Length();
404 if (i>0) fOutFile << " ";
405 fOutFile << G4std::setw(7) << G4std::setprecision(2) << z;
407 fOutFile << element8 << G4endl << G4endl;
413 void TG4XMLConvertor::OpenMaterials(const G4String& version,
414 const G4String& date, const G4String& author,
415 const G4String dtdVersion)
417 // Writes section opening.
420 G4String element1 = "<materials version = \"";
421 G4String element2 = " date = \"";
422 G4String element3 = " author = \"";
423 G4String element4 = " DTD_version=\"";
424 G4String element5 = " >";
425 G4String quota = "\"";
428 fOutFile << element1 << version << quota << G4endl
429 << element2 << date << quota << G4endl
430 << element3 << author << quota << G4endl
431 << element4 << dtdVersion << quota
432 << element5 << G4endl;
435 void TG4XMLConvertor::OpenSection(const G4String& name, const G4String& version,
436 const G4String& date, const G4String& author,
437 const G4String& topVolume)
439 // Writes section opening.
442 G4String element1 = "<section name = \"";
443 G4String element2 = " version = \"";
444 G4String element3 = " date = \"";
445 G4String element4 = " author = \"";
446 G4String element5 = " topVolume = \"";
447 G4String element6 = " >";
448 G4String quota = "\"";
451 fOutFile << element1 << name << quota << G4endl
452 << element2 << version << quota << G4endl
453 << element3 << date << quota << G4endl
454 << element4 << author << quota << G4endl
455 << element5 << topVolume << quota
456 << element6 << G4endl;
459 void TG4XMLConvertor::OpenComposition(const G4String& name)
461 // Writes composition opening.
464 G4String element = "<composition name=\"";
465 element.append(name);
466 element.append("\">");
469 fOutFile << fIndention
473 // increase indention
477 void TG4XMLConvertor::CloseMaterials()
479 // Writes materials closing.
483 G4String element = "</materials>";
490 void TG4XMLConvertor::CloseSection()
492 // Writes section closing.
496 G4String element = "</section>";
503 void TG4XMLConvertor::CloseComposition()
505 // Writes composition closing.
508 // decrease indention
512 G4String element = "</composition>";
515 fOutFile << fIndention
520 void TG4XMLConvertor::WriteMaterial(const G4Material* material)
522 // Writes G4Material.
523 // Not yet implemented, only XML comment element is written.
526 G4String name = material->GetName();
530 G4String element1 = "<!-- material = \"";
531 G4String element2 = "\" -->";
534 fOutFile << fkBasicIndention
540 void TG4XMLConvertor::WriteSolid(G4String lvName, const G4VSolid* solid,
541 G4String materialName)
543 // Finds G4Solid concrete type and calls writing function.
544 // For not yet implemented solids, only XML comment element is written.
547 // to be removed when materials are supported
548 materialName = "Hydrogen";
550 const G4Box* box = dynamic_cast<const G4Box*>(solid);
552 WriteBox(lvName, box, materialName);
556 const G4Tubs* tubs = dynamic_cast<const G4Tubs*>(solid);
558 WriteTubs(lvName, tubs, materialName);
562 const G4Cons* cons = dynamic_cast<const G4Cons*>(solid);
564 WriteCons(lvName, cons, materialName);
568 const G4Trd* trd = dynamic_cast<const G4Trd*>(solid);
570 WriteTrd(lvName, trd, materialName);
574 const G4Trap* trap = dynamic_cast<const G4Trap*>(solid);
576 WriteTrap(lvName, trap, materialName);
580 const G4Polycone* polycone = dynamic_cast<const G4Polycone*>(solid);
582 WritePolycone(lvName, polycone, materialName);
586 const G4Polyhedra* polyhedra = dynamic_cast<const G4Polyhedra*>(solid);
588 WritePolyhedra(lvName, polyhedra, materialName);
592 // write comment line in case of unsupported
596 G4String element1 = "<!-- unsupported shape name= \"";
597 G4String element2 = "\" -->";
600 fOutFile << fkBasicIndention
601 << element1 << lvName
606 void TG4XMLConvertor::WriteRotation(const G4RotationMatrix* rotation)
608 // Writes G4RotationMatrix.
609 // Not yet implemented, only XML comment element is written.
612 // return if this rotation was already written
613 G4int nofRotations = fRotations.size();
615 for (G4int i=0; i<nofRotations; i++)
616 if (fRotations[i] == rotation) return;
618 fRotations.push_back(rotation);
622 G4double xx = rotation->xx();
623 G4double xy = rotation->xy();
624 G4double xz = rotation->xz();
625 G4double yx = rotation->yx();
626 G4double yy = rotation->yy();
627 G4double yz = rotation->yz();
628 G4double zx = rotation->zx();
629 G4double zy = rotation->zy();
630 G4double zz = rotation->zz();
632 TG4Globals::AppendNumberToString(id, ++fRotationCounter);
634 // compose element string template
635 G4String quota = "\"\n";
636 G4String element1 = "<rot_matrix id=\"####### XX_XY_XZ=\"";
637 G4String element2 = " YX_YY_YZ=\"";
638 G4String element3 = " ZX_ZY_ZZ=\"";
639 G4String element4 = "\" />";
642 PutName(element1, id, "#");
645 fOutFile << fkBasicIndention
647 << G4std::setw(8) << G4std::setprecision(5) << xx << " "
648 << G4std::setw(8) << G4std::setprecision(5) << xy << " "
649 << G4std::setw(8) << G4std::setprecision(5) << xz << quota
652 << G4std::setw(8) << G4std::setprecision(5) << yx << " "
653 << G4std::setw(8) << G4std::setprecision(5) << yy << " "
654 << G4std::setw(8) << G4std::setprecision(5) << yz << quota
657 << G4std::setw(8) << G4std::setprecision(5) << zx << " "
658 << G4std::setw(8) << G4std::setprecision(5) << zy << " "
659 << G4std::setw(8) << G4std::setprecision(5) << zz
664 void TG4XMLConvertor::WritePosition(G4String lvName, G4ThreeVector position)
666 // Writes position without rotation with a given solid name.
670 G4double x = position.x()/TG3Units::Length();
671 G4double y = position.y()/TG3Units::Length();
672 G4double z = position.z()/TG3Units::Length();
674 // compose element string template
675 G4String element1 = "<posXYZ volume=\"########### X_Y_Z=\"";
676 G4String element2 = "\" />";
679 PutName(element1, lvName, "#");
682 fOutFile << fIndention
684 << G4std::setw(8) << G4std::setprecision(2) << x << " "
685 << G4std::setw(8) << G4std::setprecision(2) << y << " "
686 << G4std::setw(8) << G4std::setprecision(2) << z
691 void TG4XMLConvertor::WritePositionWithRotation(
692 G4String lvName, G4ThreeVector position,
693 const G4RotationMatrix* rotation)
695 // Writes position with rotation with a given solid name.
696 // Not yet implemented, only XML comment element is written.
700 G4double x = position.x()/TG3Units::Length();
701 G4double y = position.y()/TG3Units::Length();
702 G4double z = position.z()/TG3Units::Length();
703 G4double xx = rotation->xx();
704 G4double xy = rotation->xy();
705 G4double xz = rotation->xz();
706 G4double yx = rotation->yx();
707 G4double yy = rotation->yy();
708 G4double yz = rotation->yz();
709 G4double zx = rotation->zx();
710 G4double zy = rotation->zy();
711 G4double zz = rotation->zz();
716 while (i<fRotations.size() && fRotations[i] != rotation) i++;
717 if (i==fRotations.size()) {
718 G4String text = "TG4XMLConvertor::WritePositionWithRotation: ";
719 text = text + " Unknown rotation - fatal error.";
720 TG4Globals::Exception(text);
723 TG4Globals::AppendNumberToString(id, i);
726 // compose element string template
727 G4String quota = "\"\n";
728 G4String element1 = "<transform volume=\"########### pos=\"";
729 G4String element2 = " rot=\"";
730 G4String element3 = " ";
731 G4String element4 = "\" />";
734 PutName(element1, lvName, "#");
737 fOutFile << fIndention
739 << G4std::setw(8) << G4std::setprecision(2) << x << " "
740 << G4std::setw(8) << G4std::setprecision(2) << y << " "
741 << G4std::setw(8) << G4std::setprecision(2) << z << quota
744 << G4std::setw(8) << G4std::setprecision(5) << xx << " "
745 << G4std::setw(8) << G4std::setprecision(5) << xy << " "
746 << G4std::setw(8) << G4std::setprecision(5) << xz << G4endl
749 << G4std::setw(8) << G4std::setprecision(5) << yx << " "
750 << G4std::setw(8) << G4std::setprecision(5) << yy << " "
751 << G4std::setw(8) << G4std::setprecision(5) << yz << G4endl
754 << G4std::setw(8) << G4std::setprecision(5) << zx << " "
755 << G4std::setw(8) << G4std::setprecision(5) << zy << " "
756 << G4std::setw(8) << G4std::setprecision(5) << zz
761 void TG4XMLConvertor::WriteReplica(G4String lvName, G4PVReplica* pvr)
763 // Writes position without rotation with a given solid name.
772 pvr->GetReplicationData(axis, nReplicas, width, offset, consuming);
776 case kXAxis: tag = "X"; break;
777 case kYAxis: tag = "Y"; break;
778 case kZAxis: tag = "Z"; break;
779 case kRho: tag = "R"; break;
780 case kPhi: tag = "Phi"; break;
784 G4double value0 = offset;
785 G4double dValue = width;
787 value0 = value0/TG3Units::Length();
788 dValue = dValue/TG3Units::Length();
791 value0 = value0/TG3Units::Angle();
792 dValue = dValue/TG3Units::Angle();
795 // set tag and attributes names
796 G4String a0 = "mpos"; a0 = a0 + tag;
797 G4String a1 = tag; a1 = a1 + "0";
798 G4String a2 = "d"; a2 = a2 + tag;
800 // compose element string template
801 G4String element1 = "<" + a0 + " volume=\"########### ncopy=\"";
802 G4String element2 = "\" " + a1 + "=\"";
803 G4String element3 = "\" " + a2 + "=\"";
804 G4String element4 = "\" />";
807 PutName(element1, lvName, "#");
810 fOutFile << fIndention
812 << G4std::setw(8) << G4std::setprecision(2) << nReplicas
814 << G4std::setw(8) << G4std::setprecision(2) << value0
816 << G4std::setw(8) << G4std::setprecision(2) << dValue
821 void TG4XMLConvertor::WriteEmptyLine()
823 // Writes empty line.
829 void TG4XMLConvertor::IncreaseIndention()
831 // increase indention
832 fIndention.append(fkBasicIndention);
835 void TG4XMLConvertor::DecreaseIndention()
837 // decrease indention
838 fIndention.replace(fIndention.find(fkBasicIndention), 3 , "");