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