Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4GDMLReadSolids.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // $Id: G4GDMLReadSolids.cc 96190 2016-03-29 08:07:36Z gcosmo $
27 //
28 // class G4GDMLReadSolids Implementation
29 //
30 // Original author: Zoltan Torzsok, November 2007
31 //
32 // --------------------------------------------------------------------
33 
34 #include "G4GDMLReadSolids.hh"
35 #include "G4Box.hh"
36 #include "G4Cons.hh"
37 #include "G4Ellipsoid.hh"
38 #include "G4EllipticalCone.hh"
39 #include "G4EllipticalTube.hh"
40 #include "G4Hype.hh"
41 #include "G4IntersectionSolid.hh"
42 #include "G4Orb.hh"
43 #include "G4Para.hh"
44 #include "G4Paraboloid.hh"
45 #include "G4Polycone.hh"
46 #include "G4GenericPolycone.hh"
47 #include "G4Polyhedra.hh"
48 #include "G4QuadrangularFacet.hh"
49 #include "G4ReflectedSolid.hh"
50 #include "G4ScaledSolid.hh"
51 #include "G4Sphere.hh"
52 #include "G4SolidStore.hh"
53 #include "G4SubtractionSolid.hh"
54 #include "G4GenericTrap.hh"
55 #include "G4TessellatedSolid.hh"
56 #include "G4Tet.hh"
57 #include "G4Torus.hh"
58 #include "G4Transform3D.hh"
59 #include "G4Trap.hh"
60 #include "G4Trd.hh"
61 #include "G4TriangularFacet.hh"
62 #include "G4Tubs.hh"
63 #include "G4CutTubs.hh"
64 #include "G4TwistedBox.hh"
65 #include "G4TwistedTrap.hh"
66 #include "G4TwistedTrd.hh"
67 #include "G4TwistedTubs.hh"
68 #include "G4UnionSolid.hh"
69 #include "G4OpticalSurface.hh"
70 #include "G4UnitsTable.hh"
71 #include "G4SurfaceProperty.hh"
72 
74 {
75 }
76 
78 {
79 }
80 
82 BooleanRead(const xercesc::DOMElement* const booleanElement, const BooleanOp op)
83 {
84  G4String name;
86  G4String scnd;
87  G4ThreeVector position(0.0,0.0,0.0);
88  G4ThreeVector rotation(0.0,0.0,0.0);
89  G4ThreeVector firstposition(0.0,0.0,0.0);
90  G4ThreeVector firstrotation(0.0,0.0,0.0);
91 
92  const xercesc::DOMNamedNodeMap* const attributes
93  = booleanElement->getAttributes();
94  XMLSize_t attributeCount = attributes->getLength();
95 
96  for (XMLSize_t attribute_index=0;
97  attribute_index<attributeCount; attribute_index++)
98  {
99  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
100 
101  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
102  { continue; }
103 
104  const xercesc::DOMAttr* const attribute
105  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
106  if (!attribute)
107  {
108  G4Exception("G4GDMLReadSolids::BooleanRead()",
109  "InvalidRead", FatalException, "No attribute found!");
110  return;
111  }
112  const G4String attName = Transcode(attribute->getName());
113  const G4String attValue = Transcode(attribute->getValue());
114 
115  if (attName=="name") { name = GenerateName(attValue); }
116  }
117 
118  for (xercesc::DOMNode* iter = booleanElement->getFirstChild();
119  iter != 0;iter = iter->getNextSibling())
120  {
121  if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) { continue; }
122 
123  const xercesc::DOMElement* const child
124  = dynamic_cast<xercesc::DOMElement*>(iter);
125  if (!child)
126  {
127  G4Exception("G4GDMLReadSolids::BooleanRead()",
128  "InvalidRead", FatalException, "No child found!");
129  return;
130  }
131  const G4String tag = Transcode(child->getTagName());
132 
133  if (tag=="first") { first = RefRead(child); } else
134  if (tag=="second") { scnd = RefRead(child); } else
135  if (tag=="position") { VectorRead(child,position); } else
136  if (tag=="rotation") { VectorRead(child,rotation); } else
137  if (tag=="positionref")
138  { position = GetPosition(GenerateName(RefRead(child))); } else
139  if (tag=="rotationref")
140  { rotation = GetRotation(GenerateName(RefRead(child))); } else
141  if (tag=="firstposition") { VectorRead(child,firstposition); } else
142  if (tag=="firstrotation") { VectorRead(child,firstrotation); } else
143  if (tag=="firstpositionref")
144  { firstposition = GetPosition(GenerateName(RefRead(child))); } else
145  if (tag=="firstrotationref")
146  { firstrotation = GetRotation(GenerateName(RefRead(child))); }
147  else
148  {
149  G4String error_msg = "Unknown tag in boolean solid: " + tag;
150  G4Exception("G4GDMLReadSolids::BooleanRead()", "ReadError",
151  FatalException, error_msg);
152  }
153  }
154 
155  G4VSolid* firstSolid = GetSolid(GenerateName(first));
156  G4VSolid* secondSolid = GetSolid(GenerateName(scnd));
157 
158  G4Transform3D transform(GetRotationMatrix(rotation),position);
159 
160  if (( (firstrotation.x()!=0.0) || (firstrotation.y()!=0.0)
161  || (firstrotation.z()!=0.0))
162  || ( (firstposition.x()!=0.0) || (firstposition.y()!=0.0)
163  || (firstposition.z()!=0.0)))
164  {
165  G4Transform3D firsttransform(GetRotationMatrix(firstrotation),
166  firstposition);
167  firstSolid = new G4DisplacedSolid(GenerateName("displaced_"+first),
168  firstSolid, firsttransform);
169  }
170 
171  if (op==UNION)
172  { new G4UnionSolid(name,firstSolid,secondSolid,transform); } else
173  if (op==SUBTRACTION)
174  { new G4SubtractionSolid(name,firstSolid,secondSolid,transform); } else
175  if (op==INTERSECTION)
176  { new G4IntersectionSolid(name,firstSolid,secondSolid,transform); }
177 }
178 
179 void G4GDMLReadSolids::BoxRead(const xercesc::DOMElement* const boxElement)
180 {
181  G4String name;
182  G4double lunit = 1.0;
183  G4double x = 0.0;
184  G4double y = 0.0;
185  G4double z = 0.0;
186 
187  const xercesc::DOMNamedNodeMap* const attributes
188  = boxElement->getAttributes();
189  XMLSize_t attributeCount = attributes->getLength();
190 
191  for (XMLSize_t attribute_index=0;
192  attribute_index<attributeCount; attribute_index++)
193  {
194  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
195 
196  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
197  { continue; }
198 
199  const xercesc::DOMAttr* const attribute
200  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
201  if (!attribute)
202  {
203  G4Exception("G4GDMLReadSolids::BoxRead()",
204  "InvalidRead", FatalException, "No attribute found!");
205  return;
206  }
207  const G4String attName = Transcode(attribute->getName());
208  const G4String attValue = Transcode(attribute->getValue());
209 
210  if (attName=="name") { name = GenerateName(attValue); } else
211  if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
212  if (G4UnitDefinition::GetCategory(attValue)!="Length") {
213  G4Exception("G4GDMLReadSolids::BoxRead()", "InvalidRead",
214  FatalException, "Invalid unit for length!"); }
215  }
216  else
217  if (attName=="x") { x = eval.Evaluate(attValue); } else
218  if (attName=="y") { y = eval.Evaluate(attValue); } else
219  if (attName=="z") { z = eval.Evaluate(attValue); }
220  }
221 
222  x *= 0.5*lunit;
223  y *= 0.5*lunit;
224  z *= 0.5*lunit;
225 
226  new G4Box(name,x,y,z);
227 }
228 
229 void G4GDMLReadSolids::ConeRead(const xercesc::DOMElement* const coneElement)
230 {
231  G4String name;
232  G4double lunit = 1.0;
233  G4double aunit = 1.0;
234  G4double rmin1 = 0.0;
235  G4double rmax1 = 0.0;
236  G4double rmin2 = 0.0;
237  G4double rmax2 = 0.0;
238  G4double z = 0.0;
239  G4double startphi = 0.0;
240  G4double deltaphi = 0.0;
241 
242  const xercesc::DOMNamedNodeMap* const attributes
243  = coneElement->getAttributes();
244  XMLSize_t attributeCount = attributes->getLength();
245 
246  for (XMLSize_t attribute_index=0;
247  attribute_index<attributeCount; attribute_index++)
248  {
249  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
250 
251  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
252  { continue; }
253 
254  const xercesc::DOMAttr* const attribute
255  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
256  if (!attribute)
257  {
258  G4Exception("G4GDMLReadSolids::ConeRead()",
259  "InvalidRead", FatalException, "No attribute found!");
260  return;
261  }
262  const G4String attName = Transcode(attribute->getName());
263  const G4String attValue = Transcode(attribute->getValue());
264 
265  if (attName=="name") { name = GenerateName(attValue); } else
266  if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
267  if (G4UnitDefinition::GetCategory(attValue)!="Length") {
268  G4Exception("G4GDMLReadSolids::ConeRead()", "InvalidRead",
269  FatalException, "Invalid unit for length!"); }
270  } else
271  if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue);
272  if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
273  G4Exception("G4GDMLReadSolids::ConeRead()", "InvalidRead",
274  FatalException, "Invalid unit for angle!"); }
275  } else
276  if (attName=="rmin1") { rmin1 = eval.Evaluate(attValue); } else
277  if (attName=="rmax1") { rmax1 = eval.Evaluate(attValue); } else
278  if (attName=="rmin2") { rmin2 = eval.Evaluate(attValue); } else
279  if (attName=="rmax2") { rmax2 = eval.Evaluate(attValue); } else
280  if (attName=="z") { z = eval.Evaluate(attValue); } else
281  if (attName=="startphi") { startphi = eval.Evaluate(attValue); } else
282  if (attName=="deltaphi") { deltaphi = eval.Evaluate(attValue); }
283  }
284 
285  rmin1 *= lunit;
286  rmax1 *= lunit;
287  rmin2 *= lunit;
288  rmax2 *= lunit;
289  z *= 0.5*lunit;
290  startphi *= aunit;
291  deltaphi *= aunit;
292 
293  new G4Cons(name,rmin1,rmax1,rmin2,rmax2,z,startphi,deltaphi);
294 }
295 
297 ElconeRead(const xercesc::DOMElement* const elconeElement)
298 {
299  G4String name;
300  G4double lunit = 1.0;
301  G4double dx = 0.0;
302  G4double dy = 0.0;
303  G4double zmax = 0.0;
304  G4double zcut = 0.0;
305 
306  const xercesc::DOMNamedNodeMap* const attributes
307  = elconeElement->getAttributes();
308  XMLSize_t attributeCount = attributes->getLength();
309 
310  for (XMLSize_t attribute_index=0;
311  attribute_index<attributeCount; attribute_index++)
312  {
313  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
314 
315  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
316  { continue; }
317 
318  const xercesc::DOMAttr* const attribute
319  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
320  if (!attribute)
321  {
322  G4Exception("G4GDMLReadSolids::ElconeRead()",
323  "InvalidRead", FatalException, "No attribute found!");
324  return;
325  }
326  const G4String attName = Transcode(attribute->getName());
327  const G4String attValue = Transcode(attribute->getValue());
328 
329  if (attName=="name") { name = GenerateName(attValue); } else
330  if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
331  if (G4UnitDefinition::GetCategory(attValue)!="Length") {
332  G4Exception("G4GDMLReadSolids::ElconeRead()", "InvalidRead",
333  FatalException, "Invalid unit for length!"); }
334  } else
335  if (attName=="dx") { dx = eval.Evaluate(attValue); } else
336  if (attName=="dy") { dy = eval.Evaluate(attValue); } else
337  if (attName=="zmax") { zmax = eval.Evaluate(attValue); } else
338  if (attName=="zcut") { zcut = eval.Evaluate(attValue); }
339  }
340 
341  zmax *= lunit;
342  zcut *= lunit;
343 
344  new G4EllipticalCone(name,dx,dy,zmax,zcut);
345 }
346 
348 EllipsoidRead(const xercesc::DOMElement* const ellipsoidElement)
349 {
350  G4String name;
351  G4double lunit = 1.0;
352  G4double ax = 0.0;
353  G4double by = 0.0;
354  G4double cz = 0.0;
355  G4double zcut1 = 0.0;
356  G4double zcut2 = 0.0;
357 
358  const xercesc::DOMNamedNodeMap* const attributes
359  = ellipsoidElement->getAttributes();
360  XMLSize_t attributeCount = attributes->getLength();
361 
362  for (XMLSize_t attribute_index=0;
363  attribute_index<attributeCount; attribute_index++)
364  {
365  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
366 
367  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
368  { continue; }
369 
370  const xercesc::DOMAttr* const attribute
371  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
372  if (!attribute)
373  {
374  G4Exception("G4GDMLReadSolids::EllipsoidRead()",
375  "InvalidRead", FatalException, "No attribute found!");
376  return;
377  }
378  const G4String attName = Transcode(attribute->getName());
379  const G4String attValue = Transcode(attribute->getValue());
380 
381  if (attName=="name") { name = GenerateName(attValue); } else
382  if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
383  if (G4UnitDefinition::GetCategory(attValue)!="Length") {
384  G4Exception("G4GDMLReadSolids::EllipsoidRead()", "InvalidRead",
385  FatalException, "Invalid unit for length!"); }
386  } else
387  if (attName=="ax") { ax = eval.Evaluate(attValue); } else
388  if (attName=="by") { by = eval.Evaluate(attValue); } else
389  if (attName=="cz") { cz = eval.Evaluate(attValue); } else
390  if (attName=="zcut1") { zcut1 = eval.Evaluate(attValue); } else
391  if (attName=="zcut2") { zcut2 = eval.Evaluate(attValue); }
392  }
393 
394  ax *= lunit;
395  by *= lunit;
396  cz *= lunit;
397  zcut1 *= lunit;
398  zcut2 *= lunit;
399 
400  new G4Ellipsoid(name,ax,by,cz,zcut1,zcut2);
401 }
402 
404 EltubeRead(const xercesc::DOMElement* const eltubeElement)
405 {
406  G4String name;
407  G4double lunit = 1.0;
408  G4double dx = 0.0;
409  G4double dy = 0.0;
410  G4double dz = 0.0;
411 
412  const xercesc::DOMNamedNodeMap* const attributes
413  = eltubeElement->getAttributes();
414  XMLSize_t attributeCount = attributes->getLength();
415 
416  for (XMLSize_t attribute_index=0;
417  attribute_index<attributeCount; attribute_index++)
418  {
419  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
420 
421  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
422  { continue; }
423 
424  const xercesc::DOMAttr* const attribute
425  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
426  if (!attribute)
427  {
428  G4Exception("G4GDMLReadSolids::EltubeRead()",
429  "InvalidRead", FatalException, "No attribute found!");
430  return;
431  }
432  const G4String attName = Transcode(attribute->getName());
433  const G4String attValue = Transcode(attribute->getValue());
434 
435  if (attName=="name") { name = GenerateName(attValue); } else
436  if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
437  if (G4UnitDefinition::GetCategory(attValue)!="Length") {
438  G4Exception("G4GDMLReadSolids::EltubeRead()", "InvalidRead",
439  FatalException, "Invalid unit for length!"); }
440  } else
441  if (attName=="dx") { dx = eval.Evaluate(attValue); } else
442  if (attName=="dy") { dy = eval.Evaluate(attValue); } else
443  if (attName=="dz") { dz = eval.Evaluate(attValue); }
444  }
445 
446  dx *= lunit;
447  dy *= lunit;
448  dz *= lunit;
449 
450  new G4EllipticalTube(name,dx,dy,dz);
451 }
452 
453 void G4GDMLReadSolids::XtruRead(const xercesc::DOMElement* const xtruElement)
454 {
455  G4String name;
456  G4double lunit = 1.0;
457 
458  const xercesc::DOMNamedNodeMap* const attributes
459  = xtruElement->getAttributes();
460  XMLSize_t attributeCount = attributes->getLength();
461 
462  for (XMLSize_t attribute_index=0;
463  attribute_index<attributeCount; attribute_index++)
464  {
465  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
466 
467  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
468  { continue; }
469 
470  const xercesc::DOMAttr* const attribute
471  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
472  if (!attribute)
473  {
474  G4Exception("G4GDMLReadSolids::XtruRead()",
475  "InvalidRead", FatalException, "No attribute found!");
476  return;
477  }
478  const G4String attName = Transcode(attribute->getName());
479  const G4String attValue = Transcode(attribute->getValue());
480 
481  if (attName=="name") { name = GenerateName(attValue); } else
482  if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
483  if (G4UnitDefinition::GetCategory(attValue)!="Length") {
484  G4Exception("G4GDMLReadSolids::XtruRead()", "InvalidRead",
485  FatalException, "Invalid unit for length!"); }
486  }
487  }
488 
489  std::vector<G4TwoVector> twoDimVertexList;
490  std::vector<G4ExtrudedSolid::ZSection> sectionList;
491 
492  for (xercesc::DOMNode* iter = xtruElement->getFirstChild();
493  iter != 0; iter = iter->getNextSibling())
494  {
495  if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) { continue; }
496 
497  const xercesc::DOMElement* const child
498  = dynamic_cast<xercesc::DOMElement*>(iter);
499  if (!child)
500  {
501  G4Exception("G4GDMLReadSolids::XtruRead()",
502  "InvalidRead", FatalException, "No child found!");
503  return;
504  }
505  const G4String tag = Transcode(child->getTagName());
506 
507  if (tag=="twoDimVertex")
508  { twoDimVertexList.push_back(TwoDimVertexRead(child,lunit)); } else
509  if (tag=="section")
510  { sectionList.push_back(SectionRead(child,lunit)); }
511  }
512 
513  new G4ExtrudedSolid(name,twoDimVertexList,sectionList);
514 }
515 
516 void G4GDMLReadSolids::HypeRead(const xercesc::DOMElement* const hypeElement)
517 {
518  G4String name;
519  G4double lunit = 1.0;
520  G4double aunit = 1.0;
521  G4double rmin = 0.0;
522  G4double rmax = 0.0;
523  G4double inst = 0.0;
524  G4double outst = 0.0;
525  G4double z = 0.0;
526 
527  const xercesc::DOMNamedNodeMap* const attributes
528  = hypeElement->getAttributes();
529  XMLSize_t attributeCount = attributes->getLength();
530 
531  for (XMLSize_t attribute_index=0;
532  attribute_index<attributeCount; attribute_index++)
533  {
534  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
535 
536  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
537  { continue; }
538 
539  const xercesc::DOMAttr* const attribute
540  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
541  if (!attribute)
542  {
543  G4Exception("G4GDMLReadSolids::HypeRead()",
544  "InvalidRead", FatalException, "No attribute found!");
545  return;
546  }
547  const G4String attName = Transcode(attribute->getName());
548  const G4String attValue = Transcode(attribute->getValue());
549 
550  if (attName=="name") { name = GenerateName(attValue); } else
551  if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
552  if (G4UnitDefinition::GetCategory(attValue)!="Length") {
553  G4Exception("G4GDMLReadSolids::HypeRead()", "InvalidRead",
554  FatalException, "Invalid unit for length!"); }
555  } else
556  if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue);
557  if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
558  G4Exception("G4GDMLReadSolids::HypeRead()", "InvalidRead",
559  FatalException, "Invalid unit for angle!"); }
560  } else
561  if (attName=="rmin") { rmin = eval.Evaluate(attValue); } else
562  if (attName=="rmax") { rmax = eval.Evaluate(attValue); } else
563  if (attName=="inst") { inst = eval.Evaluate(attValue); } else
564  if (attName=="outst") { outst = eval.Evaluate(attValue); } else
565  if (attName=="z") { z = eval.Evaluate(attValue); }
566  }
567 
568  rmin *= lunit;
569  rmax *= lunit;
570  inst *= aunit;
571  outst *= aunit;
572  z *= 0.5*lunit;
573 
574  new G4Hype(name,rmin,rmax,inst,outst,z);
575 }
576 
577 #if !defined(G4GEOM_USE_USOLIDS)
579 MultiUnionNodeRead(const xercesc::DOMElement* const,
580  G4MultiUnion* const)
581 {
582  G4Exception("G4GDMLReadSolids::MultiUnionNodeRead()",
583  "InvalidSetup", FatalException,
584  "Installation with USolids primitives required!");
585  return;
586 }
587 #else
589 MultiUnionNodeRead(const xercesc::DOMElement* const unionNodeElement,
590  G4MultiUnion* const multiUnionSolid)
591 {
592  G4String name;
593  G4String solid;
594  G4ThreeVector position(0.0,0.0,0.0);
595  G4ThreeVector rotation(0.0,0.0,0.0);
596 
597  const xercesc::DOMNamedNodeMap* const attributes
598  = unionNodeElement->getAttributes();
599  XMLSize_t attributeCount = attributes->getLength();
600 
601  for (XMLSize_t attribute_index=0;
602  attribute_index<attributeCount; attribute_index++)
603  {
604  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
605 
606  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
607  { continue; }
608 
609  const xercesc::DOMAttr* const attribute
610  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
611  if (!attribute)
612  {
613  G4Exception("G4GDMLReadSolids::MultiUnionNodeRead()",
614  "InvalidRead", FatalException, "No attribute found!");
615  return;
616  }
617  const G4String attName = Transcode(attribute->getName());
618  const G4String attValue = Transcode(attribute->getValue());
619 
620  if (attName=="name") { name = GenerateName(attValue); }
621  }
622 
623  for (xercesc::DOMNode* iter = unionNodeElement->getFirstChild();
624  iter != 0;iter = iter->getNextSibling())
625  {
626  if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) { continue; }
627 
628  const xercesc::DOMElement* const child
629  = dynamic_cast<xercesc::DOMElement*>(iter);
630  if (!child)
631  {
632  G4Exception("G4GDMLReadSolids::MultiUnionNodeRead()",
633  "InvalidRead", FatalException, "No child found!");
634  return;
635  }
636  const G4String tag = Transcode(child->getTagName());
637 
638  if (tag=="position") { VectorRead(child,position); } else
639  if (tag=="rotation") { VectorRead(child,rotation); } else
640  if (tag=="positionref")
641  { position = GetPosition(GenerateName(RefRead(child))); } else
642  if (tag=="rotationref")
643  { rotation = GetRotation(GenerateName(RefRead(child))); } else
644  if (tag=="solid") { solid = RefRead(child); }
645  else
646  {
647  G4String error_msg = "Unknown tag in MultiUnion structure: " + tag;
648  G4Exception("G4GDMLReadSolids::MultiUnionNodeRead()", "ReadError",
649  FatalException, error_msg);
650  }
651  }
652  G4VSolid* solidNode = GetSolid(GenerateName(solid));
653  G4Transform3D transform(GetRotationMatrix(rotation),position);
654  multiUnionSolid->AddNode(*solidNode, transform);
655 }
656 #endif
657 
658 #if !defined(G4GEOM_USE_USOLIDS)
660 MultiUnionRead(const xercesc::DOMElement* const)
661 {
662  G4Exception("G4GDMLReadSolids::MultiUnionRead()",
663  "InvalidSetup", FatalException,
664  "Installation with USolids primitives required!");
665  return;
666 }
667 #else
669 MultiUnionRead(const xercesc::DOMElement* const unionElement)
670 {
671  G4String name;
672 
673  const xercesc::DOMNamedNodeMap* const attributes
674  = unionElement->getAttributes();
675  XMLSize_t attributeCount = attributes->getLength();
676 
677  for (XMLSize_t attribute_index=0;
678  attribute_index<attributeCount; attribute_index++)
679  {
680  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
681 
682  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
683  { continue; }
684 
685  const xercesc::DOMAttr* const attribute
686  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
687  if (!attribute)
688  {
689  G4Exception("G4GDMLReadSolids::MultiUnionRead()",
690  "InvalidRead", FatalException, "No attribute found!");
691  return;
692  }
693  const G4String attName = Transcode(attribute->getName());
694  const G4String attValue = Transcode(attribute->getValue());
695 
696  if (attName=="name") { name = GenerateName(attValue); }
697  }
698 
699  G4MultiUnion* multiUnion = new G4MultiUnion(name);
700 
701  for (xercesc::DOMNode* iter = unionElement->getFirstChild();
702  iter != 0;iter = iter->getNextSibling())
703  {
704  if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) { continue; }
705 
706  const xercesc::DOMElement* const child
707  = dynamic_cast<xercesc::DOMElement*>(iter);
708  if (!child)
709  {
710  G4Exception("G4GDMLReadSolids::MultiUnionRead()",
711  "InvalidRead", FatalException, "No child found!");
712  return;
713  }
714  const G4String tag = Transcode(child->getTagName());
715 
716  if (tag=="multiUnionNode") { MultiUnionNodeRead(child, multiUnion); }
717  else
718  {
719  G4String error_msg = "Unknown tag in MultiUnion structure: " + tag;
720  G4Exception("G4GDMLReadSolids::MultiUnionRead()", "ReadError",
721  FatalException, error_msg);
722  }
723  }
724  multiUnion->Voxelize();
725 }
726 #endif
727 
728 void G4GDMLReadSolids::OrbRead(const xercesc::DOMElement* const orbElement)
729 {
730  G4String name;
731  G4double lunit = 1.0;
732  G4double r = 0.0;
733 
734  const xercesc::DOMNamedNodeMap* const attributes
735  = orbElement->getAttributes();
736  XMLSize_t attributeCount = attributes->getLength();
737 
738  for (XMLSize_t attribute_index=0;
739  attribute_index<attributeCount; attribute_index++)
740  {
741  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
742 
743  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
744  { continue; }
745 
746  const xercesc::DOMAttr* const attribute
747  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
748  if (!attribute)
749  {
750  G4Exception("G4GDMLReadSolids::OrbRead()",
751  "InvalidRead", FatalException, "No attribute found!");
752  return;
753  }
754  const G4String attName = Transcode(attribute->getName());
755  const G4String attValue = Transcode(attribute->getValue());
756 
757  if (attName=="name") { name = GenerateName(attValue); } else
758  if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
759  if (G4UnitDefinition::GetCategory(attValue)!="Length") {
760  G4Exception("G4GDMLReadSolids::OrbRead()", "InvalidRead",
761  FatalException, "Invalid unit for length!"); }
762  } else
763  if (attName=="r") { r = eval.Evaluate(attValue); }
764  }
765 
766  r *= lunit;
767 
768  new G4Orb(name,r);
769 }
770 
771 void G4GDMLReadSolids::ParaRead(const xercesc::DOMElement* const paraElement)
772 {
773  G4String name;
774  G4double lunit = 1.0;
775  G4double aunit = 1.0;
776  G4double x = 0.0;
777  G4double y = 0.0;
778  G4double z = 0.0;
779  G4double alpha = 0.0;
780  G4double theta = 0.0;
781  G4double phi = 0.0;
782 
783  const xercesc::DOMNamedNodeMap* const attributes
784  = paraElement->getAttributes();
785  XMLSize_t attributeCount = attributes->getLength();
786 
787  for (XMLSize_t attribute_index=0;
788  attribute_index<attributeCount; attribute_index++)
789  {
790  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
791 
792  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
793  { continue; }
794 
795  const xercesc::DOMAttr* const attribute
796  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
797  if (!attribute)
798  {
799  G4Exception("G4GDMLReadSolids::ParaRead()",
800  "InvalidRead", FatalException, "No attribute found!");
801  return;
802  }
803  const G4String attName = Transcode(attribute->getName());
804  const G4String attValue = Transcode(attribute->getValue());
805 
806  if (attName=="name") { name = GenerateName(attValue); } else
807  if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
808  if (G4UnitDefinition::GetCategory(attValue)!="Length") {
809  G4Exception("G4GDMLReadSolids::ParaRead()", "InvalidRead",
810  FatalException, "Invalid unit for length!"); }
811  } else
812  if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue);
813  if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
814  G4Exception("G4GDMLReadSolids::ParaRead()", "InvalidRead",
815  FatalException, "Invalid unit for angle!"); }
816  } else
817  if (attName=="x") { x = eval.Evaluate(attValue); } else
818  if (attName=="y") { y = eval.Evaluate(attValue); } else
819  if (attName=="z") { z = eval.Evaluate(attValue); } else
820  if (attName=="alpha") { alpha = eval.Evaluate(attValue); } else
821  if (attName=="theta") { theta = eval.Evaluate(attValue); } else
822  if (attName=="phi") { phi = eval.Evaluate(attValue); }
823  }
824 
825  x *= 0.5*lunit;
826  y *= 0.5*lunit;
827  z *= 0.5*lunit;
828  alpha *= aunit;
829  theta *= aunit;
830  phi *= aunit;
831 
832  new G4Para(name,x,y,z,alpha,theta,phi);
833 }
834 
836 ParaboloidRead(const xercesc::DOMElement* const paraElement)
837 {
838  G4String name;
839  G4double lunit = 1.0;
840  G4double rlo = 0.0;
841  G4double rhi = 0.0;
842  G4double dz = 0.0;
843 
844  const xercesc::DOMNamedNodeMap* const attributes
845  = paraElement->getAttributes();
846  XMLSize_t attributeCount = attributes->getLength();
847 
848  for (XMLSize_t attribute_index=0;
849  attribute_index<attributeCount; attribute_index++)
850  {
851  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
852 
853  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
854  { continue; }
855 
856  const xercesc::DOMAttr* const attribute
857  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
858  if (!attribute)
859  {
860  G4Exception("G4GDMLReadSolids::ParaboloidRead()",
861  "InvalidRead", FatalException, "No attribute found!");
862  return;
863  }
864  const G4String attName = Transcode(attribute->getName());
865  const G4String attValue = Transcode(attribute->getValue());
866 
867  if (attName=="name") { name = GenerateName(attValue); } else
868  if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
869  if (G4UnitDefinition::GetCategory(attValue)!="Length") {
870  G4Exception("G4GDMLReadSolids::ParaboloidRead()", "InvalidRead",
871  FatalException, "Invalid unit for length!"); }
872  } else
873  if (attName=="rlo") { rlo = eval.Evaluate(attValue); } else
874  if (attName=="rhi") { rhi = eval.Evaluate(attValue); } else
875  if (attName=="dz") { dz = eval.Evaluate(attValue); }
876  }
877 
878  rlo *= 1.*lunit;
879  rhi *= 1.*lunit;
880  dz *= 1.*lunit;
881 
882  new G4Paraboloid(name,dz,rlo,rhi);
883 }
884 
886 PolyconeRead(const xercesc::DOMElement* const polyconeElement)
887 {
888  G4String name;
889  G4double lunit = 1.0;
890  G4double aunit = 1.0;
891  G4double startphi = 0.0;
892  G4double deltaphi = 0.0;
893 
894  const xercesc::DOMNamedNodeMap* const attributes
895  = polyconeElement->getAttributes();
896  XMLSize_t attributeCount = attributes->getLength();
897 
898  for (XMLSize_t attribute_index=0;
899  attribute_index<attributeCount; attribute_index++)
900  {
901  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
902 
903  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
904  { continue; }
905 
906  const xercesc::DOMAttr* const attribute
907  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
908  if (!attribute)
909  {
910  G4Exception("G4GDMLReadSolids::PolyconeRead()",
911  "InvalidRead", FatalException, "No attribute found!");
912  return;
913  }
914  const G4String attName = Transcode(attribute->getName());
915  const G4String attValue = Transcode(attribute->getValue());
916 
917  if (attName=="name") { name = GenerateName(attValue); } else
918  if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
919  if (G4UnitDefinition::GetCategory(attValue)!="Length") {
920  G4Exception("G4GDMLReadSolids::PolyconeRead()", "InvalidRead",
921  FatalException, "Invalid unit for length!"); }
922  } else
923  if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue);
924  if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
925  G4Exception("G4GDMLReadSolids::PolyconeRead()", "InvalidRead",
926  FatalException, "Invalid unit for angle!"); }
927  } else
928  if (attName=="startphi") { startphi = eval.Evaluate(attValue); }else
929  if (attName=="deltaphi") { deltaphi = eval.Evaluate(attValue); }
930  }
931 
932  startphi *= aunit;
933  deltaphi *= aunit;
934 
935  std::vector<zplaneType> zplaneList;
936 
937  for (xercesc::DOMNode* iter = polyconeElement->getFirstChild();
938  iter != 0; iter = iter->getNextSibling())
939  {
940  if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) { continue; }
941 
942  const xercesc::DOMElement* const child
943  = dynamic_cast<xercesc::DOMElement*>(iter);
944  if (!child)
945  {
946  G4Exception("G4GDMLReadSolids::PolyconeRead()",
947  "InvalidRead", FatalException, "No child found!");
948  return;
949  }
950  const G4String tag = Transcode(child->getTagName());
951 
952  if (tag=="zplane") { zplaneList.push_back(ZplaneRead(child)); }
953  }
954 
955  G4int numZPlanes = zplaneList.size();
956 
957  G4double* rmin_array = new G4double[numZPlanes];
958  G4double* rmax_array = new G4double[numZPlanes];
959  G4double* z_array = new G4double[numZPlanes];
960 
961  for (G4int i=0; i<numZPlanes; i++)
962  {
963  rmin_array[i] = zplaneList[i].rmin*lunit;
964  rmax_array[i] = zplaneList[i].rmax*lunit;
965  z_array[i] = zplaneList[i].z*lunit;
966  }
967 
968  new G4Polycone(name,startphi,deltaphi,numZPlanes,
969  z_array,rmin_array,rmax_array);
970 
971  delete [] rmin_array;
972  delete [] rmax_array;
973  delete [] z_array;
974 }
975 
977 GenericPolyconeRead(const xercesc::DOMElement* const polyconeElement)
978 {
979  G4String name;
980  G4double lunit = 1.0;
981  G4double aunit = 1.0;
982  G4double startphi = 0.0;
983  G4double deltaphi = 0.0;
984 
985  const xercesc::DOMNamedNodeMap* const attributes
986  = polyconeElement->getAttributes();
987  XMLSize_t attributeCount = attributes->getLength();
988 
989  for (XMLSize_t attribute_index=0;
990  attribute_index<attributeCount; attribute_index++)
991  {
992  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
993 
994  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
995  { continue; }
996 
997  const xercesc::DOMAttr* const attribute
998  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
999  if (!attribute)
1000  {
1001  G4Exception("G4GDMLReadSolids::GenericPolyconeRead()",
1002  "InvalidRead", FatalException, "No attribute found!");
1003  return;
1004  }
1005  const G4String attName = Transcode(attribute->getName());
1006  const G4String attValue = Transcode(attribute->getValue());
1007 
1008  if (attName=="name") { name = GenerateName(attValue); } else
1009  if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
1010  if (G4UnitDefinition::GetCategory(attValue)!="Length") {
1011  G4Exception("G4GDMLReadSolids::GenericPolyconeRead()", "InvalidRead",
1012  FatalException, "Invalid unit for length!"); }
1013  } else
1014  if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue);
1015  if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
1016  G4Exception("G4GDMLReadSolids::GenericPolyconeRead()", "InvalidRead",
1017  FatalException, "Invalid unit for angle!"); }
1018  } else
1019  if (attName=="startphi") { startphi = eval.Evaluate(attValue); }else
1020  if (attName=="deltaphi") { deltaphi = eval.Evaluate(attValue); }
1021  }
1022 
1023  startphi *= aunit;
1024  deltaphi *= aunit;
1025 
1026  std::vector<rzPointType> rzPointList;
1027 
1028  for (xercesc::DOMNode* iter = polyconeElement->getFirstChild();
1029  iter != 0; iter = iter->getNextSibling())
1030  {
1031  if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) { continue; }
1032 
1033  const xercesc::DOMElement* const child
1034  = dynamic_cast<xercesc::DOMElement*>(iter);
1035  if (!child)
1036  {
1037  G4Exception("G4GDMLReadSolids::GenericPolyconeRead()",
1038  "InvalidRead", FatalException, "No child found!");
1039  return;
1040  }
1041  const G4String tag = Transcode(child->getTagName());
1042 
1043  if (tag=="rzpoint") { rzPointList.push_back(RZPointRead(child)); }
1044  }
1045 
1046  G4int numRZPoints = rzPointList.size();
1047 
1048  G4double* r_array = new G4double[numRZPoints];
1049  G4double* z_array = new G4double[numRZPoints];
1050 
1051  for (G4int i=0; i<numRZPoints; i++)
1052  {
1053  r_array[i] = rzPointList[i].r*lunit;
1054  z_array[i] = rzPointList[i].z*lunit;
1055  }
1056  new G4GenericPolycone(name,startphi,deltaphi,numRZPoints,
1057  r_array,z_array);
1058  delete [] r_array;
1059  delete [] z_array;
1060 }
1061 
1062 void G4GDMLReadSolids::
1063 PolyhedraRead(const xercesc::DOMElement* const polyhedraElement)
1064 {
1065  G4String name;
1066  G4double lunit = 1.0;
1067  G4double aunit = 1.0;
1068  G4double startphi = 0.0;
1069  G4double deltaphi = 0.0;
1070  G4int numsides = 0;
1071 
1072  const xercesc::DOMNamedNodeMap* const attributes
1073  = polyhedraElement->getAttributes();
1074  XMLSize_t attributeCount = attributes->getLength();
1075 
1076  for (XMLSize_t attribute_index=0;
1077  attribute_index<attributeCount; attribute_index++)
1078  {
1079  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1080 
1081  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1082  { continue; }
1083 
1084  const xercesc::DOMAttr* const attribute
1085  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
1086  if (!attribute)
1087  {
1088  G4Exception("G4GDMLReadSolids::PolyhedraRead()",
1089  "InvalidRead", FatalException, "No attribute found!");
1090  return;
1091  }
1092  const G4String attName = Transcode(attribute->getName());
1093  const G4String attValue = Transcode(attribute->getValue());
1094 
1095  if (attName=="name") { name = GenerateName(attValue); } else
1096  if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
1097  if (G4UnitDefinition::GetCategory(attValue)!="Length") {
1098  G4Exception("G4GDMLReadSolids::PolyhedraRead()", "InvalidRead",
1099  FatalException, "Invalid unit for length!"); }
1100  } else
1101  if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue);
1102  if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
1103  G4Exception("G4GDMLReadSolids::PolyhedraRead()", "InvalidRead",
1104  FatalException, "Invalid unit for angle!"); }
1105  } else
1106  if (attName=="startphi") { startphi = eval.Evaluate(attValue); } else
1107  if (attName=="deltaphi") { deltaphi = eval.Evaluate(attValue); } else
1108  if (attName=="numsides") { numsides = eval.EvaluateInteger(attValue); }
1109  }
1110 
1111  startphi *= aunit;
1112  deltaphi *= aunit;
1113 
1114  std::vector<zplaneType> zplaneList;
1115 
1116  for (xercesc::DOMNode* iter = polyhedraElement->getFirstChild();
1117  iter != 0; iter = iter->getNextSibling())
1118  {
1119  if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) { continue; }
1120 
1121  const xercesc::DOMElement* const child
1122  = dynamic_cast<xercesc::DOMElement*>(iter);
1123  if (!child)
1124  {
1125  G4Exception("G4GDMLReadSolids::PolyhedraRead()",
1126  "InvalidRead", FatalException, "No child found!");
1127  return;
1128  }
1129  const G4String tag = Transcode(child->getTagName());
1130 
1131  if (tag=="zplane") { zplaneList.push_back(ZplaneRead(child)); }
1132  }
1133 
1134  G4int numZPlanes = zplaneList.size();
1135 
1136  G4double* rmin_array = new G4double[numZPlanes];
1137  G4double* rmax_array = new G4double[numZPlanes];
1138  G4double* z_array = new G4double[numZPlanes];
1139 
1140  for (G4int i=0; i<numZPlanes; i++)
1141  {
1142  rmin_array[i] = zplaneList[i].rmin*lunit;
1143  rmax_array[i] = zplaneList[i].rmax*lunit;
1144  z_array[i] = zplaneList[i].z*lunit;
1145  }
1146 
1147  new G4Polyhedra(name,startphi,deltaphi,numsides,numZPlanes,
1148  z_array,rmin_array,rmax_array);
1149 
1150  delete [] rmin_array;
1151  delete [] rmax_array;
1152  delete [] z_array;
1153 }
1154 
1155 void G4GDMLReadSolids::
1156 GenericPolyhedraRead(const xercesc::DOMElement* const polyhedraElement)
1157 {
1158  G4String name;
1159  G4double lunit = 1.0;
1160  G4double aunit = 1.0;
1161  G4double startphi = 0.0;
1162  G4double deltaphi = 0.0;
1163  G4int numsides = 0;
1164 
1165  const xercesc::DOMNamedNodeMap* const attributes
1166  = polyhedraElement->getAttributes();
1167  XMLSize_t attributeCount = attributes->getLength();
1168 
1169  for (XMLSize_t attribute_index=0;
1170  attribute_index<attributeCount; attribute_index++)
1171  {
1172  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1173 
1174  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1175  { continue; }
1176 
1177  const xercesc::DOMAttr* const attribute
1178  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
1179  if (!attribute)
1180  {
1181  G4Exception("G4GDMLReadSolids::GenericPolyhedraRead()",
1182  "InvalidRead", FatalException, "No attribute found!");
1183  return;
1184  }
1185  const G4String attName = Transcode(attribute->getName());
1186  const G4String attValue = Transcode(attribute->getValue());
1187 
1188  if (attName=="name") { name = GenerateName(attValue); } else
1189  if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
1190  if (G4UnitDefinition::GetCategory(attValue)!="Length") {
1191  G4Exception("G4GDMLReadSolids::GenericPolyhedraRead()", "InvalidRead",
1192  FatalException, "Invalid unit for length!"); }
1193  } else
1194  if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue);
1195  if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
1196  G4Exception("G4GDMLReadSolids::GenericPolyhedraRead()", "InvalidRead",
1197  FatalException, "Invalid unit for angle!"); }
1198  } else
1199  if (attName=="startphi") { startphi = eval.Evaluate(attValue); } else
1200  if (attName=="deltaphi") { deltaphi = eval.Evaluate(attValue); } else
1201  if (attName=="numsides") { numsides = eval.EvaluateInteger(attValue); }
1202  }
1203 
1204  startphi *= aunit;
1205  deltaphi *= aunit;
1206 
1207  std::vector<rzPointType> rzpointList;
1208 
1209  for (xercesc::DOMNode* iter = polyhedraElement->getFirstChild();
1210  iter != 0; iter = iter->getNextSibling())
1211  {
1212  if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) { continue; }
1213 
1214  const xercesc::DOMElement* const child
1215  = dynamic_cast<xercesc::DOMElement*>(iter);
1216  if (!child)
1217  {
1218  G4Exception("G4GDMLReadSolids::GenericPolyhedraRead()",
1219  "InvalidRead", FatalException, "No child found!");
1220  return;
1221  }
1222  const G4String tag = Transcode(child->getTagName());
1223 
1224  if (tag=="rzpoint") { rzpointList.push_back(RZPointRead(child)); }
1225  }
1226 
1227  G4int numRZPoints = rzpointList.size();
1228 
1229  G4double* r_array = new G4double[numRZPoints];
1230  G4double* z_array = new G4double[numRZPoints];
1231 
1232  for (G4int i=0; i<numRZPoints; i++)
1233  {
1234  r_array[i] = rzpointList[i].r*lunit;
1235  z_array[i] = rzpointList[i].z*lunit;
1236  }
1237 
1238  new G4Polyhedra(name,startphi,deltaphi,numsides,numRZPoints,
1239  r_array,z_array);
1240 
1241  delete [] r_array;
1242  delete [] z_array;
1243 }
1244 
1246 QuadrangularRead(const xercesc::DOMElement* const quadrangularElement)
1247 {
1248  G4ThreeVector vertex1;
1249  G4ThreeVector vertex2;
1250  G4ThreeVector vertex3;
1251  G4ThreeVector vertex4;
1252  G4FacetVertexType type = ABSOLUTE;
1253  G4double lunit = 1.0;
1254 
1255  const xercesc::DOMNamedNodeMap* const attributes
1256  = quadrangularElement->getAttributes();
1257  XMLSize_t attributeCount = attributes->getLength();
1258 
1259  for (XMLSize_t attribute_index=0;
1260  attribute_index<attributeCount; attribute_index++)
1261  {
1262  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1263 
1264  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1265  { continue; }
1266 
1267  const xercesc::DOMAttr* const attribute
1268  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
1269  if (!attribute)
1270  {
1271  G4Exception("G4GDMLReadSolids::QuadrangularRead()",
1272  "InvalidRead", FatalException, "No attribute found!");
1273  return 0;
1274  }
1275  const G4String attName = Transcode(attribute->getName());
1276  const G4String attValue = Transcode(attribute->getValue());
1277 
1278  if (attName=="vertex1")
1279  { vertex1 = GetPosition(GenerateName(attValue)); } else
1280  if (attName=="vertex2")
1281  { vertex2 = GetPosition(GenerateName(attValue)); } else
1282  if (attName=="vertex3")
1283  { vertex3 = GetPosition(GenerateName(attValue)); } else
1284  if (attName=="vertex4")
1285  { vertex4 = GetPosition(GenerateName(attValue)); } else
1286  if (attName=="lunit")
1287  { lunit = G4UnitDefinition::GetValueOf(attValue);
1288  if (G4UnitDefinition::GetCategory(attValue)!="Length") {
1289  G4Exception("G4GDMLReadSolids::QuadrangularRead()", "InvalidRead",
1290  FatalException, "Invalid unit for length!"); }
1291  } else
1292  if (attName=="type")
1293  { if (attValue=="RELATIVE") { type = RELATIVE; } }
1294  }
1295 
1296  return new G4QuadrangularFacet(vertex1*lunit,vertex2*lunit,
1297  vertex3*lunit,vertex4*lunit,type);
1298 }
1299 
1300 void G4GDMLReadSolids::
1301 ReflectedSolidRead(const xercesc::DOMElement* const reflectedSolidElement)
1302 {
1303  G4String name;
1304  G4double lunit = 1.0;
1305  G4double aunit = 1.0;
1306  G4String solid;
1307  G4ThreeVector scale(1.0,1.0,1.0);
1308  G4ThreeVector rotation;
1310 
1311  const xercesc::DOMNamedNodeMap* const attributes
1312  = reflectedSolidElement->getAttributes();
1313  XMLSize_t attributeCount = attributes->getLength();
1314 
1315  for (XMLSize_t attribute_index=0;
1316  attribute_index<attributeCount; attribute_index++)
1317  {
1318  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1319 
1320  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1321  { continue; }
1322 
1323  const xercesc::DOMAttr* const attribute
1324  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
1325  if (!attribute)
1326  {
1327  G4Exception("G4GDMLReadSolids::ReflectedSolidRead()",
1328  "InvalidRead", FatalException, "No attribute found!");
1329  return;
1330  }
1331  const G4String attName = Transcode(attribute->getName());
1332  const G4String attValue = Transcode(attribute->getValue());
1333 
1334  if (attName=="name") { name = GenerateName(attValue); } else
1335  if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
1336  if (G4UnitDefinition::GetCategory(attValue)!="Length") {
1337  G4Exception("G4GDMLReadSolids::ReflectedSolidRead()", "InvalidRead",
1338  FatalException, "Invalid unit for length!"); }
1339  } else
1340  if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue);
1341  if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
1342  G4Exception("G4GDMLReadSolids::ReflectedSolidRead()", "InvalidRead",
1343  FatalException, "Invalid unit for angle!"); }
1344  } else
1345  if (attName=="solid") { solid = GenerateName(attValue); } else
1346  if (attName=="sx") { scale.setX(eval.Evaluate(attValue)); } else
1347  if (attName=="sy") { scale.setY(eval.Evaluate(attValue)); } else
1348  if (attName=="sz") { scale.setZ(eval.Evaluate(attValue)); } else
1349  if (attName=="rx") { rotation.setX(eval.Evaluate(attValue)); } else
1350  if (attName=="ry") { rotation.setY(eval.Evaluate(attValue)); } else
1351  if (attName=="rz") { rotation.setZ(eval.Evaluate(attValue)); } else
1352  if (attName=="dx") { position.setX(eval.Evaluate(attValue)); } else
1353  if (attName=="dy") { position.setY(eval.Evaluate(attValue)); } else
1354  if (attName=="dz") { position.setZ(eval.Evaluate(attValue)); }
1355  }
1356 
1357  rotation *= aunit;
1358  position *= lunit;
1359 
1360  G4Transform3D transform(GetRotationMatrix(rotation),position);
1361  transform = transform*G4Scale3D(scale.x(),scale.y(),scale.z());
1362 
1363  new G4ReflectedSolid(name,GetSolid(solid),transform);
1364 }
1365 
1366 void G4GDMLReadSolids::
1367 ScaledSolidRead(const xercesc::DOMElement* const scaledSolidElement)
1368 {
1369  G4String name;
1370  G4VSolid* solid=0;
1371  G4ThreeVector scale(1.0,1.0,1.0);
1372 
1373  const xercesc::DOMNamedNodeMap* const attributes
1374  = scaledSolidElement->getAttributes();
1375  XMLSize_t attributeCount = attributes->getLength();
1376 
1377  for (XMLSize_t attribute_index=0;
1378  attribute_index<attributeCount; attribute_index++)
1379  {
1380  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1381 
1382  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1383  { continue; }
1384 
1385  const xercesc::DOMAttr* const attribute
1386  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
1387  if (!attribute)
1388  {
1389  G4Exception("G4GDMLReadSolids::ScaledSolidRead()",
1390  "InvalidRead", FatalException, "No attribute found!");
1391  return;
1392  }
1393  const G4String attName = Transcode(attribute->getName());
1394  const G4String attValue = Transcode(attribute->getValue());
1395 
1396  if (attName=="name") { name = GenerateName(attValue); }
1397  }
1398 
1399  for (xercesc::DOMNode* iter = scaledSolidElement->getFirstChild();
1400  iter != 0; iter = iter->getNextSibling())
1401  {
1402  if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) { continue; }
1403 
1404  const xercesc::DOMElement* const child
1405  = dynamic_cast<xercesc::DOMElement*>(iter);
1406  if (!child)
1407  {
1408  G4Exception("G4GDMLReadSolids::ScaledSolidRead()",
1409  "InvalidRead", FatalException, "No child found!");
1410  return;
1411  }
1412  const G4String tag = Transcode(child->getTagName());
1413 
1414  if (tag=="solidref")
1415  { solid = GetSolid(GenerateName(RefRead(child))); }
1416  else if (tag=="scale")
1417  { VectorRead(child,scale); }
1418  else if (tag=="scaleref")
1419  { scale = GetScale(GenerateName(RefRead(child))); }
1420  else
1421  {
1422  G4String error_msg = "Unknown tag in scaled solid: " + tag;
1423  G4Exception("G4GDMLReadSolids::ScaledSolidRead()", "ReadError",
1424  FatalException, error_msg);
1425  return;
1426  }
1427  }
1428 
1429  G4Scale3D transform = G4Scale3D(scale.x(),scale.y(),scale.z());
1430 
1431  new G4ScaledSolid(name, solid ,transform);
1432 }
1433 
1435 SectionRead(const xercesc::DOMElement* const sectionElement,G4double lunit)
1436 {
1437  G4double zPosition = 0.0;
1438  G4TwoVector Offset;
1439  G4double scalingFactor = 1.0;
1440 
1441  const xercesc::DOMNamedNodeMap* const attributes
1442  = sectionElement->getAttributes();
1443  XMLSize_t attributeCount = attributes->getLength();
1444 
1445  for (XMLSize_t attribute_index=0;
1446  attribute_index<attributeCount; attribute_index++)
1447  {
1448  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1449 
1450  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1451  { continue; }
1452 
1453  const xercesc::DOMAttr* const attribute
1454  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
1455  if (!attribute)
1456  {
1457  G4Exception("G4GDMLReadSolids::SectionRead()",
1458  "InvalidRead", FatalException, "No attribute found!");
1459  return G4ExtrudedSolid::ZSection(zPosition,Offset,scalingFactor);
1460  }
1461  const G4String attName = Transcode(attribute->getName());
1462  const G4String attValue = Transcode(attribute->getValue());
1463 
1464  if (attName=="zPosition")
1465  { zPosition = eval.Evaluate(attValue)*lunit; } else
1466  if (attName=="xOffset")
1467  { Offset.setX(eval.Evaluate(attValue)*lunit); } else
1468  if (attName=="yOffset")
1469  { Offset.setY(eval.Evaluate(attValue)*lunit); } else
1470  if (attName=="scalingFactor")
1471  { scalingFactor = eval.Evaluate(attValue); }
1472  }
1473 
1474  return G4ExtrudedSolid::ZSection(zPosition,Offset,scalingFactor);
1475 }
1476 
1477 void G4GDMLReadSolids::
1478 SphereRead(const xercesc::DOMElement* const sphereElement)
1479 {
1480  G4String name;
1481  G4double lunit = 1.0;
1482  G4double aunit = 1.0;
1483  G4double rmin = 0.0;
1484  G4double rmax = 0.0;
1485  G4double startphi = 0.0;
1486  G4double deltaphi = 0.0;
1487  G4double starttheta = 0.0;
1488  G4double deltatheta = 0.0;
1489 
1490  const xercesc::DOMNamedNodeMap* const attributes
1491  = sphereElement->getAttributes();
1492  XMLSize_t attributeCount = attributes->getLength();
1493 
1494  for (XMLSize_t attribute_index=0;
1495  attribute_index<attributeCount; attribute_index++)
1496  {
1497  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1498 
1499  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1500  { continue; }
1501 
1502  const xercesc::DOMAttr* const attribute
1503  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
1504  if (!attribute)
1505  {
1506  G4Exception("G4GDMLReadSolids::SphereRead()",
1507  "InvalidRead", FatalException, "No attribute found!");
1508  return;
1509  }
1510  const G4String attName = Transcode(attribute->getName());
1511  const G4String attValue = Transcode(attribute->getValue());
1512 
1513  if (attName=="name") { name = GenerateName(attValue); } else
1514  if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
1515  if (G4UnitDefinition::GetCategory(attValue)!="Length") {
1516  G4Exception("G4GDMLReadSolids::SphereRead()", "InvalidRead",
1517  FatalException, "Invalid unit for length!"); }
1518  } else
1519  if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue);
1520  if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
1521  G4Exception("G4GDMLReadSolids::SphereRead()", "InvalidRead",
1522  FatalException, "Invalid unit for angle!"); }
1523  } else
1524  if (attName=="rmin") { rmin = eval.Evaluate(attValue); } else
1525  if (attName=="rmax") { rmax = eval.Evaluate(attValue); } else
1526  if (attName=="startphi") { startphi = eval.Evaluate(attValue); } else
1527  if (attName=="deltaphi") { deltaphi = eval.Evaluate(attValue); } else
1528  if (attName=="starttheta") { starttheta = eval.Evaluate(attValue); } else
1529  if (attName=="deltatheta") { deltatheta = eval.Evaluate(attValue); }
1530  }
1531 
1532  rmin *= lunit;
1533  rmax *= lunit;
1534  startphi *= aunit;
1535  deltaphi *= aunit;
1536  starttheta *= aunit;
1537  deltatheta *= aunit;
1538 
1539  new G4Sphere(name,rmin,rmax,startphi,deltaphi,starttheta,deltatheta);
1540 }
1541 
1542 void G4GDMLReadSolids::
1543 TessellatedRead(const xercesc::DOMElement* const tessellatedElement)
1544 {
1545  G4String name;
1546 
1547  const xercesc::DOMNamedNodeMap* const attributes
1548  = tessellatedElement->getAttributes();
1549  XMLSize_t attributeCount = attributes->getLength();
1550 
1551  for (XMLSize_t attribute_index=0;
1552  attribute_index<attributeCount; attribute_index++)
1553  {
1554  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1555 
1556  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1557  { continue; }
1558 
1559  const xercesc::DOMAttr* const attribute
1560  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
1561  if (!attribute)
1562  {
1563  G4Exception("G4GDMLReadSolids::TessellatedRead()",
1564  "InvalidRead", FatalException, "No attribute found!");
1565  return;
1566  }
1567  const G4String attName = Transcode(attribute->getName());
1568  const G4String attValue = Transcode(attribute->getValue());
1569 
1570  if (attName=="name") { name = GenerateName(attValue); }
1571  }
1572 
1573  G4TessellatedSolid *tessellated = new G4TessellatedSolid(name);
1574 
1575  for (xercesc::DOMNode* iter = tessellatedElement->getFirstChild();
1576  iter != 0; iter = iter->getNextSibling())
1577  {
1578  if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) { continue; }
1579 
1580  const xercesc::DOMElement* const child
1581  = dynamic_cast<xercesc::DOMElement*>(iter);
1582  if (!child)
1583  {
1584  G4Exception("G4GDMLReadSolids::TessellatedRead()",
1585  "InvalidRead", FatalException, "No child found!");
1586  return;
1587  }
1588  const G4String tag = Transcode(child->getTagName());
1589 
1590  if (tag=="triangular")
1591  { tessellated->AddFacet(TriangularRead(child)); } else
1592  if (tag=="quadrangular")
1593  { tessellated->AddFacet(QuadrangularRead(child)); }
1594  }
1595 
1596  tessellated->SetSolidClosed(true);
1597 }
1598 
1599 void G4GDMLReadSolids::TetRead(const xercesc::DOMElement* const tetElement)
1600 {
1601  G4String name;
1602  G4ThreeVector vertex1;
1603  G4ThreeVector vertex2;
1604  G4ThreeVector vertex3;
1605  G4ThreeVector vertex4;
1606  G4double lunit = 1.0;
1607 
1608  const xercesc::DOMNamedNodeMap* const attributes
1609  = tetElement->getAttributes();
1610  XMLSize_t attributeCount = attributes->getLength();
1611 
1612  for (XMLSize_t attribute_index=0;
1613  attribute_index<attributeCount;attribute_index++)
1614  {
1615  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1616 
1617  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1618  { continue; }
1619 
1620  const xercesc::DOMAttr* const attribute
1621  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
1622  if (!attribute)
1623  {
1624  G4Exception("G4GDMLReadSolids::TetRead()",
1625  "InvalidRead", FatalException, "No attribute found!");
1626  return;
1627  }
1628  const G4String attName = Transcode(attribute->getName());
1629  const G4String attValue = Transcode(attribute->getValue());
1630 
1631  if (attName=="name")
1632  { name = GenerateName(attValue); } else
1633  if (attName=="lunit")
1634  { lunit = G4UnitDefinition::GetValueOf(attValue);
1635  if (G4UnitDefinition::GetCategory(attValue)!="Length") {
1636  G4Exception("G4GDMLReadSolids::TetRead()", "InvalidRead",
1637  FatalException, "Invalid unit for length!"); }
1638  } else
1639  if (attName=="vertex1")
1640  { vertex1 = GetPosition(GenerateName(attValue)); } else
1641  if (attName=="vertex2")
1642  { vertex2 = GetPosition(GenerateName(attValue)); } else
1643  if (attName=="vertex3")
1644  { vertex3 = GetPosition(GenerateName(attValue)); } else
1645  if (attName=="vertex4")
1646  { vertex4 = GetPosition(GenerateName(attValue)); }
1647  }
1648 
1649  new G4Tet(name,vertex1*lunit,vertex2*lunit,vertex3*lunit,vertex4*lunit);
1650 }
1651 
1652 void G4GDMLReadSolids::TorusRead(const xercesc::DOMElement* const torusElement)
1653 {
1654  G4String name;
1655  G4double lunit = 1.0;
1656  G4double aunit = 1.0;
1657  G4double rmin = 0.0;
1658  G4double rmax = 0.0;
1659  G4double rtor = 0.0;
1660  G4double startphi = 0.0;
1661  G4double deltaphi = 0.0;
1662 
1663  const xercesc::DOMNamedNodeMap* const attributes
1664  = torusElement->getAttributes();
1665  XMLSize_t attributeCount = attributes->getLength();
1666 
1667  for (XMLSize_t attribute_index=0;
1668  attribute_index<attributeCount; attribute_index++)
1669  {
1670  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1671 
1672  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1673  { continue; }
1674 
1675  const xercesc::DOMAttr* const attribute
1676  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
1677  if (!attribute)
1678  {
1679  G4Exception("G4GDMLReadSolids::TorusRead()",
1680  "InvalidRead", FatalException, "No attribute found!");
1681  return;
1682  }
1683  const G4String attName = Transcode(attribute->getName());
1684  const G4String attValue = Transcode(attribute->getValue());
1685 
1686  if (attName=="name") { name = GenerateName(attValue); } else
1687  if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
1688  if (G4UnitDefinition::GetCategory(attValue)!="Length") {
1689  G4Exception("G4GDMLReadSolids::TorusRead()", "InvalidRead",
1690  FatalException, "Invalid unit for length!"); }
1691  } else
1692  if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue);
1693  if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
1694  G4Exception("G4GDMLReadSolids::TorusRead()", "InvalidRead",
1695  FatalException, "Invalid unit for angle!"); }
1696  } else
1697  if (attName=="rmin") { rmin = eval.Evaluate(attValue); } else
1698  if (attName=="rmax") { rmax = eval.Evaluate(attValue); } else
1699  if (attName=="rtor") { rtor = eval.Evaluate(attValue); } else
1700  if (attName=="startphi") { startphi = eval.Evaluate(attValue); } else
1701  if (attName=="deltaphi") { deltaphi = eval.Evaluate(attValue); }
1702  }
1703 
1704  rmin *= lunit;
1705  rmax *= lunit;
1706  rtor *= lunit;
1707  startphi *= aunit;
1708  deltaphi *= aunit;
1709 
1710  new G4Torus(name,rmin,rmax,rtor,startphi,deltaphi);
1711 }
1712 
1713 void G4GDMLReadSolids::
1714 GenTrapRead(const xercesc::DOMElement* const gtrapElement)
1715 {
1716  G4String name;
1717  G4double lunit = 1.0;
1718  G4double dz =0.0;
1719  G4double v1x=0.0, v1y=0.0, v2x=0.0, v2y=0.0, v3x=0.0, v3y=0.0,
1720  v4x=0.0, v4y=0.0, v5x=0.0, v5y=0.0, v6x=0.0, v6y=0.0,
1721  v7x=0.0, v7y=0.0, v8x=0.0, v8y=0.0;
1722 
1723  const xercesc::DOMNamedNodeMap* const attributes
1724  = gtrapElement->getAttributes();
1725  XMLSize_t attributeCount = attributes->getLength();
1726 
1727  for (XMLSize_t attribute_index=0;
1728  attribute_index<attributeCount; attribute_index++)
1729  {
1730  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1731 
1732  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1733  { continue; }
1734 
1735  const xercesc::DOMAttr* const attribute
1736  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
1737  if (!attribute)
1738  {
1739  G4Exception("G4GDMLReadSolids::GenTrapRead()",
1740  "InvalidRead", FatalException, "No attribute found!");
1741  return;
1742  }
1743  const G4String attName = Transcode(attribute->getName());
1744  const G4String attValue = Transcode(attribute->getValue());
1745 
1746  if (attName=="name") { name = GenerateName(attValue); } else
1747  if (attName=="lunit") { G4UnitDefinition::GetValueOf(attValue);
1748  if (G4UnitDefinition::GetCategory(attValue)!="Length") {
1749  G4Exception("G4GDMLReadSolids::GenTrapRead()", "InvalidRead",
1750  FatalException, "Invalid unit for length!"); }
1751  } else
1752  if (attName=="dz") { dz = eval.Evaluate(attValue); } else
1753  if (attName=="v1x") { v1x = eval.Evaluate(attValue); } else
1754  if (attName=="v1y") { v1y = eval.Evaluate(attValue); } else
1755  if (attName=="v2x") { v2x = eval.Evaluate(attValue); } else
1756  if (attName=="v2y") { v2y = eval.Evaluate(attValue); } else
1757  if (attName=="v3x") { v3x = eval.Evaluate(attValue); } else
1758  if (attName=="v3y") { v3y = eval.Evaluate(attValue); } else
1759  if (attName=="v4x") { v4x = eval.Evaluate(attValue); } else
1760  if (attName=="v4y") { v4y = eval.Evaluate(attValue); } else
1761  if (attName=="v5x") { v5x = eval.Evaluate(attValue); } else
1762  if (attName=="v5y") { v5y = eval.Evaluate(attValue); } else
1763  if (attName=="v6x") { v6x = eval.Evaluate(attValue); } else
1764  if (attName=="v6y") { v6y = eval.Evaluate(attValue); } else
1765  if (attName=="v7x") { v7x = eval.Evaluate(attValue); } else
1766  if (attName=="v7y") { v7y = eval.Evaluate(attValue); } else
1767  if (attName=="v8x") { v8x = eval.Evaluate(attValue); } else
1768  if (attName=="v8y") { v8y = eval.Evaluate(attValue); }
1769  }
1770 
1771  dz *= lunit;
1772  std::vector<G4TwoVector> vertices;
1773  vertices.push_back(G4TwoVector(v1x*lunit,v1y*lunit));
1774  vertices.push_back(G4TwoVector(v2x*lunit,v2y*lunit));
1775  vertices.push_back(G4TwoVector(v3x*lunit,v3y*lunit));
1776  vertices.push_back(G4TwoVector(v4x*lunit,v4y*lunit));
1777  vertices.push_back(G4TwoVector(v5x*lunit,v5y*lunit));
1778  vertices.push_back(G4TwoVector(v6x*lunit,v6y*lunit));
1779  vertices.push_back(G4TwoVector(v7x*lunit,v7y*lunit));
1780  vertices.push_back(G4TwoVector(v8x*lunit,v8y*lunit));
1781  new G4GenericTrap(name,dz,vertices);
1782 }
1783 
1784 void G4GDMLReadSolids::TrapRead(const xercesc::DOMElement* const trapElement)
1785 {
1786  G4String name;
1787  G4double lunit = 1.0;
1788  G4double aunit = 1.0;
1789  G4double z = 0.0;
1790  G4double theta = 0.0;
1791  G4double phi = 0.0;
1792  G4double y1 = 0.0;
1793  G4double x1 = 0.0;
1794  G4double x2 = 0.0;
1795  G4double alpha1 = 0.0;
1796  G4double y2 = 0.0;
1797  G4double x3 = 0.0;
1798  G4double x4 = 0.0;
1799  G4double alpha2 = 0.0;
1800 
1801  const xercesc::DOMNamedNodeMap* const attributes
1802  = trapElement->getAttributes();
1803  XMLSize_t attributeCount = attributes->getLength();
1804 
1805  for (XMLSize_t attribute_index=0;
1806  attribute_index<attributeCount; attribute_index++)
1807  {
1808  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1809 
1810  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1811  { continue; }
1812 
1813  const xercesc::DOMAttr* const attribute
1814  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
1815  if (!attribute)
1816  {
1817  G4Exception("G4GDMLReadSolids::TrapRead()",
1818  "InvalidRead", FatalException, "No attribute found!");
1819  return;
1820  }
1821  const G4String attName = Transcode(attribute->getName());
1822  const G4String attValue = Transcode(attribute->getValue());
1823 
1824  if (attName=="name") { name = GenerateName(attValue); } else
1825  if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
1826  if (G4UnitDefinition::GetCategory(attValue)!="Length") {
1827  G4Exception("G4GDMLReadSolids::TrapRead()", "InvalidRead",
1828  FatalException, "Invalid unit for length!"); }
1829  } else
1830  if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue);
1831  if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
1832  G4Exception("G4GDMLReadSolids::TrapRead()", "InvalidRead",
1833  FatalException, "Invalid unit for angle!"); }
1834  } else
1835  if (attName=="z") { z = eval.Evaluate(attValue); } else
1836  if (attName=="theta") { theta = eval.Evaluate(attValue); } else
1837  if (attName=="phi") { phi = eval.Evaluate(attValue); } else
1838  if (attName=="y1") { y1 = eval.Evaluate(attValue); } else
1839  if (attName=="x1") { x1 = eval.Evaluate(attValue); } else
1840  if (attName=="x2") { x2 = eval.Evaluate(attValue); } else
1841  if (attName=="alpha1") { alpha1 = eval.Evaluate(attValue); } else
1842  if (attName=="y2") { y2 = eval.Evaluate(attValue); } else
1843  if (attName=="x3") { x3 = eval.Evaluate(attValue); } else
1844  if (attName=="x4") { x4 = eval.Evaluate(attValue); } else
1845  if (attName=="alpha2") { alpha2 = eval.Evaluate(attValue); }
1846  }
1847 
1848  z *= 0.5*lunit;
1849  theta *= aunit;
1850  phi *= aunit;
1851  y1 *= 0.5*lunit;
1852  x1 *= 0.5*lunit;
1853  x2 *= 0.5*lunit;
1854  alpha1 *= aunit;
1855  y2 *= 0.5*lunit;
1856  x3 *= 0.5*lunit;
1857  x4 *= 0.5*lunit;
1858  alpha2 *= aunit;
1859 
1860  new G4Trap(name,z,theta,phi,y1,x1,x2,alpha1,y2,x3,x4,alpha2);
1861 }
1862 
1863 void G4GDMLReadSolids::TrdRead(const xercesc::DOMElement* const trdElement)
1864 {
1865  G4String name;
1866  G4double lunit = 1.0;
1867  G4double x1 = 0.0;
1868  G4double x2 = 0.0;
1869  G4double y1 = 0.0;
1870  G4double y2 = 0.0;
1871  G4double z = 0.0;
1872 
1873  const xercesc::DOMNamedNodeMap* const attributes = trdElement->getAttributes();
1874  XMLSize_t attributeCount = attributes->getLength();
1875 
1876  for (XMLSize_t attribute_index=0;
1877  attribute_index<attributeCount; attribute_index++)
1878  {
1879  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1880 
1881  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1882  { continue; }
1883 
1884  const xercesc::DOMAttr* const attribute
1885  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
1886  if (!attribute)
1887  {
1888  G4Exception("G4GDMLReadSolids::TrdRead()",
1889  "InvalidRead", FatalException, "No attribute found!");
1890  return;
1891  }
1892  const G4String attName = Transcode(attribute->getName());
1893  const G4String attValue = Transcode(attribute->getValue());
1894 
1895  if (attName=="name") { name = GenerateName(attValue); } else
1896  if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
1897  if (G4UnitDefinition::GetCategory(attValue)!="Length") {
1898  G4Exception("G4GDMLReadSolids::TrdRead()", "InvalidRead",
1899  FatalException, "Invalid unit for length!"); }
1900  } else
1901  if (attName=="x1") { x1 = eval.Evaluate(attValue); } else
1902  if (attName=="x2") { x2 = eval.Evaluate(attValue); } else
1903  if (attName=="y1") { y1 = eval.Evaluate(attValue); } else
1904  if (attName=="y2") { y2 = eval.Evaluate(attValue); } else
1905  if (attName=="z") { z = eval.Evaluate(attValue); }
1906  }
1907 
1908  x1 *= 0.5*lunit;
1909  x2 *= 0.5*lunit;
1910  y1 *= 0.5*lunit;
1911  y2 *= 0.5*lunit;
1912  z *= 0.5*lunit;
1913 
1914  new G4Trd(name,x1,x2,y1,y2,z);
1915 }
1916 
1918 TriangularRead(const xercesc::DOMElement* const triangularElement)
1919 {
1920  G4ThreeVector vertex1;
1921  G4ThreeVector vertex2;
1922  G4ThreeVector vertex3;
1923  G4FacetVertexType type = ABSOLUTE;
1924  G4double lunit = 1.0;
1925 
1926  const xercesc::DOMNamedNodeMap* const attributes
1927  = triangularElement->getAttributes();
1928  XMLSize_t attributeCount = attributes->getLength();
1929 
1930  for (XMLSize_t attribute_index=0;
1931  attribute_index<attributeCount; attribute_index++)
1932  {
1933  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1934 
1935  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1936  { continue; }
1937 
1938  const xercesc::DOMAttr* const attribute
1939  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
1940  if (!attribute)
1941  {
1942  G4Exception("G4GDMLReadSolids::TriangularRead()",
1943  "InvalidRead", FatalException, "No attribute found!");
1944  return 0;
1945  }
1946  const G4String attName = Transcode(attribute->getName());
1947  const G4String attValue = Transcode(attribute->getValue());
1948 
1949  if (attName=="vertex1")
1950  { vertex1 = GetPosition(GenerateName(attValue)); } else
1951  if (attName=="vertex2")
1952  { vertex2 = GetPosition(GenerateName(attValue)); } else
1953  if (attName=="vertex3")
1954  { vertex3 = GetPosition(GenerateName(attValue)); } else
1955  if (attName=="lunit")
1956  { lunit = G4UnitDefinition::GetValueOf(attValue);
1957  if (G4UnitDefinition::GetCategory(attValue)!="Length") {
1958  G4Exception("G4GDMLReadSolids::TriangularRead()", "InvalidRead",
1959  FatalException, "Invalid unit for length!"); }
1960  } else
1961  if (attName=="type")
1962  { if (attValue=="RELATIVE") { type = RELATIVE; } }
1963  }
1964 
1965  return new G4TriangularFacet(vertex1*lunit,vertex2*lunit,vertex3*lunit,type);
1966 }
1967 
1968 void G4GDMLReadSolids::TubeRead(const xercesc::DOMElement* const tubeElement)
1969 {
1970  G4String name;
1971  G4double lunit = 1.0;
1972  G4double aunit = 1.0;
1973  G4double rmin = 0.0;
1974  G4double rmax = 0.0;
1975  G4double z = 0.0;
1976  G4double startphi = 0.0;
1977  G4double deltaphi = 0.0;
1978 
1979  const xercesc::DOMNamedNodeMap* const attributes
1980  = tubeElement->getAttributes();
1981  XMLSize_t attributeCount = attributes->getLength();
1982 
1983  for (XMLSize_t attribute_index=0;
1984  attribute_index<attributeCount; attribute_index++)
1985  {
1986  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1987 
1988  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1989  { continue; }
1990 
1991  const xercesc::DOMAttr* const attribute
1992  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
1993  if (!attribute)
1994  {
1995  G4Exception("G4GDMLReadSolids::TubeRead()",
1996  "InvalidRead", FatalException, "No attribute found!");
1997  return;
1998  }
1999  const G4String attName = Transcode(attribute->getName());
2000  const G4String attValue = Transcode(attribute->getValue());
2001 
2002  if (attName=="name") { name = GenerateName(attValue); } else
2003  if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
2004  if (G4UnitDefinition::GetCategory(attValue)!="Length") {
2005  G4Exception("G4GDMLReadSolids::TubeRead()", "InvalidRead",
2006  FatalException, "Invalid unit for length!"); }
2007  } else
2008  if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue);
2009  if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
2010  G4Exception("G4GDMLReadSolids::TubeRead()", "InvalidRead",
2011  FatalException, "Invalid unit for angle!"); }
2012  } else
2013  if (attName=="rmin") { rmin = eval.Evaluate(attValue); } else
2014  if (attName=="rmax") { rmax = eval.Evaluate(attValue); } else
2015  if (attName=="z") { z = eval.Evaluate(attValue); } else
2016  if (attName=="startphi") { startphi = eval.Evaluate(attValue); } else
2017  if (attName=="deltaphi") { deltaphi = eval.Evaluate(attValue); }
2018  }
2019 
2020  rmin *= lunit;
2021  rmax *= lunit;
2022  z *= 0.5*lunit;
2023  startphi *= aunit;
2024  deltaphi *= aunit;
2025 
2026  new G4Tubs(name,rmin,rmax,z,startphi,deltaphi);
2027 }
2028 
2029 void G4GDMLReadSolids::CutTubeRead(const xercesc::DOMElement* const cuttubeElement)
2030 {
2031  G4String name;
2032  G4double lunit = 1.0;
2033  G4double aunit = 1.0;
2034  G4double rmin = 0.0;
2035  G4double rmax = 0.0;
2036  G4double z = 0.0;
2037  G4double startphi = 0.0;
2038  G4double deltaphi = 0.0;
2039  G4ThreeVector lowNorm(0);
2040  G4ThreeVector highNorm(0);
2041 
2042  const xercesc::DOMNamedNodeMap* const attributes
2043  = cuttubeElement->getAttributes();
2044  XMLSize_t attributeCount = attributes->getLength();
2045 
2046  for (XMLSize_t attribute_index=0;
2047  attribute_index<attributeCount; attribute_index++)
2048  {
2049  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
2050 
2051  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
2052  { continue; }
2053 
2054  const xercesc::DOMAttr* const attribute
2055  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
2056  if (!attribute)
2057  {
2058  G4Exception("G4GDMLReadSolids::CutTubeRead()",
2059  "InvalidRead", FatalException, "No attribute found!");
2060  return;
2061  }
2062  const G4String attName = Transcode(attribute->getName());
2063  const G4String attValue = Transcode(attribute->getValue());
2064 
2065  if (attName=="name") { name = GenerateName(attValue); } else
2066  if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
2067  if (G4UnitDefinition::GetCategory(attValue)!="Length") {
2068  G4Exception("G4GDMLReadSolids::CutTubeRead()", "InvalidRead",
2069  FatalException, "Invalid unit for length!"); }
2070  } else
2071  if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue);
2072  if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
2073  G4Exception("G4GDMLReadSolids::CutTubeRead()", "InvalidRead",
2074  FatalException, "Invalid unit for angle!"); }
2075  } else
2076  if (attName=="rmin") { rmin = eval.Evaluate(attValue); } else
2077  if (attName=="rmax") { rmax = eval.Evaluate(attValue); } else
2078  if (attName=="z") { z = eval.Evaluate(attValue); } else
2079  if (attName=="startphi") { startphi = eval.Evaluate(attValue); } else
2080  if (attName=="deltaphi") { deltaphi = eval.Evaluate(attValue); } else
2081  if (attName=="lowX") { lowNorm.setX (eval.Evaluate(attValue)); } else
2082  if (attName=="lowY") { lowNorm.setY (eval.Evaluate(attValue)); } else
2083  if (attName=="lowZ") { lowNorm.setZ (eval.Evaluate(attValue)); } else
2084  if (attName=="highX") { highNorm.setX (eval.Evaluate(attValue)); } else
2085  if (attName=="highY") { highNorm.setY (eval.Evaluate(attValue)); } else
2086  if (attName=="highZ") { highNorm.setZ (eval.Evaluate(attValue)); }
2087 
2088  }
2089 
2090  rmin *= lunit;
2091  rmax *= lunit;
2092  z *= 0.5*lunit;
2093  startphi *= aunit;
2094  deltaphi *= aunit;
2095 
2096  new G4CutTubs(name,rmin,rmax,z,startphi,deltaphi,lowNorm,highNorm);
2097 }
2098 
2099 void G4GDMLReadSolids::
2100 TwistedboxRead(const xercesc::DOMElement* const twistedboxElement)
2101 {
2102  G4String name;
2103  G4double lunit = 1.0;
2104  G4double aunit = 1.0;
2105  G4double PhiTwist = 0.0;
2106  G4double x = 0.0;
2107  G4double y = 0.0;
2108  G4double z = 0.0;
2109 
2110  const xercesc::DOMNamedNodeMap* const attributes
2111  = twistedboxElement->getAttributes();
2112  XMLSize_t attributeCount = attributes->getLength();
2113 
2114  for (XMLSize_t attribute_index=0;
2115  attribute_index<attributeCount; attribute_index++)
2116  {
2117  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
2118 
2119  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
2120  { continue; }
2121 
2122  const xercesc::DOMAttr* const attribute
2123  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
2124  if (!attribute)
2125  {
2126  G4Exception("G4GDMLReadSolids::TwistedboxRead()",
2127  "InvalidRead", FatalException, "No attribute found!");
2128  return;
2129  }
2130  const G4String attName = Transcode(attribute->getName());
2131  const G4String attValue = Transcode(attribute->getValue());
2132 
2133  if (attName=="name") { name = GenerateName(attValue); } else
2134  if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
2135  if (G4UnitDefinition::GetCategory(attValue)!="Length") {
2136  G4Exception("G4GDMLReadSolids::TwistedBoxRead()", "InvalidRead",
2137  FatalException, "Invalid unit for length!"); }
2138  } else
2139  if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue);
2140  if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
2141  G4Exception("G4GDMLReadSolids::TwistedboxRead()", "InvalidRead",
2142  FatalException, "Invalid unit for angle!"); }
2143  } else
2144  if (attName=="PhiTwist") { PhiTwist = eval.Evaluate(attValue); } else
2145  if (attName=="x") { x = eval.Evaluate(attValue); } else
2146  if (attName=="y") { y = eval.Evaluate(attValue); } else
2147  if (attName=="z") { z = eval.Evaluate(attValue); }
2148  }
2149 
2150  PhiTwist *= aunit;
2151  x *= 0.5*lunit;
2152  y *= 0.5*lunit;
2153  z *= 0.5*lunit;
2154 
2155  new G4TwistedBox(name,PhiTwist,x,y,z);
2156 }
2157 
2158 void G4GDMLReadSolids::
2159 TwistedtrapRead(const xercesc::DOMElement* const twistedtrapElement)
2160 {
2161  G4String name;
2162  G4double lunit = 1.0;
2163  G4double aunit = 1.0;
2164  G4double PhiTwist = 0.0;
2165  G4double z = 0.0;
2166  G4double Theta = 0.0;
2167  G4double Phi = 0.0;
2168  G4double y1 = 0.0;
2169  G4double x1 = 0.0;
2170  G4double x2 = 0.0;
2171  G4double y2 = 0.0;
2172  G4double x3 = 0.0;
2173  G4double x4 = 0.0;
2174  G4double Alph = 0.0;
2175 
2176  const xercesc::DOMNamedNodeMap* const attributes
2177  = twistedtrapElement->getAttributes();
2178  XMLSize_t attributeCount = attributes->getLength();
2179 
2180  for (XMLSize_t attribute_index=0;
2181  attribute_index<attributeCount; attribute_index++)
2182  {
2183  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
2184 
2185  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
2186  { continue; }
2187 
2188  const xercesc::DOMAttr* const attribute
2189  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
2190  if (!attribute)
2191  {
2192  G4Exception("G4GDMLReadSolids::TwistedtrapRead()",
2193  "InvalidRead", FatalException, "No attribute found!");
2194  return;
2195  }
2196  const G4String attName = Transcode(attribute->getName());
2197  const G4String attValue = Transcode(attribute->getValue());
2198 
2199  if (attName=="name") { name = GenerateName(attValue); } else
2200  if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
2201  if (G4UnitDefinition::GetCategory(attValue)!="Length") {
2202  G4Exception("G4GDMLReadSolids::TwistedtrapRead()", "InvalidRead",
2203  FatalException, "Invalid unit for length!"); }
2204  } else
2205  if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue);
2206  if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
2207  G4Exception("G4GDMLReadSolids::TwistedtrapRead()", "InvalidRead",
2208  FatalException, "Invalid unit for angle!"); }
2209  } else
2210  if (attName=="PhiTwist") { PhiTwist = eval.Evaluate(attValue); } else
2211  if (attName=="z") { z = eval.Evaluate(attValue); } else
2212  if (attName=="Theta") { Theta = eval.Evaluate(attValue); } else
2213  if (attName=="Phi") { Phi = eval.Evaluate(attValue); } else
2214  if (attName=="y1") { y1 = eval.Evaluate(attValue); } else
2215  if (attName=="x1") { x1 = eval.Evaluate(attValue); } else
2216  if (attName=="x2") { x2 = eval.Evaluate(attValue); } else
2217  if (attName=="y2") { y2 = eval.Evaluate(attValue); } else
2218  if (attName=="x3") { x3 = eval.Evaluate(attValue); } else
2219  if (attName=="x4") { x4 = eval.Evaluate(attValue); } else
2220  if (attName=="Alph") { Alph = eval.Evaluate(attValue); }
2221  }
2222 
2223 
2224  PhiTwist *= aunit;
2225  z *= 0.5*lunit;
2226  Theta *= aunit;
2227  Phi *= aunit;
2228  Alph *= aunit;
2229  y1 *= 0.5*lunit;
2230  x1 *= 0.5*lunit;
2231  x2 *= 0.5*lunit;
2232  y2 *= 0.5*lunit;
2233  x3 *= 0.5*lunit;
2234  x4 *= 0.5*lunit;
2235 
2236  new G4TwistedTrap(name,PhiTwist,z,Theta,Phi,y1,x1,x2,y2,x3,x4,Alph);
2237 }
2238 
2239 void G4GDMLReadSolids::
2240 TwistedtrdRead(const xercesc::DOMElement* const twistedtrdElement)
2241 {
2242  G4String name;
2243  G4double lunit = 1.0;
2244  G4double aunit = 1.0;
2245  G4double x1 = 0.0;
2246  G4double x2 = 0.0;
2247  G4double y1 = 0.0;
2248  G4double y2 = 0.0;
2249  G4double z = 0.0;
2250  G4double PhiTwist = 0.0;
2251 
2252  const xercesc::DOMNamedNodeMap* const attributes
2253  = twistedtrdElement->getAttributes();
2254  XMLSize_t attributeCount = attributes->getLength();
2255 
2256  for (XMLSize_t attribute_index=0;
2257  attribute_index<attributeCount; attribute_index++)
2258  {
2259  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
2260 
2261  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
2262  { continue; }
2263 
2264  const xercesc::DOMAttr* const attribute
2265  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
2266  if (!attribute)
2267  {
2268  G4Exception("G4GDMLReadSolids::TwistedtrdRead()",
2269  "InvalidRead", FatalException, "No attribute found!");
2270  return;
2271  }
2272  const G4String attName = Transcode(attribute->getName());
2273  const G4String attValue = Transcode(attribute->getValue());
2274 
2275  if (attName=="name") { name = GenerateName(attValue); } else
2276  if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
2277  if (G4UnitDefinition::GetCategory(attValue)!="Length") {
2278  G4Exception("G4GDMLReadSolids::TwistedtrdRead()", "InvalidRead",
2279  FatalException, "Invalid unit for length!"); }
2280  } else
2281  if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue);
2282  if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
2283  G4Exception("G4GDMLReadSolids::TwistedtrdRead()", "InvalidRead",
2284  FatalException, "Invalid unit for angle!"); }
2285  } else
2286  if (attName=="x1") { x1 = eval.Evaluate(attValue); } else
2287  if (attName=="x2") { x2 = eval.Evaluate(attValue); } else
2288  if (attName=="y1") { y1 = eval.Evaluate(attValue); } else
2289  if (attName=="y2") { y2 = eval.Evaluate(attValue); } else
2290  if (attName=="z") { z = eval.Evaluate(attValue); } else
2291  if (attName=="PhiTwist") { PhiTwist = eval.Evaluate(attValue); }
2292  }
2293 
2294  x1 *= 0.5*lunit;
2295  x2 *= 0.5*lunit;
2296  y1 *= 0.5*lunit;
2297  y2 *= 0.5*lunit;
2298  z *= 0.5*lunit;
2299  PhiTwist *= aunit;
2300 
2301  new G4TwistedTrd(name,x1,x2,y1,y2,z,PhiTwist);
2302 }
2303 
2304 void G4GDMLReadSolids::
2305 TwistedtubsRead(const xercesc::DOMElement* const twistedtubsElement)
2306 {
2307  G4String name;
2308  G4double lunit = 1.0;
2309  G4double aunit = 1.0;
2310  G4double twistedangle = 0.0;
2311  G4double endinnerrad = 0.0;
2312  G4double endouterrad = 0.0;
2313  G4double zlen = 0.0;
2314  G4double phi = 0.0;
2315 
2316  const xercesc::DOMNamedNodeMap* const attributes
2317  = twistedtubsElement->getAttributes();
2318  XMLSize_t attributeCount = attributes->getLength();
2319 
2320  for (XMLSize_t attribute_index=0;
2321  attribute_index<attributeCount; attribute_index++)
2322  {
2323  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
2324 
2325  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
2326  { continue; }
2327 
2328  const xercesc::DOMAttr* const attribute
2329  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
2330  if (!attribute)
2331  {
2332  G4Exception("G4GDMLReadSolids::TwistedtubsRead()",
2333  "InvalidRead", FatalException, "No attribute found!");
2334  return;
2335  }
2336  const G4String attName = Transcode(attribute->getName());
2337  const G4String attValue = Transcode(attribute->getValue());
2338 
2339  if (attName=="name") { name = GenerateName(attValue); } else
2340  if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue);
2341  if (G4UnitDefinition::GetCategory(attValue)!="Length") {
2342  G4Exception("G4GDMLReadSolids::TwistedtubsRead()", "InvalidRead",
2343  FatalException, "Invalid unit for length!"); }
2344  } else
2345  if (attName=="aunit") { aunit = G4UnitDefinition::GetValueOf(attValue);
2346  if (G4UnitDefinition::GetCategory(attValue)!="Angle") {
2347  G4Exception("G4GDMLReadSolids::TwistedtubsRead()", "InvalidRead",
2348  FatalException, "Invalid unit for angle!"); }
2349  } else
2350  if (attName=="twistedangle") { twistedangle=eval.Evaluate(attValue); } else
2351  if (attName=="endinnerrad") { endinnerrad=eval.Evaluate(attValue); } else
2352  if (attName=="endouterrad") { endouterrad=eval.Evaluate(attValue); } else
2353  if (attName=="zlen") { zlen = eval.Evaluate(attValue); } else
2354  if (attName=="phi") { phi = eval.Evaluate(attValue); }
2355  }
2356 
2357  twistedangle *= aunit;
2358  endinnerrad *= lunit;
2359  endouterrad *= lunit;
2360  zlen *= 0.5*lunit;
2361  phi *= aunit;
2362 
2363  new G4TwistedTubs(name,twistedangle,endinnerrad,endouterrad,zlen,phi);
2364 }
2365 
2367 TwoDimVertexRead(const xercesc::DOMElement* const element, G4double lunit)
2368 {
2369  G4TwoVector vec;
2370 
2371  const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
2372  XMLSize_t attributeCount = attributes->getLength();
2373 
2374  for (XMLSize_t attribute_index=0;
2375  attribute_index<attributeCount; attribute_index++)
2376  {
2377  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
2378 
2379  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
2380  { continue; }
2381 
2382  const xercesc::DOMAttr* const attribute
2383  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
2384  if (!attribute)
2385  {
2386  G4Exception("G4GDMLReadSolids::TwoDimVertexRead()",
2387  "InvalidRead", FatalException, "No attribute found!");
2388  return vec;
2389  }
2390  const G4String attName = Transcode(attribute->getName());
2391  const G4String attValue = Transcode(attribute->getValue());
2392 
2393  if (attName=="x") { vec.setX(eval.Evaluate(attValue)*lunit); } else
2394  if (attName=="y") { vec.setY(eval.Evaluate(attValue)*lunit); }
2395  }
2396 
2397  return vec;
2398 }
2399 
2401 ZplaneRead(const xercesc::DOMElement* const zplaneElement)
2402 {
2403  zplaneType zplane = {0.,0.,0.};
2404 
2405  const xercesc::DOMNamedNodeMap* const attributes
2406  = zplaneElement->getAttributes();
2407  XMLSize_t attributeCount = attributes->getLength();
2408 
2409  for (XMLSize_t attribute_index=0;
2410  attribute_index<attributeCount; attribute_index++)
2411  {
2412  xercesc::DOMNode* node = attributes->item(attribute_index);
2413 
2414  if (node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) { continue; }
2415 
2416  const xercesc::DOMAttr* const attribute
2417  = dynamic_cast<xercesc::DOMAttr*>(node);
2418  if (!attribute)
2419  {
2420  G4Exception("G4GDMLReadSolids::ZplaneRead()",
2421  "InvalidRead", FatalException, "No attribute found!");
2422  return zplane;
2423  }
2424  const G4String attName = Transcode(attribute->getName());
2425  const G4String attValue = Transcode(attribute->getValue());
2426 
2427  if (attName=="rmin") { zplane.rmin = eval.Evaluate(attValue); } else
2428  if (attName=="rmax") { zplane.rmax = eval.Evaluate(attValue); } else
2429  if (attName=="z") { zplane.z = eval.Evaluate(attValue); }
2430  }
2431 
2432  return zplane;
2433 }
2434 G4GDMLReadSolids::rzPointType G4GDMLReadSolids::
2435 RZPointRead(const xercesc::DOMElement* const zplaneElement)
2436 {
2437  rzPointType rzpoint = {0.,0.};
2438 
2439  const xercesc::DOMNamedNodeMap* const attributes
2440  = zplaneElement->getAttributes();
2441  XMLSize_t attributeCount = attributes->getLength();
2442 
2443  for (XMLSize_t attribute_index=0;
2444  attribute_index<attributeCount; attribute_index++)
2445  {
2446  xercesc::DOMNode* node = attributes->item(attribute_index);
2447 
2448  if (node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) { continue; }
2449 
2450  const xercesc::DOMAttr* const attribute
2451  = dynamic_cast<xercesc::DOMAttr*>(node);
2452  if (!attribute)
2453  {
2454  G4Exception("G4GDMLReadSolids::RZPointRead()",
2455  "InvalidRead", FatalException, "No attribute found!");
2456  return rzpoint;
2457  }
2458  const G4String attName = Transcode(attribute->getName());
2459  const G4String attValue = Transcode(attribute->getValue());
2460 
2461  if (attName=="r") { rzpoint.r = eval.Evaluate(attValue); } else
2462  if (attName=="z") { rzpoint.z = eval.Evaluate(attValue); }
2463  }
2464 
2465  return rzpoint;
2466 
2467 }
2468 
2469 void G4GDMLReadSolids::
2470 OpticalSurfaceRead(const xercesc::DOMElement* const opticalsurfaceElement)
2471 {
2472  G4String name;
2473  G4String smodel;
2474  G4String sfinish;
2475  G4String stype;
2476  G4double value = 0.0;
2477 
2478  const xercesc::DOMNamedNodeMap* const attributes
2479  = opticalsurfaceElement->getAttributes();
2480  XMLSize_t attributeCount = attributes->getLength();
2481 
2482  for (XMLSize_t attribute_index=0;
2483  attribute_index<attributeCount; attribute_index++)
2484  {
2485  xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
2486 
2487  if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
2488  { continue; }
2489 
2490  const xercesc::DOMAttr* const attribute
2491  = dynamic_cast<xercesc::DOMAttr*>(attribute_node);
2492  if (!attribute)
2493  {
2494  G4Exception("G4GDMLReadSolids::OpticalSurfaceRead()",
2495  "InvalidRead", FatalException, "No attribute found!");
2496  return;
2497  }
2498  const G4String attName = Transcode(attribute->getName());
2499  const G4String attValue = Transcode(attribute->getValue());
2500 
2501  if (attName=="name") { name = GenerateName(attValue); } else
2502  if (attName=="model") { smodel = attValue; } else
2503  if (attName=="finish") { sfinish = attValue; } else
2504  if (attName=="type") { stype = attValue; } else
2505  if (attName=="value") { value = eval.Evaluate(attValue); }
2506  }
2507 
2509  G4OpticalSurfaceFinish finish;
2510  G4SurfaceType type;
2511 
2512  if ((smodel=="glisur") || (smodel=="0")) { model = glisur; } else
2513  if ((smodel=="unified") || (smodel=="1")) { model = unified; } else
2514  if ((smodel=="LUT") || (smodel=="2")) { model = LUT; }
2515  else { model = dichroic; }
2516 
2517  if ((sfinish=="polished") || (sfinish=="0"))
2518  { finish = polished; } else
2519  if ((sfinish=="polishedfrontpainted") || (sfinish=="1"))
2520  { finish = polishedfrontpainted; } else
2521  if ((sfinish=="polishedbackpainted") || (sfinish=="2"))
2522  { finish = polishedbackpainted; } else
2523  if ((sfinish=="ground") || (sfinish=="3"))
2524  { finish = ground; } else
2525  if ((sfinish=="groundfrontpainted") || (sfinish=="4"))
2526  { finish = groundfrontpainted; } else
2527  if ((sfinish=="groundbackpainted") || (sfinish=="5"))
2528  { finish = groundbackpainted; } else
2529  if ((sfinish=="polishedlumirrorair") || (sfinish=="6"))
2530  { finish = polishedlumirrorair; } else
2531  if ((sfinish=="polishedlumirrorglue") || (sfinish=="7"))
2532  { finish = polishedlumirrorglue; } else
2533  if ((sfinish=="polishedair") || (sfinish=="8"))
2534  { finish = polishedair; } else
2535  if ((sfinish=="polishedteflonair") || (sfinish=="9"))
2536  { finish = polishedteflonair; } else
2537  if ((sfinish=="polishedtioair") || (sfinish=="10"))
2538  { finish = polishedtioair; } else
2539  if ((sfinish=="polishedtyvekair") || (sfinish=="11"))
2540  { finish = polishedtyvekair; } else
2541  if ((sfinish=="polishedvm2000air") || (sfinish=="12"))
2542  { finish = polishedvm2000air; } else
2543  if ((sfinish=="polishedvm2000glue") || (sfinish=="13"))
2544  { finish = polishedvm2000glue; } else
2545  if ((sfinish=="etchedlumirrorair") || (sfinish=="14"))
2546  { finish = etchedlumirrorair; } else
2547  if ((sfinish=="etchedlumirrorglue") || (sfinish=="15"))
2548  { finish = etchedlumirrorglue; } else
2549  if ((sfinish=="etchedair") || (sfinish=="16"))
2550  { finish = etchedair; } else
2551  if ((sfinish=="etchedteflonair") || (sfinish=="17"))
2552  { finish = etchedteflonair; } else
2553  if ((sfinish=="etchedtioair") || (sfinish=="18"))
2554  { finish = etchedtioair; } else
2555  if ((sfinish=="etchedtyvekair") || (sfinish=="19"))
2556  { finish = etchedtyvekair; } else
2557  if ((sfinish=="etchedvm2000air") || (sfinish=="20"))
2558  { finish = etchedvm2000air; } else
2559  if ((sfinish=="etchedvm2000glue") || (sfinish=="21"))
2560  { finish = etchedvm2000glue; } else
2561  if ((sfinish=="groundlumirrorair") || (sfinish=="22"))
2562  { finish = groundlumirrorair; } else
2563  if ((sfinish=="groundlumirrorglue") || (sfinish=="23"))
2564  { finish = groundlumirrorglue; } else
2565  if ((sfinish=="groundair") || (sfinish=="24"))
2566  { finish = groundair; } else
2567  if ((sfinish=="groundteflonair") || (sfinish=="25"))
2568  { finish = groundteflonair; } else
2569  if ((sfinish=="groundtioair") || (sfinish=="26"))
2570  { finish = groundtioair; } else
2571  if ((sfinish=="groundtyvekair") || (sfinish=="27"))
2572  { finish = groundtyvekair; } else
2573  if ((sfinish=="groundvm2000air") || (sfinish=="28"))
2574  { finish = groundvm2000air; }
2575  else { finish = groundvm2000glue; }
2576 
2577  if ((stype=="dielectric_metal") || (stype=="0"))
2578  { type = dielectric_metal; } else
2579  if ((stype=="dielectric_dielectric") || (stype=="1"))
2580  { type = dielectric_dielectric; } else
2581  if ((stype=="dielectric_LUT") || (stype=="2"))
2582  { type = dielectric_LUT; } else
2583  if ((stype=="dielectric_dichroic") || (stype=="3"))
2584  { type = dielectric_dichroic; } else
2585  if ((stype=="firsov") || (stype=="4"))
2586  { type = firsov; }
2587  else { type = x_ray; }
2588 
2589  new G4OpticalSurface(name,model,finish,type,value);
2590 }
2591 
2592 void G4GDMLReadSolids::SolidsRead(const xercesc::DOMElement* const solidsElement)
2593 {
2594  G4cout << "G4GDML: Reading solids..." << G4endl;
2595 
2596  for (xercesc::DOMNode* iter = solidsElement->getFirstChild();
2597  iter != 0; iter = iter->getNextSibling())
2598  {
2599  if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) { continue; }
2600 
2601  const xercesc::DOMElement* const child
2602  = dynamic_cast<xercesc::DOMElement*>(iter);
2603  if (!child)
2604  {
2605  G4Exception("G4GDMLReadSolids::SolidsRead()",
2606  "InvalidRead", FatalException, "No child found!");
2607  return;
2608  }
2609  const G4String tag = Transcode(child->getTagName());
2610  if (tag=="define") { DefineRead(child); } else
2611  if (tag=="box") { BoxRead(child); } else
2612  if (tag=="cone") { ConeRead(child); } else
2613  if (tag=="elcone") { ElconeRead(child); } else
2614  if (tag=="ellipsoid") { EllipsoidRead(child); }else
2615  if (tag=="eltube") { EltubeRead(child); } else
2616  if (tag=="xtru") { XtruRead(child); } else
2617  if (tag=="hype") { HypeRead(child); } else
2618  if (tag=="intersection") { BooleanRead(child,INTERSECTION); } else
2619  if (tag=="multiUnion") { MultiUnionRead(child); } else
2620  if (tag=="orb") { OrbRead(child); } else
2621  if (tag=="para") { ParaRead(child); } else
2622  if (tag=="paraboloid") { ParaboloidRead(child); } else
2623  if (tag=="polycone") { PolyconeRead(child); } else
2624  if (tag=="genericPolycone") { GenericPolyconeRead(child); } else
2625  if (tag=="polyhedra") { PolyhedraRead(child); } else
2626  if (tag=="genericPolyhedra") { GenericPolyhedraRead(child); } else
2627  if (tag=="reflectedSolid") { ReflectedSolidRead(child); } else
2628  if (tag=="scaledSolid") { ScaledSolidRead(child); } else
2629  if (tag=="sphere") { SphereRead(child); } else
2630  if (tag=="subtraction") { BooleanRead(child,SUBTRACTION); } else
2631  if (tag=="tessellated") { TessellatedRead(child); } else
2632  if (tag=="tet") { TetRead(child); } else
2633  if (tag=="torus") { TorusRead(child); } else
2634  if (tag=="arb8") { GenTrapRead(child); } else
2635  if (tag=="trap") { TrapRead(child); } else
2636  if (tag=="trd") { TrdRead(child); } else
2637  if (tag=="tube") { TubeRead(child); } else
2638  if (tag=="cutTube") { CutTubeRead(child); } else
2639  if (tag=="twistedbox") { TwistedboxRead(child); } else
2640  if (tag=="twistedtrap") { TwistedtrapRead(child); } else
2641  if (tag=="twistedtrd") { TwistedtrdRead(child); } else
2642  if (tag=="twistedtubs") { TwistedtubsRead(child); } else
2643  if (tag=="union") { BooleanRead(child,UNION); } else
2644  if (tag=="opticalsurface") { OpticalSurfaceRead(child); } else
2645  if (tag=="loop") { LoopRead(child,&G4GDMLRead::SolidsRead); }
2646  else
2647  {
2648  G4String error_msg = "Unknown tag in solids: " + tag;
2649  G4Exception("G4GDMLReadSolids::SolidsRead()", "ReadError",
2650  FatalException, error_msg);
2651  }
2652  }
2653 }
2654 
2656 {
2657  G4VSolid* solidPtr = G4SolidStore::GetInstance()->GetSolid(ref,false);
2658 
2659  if (!solidPtr)
2660  {
2661  G4String error_msg = "Referenced solid '" + ref + "' was not found!";
2662  G4Exception("G4GDMLReadSolids::GetSolid()", "ReadError",
2663  FatalException, error_msg);
2664  }
2665 
2666  return solidPtr;
2667 }
2668 
2670 GetSurfaceProperty(const G4String& ref) const
2671 {
2672  const G4SurfacePropertyTable* surfaceList
2674  const size_t surfaceCount = surfaceList->size();
2675 
2676  for (size_t i=0; i<surfaceCount; i++)
2677  {
2678  if ((*surfaceList)[i]->GetName() == ref) { return (*surfaceList)[i]; }
2679  }
2680 
2681  G4String error_msg = "Referenced optical surface '" + ref + "' was not found!";
2682  G4Exception("G4GDMLReadSolids::GetSurfaceProperty()", "ReadError",
2683  FatalException, error_msg);
2684 
2685  return 0;
2686 }
zplaneType ZplaneRead(const xercesc::DOMElement *const)
void TubeRead(const xercesc::DOMElement *const)
const XML_Char * name
Definition: expat.h:151
void TwistedtrapRead(const xercesc::DOMElement *const)
G4int EvaluateInteger(const G4String &)
Definition: G4Para.hh:77
void SetSolidClosed(const G4bool t)
void BoxRead(const xercesc::DOMElement *const)
G4VSolid * GetSolid(const G4String &name, G4bool verbose=true) const
G4GDMLEvaluator eval
Definition: G4GDMLRead.hh:155
void OpticalSurfaceRead(const xercesc::DOMElement *const)
void ScaledSolidRead(const xercesc::DOMElement *const)
double x() const
virtual void DefineRead(const xercesc::DOMElement *const)
Definition: G4Box.hh:64
void TwistedboxRead(const xercesc::DOMElement *const)
Definition: G4Tubs.hh:85
Definition: xmlparse.cc:187
void MultiUnionRead(const xercesc::DOMElement *const)
void TorusRead(const xercesc::DOMElement *const)
G4String Transcode(const XMLCh *const)
Definition: G4GDMLRead.cc:55
void TetRead(const xercesc::DOMElement *const)
G4ThreeVector GetScale(const G4String &)
G4TwoVector TwoDimVertexRead(const xercesc::DOMElement *const, G4double)
G4SurfaceProperty * GetSurfaceProperty(const G4String &) const
void GenericPolyhedraRead(const xercesc::DOMElement *const)
tuple x
Definition: test.py:50
Definition: G4Trd.hh:72
G4SurfaceType
G4TriangularFacet * TriangularRead(const xercesc::DOMElement *const)
int G4int
Definition: G4Types.hh:78
void setY(double)
double z() const
void setZ(double)
void setX(double)
G4VSolid * GetSolid(const G4String &) const
void TwistedtubsRead(const xercesc::DOMElement *const)
void TrapRead(const xercesc::DOMElement *const)
void ConeRead(const xercesc::DOMElement *const)
G4String RefRead(const xercesc::DOMElement *const)
void LoopRead(const xercesc::DOMElement *const, void(G4GDMLRead::*)(const xercesc::DOMElement *const))
Definition: G4GDMLRead.cc:176
void SphereRead(const xercesc::DOMElement *const)
static G4double GetValueOf(const G4String &)
void OrbRead(const xercesc::DOMElement *const)
#define position
Definition: xmlparse.cc:622
G4ExtrudedSolid::ZSection SectionRead(const xercesc::DOMElement *const, G4double)
G4GLOB_DLL std::ostream G4cout
void BooleanRead(const xercesc::DOMElement *const, const BooleanOp)
G4FacetVertexType
Definition: G4VFacet.hh:56
const XML_Char int const XML_Char * value
Definition: expat.h:331
Definition: G4Tet.hh:66
Definition: G4Hype.hh:67
void ReflectedSolidRead(const xercesc::DOMElement *const)
void EllipsoidRead(const xercesc::DOMElement *const)
Definition: G4Cons.hh:83
G4bool AddFacet(G4VFacet *aFacet)
void GenTrapRead(const xercesc::DOMElement *const)
static G4SolidStore * GetInstance()
void TrdRead(const xercesc::DOMElement *const)
virtual ~G4GDMLReadSolids()
HepGeom::Scale3D G4Scale3D
Definition: G4Orb.hh:61
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
virtual void SolidsRead(const xercesc::DOMElement *const)
void EltubeRead(const xercesc::DOMElement *const)
rzPointType RZPointRead(const xercesc::DOMElement *const)
void G4MultiUnion
Definition: G4MultiUnion.hh:53
static G4String GetCategory(const G4String &)
std::vector< G4SurfaceProperty * > G4SurfacePropertyTable
G4String GenerateName(const G4String &name, G4bool strip=false)
Definition: G4GDMLRead.cc:68
void TessellatedRead(const xercesc::DOMElement *const)
void PolyhedraRead(const xercesc::DOMElement *const)
void XtruRead(const xercesc::DOMElement *const)
void CutTubeRead(const xercesc::DOMElement *const)
G4OpticalSurfaceFinish
double y() const
void VectorRead(const xercesc::DOMElement *const, G4ThreeVector &)
void ParaboloidRead(const xercesc::DOMElement *const)
tuple z
Definition: test.py:28
CLHEP::Hep2Vector G4TwoVector
Definition: G4TwoVector.hh:42
void GenericPolyconeRead(const xercesc::DOMElement *const)
G4OpticalSurfaceModel
void ElconeRead(const xercesc::DOMElement *const)
#define G4endl
Definition: G4ios.hh:61
G4ThreeVector GetRotation(const G4String &)
G4RotationMatrix GetRotationMatrix(const G4ThreeVector &)
void ParaRead(const xercesc::DOMElement *const)
double G4double
Definition: G4Types.hh:76
void HypeRead(const xercesc::DOMElement *const)
void setY(double y)
static const G4double alpha
void PolyconeRead(const xercesc::DOMElement *const)
G4QuadrangularFacet * QuadrangularRead(const xercesc::DOMElement *const)
void MultiUnionNodeRead(const xercesc::DOMElement *const, G4MultiUnion *const)
const XML_Char XML_Content * model
Definition: expat.h:151
static const G4SurfacePropertyTable * GetSurfacePropertyTable()
virtual void SolidsRead(const xercesc::DOMElement *const)=0
void TwistedtrdRead(const xercesc::DOMElement *const)
G4double Evaluate(const G4String &)
G4ThreeVector GetPosition(const G4String &)
void setX(double x)