Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/persistency/gdml/src/G4GDMLReadParamvol.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /persistency/gdml/src/G4GDMLReadParamvol.cc (Version 11.3.0) and /persistency/gdml/src/G4GDMLReadParamvol.cc (Version 10.7.p1)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 // G4GDMLReadParamvol implementation               26 // G4GDMLReadParamvol implementation
 27 //                                                 27 //
 28 // Author: Zoltan Torzsok, November 2007           28 // Author: Zoltan Torzsok, November 2007
 29 // -------------------------------------------     29 // --------------------------------------------------------------------
 30                                                    30 
 31 #include "G4GDMLReadParamvol.hh"                   31 #include "G4GDMLReadParamvol.hh"
 32 #include "G4GDMLReadSolids.hh"                     32 #include "G4GDMLReadSolids.hh"
 33 #include "G4LogicalVolume.hh"                      33 #include "G4LogicalVolume.hh"
 34 #include "G4PVParameterised.hh"                    34 #include "G4PVParameterised.hh"
 35 #include "G4PVPlacement.hh"                        35 #include "G4PVPlacement.hh"
 36 #include "G4VPhysicalVolume.hh"                    36 #include "G4VPhysicalVolume.hh"
 37 #include "G4UnitsTable.hh"                         37 #include "G4UnitsTable.hh"
 38                                                    38 
 39 // -------------------------------------------     39 // --------------------------------------------------------------------
 40 G4GDMLReadParamvol::G4GDMLReadParamvol()           40 G4GDMLReadParamvol::G4GDMLReadParamvol()
 41   : G4GDMLReadSetup()                              41   : G4GDMLReadSetup()
 42 {                                                  42 {
 43 }                                                  43 }
 44                                                    44 
 45 G4GDMLReadParamvol::~G4GDMLReadParamvol()          45 G4GDMLReadParamvol::~G4GDMLReadParamvol()
 46 {                                                  46 {
 47 }                                                  47 }
 48                                                    48 
 49 // -------------------------------------------     49 // --------------------------------------------------------------------
 50 void G4GDMLReadParamvol::Box_dimensionsRead(       50 void G4GDMLReadParamvol::Box_dimensionsRead(
 51   const xercesc::DOMElement* const element,        51   const xercesc::DOMElement* const element,
 52   G4GDMLParameterisation::PARAMETER& parameter     52   G4GDMLParameterisation::PARAMETER& parameter)
 53 {                                                  53 {
 54   G4double lunit = 1.0;                            54   G4double lunit = 1.0;
 55                                                    55 
 56   const xercesc::DOMNamedNodeMap* const attrib     56   const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
 57   XMLSize_t attributeCount                         57   XMLSize_t attributeCount                         = attributes->getLength();
 58                                                    58 
 59   for(XMLSize_t attribute_index = 0; attribute     59   for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
 60       ++attribute_index)                           60       ++attribute_index)
 61   {                                                61   {
 62     xercesc::DOMNode* attribute_node = attribu     62     xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
 63                                                    63 
 64     if(attribute_node->getNodeType() != xerces     64     if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
 65     {                                              65     {
 66       continue;                                    66       continue;
 67     }                                              67     }
 68                                                    68 
 69     const xercesc::DOMAttr* const attribute =      69     const xercesc::DOMAttr* const attribute =
 70       dynamic_cast<xercesc::DOMAttr*>(attribut     70       dynamic_cast<xercesc::DOMAttr*>(attribute_node);
 71     if(attribute == nullptr)                       71     if(attribute == nullptr)
 72     {                                              72     {
 73       G4Exception("G4GDMLReadParamvol::Box_dim     73       G4Exception("G4GDMLReadParamvol::Box_dimensionsRead()", "InvalidRead",
 74                   FatalException, "No attribut     74                   FatalException, "No attribute found!");
 75       return;                                      75       return;
 76     }                                              76     }
 77     const G4String attName  = Transcode(attrib     77     const G4String attName  = Transcode(attribute->getName());
 78     const G4String attValue = Transcode(attrib     78     const G4String attValue = Transcode(attribute->getValue());
 79                                                    79 
 80     if(attName == "lunit")                         80     if(attName == "lunit")
 81     {                                              81     {
 82       lunit = G4UnitDefinition::GetValueOf(att     82       lunit = G4UnitDefinition::GetValueOf(attValue);
 83       if(G4UnitDefinition::GetCategory(attValu     83       if(G4UnitDefinition::GetCategory(attValue) != "Length")
 84       {                                            84       {
 85         G4Exception("G4GDMLReadParamvol::Box_d     85         G4Exception("G4GDMLReadParamvol::Box_dimensionsRead()", "InvalidRead",
 86                     FatalException, "Invalid u     86                     FatalException, "Invalid unit for length!");
 87       }                                            87       }
 88     }                                              88     }
 89     else if(attName == "x")                        89     else if(attName == "x")
 90     {                                              90     {
 91       parameter.dimension[0] = eval.Evaluate(a     91       parameter.dimension[0] = eval.Evaluate(attValue);
 92     }                                              92     }
 93     else if(attName == "y")                        93     else if(attName == "y")
 94     {                                              94     {
 95       parameter.dimension[1] = eval.Evaluate(a     95       parameter.dimension[1] = eval.Evaluate(attValue);
 96     }                                              96     }
 97     else if(attName == "z")                        97     else if(attName == "z")
 98     {                                              98     {
 99       parameter.dimension[2] = eval.Evaluate(a     99       parameter.dimension[2] = eval.Evaluate(attValue);
100     }                                             100     }
101   }                                               101   }
102                                                   102 
103   parameter.dimension[0] *= 0.5 * lunit;          103   parameter.dimension[0] *= 0.5 * lunit;
104   parameter.dimension[1] *= 0.5 * lunit;          104   parameter.dimension[1] *= 0.5 * lunit;
105   parameter.dimension[2] *= 0.5 * lunit;          105   parameter.dimension[2] *= 0.5 * lunit;
106 }                                                 106 }
107                                                   107 
108 // -------------------------------------------    108 // --------------------------------------------------------------------
109 void G4GDMLReadParamvol::Trd_dimensionsRead(      109 void G4GDMLReadParamvol::Trd_dimensionsRead(
110   const xercesc::DOMElement* const element,       110   const xercesc::DOMElement* const element,
111   G4GDMLParameterisation::PARAMETER& parameter    111   G4GDMLParameterisation::PARAMETER& parameter)
112 {                                                 112 {
113   G4double lunit = 1.0;                           113   G4double lunit = 1.0;
114                                                   114 
115   const xercesc::DOMNamedNodeMap* const attrib    115   const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
116   XMLSize_t attributeCount                        116   XMLSize_t attributeCount                         = attributes->getLength();
117                                                   117 
118   for(XMLSize_t attribute_index = 0; attribute    118   for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
119       ++attribute_index)                          119       ++attribute_index)
120   {                                               120   {
121     xercesc::DOMNode* attribute_node = attribu    121     xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
122                                                   122 
123     if(attribute_node->getNodeType() != xerces    123     if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
124     {                                             124     {
125       continue;                                   125       continue;
126     }                                             126     }
127                                                   127 
128     const xercesc::DOMAttr* const attribute =     128     const xercesc::DOMAttr* const attribute =
129       dynamic_cast<xercesc::DOMAttr*>(attribut    129       dynamic_cast<xercesc::DOMAttr*>(attribute_node);
130     if(attribute == nullptr)                      130     if(attribute == nullptr)
131     {                                             131     {
132       G4Exception("G4GDMLReadParamvol::Trd_dim    132       G4Exception("G4GDMLReadParamvol::Trd_dimensionsRead()", "InvalidRead",
133                   FatalException, "No attribut    133                   FatalException, "No attribute found!");
134       return;                                     134       return;
135     }                                             135     }
136     const G4String attName  = Transcode(attrib    136     const G4String attName  = Transcode(attribute->getName());
137     const G4String attValue = Transcode(attrib    137     const G4String attValue = Transcode(attribute->getValue());
138                                                   138 
139     if(attName == "lunit")                        139     if(attName == "lunit")
140     {                                             140     {
141       lunit = G4UnitDefinition::GetValueOf(att    141       lunit = G4UnitDefinition::GetValueOf(attValue);
142       if(G4UnitDefinition::GetCategory(attValu    142       if(G4UnitDefinition::GetCategory(attValue) != "Length")
143       {                                           143       {
144         G4Exception("G4GDMLReadParamvol::Trd_d    144         G4Exception("G4GDMLReadParamvol::Trd_dimensionsRead()", "InvalidRead",
145                     FatalException, "Invalid u    145                     FatalException, "Invalid unit for length!");
146       }                                           146       }
147     }                                             147     }
148     else if(attName == "x1")                      148     else if(attName == "x1")
149     {                                             149     {
150       parameter.dimension[0] = eval.Evaluate(a    150       parameter.dimension[0] = eval.Evaluate(attValue);
151     }                                             151     }
152     else if(attName == "x2")                      152     else if(attName == "x2")
153     {                                             153     {
154       parameter.dimension[1] = eval.Evaluate(a    154       parameter.dimension[1] = eval.Evaluate(attValue);
155     }                                             155     }
156     else if(attName == "y1")                      156     else if(attName == "y1")
157     {                                             157     {
158       parameter.dimension[2] = eval.Evaluate(a    158       parameter.dimension[2] = eval.Evaluate(attValue);
159     }                                             159     }
160     else if(attName == "y2")                      160     else if(attName == "y2")
161     {                                             161     {
162       parameter.dimension[3] = eval.Evaluate(a    162       parameter.dimension[3] = eval.Evaluate(attValue);
163     }                                             163     }
164     else if(attName == "z")                       164     else if(attName == "z")
165     {                                             165     {
166       parameter.dimension[4] = eval.Evaluate(a    166       parameter.dimension[4] = eval.Evaluate(attValue);
167     }                                             167     }
168   }                                               168   }
169                                                   169 
170   parameter.dimension[0] *= 0.5 * lunit;          170   parameter.dimension[0] *= 0.5 * lunit;
171   parameter.dimension[1] *= 0.5 * lunit;          171   parameter.dimension[1] *= 0.5 * lunit;
172   parameter.dimension[2] *= 0.5 * lunit;          172   parameter.dimension[2] *= 0.5 * lunit;
173   parameter.dimension[3] *= 0.5 * lunit;          173   parameter.dimension[3] *= 0.5 * lunit;
174   parameter.dimension[4] *= 0.5 * lunit;          174   parameter.dimension[4] *= 0.5 * lunit;
175 }                                                 175 }
176                                                   176 
177 // -------------------------------------------    177 // --------------------------------------------------------------------
178 void G4GDMLReadParamvol::Trap_dimensionsRead(     178 void G4GDMLReadParamvol::Trap_dimensionsRead(
179   const xercesc::DOMElement* const element,       179   const xercesc::DOMElement* const element,
180   G4GDMLParameterisation::PARAMETER& parameter    180   G4GDMLParameterisation::PARAMETER& parameter)
181 {                                                 181 {
182   G4double lunit = 1.0;                           182   G4double lunit = 1.0;
183   G4double aunit = 1.0;                           183   G4double aunit = 1.0;
184                                                   184 
185   const xercesc::DOMNamedNodeMap* const attrib    185   const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
186   XMLSize_t attributeCount                        186   XMLSize_t attributeCount                         = attributes->getLength();
187                                                   187 
188   for(XMLSize_t attribute_index = 0; attribute    188   for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
189       ++attribute_index)                          189       ++attribute_index)
190   {                                               190   {
191     xercesc::DOMNode* attribute_node = attribu    191     xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
192                                                   192 
193     if(attribute_node->getNodeType() != xerces    193     if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
194     {                                             194     {
195       continue;                                   195       continue;
196     }                                             196     }
197                                                   197 
198     const xercesc::DOMAttr* const attribute =     198     const xercesc::DOMAttr* const attribute =
199       dynamic_cast<xercesc::DOMAttr*>(attribut    199       dynamic_cast<xercesc::DOMAttr*>(attribute_node);
200     if(attribute == nullptr)                      200     if(attribute == nullptr)
201     {                                             201     {
202       G4Exception("G4GDMLReadParamvol::Trap_di    202       G4Exception("G4GDMLReadParamvol::Trap_dimensionsRead()", "InvalidRead",
203                   FatalException, "No attribut    203                   FatalException, "No attribute found!");
204       return;                                     204       return;
205     }                                             205     }
206     const G4String attName  = Transcode(attrib    206     const G4String attName  = Transcode(attribute->getName());
207     const G4String attValue = Transcode(attrib    207     const G4String attValue = Transcode(attribute->getValue());
208                                                   208 
209     if(attName == "lunit")                        209     if(attName == "lunit")
210     {                                             210     {
211       lunit = G4UnitDefinition::GetValueOf(att    211       lunit = G4UnitDefinition::GetValueOf(attValue);
212       if(G4UnitDefinition::GetCategory(attValu    212       if(G4UnitDefinition::GetCategory(attValue) != "Length")
213       {                                           213       {
214         G4Exception("G4GDMLReadParamvol::Trap_    214         G4Exception("G4GDMLReadParamvol::Trap_dimensionsRead()", "InvalidRead",
215                     FatalException, "Invalid u    215                     FatalException, "Invalid unit for length!");
216       }                                           216       }
217     }                                             217     }
218     else if(attName == "aunit")                   218     else if(attName == "aunit")
219     {                                             219     {
220       aunit = G4UnitDefinition::GetValueOf(att    220       aunit = G4UnitDefinition::GetValueOf(attValue);
221       if(G4UnitDefinition::GetCategory(attValu    221       if(G4UnitDefinition::GetCategory(attValue) != "Angle")
222       {                                           222       {
223         G4Exception("G4GDMLReadParamvol::Trap_    223         G4Exception("G4GDMLReadParamvol::Trap_dimensionsRead()", "InvalidRead",
224                     FatalException, "Invalid u    224                     FatalException, "Invalid unit for angle!");
225       }                                           225       }
226     }                                             226     }
227     else if(attName == "z")                       227     else if(attName == "z")
228     {                                             228     {
229       parameter.dimension[0] = eval.Evaluate(a    229       parameter.dimension[0] = eval.Evaluate(attValue);
230     }                                             230     }
231     else if(attName == "theta")                   231     else if(attName == "theta")
232     {                                             232     {
233       parameter.dimension[1] = eval.Evaluate(a    233       parameter.dimension[1] = eval.Evaluate(attValue);
234     }                                             234     }
235     else if(attName == "phi")                     235     else if(attName == "phi")
236     {                                             236     {
237       parameter.dimension[2] = eval.Evaluate(a    237       parameter.dimension[2] = eval.Evaluate(attValue);
238     }                                             238     }
239     else if(attName == "y1")                      239     else if(attName == "y1")
240     {                                             240     {
241       parameter.dimension[3] = eval.Evaluate(a    241       parameter.dimension[3] = eval.Evaluate(attValue);
242     }                                             242     }
243     else if(attName == "x1")                      243     else if(attName == "x1")
244     {                                             244     {
245       parameter.dimension[4] = eval.Evaluate(a    245       parameter.dimension[4] = eval.Evaluate(attValue);
246     }                                             246     }
247     else if(attName == "x2")                      247     else if(attName == "x2")
248     {                                             248     {
249       parameter.dimension[5] = eval.Evaluate(a    249       parameter.dimension[5] = eval.Evaluate(attValue);
250     }                                             250     }
251     else if(attName == "alpha1")                  251     else if(attName == "alpha1")
252     {                                             252     {
253       parameter.dimension[6] = eval.Evaluate(a    253       parameter.dimension[6] = eval.Evaluate(attValue);
254     }                                             254     }
255     else if(attName == "y2")                      255     else if(attName == "y2")
256     {                                             256     {
257       parameter.dimension[7] = eval.Evaluate(a    257       parameter.dimension[7] = eval.Evaluate(attValue);
258     }                                             258     }
259     else if(attName == "x3")                      259     else if(attName == "x3")
260     {                                             260     {
261       parameter.dimension[8] = eval.Evaluate(a    261       parameter.dimension[8] = eval.Evaluate(attValue);
262     }                                             262     }
263     else if(attName == "x4")                      263     else if(attName == "x4")
264     {                                             264     {
265       parameter.dimension[9] = eval.Evaluate(a    265       parameter.dimension[9] = eval.Evaluate(attValue);
266     }                                             266     }
267     else if(attName == "alpha2")                  267     else if(attName == "alpha2")
268     {                                             268     {
269       parameter.dimension[10] = eval.Evaluate(    269       parameter.dimension[10] = eval.Evaluate(attValue);
270     }                                             270     }
271   }                                               271   }
272                                                   272 
273   parameter.dimension[0] *= 0.5 * lunit;          273   parameter.dimension[0] *= 0.5 * lunit;
274   parameter.dimension[1] *= aunit;                274   parameter.dimension[1] *= aunit;
275   parameter.dimension[2] *= aunit;                275   parameter.dimension[2] *= aunit;
276   parameter.dimension[3] *= 0.5 * lunit;          276   parameter.dimension[3] *= 0.5 * lunit;
277   parameter.dimension[4] *= 0.5 * lunit;          277   parameter.dimension[4] *= 0.5 * lunit;
278   parameter.dimension[5] *= 0.5 * lunit;          278   parameter.dimension[5] *= 0.5 * lunit;
279   parameter.dimension[6] *= aunit;                279   parameter.dimension[6] *= aunit;
280   parameter.dimension[7] *= 0.5 * lunit;          280   parameter.dimension[7] *= 0.5 * lunit;
281   parameter.dimension[8] *= 0.5 * lunit;          281   parameter.dimension[8] *= 0.5 * lunit;
282   parameter.dimension[9] *= 0.5 * lunit;          282   parameter.dimension[9] *= 0.5 * lunit;
283   parameter.dimension[10] *= aunit;               283   parameter.dimension[10] *= aunit;
284 }                                                 284 }
285                                                   285 
286 // -------------------------------------------    286 // --------------------------------------------------------------------
287 void G4GDMLReadParamvol::Tube_dimensionsRead(     287 void G4GDMLReadParamvol::Tube_dimensionsRead(
288   const xercesc::DOMElement* const element,       288   const xercesc::DOMElement* const element,
289   G4GDMLParameterisation::PARAMETER& parameter    289   G4GDMLParameterisation::PARAMETER& parameter)
290 {                                                 290 {
291   G4double lunit = 1.0;                           291   G4double lunit = 1.0;
292   G4double aunit = 1.0;                           292   G4double aunit = 1.0;
293                                                   293 
294   const xercesc::DOMNamedNodeMap* const attrib    294   const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
295   XMLSize_t attributeCount                        295   XMLSize_t attributeCount                         = attributes->getLength();
296                                                   296 
297   for(XMLSize_t attribute_index = 0; attribute    297   for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
298       ++attribute_index)                          298       ++attribute_index)
299   {                                               299   {
300     xercesc::DOMNode* attribute_node = attribu    300     xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
301                                                   301 
302     if(attribute_node->getNodeType() != xerces    302     if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
303     {                                             303     {
304       continue;                                   304       continue;
305     }                                             305     }
306                                                   306 
307     const xercesc::DOMAttr* const attribute =     307     const xercesc::DOMAttr* const attribute =
308       dynamic_cast<xercesc::DOMAttr*>(attribut    308       dynamic_cast<xercesc::DOMAttr*>(attribute_node);
309     if(attribute == nullptr)                      309     if(attribute == nullptr)
310     {                                             310     {
311       G4Exception("G4GDMLReadParamvol::Tube_di    311       G4Exception("G4GDMLReadParamvol::Tube_dimensionsRead()", "InvalidRead",
312                   FatalException, "No attribut    312                   FatalException, "No attribute found!");
313       return;                                     313       return;
314     }                                             314     }
315     const G4String attName  = Transcode(attrib    315     const G4String attName  = Transcode(attribute->getName());
316     const G4String attValue = Transcode(attrib    316     const G4String attValue = Transcode(attribute->getValue());
317                                                   317 
318     if(attName == "lunit")                        318     if(attName == "lunit")
319     {                                             319     {
320       lunit = G4UnitDefinition::GetValueOf(att    320       lunit = G4UnitDefinition::GetValueOf(attValue);
321       if(G4UnitDefinition::GetCategory(attValu    321       if(G4UnitDefinition::GetCategory(attValue) != "Length")
322       {                                           322       {
323         G4Exception("G4GDMLReadParamvol::Tube_    323         G4Exception("G4GDMLReadParamvol::Tube_dimensionsRead()", "InvalidRead",
324                     FatalException, "Invalid u    324                     FatalException, "Invalid unit for length!");
325       }                                           325       }
326     }                                             326     }
327     else if(attName == "aunit")                   327     else if(attName == "aunit")
328     {                                             328     {
329       aunit = G4UnitDefinition::GetValueOf(att    329       aunit = G4UnitDefinition::GetValueOf(attValue);
330       if(G4UnitDefinition::GetCategory(attValu    330       if(G4UnitDefinition::GetCategory(attValue) != "Angle")
331       {                                           331       {
332         G4Exception("G4GDMLReadParamvol::Tube_    332         G4Exception("G4GDMLReadParamvol::Tube_dimensionsRead()", "InvalidRead",
333                     FatalException, "Invalid u    333                     FatalException, "Invalid unit for angle!");
334       }                                           334       }
335     }                                             335     }
336     else if(attName == "InR")                     336     else if(attName == "InR")
337     {                                             337     {
338       parameter.dimension[0] = eval.Evaluate(a    338       parameter.dimension[0] = eval.Evaluate(attValue);
339     }                                             339     }
340     else if(attName == "OutR")                    340     else if(attName == "OutR")
341     {                                             341     {
342       parameter.dimension[1] = eval.Evaluate(a    342       parameter.dimension[1] = eval.Evaluate(attValue);
343     }                                             343     }
344     else if(attName == "hz")                      344     else if(attName == "hz")
345     {                                             345     {
346       parameter.dimension[2] = eval.Evaluate(a    346       parameter.dimension[2] = eval.Evaluate(attValue);
347     }                                             347     }
348     else if(attName == "StartPhi")                348     else if(attName == "StartPhi")
349     {                                             349     {
350       parameter.dimension[3] = eval.Evaluate(a    350       parameter.dimension[3] = eval.Evaluate(attValue);
351     }                                             351     }
352     else if(attName == "DeltaPhi")                352     else if(attName == "DeltaPhi")
353     {                                             353     {
354       parameter.dimension[4] = eval.Evaluate(a    354       parameter.dimension[4] = eval.Evaluate(attValue);
355     }                                             355     }
356   }                                               356   }
357                                                   357 
358   parameter.dimension[0] *= lunit;                358   parameter.dimension[0] *= lunit;
359   parameter.dimension[1] *= lunit;                359   parameter.dimension[1] *= lunit;
360   parameter.dimension[2] *= 0.5 * lunit;          360   parameter.dimension[2] *= 0.5 * lunit;
361   parameter.dimension[3] *= aunit;                361   parameter.dimension[3] *= aunit;
362   parameter.dimension[4] *= aunit;                362   parameter.dimension[4] *= aunit;
363 }                                                 363 }
364                                                   364 
365 // -------------------------------------------    365 // --------------------------------------------------------------------
366 void G4GDMLReadParamvol::Cone_dimensionsRead(     366 void G4GDMLReadParamvol::Cone_dimensionsRead(
367   const xercesc::DOMElement* const element,       367   const xercesc::DOMElement* const element,
368   G4GDMLParameterisation::PARAMETER& parameter    368   G4GDMLParameterisation::PARAMETER& parameter)
369 {                                                 369 {
370   G4double lunit = 1.0;                           370   G4double lunit = 1.0;
371   G4double aunit = 1.0;                           371   G4double aunit = 1.0;
372                                                   372 
373   const xercesc::DOMNamedNodeMap* const attrib    373   const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
374   XMLSize_t attributeCount                        374   XMLSize_t attributeCount                         = attributes->getLength();
375                                                   375 
376   for(XMLSize_t attribute_index = 0; attribute    376   for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
377       ++attribute_index)                          377       ++attribute_index)
378   {                                               378   {
379     xercesc::DOMNode* attribute_node = attribu    379     xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
380                                                   380 
381     if(attribute_node->getNodeType() != xerces    381     if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
382     {                                             382     {
383       continue;                                   383       continue;
384     }                                             384     }
385                                                   385 
386     const xercesc::DOMAttr* const attribute =     386     const xercesc::DOMAttr* const attribute =
387       dynamic_cast<xercesc::DOMAttr*>(attribut    387       dynamic_cast<xercesc::DOMAttr*>(attribute_node);
388     if(attribute == nullptr)                      388     if(attribute == nullptr)
389     {                                             389     {
390       G4Exception("G4GDMLReadParamvol::Cone_di    390       G4Exception("G4GDMLReadParamvol::Cone_dimensionsRead()", "InvalidRead",
391                   FatalException, "No attribut    391                   FatalException, "No attribute found!");
392       return;                                     392       return;
393     }                                             393     }
394     const G4String attName  = Transcode(attrib    394     const G4String attName  = Transcode(attribute->getName());
395     const G4String attValue = Transcode(attrib    395     const G4String attValue = Transcode(attribute->getValue());
396                                                   396 
397     if(attName == "lunit")                        397     if(attName == "lunit")
398     {                                             398     {
399       lunit = G4UnitDefinition::GetValueOf(att    399       lunit = G4UnitDefinition::GetValueOf(attValue);
400       if(G4UnitDefinition::GetCategory(attValu    400       if(G4UnitDefinition::GetCategory(attValue) != "Length")
401       {                                           401       {
402         G4Exception("G4GDMLReadParamvol::Cone_    402         G4Exception("G4GDMLReadParamvol::Cone_dimensionsRead()", "InvalidRead",
403                     FatalException, "Invalid u    403                     FatalException, "Invalid unit for length!");
404       }                                           404       }
405     }                                             405     }
406     else if(attName == "aunit")                   406     else if(attName == "aunit")
407     {                                             407     {
408       aunit = G4UnitDefinition::GetValueOf(att    408       aunit = G4UnitDefinition::GetValueOf(attValue);
409       if(G4UnitDefinition::GetCategory(attValu    409       if(G4UnitDefinition::GetCategory(attValue) != "Angle")
410       {                                           410       {
411         G4Exception("G4GDMLReadParamvol::Cone_    411         G4Exception("G4GDMLReadParamvol::Cone_dimensions()", "InvalidRead",
412                     FatalException, "Invalid u    412                     FatalException, "Invalid unit for angle!");
413       }                                           413       }
414     }                                             414     }
415     else if(attName == "rmin1")                   415     else if(attName == "rmin1")
416     {                                             416     {
417       parameter.dimension[0] = eval.Evaluate(a    417       parameter.dimension[0] = eval.Evaluate(attValue);
418     }                                             418     }
419     else if(attName == "rmax1")                   419     else if(attName == "rmax1")
420     {                                             420     {
421       parameter.dimension[1] = eval.Evaluate(a    421       parameter.dimension[1] = eval.Evaluate(attValue);
422     }                                             422     }
423     else if(attName == "rmin2")                   423     else if(attName == "rmin2")
424     {                                             424     {
425       parameter.dimension[2] = eval.Evaluate(a    425       parameter.dimension[2] = eval.Evaluate(attValue);
426     }                                             426     }
427     else if(attName == "rmax2")                   427     else if(attName == "rmax2")
428     {                                             428     {
429       parameter.dimension[3] = eval.Evaluate(a    429       parameter.dimension[3] = eval.Evaluate(attValue);
430     }                                             430     }
431     else if(attName == "z")                       431     else if(attName == "z")
432     {                                             432     {
433       parameter.dimension[4] = eval.Evaluate(a    433       parameter.dimension[4] = eval.Evaluate(attValue);
434     }                                             434     }
435     else if(attName == "startphi")                435     else if(attName == "startphi")
436     {                                             436     {
437       parameter.dimension[5] = eval.Evaluate(a    437       parameter.dimension[5] = eval.Evaluate(attValue);
438     }                                             438     }
439     else if(attName == "deltaphi")                439     else if(attName == "deltaphi")
440     {                                             440     {
441       parameter.dimension[6] = eval.Evaluate(a    441       parameter.dimension[6] = eval.Evaluate(attValue);
442     }                                             442     }
443   }                                               443   }
444                                                   444 
445   parameter.dimension[0] *= lunit;                445   parameter.dimension[0] *= lunit;
446   parameter.dimension[1] *= lunit;                446   parameter.dimension[1] *= lunit;
447   parameter.dimension[2] *= lunit;                447   parameter.dimension[2] *= lunit;
448   parameter.dimension[3] *= lunit;                448   parameter.dimension[3] *= lunit;
449   parameter.dimension[4] *= 0.5 * lunit;          449   parameter.dimension[4] *= 0.5 * lunit;
450   parameter.dimension[5] *= aunit;                450   parameter.dimension[5] *= aunit;
451   parameter.dimension[6] *= aunit;                451   parameter.dimension[6] *= aunit;
452 }                                                 452 }
453                                                   453 
454 // -------------------------------------------    454 // --------------------------------------------------------------------
455 void G4GDMLReadParamvol::Sphere_dimensionsRead    455 void G4GDMLReadParamvol::Sphere_dimensionsRead(
456   const xercesc::DOMElement* const element,       456   const xercesc::DOMElement* const element,
457   G4GDMLParameterisation::PARAMETER& parameter    457   G4GDMLParameterisation::PARAMETER& parameter)
458 {                                                 458 {
459   G4double lunit = 1.0;                           459   G4double lunit = 1.0;
460   G4double aunit = 1.0;                           460   G4double aunit = 1.0;
461                                                   461 
462   const xercesc::DOMNamedNodeMap* const attrib    462   const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
463   XMLSize_t attributeCount                        463   XMLSize_t attributeCount                         = attributes->getLength();
464                                                   464 
465   for(XMLSize_t attribute_index = 0; attribute    465   for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
466       ++attribute_index)                          466       ++attribute_index)
467   {                                               467   {
468     xercesc::DOMNode* attribute_node = attribu    468     xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
469                                                   469 
470     if(attribute_node->getNodeType() != xerces    470     if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
471     {                                             471     {
472       continue;                                   472       continue;
473     }                                             473     }
474                                                   474 
475     const xercesc::DOMAttr* const attribute =     475     const xercesc::DOMAttr* const attribute =
476       dynamic_cast<xercesc::DOMAttr*>(attribut    476       dynamic_cast<xercesc::DOMAttr*>(attribute_node);
477     if(attribute == nullptr)                      477     if(attribute == nullptr)
478     {                                             478     {
479       G4Exception("G4GDMLReadParamvol::Sphere_    479       G4Exception("G4GDMLReadParamvol::Sphere_dimensionsRead()", "InvalidRead",
480                   FatalException, "No attribut    480                   FatalException, "No attribute found!");
481       return;                                     481       return;
482     }                                             482     }
483     const G4String attName  = Transcode(attrib    483     const G4String attName  = Transcode(attribute->getName());
484     const G4String attValue = Transcode(attrib    484     const G4String attValue = Transcode(attribute->getValue());
485                                                   485 
486     if(attName == "lunit")                        486     if(attName == "lunit")
487     {                                             487     {
488       lunit = G4UnitDefinition::GetValueOf(att    488       lunit = G4UnitDefinition::GetValueOf(attValue);
489       if(G4UnitDefinition::GetCategory(attValu    489       if(G4UnitDefinition::GetCategory(attValue) != "Length")
490       {                                           490       {
491         G4Exception("G4GDMLReadParamvol::Spher    491         G4Exception("G4GDMLReadParamvol::Sphere_dimensionsRead()",
492                     "InvalidRead", FatalExcept    492                     "InvalidRead", FatalException, "Invalid unit for length!");
493       }                                           493       }
494     }                                             494     }
495     else if(attName == "aunit")                   495     else if(attName == "aunit")
496     {                                             496     {
497       aunit = G4UnitDefinition::GetValueOf(att    497       aunit = G4UnitDefinition::GetValueOf(attValue);
498       if(G4UnitDefinition::GetCategory(attValu    498       if(G4UnitDefinition::GetCategory(attValue) != "Angle")
499       {                                           499       {
500         G4Exception("G4GDMLReadParamvol::Spher    500         G4Exception("G4GDMLReadParamvol::Sphere_dimensionsRead()",
501                     "InvalidRead", FatalExcept    501                     "InvalidRead", FatalException, "Invalid unit for angle!");
502       }                                           502       }
503     }                                             503     }
504     else if(attName == "rmin")                    504     else if(attName == "rmin")
505     {                                             505     {
506       parameter.dimension[0] = eval.Evaluate(a    506       parameter.dimension[0] = eval.Evaluate(attValue);
507     }                                             507     }
508     else if(attName == "rmax")                    508     else if(attName == "rmax")
509     {                                             509     {
510       parameter.dimension[1] = eval.Evaluate(a    510       parameter.dimension[1] = eval.Evaluate(attValue);
511     }                                             511     }
512     else if(attName == "startphi")                512     else if(attName == "startphi")
513     {                                             513     {
514       parameter.dimension[2] = eval.Evaluate(a    514       parameter.dimension[2] = eval.Evaluate(attValue);
515     }                                             515     }
516     else if(attName == "deltaphi")                516     else if(attName == "deltaphi")
517     {                                             517     {
518       parameter.dimension[3] = eval.Evaluate(a    518       parameter.dimension[3] = eval.Evaluate(attValue);
519     }                                             519     }
520     else if(attName == "starttheta")              520     else if(attName == "starttheta")
521     {                                             521     {
522       parameter.dimension[4] = eval.Evaluate(a    522       parameter.dimension[4] = eval.Evaluate(attValue);
523     }                                             523     }
524     else if(attName == "deltatheta")              524     else if(attName == "deltatheta")
525     {                                             525     {
526       parameter.dimension[5] = eval.Evaluate(a    526       parameter.dimension[5] = eval.Evaluate(attValue);
527     }                                             527     }
528   }                                               528   }
529                                                   529 
530   parameter.dimension[0] *= lunit;                530   parameter.dimension[0] *= lunit;
531   parameter.dimension[1] *= lunit;                531   parameter.dimension[1] *= lunit;
532   parameter.dimension[2] *= aunit;                532   parameter.dimension[2] *= aunit;
533   parameter.dimension[3] *= aunit;                533   parameter.dimension[3] *= aunit;
534   parameter.dimension[4] *= aunit;                534   parameter.dimension[4] *= aunit;
535   parameter.dimension[5] *= aunit;                535   parameter.dimension[5] *= aunit;
536 }                                                 536 }
537                                                   537 
538 // -------------------------------------------    538 // --------------------------------------------------------------------
539 void G4GDMLReadParamvol::Orb_dimensionsRead(      539 void G4GDMLReadParamvol::Orb_dimensionsRead(
540   const xercesc::DOMElement* const element,       540   const xercesc::DOMElement* const element,
541   G4GDMLParameterisation::PARAMETER& parameter    541   G4GDMLParameterisation::PARAMETER& parameter)
542 {                                                 542 {
543   G4double lunit = 1.0;                           543   G4double lunit = 1.0;
544                                                   544 
545   const xercesc::DOMNamedNodeMap* const attrib    545   const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
546   XMLSize_t attributeCount                        546   XMLSize_t attributeCount                         = attributes->getLength();
547                                                   547 
548   for(XMLSize_t attribute_index = 0; attribute    548   for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
549       ++attribute_index)                          549       ++attribute_index)
550   {                                               550   {
551     xercesc::DOMNode* attribute_node = attribu    551     xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
552                                                   552 
553     if(attribute_node->getNodeType() != xerces    553     if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
554     {                                             554     {
555       continue;                                   555       continue;
556     }                                             556     }
557                                                   557 
558     const xercesc::DOMAttr* const attribute =     558     const xercesc::DOMAttr* const attribute =
559       dynamic_cast<xercesc::DOMAttr*>(attribut    559       dynamic_cast<xercesc::DOMAttr*>(attribute_node);
560     if(attribute == nullptr)                      560     if(attribute == nullptr)
561     {                                             561     {
562       G4Exception("G4GDMLReadParamvol::Orb_dim    562       G4Exception("G4GDMLReadParamvol::Orb_dimensionsRead()", "InvalidRead",
563                   FatalException, "No attribut    563                   FatalException, "No attribute found!");
564       return;                                     564       return;
565     }                                             565     }
566     const G4String attName  = Transcode(attrib    566     const G4String attName  = Transcode(attribute->getName());
567     const G4String attValue = Transcode(attrib    567     const G4String attValue = Transcode(attribute->getValue());
568                                                   568 
569     if(attName == "lunit")                        569     if(attName == "lunit")
570     {                                             570     {
571       lunit = G4UnitDefinition::GetValueOf(att    571       lunit = G4UnitDefinition::GetValueOf(attValue);
572     }                                             572     }
573     if(G4UnitDefinition::GetCategory(attValue)    573     if(G4UnitDefinition::GetCategory(attValue) != "Length")
574     {                                             574     {
575       G4Exception("G4GDMLReadParamvol::Orb_dim    575       G4Exception("G4GDMLReadParamvol::Orb_dimensionsRead()", "InvalidRead",
576                   FatalException, "Invalid uni    576                   FatalException, "Invalid unit for length!");
577     }                                             577     }
578     else if(attName == "r")                       578     else if(attName == "r")
579     {                                             579     {
580       parameter.dimension[0] = eval.Evaluate(a    580       parameter.dimension[0] = eval.Evaluate(attValue);
581     }                                             581     }
582   }                                               582   }
583                                                   583 
584   parameter.dimension[0] *= lunit;                584   parameter.dimension[0] *= lunit;
585 }                                                 585 }
586                                                   586 
587 // -------------------------------------------    587 // --------------------------------------------------------------------
588 void G4GDMLReadParamvol::Torus_dimensionsRead(    588 void G4GDMLReadParamvol::Torus_dimensionsRead(
589   const xercesc::DOMElement* const element,       589   const xercesc::DOMElement* const element,
590   G4GDMLParameterisation::PARAMETER& parameter    590   G4GDMLParameterisation::PARAMETER& parameter)
591 {                                                 591 {
592   G4double lunit = 1.0;                           592   G4double lunit = 1.0;
593   G4double aunit = 1.0;                           593   G4double aunit = 1.0;
594                                                   594 
595   const xercesc::DOMNamedNodeMap* const attrib    595   const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
596   XMLSize_t attributeCount                        596   XMLSize_t attributeCount                         = attributes->getLength();
597                                                   597 
598   for(XMLSize_t attribute_index = 0; attribute    598   for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
599       ++attribute_index)                          599       ++attribute_index)
600   {                                               600   {
601     xercesc::DOMNode* attribute_node = attribu    601     xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
602                                                   602 
603     if(attribute_node->getNodeType() != xerces    603     if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
604     {                                             604     {
605       continue;                                   605       continue;
606     }                                             606     }
607                                                   607 
608     const xercesc::DOMAttr* const attribute =     608     const xercesc::DOMAttr* const attribute =
609       dynamic_cast<xercesc::DOMAttr*>(attribut    609       dynamic_cast<xercesc::DOMAttr*>(attribute_node);
610     if(attribute == nullptr)                      610     if(attribute == nullptr)
611     {                                             611     {
612       G4Exception("G4GDMLReadParamvol::Torus_d    612       G4Exception("G4GDMLReadParamvol::Torus_dimensionsRead()", "InvalidRead",
613                   FatalException, "No attribut    613                   FatalException, "No attribute found!");
614       return;                                     614       return;
615     }                                             615     }
616     const G4String attName  = Transcode(attrib    616     const G4String attName  = Transcode(attribute->getName());
617     const G4String attValue = Transcode(attrib    617     const G4String attValue = Transcode(attribute->getValue());
618                                                   618 
619     if(attName == "lunit")                        619     if(attName == "lunit")
620     {                                             620     {
621       lunit = G4UnitDefinition::GetValueOf(att    621       lunit = G4UnitDefinition::GetValueOf(attValue);
622       if(G4UnitDefinition::GetCategory(attValu    622       if(G4UnitDefinition::GetCategory(attValue) != "Length")
623       {                                           623       {
624         G4Exception("G4GDMLReadParamvol::Torus    624         G4Exception("G4GDMLReadParamvol::Torus_dimensionsRead()", "InvalidRead",
625                     FatalException, "Invalid u    625                     FatalException, "Invalid unit for length!");
626       }                                           626       }
627     }                                             627     }
628     else if(attName == "aunit")                   628     else if(attName == "aunit")
629     {                                             629     {
630       aunit = G4UnitDefinition::GetValueOf(att    630       aunit = G4UnitDefinition::GetValueOf(attValue);
631       if(G4UnitDefinition::GetCategory(attValu    631       if(G4UnitDefinition::GetCategory(attValue) != "Angle")
632       {                                           632       {
633         G4Exception("G4GDMLReadParamvol::Torus    633         G4Exception("G4GDMLReadParamvol::Torus_dimensionsRead()", "InvalidRead",
634                     FatalException, "Invalid u    634                     FatalException, "Invalid unit for angle!");
635       }                                           635       }
636     }                                             636     }
637     else if(attName == "rmin")                    637     else if(attName == "rmin")
638     {                                             638     {
639       parameter.dimension[0] = eval.Evaluate(a    639       parameter.dimension[0] = eval.Evaluate(attValue);
640     }                                             640     }
641     else if(attName == "rmax")                    641     else if(attName == "rmax")
642     {                                             642     {
643       parameter.dimension[1] = eval.Evaluate(a    643       parameter.dimension[1] = eval.Evaluate(attValue);
644     }                                             644     }
645     else if(attName == "rtor")                    645     else if(attName == "rtor")
646     {                                             646     {
647       parameter.dimension[2] = eval.Evaluate(a    647       parameter.dimension[2] = eval.Evaluate(attValue);
648     }                                             648     }
649     else if(attName == "startphi")                649     else if(attName == "startphi")
650     {                                             650     {
651       parameter.dimension[3] = eval.Evaluate(a    651       parameter.dimension[3] = eval.Evaluate(attValue);
652     }                                             652     }
653     else if(attName == "deltaphi")                653     else if(attName == "deltaphi")
654     {                                             654     {
655       parameter.dimension[4] = eval.Evaluate(a    655       parameter.dimension[4] = eval.Evaluate(attValue);
656     }                                             656     }
657   }                                               657   }
658                                                   658 
659   parameter.dimension[0] *= lunit;                659   parameter.dimension[0] *= lunit;
660   parameter.dimension[1] *= lunit;                660   parameter.dimension[1] *= lunit;
661   parameter.dimension[2] *= lunit;                661   parameter.dimension[2] *= lunit;
662   parameter.dimension[3] *= aunit;                662   parameter.dimension[3] *= aunit;
663   parameter.dimension[4] *= aunit;                663   parameter.dimension[4] *= aunit;
664 }                                                 664 }
665                                                   665 
666 // -------------------------------------------    666 // --------------------------------------------------------------------
667 void G4GDMLReadParamvol::Ellipsoid_dimensionsR    667 void G4GDMLReadParamvol::Ellipsoid_dimensionsRead(
668   const xercesc::DOMElement* const element,       668   const xercesc::DOMElement* const element,
669   G4GDMLParameterisation::PARAMETER& parameter    669   G4GDMLParameterisation::PARAMETER& parameter)
670 {                                                 670 {
671   G4double lunit                                  671   G4double lunit                                   = 1.0;
672   const xercesc::DOMNamedNodeMap* const attrib    672   const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
673   XMLSize_t attributeCount                        673   XMLSize_t attributeCount                         = attributes->getLength();
674                                                   674 
675   for(XMLSize_t attribute_index = 0; attribute    675   for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
676       ++attribute_index)                          676       ++attribute_index)
677   {                                               677   {
678     xercesc::DOMNode* attribute_node = attribu    678     xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
679                                                   679 
680     if(attribute_node->getNodeType() != xerces    680     if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
681     {                                             681     {
682       continue;                                   682       continue;
683     }                                             683     }
684                                                   684 
685     const xercesc::DOMAttr* const attribute =     685     const xercesc::DOMAttr* const attribute =
686       dynamic_cast<xercesc::DOMAttr*>(attribut    686       dynamic_cast<xercesc::DOMAttr*>(attribute_node);
687     if(attribute == nullptr)                      687     if(attribute == nullptr)
688     {                                             688     {
689       G4Exception("G4GDMLReadParamvol::Ellipso    689       G4Exception("G4GDMLReadParamvol::Ellipsoid_dimensionsRead()",
690                   "InvalidRead", FatalExceptio    690                   "InvalidRead", FatalException, "No attribute found!");
691       return;                                     691       return;
692     }                                             692     }
693     const G4String attName  = Transcode(attrib    693     const G4String attName  = Transcode(attribute->getName());
694     const G4String attValue = Transcode(attrib    694     const G4String attValue = Transcode(attribute->getValue());
695                                                   695 
696     if(attName == "lunit")                        696     if(attName == "lunit")
697     {                                             697     {
698       lunit = G4UnitDefinition::GetValueOf(att    698       lunit = G4UnitDefinition::GetValueOf(attValue);
699       if(G4UnitDefinition::GetCategory(attValu    699       if(G4UnitDefinition::GetCategory(attValue) != "Length")
700       {                                           700       {
701         G4Exception("G4GDMLReadParamvol::Ellip    701         G4Exception("G4GDMLReadParamvol::Ellipsoid_dimensionsRead()",
702                     "InvalidRead", FatalExcept    702                     "InvalidRead", FatalException, "Invalid unit for length!");
703       }                                           703       }
704     }                                             704     }
705     else if(attName == "ax")                      705     else if(attName == "ax")
706     {                                             706     {
707       parameter.dimension[0] = eval.Evaluate(a    707       parameter.dimension[0] = eval.Evaluate(attValue);
708     }                                             708     }
709     else if(attName == "by")                      709     else if(attName == "by")
710     {                                             710     {
711       parameter.dimension[1] = eval.Evaluate(a    711       parameter.dimension[1] = eval.Evaluate(attValue);
712     }                                             712     }
713     else if(attName == "cz")                      713     else if(attName == "cz")
714     {                                             714     {
715       parameter.dimension[2] = eval.Evaluate(a    715       parameter.dimension[2] = eval.Evaluate(attValue);
716     }                                             716     }
717     else if(attName == "zcut1")                   717     else if(attName == "zcut1")
718     {                                             718     {
719       parameter.dimension[3] = eval.Evaluate(a    719       parameter.dimension[3] = eval.Evaluate(attValue);
720     }                                             720     }
721     else if(attName == "zcut2")                   721     else if(attName == "zcut2")
722     {                                             722     {
723       parameter.dimension[4] = eval.Evaluate(a    723       parameter.dimension[4] = eval.Evaluate(attValue);
724     }                                             724     }
725   }                                               725   }
726                                                   726 
727   parameter.dimension[0] *= lunit;                727   parameter.dimension[0] *= lunit;
728   parameter.dimension[1] *= lunit;                728   parameter.dimension[1] *= lunit;
729   parameter.dimension[2] *= lunit;                729   parameter.dimension[2] *= lunit;
730   parameter.dimension[3] *= lunit;                730   parameter.dimension[3] *= lunit;
731   parameter.dimension[4] *= lunit;                731   parameter.dimension[4] *= lunit;
732 }                                                 732 }
733                                                   733 
734 // -------------------------------------------    734 // --------------------------------------------------------------------
735 void G4GDMLReadParamvol::Para_dimensionsRead(     735 void G4GDMLReadParamvol::Para_dimensionsRead(
736   const xercesc::DOMElement* const element,       736   const xercesc::DOMElement* const element,
737   G4GDMLParameterisation::PARAMETER& parameter    737   G4GDMLParameterisation::PARAMETER& parameter)
738 {                                                 738 {
739   G4double lunit = 1.0;                           739   G4double lunit = 1.0;
740   G4double aunit = 1.0;                           740   G4double aunit = 1.0;
741                                                   741 
742   const xercesc::DOMNamedNodeMap* const attrib    742   const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
743   XMLSize_t attributeCount                        743   XMLSize_t attributeCount                         = attributes->getLength();
744                                                   744 
745   for(XMLSize_t attribute_index = 0; attribute    745   for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
746       ++attribute_index)                          746       ++attribute_index)
747   {                                               747   {
748     xercesc::DOMNode* attribute_node = attribu    748     xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
749                                                   749 
750     if(attribute_node->getNodeType() != xerces    750     if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
751     {                                             751     {
752       continue;                                   752       continue;
753     }                                             753     }
754                                                   754 
755     const xercesc::DOMAttr* const attribute =     755     const xercesc::DOMAttr* const attribute =
756       dynamic_cast<xercesc::DOMAttr*>(attribut    756       dynamic_cast<xercesc::DOMAttr*>(attribute_node);
757     if(attribute == nullptr)                      757     if(attribute == nullptr)
758     {                                             758     {
759       G4Exception("G4GDMLReadParamvol::Para_di    759       G4Exception("G4GDMLReadParamvol::Para_dimensionsRead()", "InvalidRead",
760                   FatalException, "No attribut    760                   FatalException, "No attribute found!");
761       return;                                     761       return;
762     }                                             762     }
763     const G4String attName  = Transcode(attrib    763     const G4String attName  = Transcode(attribute->getName());
764     const G4String attValue = Transcode(attrib    764     const G4String attValue = Transcode(attribute->getValue());
765                                                   765 
766     if(attName == "lunit")                        766     if(attName == "lunit")
767     {                                             767     {
768       lunit = G4UnitDefinition::GetValueOf(att    768       lunit = G4UnitDefinition::GetValueOf(attValue);
769       if(G4UnitDefinition::GetCategory(attValu    769       if(G4UnitDefinition::GetCategory(attValue) != "Length")
770       {                                           770       {
771         G4Exception("G4GDMLReadParamvol::Para_    771         G4Exception("G4GDMLReadParamvol::Para_dimensionsRead()", "InvalidRead",
772                     FatalException, "Invalid u    772                     FatalException, "Invalid unit for length!");
773       }                                           773       }
774     }                                             774     }
775     else if(attName == "aunit")                   775     else if(attName == "aunit")
776     {                                             776     {
777       aunit = G4UnitDefinition::GetValueOf(att    777       aunit = G4UnitDefinition::GetValueOf(attValue);
778       if(G4UnitDefinition::GetCategory(attValu    778       if(G4UnitDefinition::GetCategory(attValue) != "Angle")
779       {                                           779       {
780         G4Exception("G4GDMLReadParamvol::Para_    780         G4Exception("G4GDMLReadParamvol::Para_dimensionsRead()", "InvalidRead",
781                     FatalException, "Invalid u    781                     FatalException, "Invalid unit for angle!");
782       }                                           782       }
783     }                                             783     }
784     else if(attName == "x")                       784     else if(attName == "x")
785     {                                             785     {
786       parameter.dimension[0] = eval.Evaluate(a    786       parameter.dimension[0] = eval.Evaluate(attValue);
787     }                                             787     }
788     else if(attName == "y")                       788     else if(attName == "y")
789     {                                             789     {
790       parameter.dimension[1] = eval.Evaluate(a    790       parameter.dimension[1] = eval.Evaluate(attValue);
791     }                                             791     }
792     else if(attName == "z")                       792     else if(attName == "z")
793     {                                             793     {
794       parameter.dimension[2] = eval.Evaluate(a    794       parameter.dimension[2] = eval.Evaluate(attValue);
795     }                                             795     }
796     else if(attName == "alpha")                   796     else if(attName == "alpha")
797     {                                             797     {
798       parameter.dimension[3] = eval.Evaluate(a    798       parameter.dimension[3] = eval.Evaluate(attValue);
799     }                                             799     }
800     else if(attName == "theta")                   800     else if(attName == "theta")
801     {                                             801     {
802       parameter.dimension[4] = eval.Evaluate(a    802       parameter.dimension[4] = eval.Evaluate(attValue);
803     }                                             803     }
804     else if(attName == "phi")                     804     else if(attName == "phi")
805     {                                             805     {
806       parameter.dimension[5] = eval.Evaluate(a    806       parameter.dimension[5] = eval.Evaluate(attValue);
807     }                                             807     }
808   }                                               808   }
809                                                   809 
810   parameter.dimension[0] = 0.5 * lunit;           810   parameter.dimension[0] = 0.5 * lunit;
811   parameter.dimension[1] = 0.5 * lunit;           811   parameter.dimension[1] = 0.5 * lunit;
812   parameter.dimension[2] = 0.5 * lunit;           812   parameter.dimension[2] = 0.5 * lunit;
813   parameter.dimension[3] = aunit;                 813   parameter.dimension[3] = aunit;
814   parameter.dimension[4] = aunit;                 814   parameter.dimension[4] = aunit;
815   parameter.dimension[5] = aunit;                 815   parameter.dimension[5] = aunit;
816 }                                                 816 }
817                                                   817 
818 // -------------------------------------------    818 // --------------------------------------------------------------------
819 void G4GDMLReadParamvol::Hype_dimensionsRead(     819 void G4GDMLReadParamvol::Hype_dimensionsRead(
820   const xercesc::DOMElement* const element,       820   const xercesc::DOMElement* const element,
821   G4GDMLParameterisation::PARAMETER& parameter    821   G4GDMLParameterisation::PARAMETER& parameter)
822 {                                                 822 {
823   G4double lunit = 1.0;                           823   G4double lunit = 1.0;
824   G4double aunit = 1.0;                           824   G4double aunit = 1.0;
825                                                   825 
826   const xercesc::DOMNamedNodeMap* const attrib    826   const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
827   XMLSize_t attributeCount                        827   XMLSize_t attributeCount                         = attributes->getLength();
828                                                   828 
829   for(XMLSize_t attribute_index = 0; attribute    829   for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
830       ++attribute_index)                          830       ++attribute_index)
831   {                                               831   {
832     xercesc::DOMNode* attribute_node = attribu    832     xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
833                                                   833 
834     if(attribute_node->getNodeType() != xerces    834     if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
835     {                                             835     {
836       continue;                                   836       continue;
837     }                                             837     }
838                                                   838 
839     const xercesc::DOMAttr* const attribute =     839     const xercesc::DOMAttr* const attribute =
840       dynamic_cast<xercesc::DOMAttr*>(attribut    840       dynamic_cast<xercesc::DOMAttr*>(attribute_node);
841     if(attribute == nullptr)                      841     if(attribute == nullptr)
842     {                                             842     {
843       G4Exception("G4GDMLReadParamvol::Hype_di    843       G4Exception("G4GDMLReadParamvol::Hype_dimensionsRead()", "InvalidRead",
844                   FatalException, "No attribut    844                   FatalException, "No attribute found!");
845       return;                                     845       return;
846     }                                             846     }
847     const G4String attName  = Transcode(attrib    847     const G4String attName  = Transcode(attribute->getName());
848     const G4String attValue = Transcode(attrib    848     const G4String attValue = Transcode(attribute->getValue());
849                                                   849 
850     if(attName == "lunit")                        850     if(attName == "lunit")
851     {                                             851     {
852       lunit = G4UnitDefinition::GetValueOf(att    852       lunit = G4UnitDefinition::GetValueOf(attValue);
853       if(G4UnitDefinition::GetCategory(attValu    853       if(G4UnitDefinition::GetCategory(attValue) != "Length")
854       {                                           854       {
855         G4Exception("G4GDMLReadParamvol::Hype_    855         G4Exception("G4GDMLReadParamvol::Hype_dimensionsRead()", "InvalidRead",
856                     FatalException, "Invalid u    856                     FatalException, "Invalid unit for length!");
857       }                                           857       }
858     }                                             858     }
859     else if(attName == "aunit")                   859     else if(attName == "aunit")
860     {                                             860     {
861       aunit = G4UnitDefinition::GetValueOf(att    861       aunit = G4UnitDefinition::GetValueOf(attValue);
862       if(G4UnitDefinition::GetCategory(attValu    862       if(G4UnitDefinition::GetCategory(attValue) != "Angle")
863       {                                           863       {
864         G4Exception("G4GDMLReadParamvol::Hype_    864         G4Exception("G4GDMLReadParamvol::Hype_dimensionsRead()", "InvalidRead",
865                     FatalException, "Invalid u    865                     FatalException, "Invalid unit for angle!");
866       }                                           866       }
867     }                                             867     }
868     else if(attName == "rmin")                    868     else if(attName == "rmin")
869     {                                             869     {
870       parameter.dimension[0] = eval.Evaluate(a    870       parameter.dimension[0] = eval.Evaluate(attValue);
871     }                                             871     }
872     else if(attName == "rmax")                    872     else if(attName == "rmax")
873     {                                             873     {
874       parameter.dimension[1] = eval.Evaluate(a    874       parameter.dimension[1] = eval.Evaluate(attValue);
875     }                                             875     }
876     else if(attName == "inst")                    876     else if(attName == "inst")
877     {                                             877     {
878       parameter.dimension[2] = eval.Evaluate(a    878       parameter.dimension[2] = eval.Evaluate(attValue);
879     }                                             879     }
880     else if(attName == "outst")                   880     else if(attName == "outst")
881     {                                             881     {
882       parameter.dimension[3] = eval.Evaluate(a    882       parameter.dimension[3] = eval.Evaluate(attValue);
883     }                                             883     }
884     else if(attName == "z")                       884     else if(attName == "z")
885     {                                             885     {
886       parameter.dimension[4] = eval.Evaluate(a    886       parameter.dimension[4] = eval.Evaluate(attValue);
887     }                                             887     }
888   }                                               888   }
889                                                   889 
890   parameter.dimension[0] = lunit;                 890   parameter.dimension[0] = lunit;
891   parameter.dimension[1] = lunit;                 891   parameter.dimension[1] = lunit;
892   parameter.dimension[2] = aunit;                 892   parameter.dimension[2] = aunit;
893   parameter.dimension[3] = aunit;                 893   parameter.dimension[3] = aunit;
894   parameter.dimension[4] = 0.5 * lunit;           894   parameter.dimension[4] = 0.5 * lunit;
895 }                                                 895 }
896                                                   896 
897 // -------------------------------------------    897 // --------------------------------------------------------------------
898 void G4GDMLReadParamvol::Polycone_dimensionsRe    898 void G4GDMLReadParamvol::Polycone_dimensionsRead(
899   const xercesc::DOMElement* const element,       899   const xercesc::DOMElement* const element,
900   G4GDMLParameterisation::PARAMETER& parameter    900   G4GDMLParameterisation::PARAMETER& parameter)
901 {                                                 901 {
902   G4double lunit = 1.0;                           902   G4double lunit = 1.0;
903   G4double aunit = 1.0;                           903   G4double aunit = 1.0;
904                                                   904 
905   std::vector<zplaneType> zplaneList;             905   std::vector<zplaneType> zplaneList;
906                                                   906 
907   const xercesc::DOMNamedNodeMap* const attrib    907   const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
908   XMLSize_t attributeCount                        908   XMLSize_t attributeCount                         = attributes->getLength();
909                                                   909 
910   for(XMLSize_t attribute_index = 0; attribute    910   for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
911       ++attribute_index)                          911       ++attribute_index)
912   {                                               912   {
913     xercesc::DOMNode* attribute_node = attribu    913     xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
914                                                   914 
915     if(attribute_node->getNodeType() != xerces    915     if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
916     {                                             916     {
917       continue;                                   917       continue;
918     }                                             918     }
919                                                   919 
920     const xercesc::DOMAttr* const attribute =     920     const xercesc::DOMAttr* const attribute =
921       dynamic_cast<xercesc::DOMAttr*>(attribut    921       dynamic_cast<xercesc::DOMAttr*>(attribute_node);
922     if(attribute == nullptr)                      922     if(attribute == nullptr)
923     {                                             923     {
924       G4Exception("G4GDMLReadParamvol::Polycon    924       G4Exception("G4GDMLReadParamvol::Polycone_dimensionsRead()",
925                   "InvalidRead", FatalExceptio    925                   "InvalidRead", FatalException, "No attribute found!");
926       return;                                     926       return;
927     }                                             927     }
928     const G4String attName  = Transcode(attrib    928     const G4String attName  = Transcode(attribute->getName());
929     const G4String attValue = Transcode(attrib    929     const G4String attValue = Transcode(attribute->getValue());
930                                                   930 
931     if(attName == "lunit")                        931     if(attName == "lunit")
932     {                                             932     {
933       lunit = G4UnitDefinition::GetValueOf(att    933       lunit = G4UnitDefinition::GetValueOf(attValue);
934       if(G4UnitDefinition::GetCategory(attValu    934       if(G4UnitDefinition::GetCategory(attValue) != "Length")
935       {                                           935       {
936         G4Exception("G4GDMLReadParamvol::Polyc    936         G4Exception("G4GDMLReadParamvol::Polycone_dimensionsRead()",
937                     "InvalidRead", FatalExcept    937                     "InvalidRead", FatalException, "Invalid unit for length!");
938       }                                           938       }
939     }                                             939     }
940     else if(attName == "aunit")                   940     else if(attName == "aunit")
941     {                                             941     {
942       aunit = G4UnitDefinition::GetValueOf(att    942       aunit = G4UnitDefinition::GetValueOf(attValue);
943       if(G4UnitDefinition::GetCategory(attValu    943       if(G4UnitDefinition::GetCategory(attValue) != "Angle")
944       {                                           944       {
945         G4Exception("G4GDMLReadParamvol::Polyc    945         G4Exception("G4GDMLReadParamvol::Polycone_dimensionsRead()",
946                     "InvalidRead", FatalExcept    946                     "InvalidRead", FatalException, "Invalid unit for angle!");
947       }                                           947       }
948     }                                             948     }
949     else if(attName == "startPhi")                949     else if(attName == "startPhi")
950     {                                             950     {
951       parameter.dimension[0] = eval.Evaluate(a    951       parameter.dimension[0] = eval.Evaluate(attValue);
952     }                                             952     }
953     else if(attName == "openPhi")                 953     else if(attName == "openPhi")
954     {                                             954     {
955       parameter.dimension[1] = eval.Evaluate(a    955       parameter.dimension[1] = eval.Evaluate(attValue);
956     }                                             956     }
957     else if(attName == "numRZ")                   957     else if(attName == "numRZ")
958     {                                             958     {
959       parameter.dimension[2] = eval.Evaluate(a    959       parameter.dimension[2] = eval.Evaluate(attValue);
960     }                                             960     }
961   }                                               961   }
962                                                   962 
963   parameter.dimension[0] *= aunit;                963   parameter.dimension[0] *= aunit;
964   parameter.dimension[1] *= aunit;                964   parameter.dimension[1] *= aunit;
965                                                   965 
966   for(xercesc::DOMNode* iter = element->getFir    966   for(xercesc::DOMNode* iter = element->getFirstChild(); iter != nullptr;
967       iter                   = iter->getNextSi    967       iter                   = iter->getNextSibling())
968   {                                               968   {
969     if(iter->getNodeType() != xercesc::DOMNode    969     if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
970     {                                             970     {
971       continue;                                   971       continue;
972     }                                             972     }
973                                                   973 
974     const xercesc::DOMElement* const child =      974     const xercesc::DOMElement* const child =
975       dynamic_cast<xercesc::DOMElement*>(iter)    975       dynamic_cast<xercesc::DOMElement*>(iter);
976     if(child == nullptr)                          976     if(child == nullptr)
977     {                                             977     {
978       G4Exception("G4GDMLReadParamVol::Polycon    978       G4Exception("G4GDMLReadParamVol::Polycone_dimensionsRead()",
979                   "InvalidRead", FatalExceptio    979                   "InvalidRead", FatalException, "No child found!");
980       return;                                     980       return;
981     }                                             981     }
982     const G4String tag = Transcode(child->getT    982     const G4String tag = Transcode(child->getTagName());
983                                                   983 
984     if(tag == "zplane")                           984     if(tag == "zplane")
985     {                                             985     {
986       zplaneList.push_back(ZplaneRead(child));    986       zplaneList.push_back(ZplaneRead(child));
987     }                                             987     }
988   }                                               988   }
989                                                   989 
990   std::size_t numZPlanes = zplaneList.size();  << 990   G4int numZPlanes = zplaneList.size();
991   for(std::size_t i = 0; i < numZPlanes; ++i)  << 991   for(G4int i = 0; i < numZPlanes; ++i)
992   {                                               992   {
993     parameter.dimension[3 + i * 3] = zplaneLis    993     parameter.dimension[3 + i * 3] = zplaneList[i].rmin * lunit;
994     parameter.dimension[4 + i * 3] = zplaneLis    994     parameter.dimension[4 + i * 3] = zplaneList[i].rmax * lunit;
995     parameter.dimension[5 + i * 3] = zplaneLis    995     parameter.dimension[5 + i * 3] = zplaneList[i].z * lunit;
996   }                                               996   }
997 }                                                 997 }
998                                                   998 
999 // -------------------------------------------    999 // --------------------------------------------------------------------
1000 void G4GDMLReadParamvol::Polyhedra_dimensions    1000 void G4GDMLReadParamvol::Polyhedra_dimensionsRead(
1001   const xercesc::DOMElement* const element,      1001   const xercesc::DOMElement* const element,
1002   G4GDMLParameterisation::PARAMETER& paramete    1002   G4GDMLParameterisation::PARAMETER& parameter)
1003 {                                                1003 {
1004   G4double lunit = 1.0;                          1004   G4double lunit = 1.0;
1005   G4double aunit = 1.0;                          1005   G4double aunit = 1.0;
1006                                                  1006 
1007   std::vector<zplaneType> zplaneList;            1007   std::vector<zplaneType> zplaneList;
1008                                                  1008 
1009   const xercesc::DOMNamedNodeMap* const attri    1009   const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes();
1010   XMLSize_t attributeCount                       1010   XMLSize_t attributeCount                         = attributes->getLength();
1011                                                  1011 
1012   for(XMLSize_t attribute_index = 0; attribut    1012   for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
1013       ++attribute_index)                         1013       ++attribute_index)
1014   {                                              1014   {
1015     xercesc::DOMNode* attribute_node = attrib    1015     xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1016                                                  1016 
1017     if(attribute_node->getNodeType() != xerce    1017     if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1018     {                                            1018     {
1019       continue;                                  1019       continue;
1020     }                                            1020     }
1021                                                  1021 
1022     const xercesc::DOMAttr* const attribute =    1022     const xercesc::DOMAttr* const attribute =
1023       dynamic_cast<xercesc::DOMAttr*>(attribu    1023       dynamic_cast<xercesc::DOMAttr*>(attribute_node);
1024     if(attribute == nullptr)                     1024     if(attribute == nullptr)
1025     {                                            1025     {
1026       G4Exception("G4GDMLReadParamvol::Polyco    1026       G4Exception("G4GDMLReadParamvol::Polycone_dimensionsRead()",
1027                   "InvalidRead", FatalExcepti    1027                   "InvalidRead", FatalException, "No attribute found!");
1028       return;                                    1028       return;
1029     }                                            1029     }
1030     const G4String attName  = Transcode(attri    1030     const G4String attName  = Transcode(attribute->getName());
1031     const G4String attValue = Transcode(attri    1031     const G4String attValue = Transcode(attribute->getValue());
1032                                                  1032 
1033     if(attName == "lunit")                       1033     if(attName == "lunit")
1034     {                                            1034     {
1035       lunit = G4UnitDefinition::GetValueOf(at    1035       lunit = G4UnitDefinition::GetValueOf(attValue);
1036       if(G4UnitDefinition::GetCategory(attVal    1036       if(G4UnitDefinition::GetCategory(attValue) != "Length")
1037       {                                          1037       {
1038         G4Exception("G4GDMLReadParamvol::Poly    1038         G4Exception("G4GDMLReadParamvol::Polyhedra_dimensionsRead()",
1039                     "InvalidRead", FatalExcep    1039                     "InvalidRead", FatalException, "Invalid unit for length!");
1040       }                                          1040       }
1041     }                                            1041     }
1042     else if(attName == "aunit")                  1042     else if(attName == "aunit")
1043     {                                            1043     {
1044       aunit = G4UnitDefinition::GetValueOf(at    1044       aunit = G4UnitDefinition::GetValueOf(attValue);
1045       if(G4UnitDefinition::GetCategory(attVal    1045       if(G4UnitDefinition::GetCategory(attValue) != "Angle")
1046       {                                          1046       {
1047         G4Exception("G4GDMLReadParamvol::Poly    1047         G4Exception("G4GDMLReadParamvol::Polyhedra_dimensionsRead()",
1048                     "InvalidRead", FatalExcep    1048                     "InvalidRead", FatalException, "Invalid unit for angle!");
1049       }                                          1049       }
1050     }                                            1050     }
1051     else if(attName == "startPhi")               1051     else if(attName == "startPhi")
1052     {                                            1052     {
1053       parameter.dimension[0] = eval.Evaluate(    1053       parameter.dimension[0] = eval.Evaluate(attValue);
1054     }                                            1054     }
1055     else if(attName == "openPhi")                1055     else if(attName == "openPhi")
1056     {                                            1056     {
1057       parameter.dimension[1] = eval.Evaluate(    1057       parameter.dimension[1] = eval.Evaluate(attValue);
1058     }                                            1058     }
1059     else if(attName == "numRZ")                  1059     else if(attName == "numRZ")
1060     {                                            1060     {
1061       parameter.dimension[2] = eval.Evaluate(    1061       parameter.dimension[2] = eval.Evaluate(attValue);
1062     }                                            1062     }
1063     else if(attName == "numSide")                1063     else if(attName == "numSide")
1064     {                                            1064     {
1065       parameter.dimension[3] = eval.Evaluate(    1065       parameter.dimension[3] = eval.Evaluate(attValue);
1066     }                                            1066     }
1067   }                                              1067   }
1068                                                  1068 
1069   parameter.dimension[0] *= aunit;               1069   parameter.dimension[0] *= aunit;
1070   parameter.dimension[1] *= aunit;               1070   parameter.dimension[1] *= aunit;
1071                                                  1071 
1072   for(auto iter = element->getFirstChild(); i << 1072   for(xercesc::DOMNode* iter = element->getFirstChild(); iter != nullptr;
1073            iter = iter->getNextSibling())     << 1073       iter                   = iter->getNextSibling())
1074   {                                              1074   {
1075     if(iter->getNodeType() != xercesc::DOMNod    1075     if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
1076     {                                            1076     {
1077       continue;                                  1077       continue;
1078     }                                            1078     }
1079                                                  1079 
1080     const xercesc::DOMElement* const child =     1080     const xercesc::DOMElement* const child =
1081       dynamic_cast<xercesc::DOMElement*>(iter    1081       dynamic_cast<xercesc::DOMElement*>(iter);
1082     if(child == nullptr)                         1082     if(child == nullptr)
1083     {                                            1083     {
1084       G4Exception("G4GDMLReadParamvo::Polyhed    1084       G4Exception("G4GDMLReadParamvo::PolyhedraRead()", "InvalidRead",
1085                   FatalException, "No child f    1085                   FatalException, "No child found!");
1086       return;                                    1086       return;
1087     }                                            1087     }
1088     const G4String tag = Transcode(child->get    1088     const G4String tag = Transcode(child->getTagName());
1089                                                  1089 
1090     if(tag == "zplane")                          1090     if(tag == "zplane")
1091     {                                            1091     {
1092       zplaneList.push_back(ZplaneRead(child))    1092       zplaneList.push_back(ZplaneRead(child));
1093     }                                            1093     }
1094   }                                              1094   }
1095                                                  1095 
1096   std::size_t numZPlanes = zplaneList.size(); << 1096   G4int numZPlanes = zplaneList.size();
1097   for(std::size_t i = 0; i < numZPlanes; ++i) << 1097   for(G4int i = 0; i < numZPlanes; ++i)
1098   {                                              1098   {
1099     parameter.dimension[4 + i * 3] = zplaneLi    1099     parameter.dimension[4 + i * 3] = zplaneList[i].rmin * lunit;
1100     parameter.dimension[5 + i * 3] = zplaneLi    1100     parameter.dimension[5 + i * 3] = zplaneList[i].rmax * lunit;
1101     parameter.dimension[6 + i * 3] = zplaneLi    1101     parameter.dimension[6 + i * 3] = zplaneList[i].z * lunit;
1102   }                                              1102   }
1103 }                                                1103 }
1104                                                  1104 
1105 // ------------------------------------------    1105 // --------------------------------------------------------------------
1106 void G4GDMLReadParamvol::ParametersRead(         1106 void G4GDMLReadParamvol::ParametersRead(
1107   const xercesc::DOMElement* const element)      1107   const xercesc::DOMElement* const element)
1108 {                                                1108 {
1109   G4ThreeVector rotation(0.0, 0.0, 0.0);         1109   G4ThreeVector rotation(0.0, 0.0, 0.0);
1110   G4ThreeVector position(0.0, 0.0, 0.0);         1110   G4ThreeVector position(0.0, 0.0, 0.0);
1111                                                  1111 
1112   G4GDMLParameterisation::PARAMETER parameter    1112   G4GDMLParameterisation::PARAMETER parameter;
1113                                                  1113 
1114   for(xercesc::DOMNode* iter = element->getFi    1114   for(xercesc::DOMNode* iter = element->getFirstChild(); iter != nullptr;
1115       iter                   = iter->getNextS    1115       iter                   = iter->getNextSibling())
1116   {                                              1116   {
1117     if(iter->getNodeType() != xercesc::DOMNod    1117     if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
1118     {                                            1118     {
1119       continue;                                  1119       continue;
1120     }                                            1120     }
1121                                                  1121 
1122     const xercesc::DOMElement* const child =     1122     const xercesc::DOMElement* const child =
1123       dynamic_cast<xercesc::DOMElement*>(iter    1123       dynamic_cast<xercesc::DOMElement*>(iter);
1124     if(child == nullptr)                         1124     if(child == nullptr)
1125     {                                            1125     {
1126       G4Exception("G4GDMLReadParamvol::Parame    1126       G4Exception("G4GDMLReadParamvol::ParametersRead()", "InvalidRead",
1127                   FatalException, "No child f    1127                   FatalException, "No child found!");
1128       return;                                    1128       return;
1129     }                                            1129     }
1130     const G4String tag = Transcode(child->get    1130     const G4String tag = Transcode(child->getTagName());
1131     if(tag == "rotation")                        1131     if(tag == "rotation")
1132     {                                            1132     {
1133       VectorRead(child, rotation);               1133       VectorRead(child, rotation);
1134     }                                            1134     }
1135     else if(tag == "position")                   1135     else if(tag == "position")
1136     {                                            1136     {
1137       VectorRead(child, position);               1137       VectorRead(child, position);
1138     }                                            1138     }
1139     else if(tag == "positionref")                1139     else if(tag == "positionref")
1140     {                                            1140     {
1141       position = GetPosition(GenerateName(Ref    1141       position = GetPosition(GenerateName(RefRead(child)));
1142     }                                            1142     }
1143     else if(tag == "rotationref")                1143     else if(tag == "rotationref")
1144     {                                            1144     {
1145       rotation = GetRotation(GenerateName(Ref    1145       rotation = GetRotation(GenerateName(RefRead(child)));
1146     }                                            1146     }
1147     else if(tag == "box_dimensions")             1147     else if(tag == "box_dimensions")
1148     {                                            1148     {
1149       Box_dimensionsRead(child, parameter);      1149       Box_dimensionsRead(child, parameter);
1150     }                                            1150     }
1151     else if(tag == "trd_dimensions")             1151     else if(tag == "trd_dimensions")
1152     {                                            1152     {
1153       Trd_dimensionsRead(child, parameter);      1153       Trd_dimensionsRead(child, parameter);
1154     }                                            1154     }
1155     else if(tag == "trap_dimensions")            1155     else if(tag == "trap_dimensions")
1156     {                                            1156     {
1157       Trap_dimensionsRead(child, parameter);     1157       Trap_dimensionsRead(child, parameter);
1158     }                                            1158     }
1159     else if(tag == "tube_dimensions")            1159     else if(tag == "tube_dimensions")
1160     {                                            1160     {
1161       Tube_dimensionsRead(child, parameter);     1161       Tube_dimensionsRead(child, parameter);
1162     }                                            1162     }
1163     else if(tag == "cone_dimensions")            1163     else if(tag == "cone_dimensions")
1164     {                                            1164     {
1165       Cone_dimensionsRead(child, parameter);     1165       Cone_dimensionsRead(child, parameter);
1166     }                                            1166     }
1167     else if(tag == "sphere_dimensions")          1167     else if(tag == "sphere_dimensions")
1168     {                                            1168     {
1169       Sphere_dimensionsRead(child, parameter)    1169       Sphere_dimensionsRead(child, parameter);
1170     }                                            1170     }
1171     else if(tag == "orb_dimensions")             1171     else if(tag == "orb_dimensions")
1172     {                                            1172     {
1173       Orb_dimensionsRead(child, parameter);      1173       Orb_dimensionsRead(child, parameter);
1174     }                                            1174     }
1175     else if(tag == "torus_dimensions")           1175     else if(tag == "torus_dimensions")
1176     {                                            1176     {
1177       Torus_dimensionsRead(child, parameter);    1177       Torus_dimensionsRead(child, parameter);
1178     }                                            1178     }
1179     else if(tag == "ellipsoid_dimensions")       1179     else if(tag == "ellipsoid_dimensions")
1180     {                                            1180     {
1181       Ellipsoid_dimensionsRead(child, paramet    1181       Ellipsoid_dimensionsRead(child, parameter);
1182     }                                            1182     }
1183     else if(tag == "para_dimensions")            1183     else if(tag == "para_dimensions")
1184     {                                            1184     {
1185       Para_dimensionsRead(child, parameter);     1185       Para_dimensionsRead(child, parameter);
1186     }                                            1186     }
1187     else if(tag == "polycone_dimensions")        1187     else if(tag == "polycone_dimensions")
1188     {                                            1188     {
1189       Polycone_dimensionsRead(child, paramete    1189       Polycone_dimensionsRead(child, parameter);
1190     }                                            1190     }
1191     else if(tag == "polyhedra_dimensions")       1191     else if(tag == "polyhedra_dimensions")
1192     {                                            1192     {
1193       Polyhedra_dimensionsRead(child, paramet    1193       Polyhedra_dimensionsRead(child, parameter);
1194     }                                            1194     }
1195     else if(tag == "hype_dimensions")            1195     else if(tag == "hype_dimensions")
1196     {                                            1196     {
1197       Hype_dimensionsRead(child, parameter);     1197       Hype_dimensionsRead(child, parameter);
1198     }                                            1198     }
1199     else                                         1199     else
1200     {                                            1200     {
1201       G4String error_msg = "Unknown tag in pa    1201       G4String error_msg = "Unknown tag in parameters: " + tag;
1202       G4Exception("G4GDMLReadParamvol::Parame    1202       G4Exception("G4GDMLReadParamvol::ParametersRead()", "ReadError",
1203                   FatalException, error_msg);    1203                   FatalException, error_msg);
1204     }                                            1204     }
1205   }                                              1205   }
1206                                                  1206 
1207   parameter.pRot = new G4RotationMatrix();       1207   parameter.pRot = new G4RotationMatrix();
1208                                                  1208 
1209   parameter.pRot->rotateX(rotation.x());         1209   parameter.pRot->rotateX(rotation.x());
1210   parameter.pRot->rotateY(rotation.y());         1210   parameter.pRot->rotateY(rotation.y());
1211   parameter.pRot->rotateZ(rotation.z());         1211   parameter.pRot->rotateZ(rotation.z());
1212                                                  1212 
1213   parameter.position = position;                 1213   parameter.position = position;
1214                                                  1214 
1215   parameterisation->AddParameter(parameter);     1215   parameterisation->AddParameter(parameter);
1216 }                                                1216 }
1217                                                  1217 
1218 // ------------------------------------------    1218 // --------------------------------------------------------------------
1219 void G4GDMLReadParamvol::ParameterisedRead(      1219 void G4GDMLReadParamvol::ParameterisedRead(
1220   const xercesc::DOMElement* const element)      1220   const xercesc::DOMElement* const element)
1221 {                                                1221 {
1222   for(xercesc::DOMNode* iter = element->getFi    1222   for(xercesc::DOMNode* iter = element->getFirstChild(); iter != nullptr;
1223       iter                   = iter->getNextS    1223       iter                   = iter->getNextSibling())
1224   {                                              1224   {
1225     if(iter->getNodeType() != xercesc::DOMNod    1225     if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
1226     {                                            1226     {
1227       continue;                                  1227       continue;
1228     }                                            1228     }
1229                                                  1229 
1230     const xercesc::DOMElement* const child =     1230     const xercesc::DOMElement* const child =
1231       dynamic_cast<xercesc::DOMElement*>(iter    1231       dynamic_cast<xercesc::DOMElement*>(iter);
1232     if(child == nullptr)                         1232     if(child == nullptr)
1233     {                                            1233     {
1234       G4Exception("G4GDMLReadParamvol::Parame    1234       G4Exception("G4GDMLReadParamvol::ParameterisedRead()", "InvalidRead",
1235                   FatalException, "No child f    1235                   FatalException, "No child found!");
1236       return;                                    1236       return;
1237     }                                            1237     }
1238     const G4String tag = Transcode(child->get    1238     const G4String tag = Transcode(child->getTagName());
1239                                                  1239 
1240     if(tag == "parameters")                      1240     if(tag == "parameters")
1241     {                                            1241     {
1242       const xercesc::DOMNamedNodeMap* const a    1242       const xercesc::DOMNamedNodeMap* const attributes =
1243         element->getAttributes();                1243         element->getAttributes();
1244       XMLSize_t attributeCount = attributes->    1244       XMLSize_t attributeCount = attributes->getLength();
1245       for(XMLSize_t attribute_index = 0; attr    1245       for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
1246           ++attribute_index)                     1246           ++attribute_index)
1247       {                                          1247       {
1248         xercesc::DOMNode* attribute_node = at    1248         xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
1249                                                  1249 
1250         if(attribute_node->getNodeType() != x    1250         if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
1251         {                                        1251         {
1252           continue;                              1252           continue;
1253         }                                        1253         }
1254                                                  1254 
1255         const xercesc::DOMAttr* const attribu    1255         const xercesc::DOMAttr* const attribute =
1256           dynamic_cast<xercesc::DOMAttr*>(att    1256           dynamic_cast<xercesc::DOMAttr*>(attribute_node);
1257         if(attribute == nullptr)                 1257         if(attribute == nullptr)
1258         {                                        1258         {
1259           G4Exception("G4GDMLReadParamvol::Pa    1259           G4Exception("G4GDMLReadParamvol::ParameterisedRead()", "InvalidRead",
1260                       FatalException, "No att    1260                       FatalException, "No attribute found!");
1261           return;                                1261           return;
1262         }                                        1262         }
1263         const G4String attName  = Transcode(a    1263         const G4String attName  = Transcode(attribute->getName());
1264         const G4String attValue = Transcode(a    1264         const G4String attValue = Transcode(attribute->getValue());
1265                                                  1265 
1266         if(attName == "number")                  1266         if(attName == "number")
1267         {                                        1267         {
1268           eval.Evaluate(attValue);               1268           eval.Evaluate(attValue);
1269         }                                        1269         }
1270       }                                          1270       }
1271       ParametersRead(child);                     1271       ParametersRead(child);
1272     }                                            1272     }
1273     else                                         1273     else
1274     {                                            1274     {
1275       if(tag == "loop")                          1275       if(tag == "loop")
1276       {                                          1276       {
1277         LoopRead(child, &G4GDMLRead::Paramvol    1277         LoopRead(child, &G4GDMLRead::Paramvol_contentRead);
1278       }                                          1278       }
1279     }                                            1279     }
1280   }                                              1280   }
1281 }                                                1281 }
1282                                                  1282 
1283 // ------------------------------------------    1283 // --------------------------------------------------------------------
1284 void G4GDMLReadParamvol::Paramvol_contentRead    1284 void G4GDMLReadParamvol::Paramvol_contentRead(
1285   const xercesc::DOMElement* const element)      1285   const xercesc::DOMElement* const element)
1286 {                                                1286 {
1287   for(xercesc::DOMNode* iter = element->getFi    1287   for(xercesc::DOMNode* iter = element->getFirstChild(); iter != nullptr;
1288       iter                   = iter->getNextS    1288       iter                   = iter->getNextSibling())
1289   {                                              1289   {
1290     if(iter->getNodeType() != xercesc::DOMNod    1290     if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
1291     {                                            1291     {
1292       continue;                                  1292       continue;
1293     }                                            1293     }
1294                                                  1294 
1295     const xercesc::DOMElement* const child =     1295     const xercesc::DOMElement* const child =
1296       dynamic_cast<xercesc::DOMElement*>(iter    1296       dynamic_cast<xercesc::DOMElement*>(iter);
1297     if(child == nullptr)                         1297     if(child == nullptr)
1298     {                                            1298     {
1299       G4Exception("G4GDMLReadParamvol::Paramv    1299       G4Exception("G4GDMLReadParamvol::Paramvol_contentRead()", "InvalidRead",
1300                   FatalException, "No child f    1300                   FatalException, "No child found!");
1301       return;                                    1301       return;
1302     }                                            1302     }
1303     const G4String tag = Transcode(child->get    1303     const G4String tag = Transcode(child->getTagName());
1304     if(tag == "parameterised_position_size")     1304     if(tag == "parameterised_position_size")
1305     {                                            1305     {
1306       ParameterisedRead(child);                  1306       ParameterisedRead(child);
1307     }                                            1307     }
1308     else if(tag == "loop")                       1308     else if(tag == "loop")
1309     {                                            1309     {
1310       LoopRead(child, &G4GDMLRead::Paramvol_c    1310       LoopRead(child, &G4GDMLRead::Paramvol_contentRead);
1311     }                                            1311     }
1312   }                                              1312   }
1313 }                                                1313 }
1314                                                  1314 
1315 // ------------------------------------------    1315 // --------------------------------------------------------------------
1316 void G4GDMLReadParamvol::ParamvolRead(const x    1316 void G4GDMLReadParamvol::ParamvolRead(const xercesc::DOMElement* const element,
1317                                       G4Logic    1317                                       G4LogicalVolume* mother)
1318 {                                                1318 {
1319   G4String volumeref;                            1319   G4String volumeref;
1320                                                  1320 
1321   parameterisation = new G4GDMLParameterisati    1321   parameterisation = new G4GDMLParameterisation();
1322   for(xercesc::DOMNode* iter = element->getFi    1322   for(xercesc::DOMNode* iter = element->getFirstChild(); iter != nullptr;
1323       iter                   = iter->getNextS    1323       iter                   = iter->getNextSibling())
1324   {                                              1324   {
1325     if(iter->getNodeType() != xercesc::DOMNod    1325     if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
1326     {                                            1326     {
1327       continue;                                  1327       continue;
1328     }                                            1328     }
1329                                                  1329 
1330     const xercesc::DOMElement* const child =     1330     const xercesc::DOMElement* const child =
1331       dynamic_cast<xercesc::DOMElement*>(iter    1331       dynamic_cast<xercesc::DOMElement*>(iter);
1332     if(child == nullptr)                         1332     if(child == nullptr)
1333     {                                            1333     {
1334       G4Exception("G4GDMLReadParamvol::Paramv    1334       G4Exception("G4GDMLReadParamvol::ParamvolRead()", "InvalidRead",
1335                   FatalException, "No child f    1335                   FatalException, "No child found!");
1336       return;                                    1336       return;
1337     }                                            1337     }
1338     const G4String tag = Transcode(child->get    1338     const G4String tag = Transcode(child->getTagName());
1339                                                  1339 
1340     if(tag == "volumeref")                       1340     if(tag == "volumeref")
1341     {                                            1341     {
1342       volumeref = RefRead(child);                1342       volumeref = RefRead(child);
1343     }                                            1343     }
1344   }                                              1344   }
1345                                                  1345 
1346   Paramvol_contentRead(element);                 1346   Paramvol_contentRead(element);
1347                                                  1347 
1348   G4LogicalVolume* logvol = GetVolume(Generat    1348   G4LogicalVolume* logvol = GetVolume(GenerateName(volumeref));
1349                                                  1349 
1350   if(parameterisation->GetSize() == 0)           1350   if(parameterisation->GetSize() == 0)
1351   {                                              1351   {
1352     G4Exception("G4GDMLReadParamvol::Paramvol    1352     G4Exception("G4GDMLReadParamvol::ParamvolRead()", "ReadError",
1353                 FatalException,                  1353                 FatalException,
1354                 "No parameters are defined in    1354                 "No parameters are defined in parameterised volume!");
1355   }                                              1355   }
1356   G4String pv_name = logvol->GetName() + "_pa    1356   G4String pv_name = logvol->GetName() + "_param";
1357   new G4PVParameterised(pv_name, logvol, moth    1357   new G4PVParameterised(pv_name, logvol, mother, kUndefined,
1358                         parameterisation->Get    1358                         parameterisation->GetSize(), parameterisation, check);
1359 }                                                1359 }
1360                                                  1360