Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/persistency/gdml/src/G4GDMLReadStructure.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/G4GDMLReadStructure.cc (Version 11.3.0) and /persistency/gdml/src/G4GDMLReadStructure.cc (Version 10.7.p3)


  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 // G4GDMLReadStructure implementation              26 // G4GDMLReadStructure implementation
 27 //                                                 27 //
 28 // Author: Zoltan Torzsok, November 2007           28 // Author: Zoltan Torzsok, November 2007
 29 // -------------------------------------------     29 // --------------------------------------------------------------------
 30                                                    30 
 31 #include "G4GDMLReadStructure.hh"                  31 #include "G4GDMLReadStructure.hh"
 32                                                    32 
 33 #include "G4UnitsTable.hh"                         33 #include "G4UnitsTable.hh"
 34 #include "G4LogicalVolume.hh"                      34 #include "G4LogicalVolume.hh"
 35 #include "G4VPhysicalVolume.hh"                    35 #include "G4VPhysicalVolume.hh"
 36 #include "G4PVPlacement.hh"                        36 #include "G4PVPlacement.hh"
 37 #include "G4LogicalVolumeStore.hh"                 37 #include "G4LogicalVolumeStore.hh"
 38 #include "G4PhysicalVolumeStore.hh"                38 #include "G4PhysicalVolumeStore.hh"
 39 #include "G4AssemblyVolume.hh"                     39 #include "G4AssemblyVolume.hh"
 40 #include "G4ReflectionFactory.hh"                  40 #include "G4ReflectionFactory.hh"
 41 #include "G4PVDivisionFactory.hh"                  41 #include "G4PVDivisionFactory.hh"
 42 #include "G4LogicalBorderSurface.hh"               42 #include "G4LogicalBorderSurface.hh"
 43 #include "G4LogicalSkinSurface.hh"                 43 #include "G4LogicalSkinSurface.hh"
 44 #include "G4VisAttributes.hh"                      44 #include "G4VisAttributes.hh"
 45                                                    45 
 46 // -------------------------------------------     46 // --------------------------------------------------------------------
 47 G4GDMLReadStructure::G4GDMLReadStructure()         47 G4GDMLReadStructure::G4GDMLReadStructure()
 48   : G4GDMLReadParamvol()                           48   : G4GDMLReadParamvol()
 49 {                                                  49 {
 50 }                                                  50 }
 51                                                    51 
 52 // -------------------------------------------     52 // --------------------------------------------------------------------
 53 G4GDMLReadStructure::~G4GDMLReadStructure()        53 G4GDMLReadStructure::~G4GDMLReadStructure()
 54 {                                                  54 {
 55 }                                                  55 }
 56                                                    56 
 57 // -------------------------------------------     57 // --------------------------------------------------------------------
 58 void G4GDMLReadStructure::BorderSurfaceRead(       58 void G4GDMLReadStructure::BorderSurfaceRead(
 59   const xercesc::DOMElement* const bordersurfa     59   const xercesc::DOMElement* const bordersurfaceElement)
 60 {                                                  60 {
 61   G4String name;                                   61   G4String name;
 62   G4VPhysicalVolume* pv1  = nullptr;               62   G4VPhysicalVolume* pv1  = nullptr;
 63   G4VPhysicalVolume* pv2  = nullptr;               63   G4VPhysicalVolume* pv2  = nullptr;
 64   G4SurfaceProperty* prop = nullptr;               64   G4SurfaceProperty* prop = nullptr;
 65   G4int index             = 0;                     65   G4int index             = 0;
 66                                                    66 
 67   const xercesc::DOMNamedNodeMap* const attrib     67   const xercesc::DOMNamedNodeMap* const attributes =
 68     bordersurfaceElement->getAttributes();         68     bordersurfaceElement->getAttributes();
 69   XMLSize_t attributeCount = attributes->getLe     69   XMLSize_t attributeCount = attributes->getLength();
 70                                                    70 
 71   for(XMLSize_t attribute_index = 0; attribute     71   for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
 72       ++attribute_index)                           72       ++attribute_index)
 73   {                                                73   {
 74     xercesc::DOMNode* attribute_node = attribu     74     xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
 75                                                    75 
 76     if(attribute_node->getNodeType() != xerces     76     if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
 77     {                                              77     {
 78       continue;                                    78       continue;
 79     }                                              79     }
 80                                                    80 
 81     const xercesc::DOMAttr* const attribute =      81     const xercesc::DOMAttr* const attribute =
 82       dynamic_cast<xercesc::DOMAttr*>(attribut     82       dynamic_cast<xercesc::DOMAttr*>(attribute_node);
 83     if(attribute == nullptr)                       83     if(attribute == nullptr)
 84     {                                              84     {
 85       G4Exception("G4GDMLReadStructure::Border     85       G4Exception("G4GDMLReadStructure::BorderSurfaceRead()", "InvalidRead",
 86                   FatalException, "No attribut     86                   FatalException, "No attribute found!");
 87       return;                                      87       return;
 88     }                                              88     }
 89     const G4String attName  = Transcode(attrib     89     const G4String attName  = Transcode(attribute->getName());
 90     const G4String attValue = Transcode(attrib     90     const G4String attValue = Transcode(attribute->getValue());
 91                                                    91 
 92     if(attName == "name")                          92     if(attName == "name")
 93     {                                              93     {
 94       name = GenerateName(attValue);               94       name = GenerateName(attValue);
 95     }                                              95     }
 96     else if(attName == "surfaceproperty")          96     else if(attName == "surfaceproperty")
 97     {                                              97     {
 98       prop = GetSurfaceProperty(GenerateName(a     98       prop = GetSurfaceProperty(GenerateName(attValue));
 99     }                                              99     }
100   }                                               100   }
101                                                   101 
102   for(xercesc::DOMNode* iter = bordersurfaceEl    102   for(xercesc::DOMNode* iter = bordersurfaceElement->getFirstChild();
103                         iter != nullptr; iter     103                         iter != nullptr; iter = iter->getNextSibling())
104   {                                               104   {
105     if(iter->getNodeType() != xercesc::DOMNode    105     if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
106     {                                             106     {
107       continue;                                   107       continue;
108     }                                             108     }
109                                                   109 
110     const xercesc::DOMElement* const child =      110     const xercesc::DOMElement* const child =
111       dynamic_cast<xercesc::DOMElement*>(iter)    111       dynamic_cast<xercesc::DOMElement*>(iter);
112     if(child == nullptr)                          112     if(child == nullptr)
113     {                                             113     {
114       G4Exception("G4GDMLReadStructure::Border    114       G4Exception("G4GDMLReadStructure::BorderSurfaceRead()", "InvalidRead",
115                   FatalException, "No child fo    115                   FatalException, "No child found!");
116       return;                                     116       return;
117     }                                             117     }
118     const G4String tag = Transcode(child->getT    118     const G4String tag = Transcode(child->getTagName());
119                                                   119 
120     if(tag != "physvolref")                       120     if(tag != "physvolref")
121     {                                             121     {
122       continue;                                   122       continue;
123     }                                             123     }
124                                                   124 
125     if(index == 0)                                125     if(index == 0)
126     {                                             126     {
127       pv1 = GetPhysvol(GenerateName(RefRead(ch    127       pv1 = GetPhysvol(GenerateName(RefRead(child)));
128       ++index;                                    128       ++index;
129     }                                             129     }
130     else if(index == 1)                           130     else if(index == 1)
131     {                                             131     {
132       pv2 = GetPhysvol(GenerateName(RefRead(ch    132       pv2 = GetPhysvol(GenerateName(RefRead(child)));
133       ++index;                                    133       ++index;
134     }                                             134     }
135     else                                          135     else
136       break;                                      136       break;
137   }                                               137   }
138                                                   138 
139   new G4LogicalBorderSurface(Strip(name), pv1,    139   new G4LogicalBorderSurface(Strip(name), pv1, pv2, prop);
140 }                                                 140 }
141                                                   141 
142 // -------------------------------------------    142 // --------------------------------------------------------------------
143 void G4GDMLReadStructure::DivisionvolRead(        143 void G4GDMLReadStructure::DivisionvolRead(
144   const xercesc::DOMElement* const divisionvol    144   const xercesc::DOMElement* const divisionvolElement)
145 {                                                 145 {
146   G4String name;                                  146   G4String name;
147   G4double unit           = 1.0;                  147   G4double unit           = 1.0;
148   G4double width          = 0.0;                  148   G4double width          = 0.0;
149   G4double offset         = 0.0;                  149   G4double offset         = 0.0;
150   G4int number            = 0;                    150   G4int number            = 0;
151   EAxis axis              = kUndefined;           151   EAxis axis              = kUndefined;
152   G4LogicalVolume* logvol = nullptr;              152   G4LogicalVolume* logvol = nullptr;
153                                                   153 
154   const xercesc::DOMNamedNodeMap* const attrib    154   const xercesc::DOMNamedNodeMap* const attributes =
155     divisionvolElement->getAttributes();          155     divisionvolElement->getAttributes();
156   XMLSize_t attributeCount = attributes->getLe    156   XMLSize_t attributeCount = attributes->getLength();
157   G4String unitname;                              157   G4String unitname;
158                                                   158 
159   for(XMLSize_t attribute_index = 0; attribute    159   for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
160       ++attribute_index)                          160       ++attribute_index)
161   {                                               161   {
162     xercesc::DOMNode* attribute_node = attribu    162     xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
163                                                   163 
164     if(attribute_node->getNodeType() != xerces    164     if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
165     {                                             165     {
166       continue;                                   166       continue;
167     }                                             167     }
168                                                   168 
169     const xercesc::DOMAttr* const attribute =     169     const xercesc::DOMAttr* const attribute =
170       dynamic_cast<xercesc::DOMAttr*>(attribut    170       dynamic_cast<xercesc::DOMAttr*>(attribute_node);
171     if(attribute == nullptr)                      171     if(attribute == nullptr)
172     {                                             172     {
173       G4Exception("G4GDMLReadStructure::Divisi    173       G4Exception("G4GDMLReadStructure::DivisionvolRead()", "InvalidRead",
174                   FatalException, "No attribut    174                   FatalException, "No attribute found!");
175       return;                                     175       return;
176     }                                             176     }
177     const G4String attName  = Transcode(attrib    177     const G4String attName  = Transcode(attribute->getName());
178     const G4String attValue = Transcode(attrib    178     const G4String attValue = Transcode(attribute->getValue());
179                                                   179 
180     if(attName == "name")                         180     if(attName == "name")
181     {                                             181     {
182       name = attValue;                            182       name = attValue;
183     }                                             183     }
184     else if(attName == "unit")                    184     else if(attName == "unit")
185     {                                             185     {
186       unit     = G4UnitDefinition::GetValueOf(    186       unit     = G4UnitDefinition::GetValueOf(attValue);
187       unitname = G4UnitDefinition::GetCategory    187       unitname = G4UnitDefinition::GetCategory(attValue);
188     }                                             188     }
189     else if(attName == "width")                   189     else if(attName == "width")
190     {                                             190     {
191       width = eval.Evaluate(attValue);            191       width = eval.Evaluate(attValue);
192     }                                             192     }
193     else if(attName == "offset")                  193     else if(attName == "offset")
194     {                                             194     {
195       offset = eval.Evaluate(attValue);           195       offset = eval.Evaluate(attValue);
196     }                                             196     }
197     else if(attName == "number")                  197     else if(attName == "number")
198     {                                             198     {
199       number = eval.EvaluateInteger(attValue);    199       number = eval.EvaluateInteger(attValue);
200     }                                             200     }
201     else if(attName == "axis")                    201     else if(attName == "axis")
202     {                                             202     {
203       if(attValue == "kXAxis")                    203       if(attValue == "kXAxis")
204       {                                           204       {
205         axis = kXAxis;                            205         axis = kXAxis;
206       }                                           206       }
207       else if(attValue == "kYAxis")               207       else if(attValue == "kYAxis")
208       {                                           208       {
209         axis = kYAxis;                            209         axis = kYAxis;
210       }                                           210       }
211       else if(attValue == "kZAxis")               211       else if(attValue == "kZAxis")
212       {                                           212       {
213         axis = kZAxis;                            213         axis = kZAxis;
214       }                                           214       }
215       else if(attValue == "kRho")                 215       else if(attValue == "kRho")
216       {                                           216       {
217         axis = kRho;                              217         axis = kRho;
218       }                                           218       }
219       else if(attValue == "kPhi")                 219       else if(attValue == "kPhi")
220       {                                           220       {
221         axis = kPhi;                              221         axis = kPhi;
222       }                                           222       }
223     }                                             223     }
224   }                                               224   }
225                                                   225 
226   if(((axis == kXAxis || axis == kYAxis || axi    226   if(((axis == kXAxis || axis == kYAxis || axis == kZAxis) &&
227       unitname != "Length") ||                    227       unitname != "Length") ||
228      ((axis == kRho || axis == kPhi) && unitna    228      ((axis == kRho || axis == kPhi) && unitname != "Angle"))
229   {                                               229   {
230     G4Exception("G4GDMLReadStructure::Division    230     G4Exception("G4GDMLReadStructure::DivisionvolRead()", "InvalidRead",
231                 FatalException, "Invalid unit!    231                 FatalException, "Invalid unit!");
232   }                                               232   }
233                                                   233 
234   width *= unit;                                  234   width *= unit;
235   offset *= unit;                                 235   offset *= unit;
236                                                   236 
237   for(xercesc::DOMNode* iter = divisionvolElem    237   for(xercesc::DOMNode* iter = divisionvolElement->getFirstChild();
238                         iter != nullptr; iter     238                         iter != nullptr; iter = iter->getNextSibling())
239   {                                               239   {
240     if(iter->getNodeType() != xercesc::DOMNode    240     if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
241     {                                             241     {
242       continue;                                   242       continue;
243     }                                             243     }
244                                                   244 
245     const xercesc::DOMElement* const child =      245     const xercesc::DOMElement* const child =
246       dynamic_cast<xercesc::DOMElement*>(iter)    246       dynamic_cast<xercesc::DOMElement*>(iter);
247     if(child == nullptr)                          247     if(child == nullptr)
248     {                                             248     {
249       G4Exception("G4GDMLReadStructure::Divisi    249       G4Exception("G4GDMLReadStructure::DivisionvolRead()", "InvalidRead",
250                   FatalException, "No child fo    250                   FatalException, "No child found!");
251       return;                                     251       return;
252     }                                             252     }
253     const G4String tag = Transcode(child->getT    253     const G4String tag = Transcode(child->getTagName());
254                                                   254 
255     if(tag == "volumeref")                        255     if(tag == "volumeref")
256     {                                             256     {
257       logvol = GetVolume(GenerateName(RefRead(    257       logvol = GetVolume(GenerateName(RefRead(child)));
258     }                                             258     }
259   }                                               259   }
260                                                   260 
261   if(logvol == nullptr)                           261   if(logvol == nullptr)
262   {                                               262   {
263     return;                                       263     return;
264   }                                               264   }
265                                                   265 
266   G4PVDivisionFactory::GetInstance();             266   G4PVDivisionFactory::GetInstance();
267   G4PhysicalVolumesPair pair;                     267   G4PhysicalVolumesPair pair;
268                                                   268 
269   G4String pv_name = logvol->GetName() + "_div    269   G4String pv_name = logvol->GetName() + "_div";
270   if((number != 0) && (width == 0.0))             270   if((number != 0) && (width == 0.0))
271   {                                               271   {
272     pair = G4ReflectionFactory::Instance()->Di    272     pair = G4ReflectionFactory::Instance()->Divide(
273       pv_name, logvol, pMotherLogical, axis, n    273       pv_name, logvol, pMotherLogical, axis, number, offset);
274   }                                               274   }
275   else if((number == 0) && (width != 0.0))        275   else if((number == 0) && (width != 0.0))
276   {                                               276   {
277     pair = G4ReflectionFactory::Instance()->Di    277     pair = G4ReflectionFactory::Instance()->Divide(
278       pv_name, logvol, pMotherLogical, axis, w    278       pv_name, logvol, pMotherLogical, axis, width, offset);
279   }                                               279   }
280   else                                            280   else
281   {                                               281   {
282     pair = G4ReflectionFactory::Instance()->Di    282     pair = G4ReflectionFactory::Instance()->Divide(
283       pv_name, logvol, pMotherLogical, axis, n    283       pv_name, logvol, pMotherLogical, axis, number, width, offset);
284   }                                               284   }
285                                                   285 
286   if(pair.first != nullptr)                       286   if(pair.first != nullptr)
287   {                                               287   {
288     GeneratePhysvolName(name, pair.first);        288     GeneratePhysvolName(name, pair.first);
289   }                                               289   }
290   if(pair.second != nullptr)                      290   if(pair.second != nullptr)
291   {                                               291   {
292     GeneratePhysvolName(name, pair.second);       292     GeneratePhysvolName(name, pair.second);
293   }                                               293   }
294 }                                                 294 }
295                                                   295 
296 // -------------------------------------------    296 // --------------------------------------------------------------------
297 G4LogicalVolume* G4GDMLReadStructure::FileRead    297 G4LogicalVolume* G4GDMLReadStructure::FileRead(
298   const xercesc::DOMElement* const fileElement    298   const xercesc::DOMElement* const fileElement)
299 {                                                 299 {
300   G4String name;                                  300   G4String name;
301   G4String volname;                               301   G4String volname;
302                                                   302 
303   const xercesc::DOMNamedNodeMap* const attrib    303   const xercesc::DOMNamedNodeMap* const attributes =
304     fileElement->getAttributes();                 304     fileElement->getAttributes();
305   XMLSize_t attributeCount = attributes->getLe    305   XMLSize_t attributeCount = attributes->getLength();
306                                                   306 
307   for(XMLSize_t attribute_index = 0; attribute    307   for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
308       ++attribute_index)                          308       ++attribute_index)
309   {                                               309   {
310     xercesc::DOMNode* attribute_node = attribu    310     xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
311                                                   311 
312     if(attribute_node->getNodeType() != xerces    312     if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
313     {                                             313     {
314       continue;                                   314       continue;
315     }                                             315     }
316                                                   316 
317     const xercesc::DOMAttr* const attribute =     317     const xercesc::DOMAttr* const attribute =
318       dynamic_cast<xercesc::DOMAttr*>(attribut    318       dynamic_cast<xercesc::DOMAttr*>(attribute_node);
319     if(attribute == nullptr)                      319     if(attribute == nullptr)
320     {                                             320     {
321       G4Exception("G4GDMLReadStructure::FileRe    321       G4Exception("G4GDMLReadStructure::FileRead()", "InvalidRead",
322                   FatalException, "No attribut    322                   FatalException, "No attribute found!");
323       return nullptr;                             323       return nullptr;
324     }                                             324     }
325     const G4String attName  = Transcode(attrib    325     const G4String attName  = Transcode(attribute->getName());
326     const G4String attValue = Transcode(attrib    326     const G4String attValue = Transcode(attribute->getValue());
327                                                   327 
328     if(attName == "name")                         328     if(attName == "name")
329     {                                             329     {
330       name = attValue;                            330       name = attValue;
331     }                                             331     }
332     else if(attName == "volname")                 332     else if(attName == "volname")
333     {                                             333     {
334       volname = attValue;                         334       volname = attValue;
335     }                                             335     }
336   }                                               336   }
337                                                   337 
338   const G4bool isModule = true;                   338   const G4bool isModule = true;
339   G4GDMLReadStructure structure;                  339   G4GDMLReadStructure structure;
340   structure.Read(name, validate, isModule);       340   structure.Read(name, validate, isModule);
341                                                   341 
342   // Register existing auxiliar information de    342   // Register existing auxiliar information defined in child module
343   //                                              343   //
344   const G4GDMLAuxMapType* aux = structure.GetA    344   const G4GDMLAuxMapType* aux = structure.GetAuxMap();
345   if(!aux->empty())                               345   if(!aux->empty())
346   {                                               346   {
347     for(auto pos = aux->cbegin(); pos != aux->    347     for(auto pos = aux->cbegin(); pos != aux->cend(); ++pos)
348     {                                             348     {
349       auxMap.insert(std::make_pair(pos->first,    349       auxMap.insert(std::make_pair(pos->first, pos->second));
350     }                                             350     }
351   }                                               351   }
352                                                   352 
353   // Return volume structure from child module    353   // Return volume structure from child module
354   //                                              354   //
355   if(volname.empty())                             355   if(volname.empty())
356   {                                               356   {
357     return structure.GetVolume(structure.GetSe    357     return structure.GetVolume(structure.GetSetup("Default"));
358   }                                               358   }
359   else                                            359   else
360   {                                               360   {
361     return structure.GetVolume(structure.Gener    361     return structure.GetVolume(structure.GenerateName(volname));
362   }                                               362   }
363 }                                                 363 }
364                                                   364 
365 // -------------------------------------------    365 // --------------------------------------------------------------------
366 void G4GDMLReadStructure::PhysvolRead(            366 void G4GDMLReadStructure::PhysvolRead(
367   const xercesc::DOMElement* const physvolElem    367   const xercesc::DOMElement* const physvolElement, G4AssemblyVolume* pAssembly)
368 {                                                 368 {
369   G4String name;                                  369   G4String name;
370   G4LogicalVolume* logvol    = nullptr;           370   G4LogicalVolume* logvol    = nullptr;
371   G4AssemblyVolume* assembly = nullptr;           371   G4AssemblyVolume* assembly = nullptr;
372   G4ThreeVector position(0.0, 0.0, 0.0);          372   G4ThreeVector position(0.0, 0.0, 0.0);
373   G4ThreeVector rotation(0.0, 0.0, 0.0);          373   G4ThreeVector rotation(0.0, 0.0, 0.0);
374   G4ThreeVector scale(1.0, 1.0, 1.0);             374   G4ThreeVector scale(1.0, 1.0, 1.0);
375   G4int copynumber = 0;                           375   G4int copynumber = 0;
376                                                   376 
377   const xercesc::DOMNamedNodeMap* const attrib    377   const xercesc::DOMNamedNodeMap* const attributes =
378     physvolElement->getAttributes();              378     physvolElement->getAttributes();
379   XMLSize_t attributeCount = attributes->getLe    379   XMLSize_t attributeCount = attributes->getLength();
380                                                   380 
381   for(XMLSize_t attribute_index = 0; attribute    381   for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
382       ++attribute_index)                          382       ++attribute_index)
383   {                                               383   {
384     xercesc::DOMNode* attribute_node = attribu    384     xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
385                                                   385 
386     if(attribute_node->getNodeType() != xerces    386     if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
387     {                                             387     {
388       continue;                                   388       continue;
389     }                                             389     }
390                                                   390 
391     const xercesc::DOMAttr* const attribute =     391     const xercesc::DOMAttr* const attribute =
392       dynamic_cast<xercesc::DOMAttr*>(attribut    392       dynamic_cast<xercesc::DOMAttr*>(attribute_node);
393     if(attribute == nullptr)                      393     if(attribute == nullptr)
394     {                                             394     {
395       G4Exception("G4GDMLReadStructure::Physvo    395       G4Exception("G4GDMLReadStructure::PhysvolRead()", "InvalidRead",
396                   FatalException, "No attribut    396                   FatalException, "No attribute found!");
397       return;                                     397       return;
398     }                                             398     }
399     const G4String attName  = Transcode(attrib    399     const G4String attName  = Transcode(attribute->getName());
400     const G4String attValue = Transcode(attrib    400     const G4String attValue = Transcode(attribute->getValue());
401                                                   401 
402     if(attName == "name")                         402     if(attName == "name")
403     {                                             403     {
404       name = attValue;                            404       name = attValue;
405     }                                             405     }
406     if(attName == "copynumber")                   406     if(attName == "copynumber")
407     {                                             407     {
408       copynumber = eval.EvaluateInteger(attVal    408       copynumber = eval.EvaluateInteger(attValue);
409     }                                             409     }
410   }                                               410   }
411                                                   411 
412   for(xercesc::DOMNode* iter = physvolElement-    412   for(xercesc::DOMNode* iter = physvolElement->getFirstChild(); iter != nullptr;
413       iter                   = iter->getNextSi    413       iter                   = iter->getNextSibling())
414   {                                               414   {
415     if(iter->getNodeType() != xercesc::DOMNode    415     if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
416     {                                             416     {
417       continue;                                   417       continue;
418     }                                             418     }
419                                                   419 
420     const xercesc::DOMElement* const child =      420     const xercesc::DOMElement* const child =
421       dynamic_cast<xercesc::DOMElement*>(iter)    421       dynamic_cast<xercesc::DOMElement*>(iter);
422     if(child == nullptr)                          422     if(child == nullptr)
423     {                                             423     {
424       G4Exception("G4GDMLReadStructure::Physvo    424       G4Exception("G4GDMLReadStructure::PhysvolRead()", "InvalidRead",
425                   FatalException, "No child fo    425                   FatalException, "No child found!");
426       return;                                     426       return;
427     }                                             427     }
428     const G4String tag = Transcode(child->getT    428     const G4String tag = Transcode(child->getTagName());
429                                                   429 
430     if(tag == "volumeref")                        430     if(tag == "volumeref")
431     {                                             431     {
432       const G4String& child_name = GenerateNam    432       const G4String& child_name = GenerateName(RefRead(child));
433       assembly                   = GetAssembly    433       assembly                   = GetAssembly(child_name);
434       if(assembly == nullptr)                     434       if(assembly == nullptr)
435       {                                           435       {
436         logvol = GetVolume(child_name);           436         logvol = GetVolume(child_name);
437       }                                           437       }
438     }                                             438     }
439     else if(tag == "file")                        439     else if(tag == "file")
440     {                                             440     {
441       logvol = FileRead(child);                   441       logvol = FileRead(child);
442     }                                             442     }
443     else if(tag == "position")                    443     else if(tag == "position")
444     {                                             444     {
445       VectorRead(child, position);                445       VectorRead(child, position);
446     }                                             446     }
447     else if(tag == "rotation")                    447     else if(tag == "rotation")
448     {                                             448     {
449       VectorRead(child, rotation);                449       VectorRead(child, rotation);
450     }                                             450     }
451     else if(tag == "scale")                       451     else if(tag == "scale")
452     {                                             452     {
453       VectorRead(child, scale);                   453       VectorRead(child, scale);
454     }                                             454     }
455     else if(tag == "positionref")                 455     else if(tag == "positionref")
456     {                                             456     {
457       position = GetPosition(GenerateName(RefR    457       position = GetPosition(GenerateName(RefRead(child)));
458     }                                             458     }
459     else if(tag == "rotationref")                 459     else if(tag == "rotationref")
460     {                                             460     {
461       rotation = GetRotation(GenerateName(RefR    461       rotation = GetRotation(GenerateName(RefRead(child)));
462     }                                             462     }
463     else if(tag == "scaleref")                    463     else if(tag == "scaleref")
464     {                                             464     {
465       scale = GetScale(GenerateName(RefRead(ch    465       scale = GetScale(GenerateName(RefRead(child)));
466     }                                             466     }
467     else                                          467     else
468     {                                             468     {
469       G4String error_msg = "Unknown tag in phy    469       G4String error_msg = "Unknown tag in physvol: " + tag;
470       G4Exception("G4GDMLReadStructure::Physvo    470       G4Exception("G4GDMLReadStructure::PhysvolRead()", "ReadError",
471                   FatalException, error_msg);     471                   FatalException, error_msg);
472       return;                                     472       return;
473     }                                             473     }
474   }                                               474   }
475                                                   475 
476   G4Transform3D transform(GetRotationMatrix(ro    476   G4Transform3D transform(GetRotationMatrix(rotation).inverse(), position);
477   transform = transform * G4Scale3D(scale.x(),    477   transform = transform * G4Scale3D(scale.x(), scale.y(), scale.z());
478                                                   478 
479   if(pAssembly != nullptr)  // Fill assembly s    479   if(pAssembly != nullptr)  // Fill assembly structure
480   {                                               480   {
481     if(assembly != nullptr)  // Case of recurs    481     if(assembly != nullptr)  // Case of recursive assemblies
482     {                                             482     {
483       pAssembly->AddPlacedAssembly(assembly, t    483       pAssembly->AddPlacedAssembly(assembly, transform);
484     }                                             484     }
485     if(logvol == nullptr)                         485     if(logvol == nullptr)
486     {                                             486     {
487       return;                                     487       return;
488     }                                             488     }
489     pAssembly->AddPlacedVolume(logvol, transfo    489     pAssembly->AddPlacedVolume(logvol, transform);
490   }                                               490   }
491   else  // Generate physical volume tree or do    491   else  // Generate physical volume tree or do assembly imprint
492   {                                               492   {
493     if(assembly != nullptr)                       493     if(assembly != nullptr)
494     {                                             494     {
495       assembly->MakeImprint(pMotherLogical, tr    495       assembly->MakeImprint(pMotherLogical, transform, 0, check);
496     }                                             496     }
497     else                                          497     else
498     {                                             498     {
499       if(logvol == nullptr)                       499       if(logvol == nullptr)
500       {                                           500       {
501         return;                                   501         return;
502       }                                           502       }
503       G4String pv_name           = logvol->Get    503       G4String pv_name           = logvol->GetName() + "_PV";
504       G4PhysicalVolumesPair pair = G4Reflectio    504       G4PhysicalVolumesPair pair = G4ReflectionFactory::Instance()->Place(
505         transform, pv_name, logvol, pMotherLog    505         transform, pv_name, logvol, pMotherLogical, false, copynumber, check);
506                                                   506 
507       if(pair.first != nullptr)                   507       if(pair.first != nullptr)
508       {                                           508       {
509         GeneratePhysvolName(name, pair.first);    509         GeneratePhysvolName(name, pair.first);
510       }                                           510       }
511       if(pair.second != nullptr)                  511       if(pair.second != nullptr)
512       {                                           512       {
513         GeneratePhysvolName(name, pair.second)    513         GeneratePhysvolName(name, pair.second);
514       }                                           514       }
515     }                                             515     }
516   }                                               516   }
517 }                                                 517 }
518                                                   518 
519 // -------------------------------------------    519 // --------------------------------------------------------------------
520 void G4GDMLReadStructure::ReplicavolRead(         520 void G4GDMLReadStructure::ReplicavolRead(
521   const xercesc::DOMElement* const replicavolE    521   const xercesc::DOMElement* const replicavolElement, G4int number)
522 {                                                 522 {
523   G4LogicalVolume* logvol = nullptr;              523   G4LogicalVolume* logvol = nullptr;
524   for(xercesc::DOMNode* iter = replicavolEleme    524   for(xercesc::DOMNode* iter = replicavolElement->getFirstChild();
525                         iter != nullptr; iter     525                         iter != nullptr; iter = iter->getNextSibling())
526   {                                               526   {
527     if(iter->getNodeType() != xercesc::DOMNode    527     if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
528     {                                             528     {
529       continue;                                   529       continue;
530     }                                             530     }
531                                                   531 
532     const xercesc::DOMElement* const child =      532     const xercesc::DOMElement* const child =
533       dynamic_cast<xercesc::DOMElement*>(iter)    533       dynamic_cast<xercesc::DOMElement*>(iter);
534     if(child == nullptr)                          534     if(child == nullptr)
535     {                                             535     {
536       G4Exception("G4GDMLReadStructure::Replic    536       G4Exception("G4GDMLReadStructure::ReplicavolRead()", "InvalidRead",
537                   FatalException, "No child fo    537                   FatalException, "No child found!");
538       return;                                     538       return;
539     }                                             539     }
540     const G4String tag = Transcode(child->getT    540     const G4String tag = Transcode(child->getTagName());
541                                                   541 
542     if(tag == "volumeref")                        542     if(tag == "volumeref")
543     {                                             543     {
544       logvol = GetVolume(GenerateName(RefRead(    544       logvol = GetVolume(GenerateName(RefRead(child)));
545     }                                             545     }
546     else if(tag == "replicate_along_axis")        546     else if(tag == "replicate_along_axis")
547     {                                             547     {
548       if(logvol)                                  548       if(logvol)
549       {                                           549       {
550         ReplicaRead(child, logvol, number);       550         ReplicaRead(child, logvol, number);
551       }                                           551       }
552     }                                             552     }
553     else                                          553     else
554     {                                             554     {
555       G4String error_msg = "Unknown tag in Rep    555       G4String error_msg = "Unknown tag in ReplicavolRead: " + tag;
556       G4Exception("G4GDMLReadStructure::Replic    556       G4Exception("G4GDMLReadStructure::ReplicavolRead()", "ReadError",
557                   FatalException, error_msg);     557                   FatalException, error_msg);
558     }                                             558     }
559   }                                               559   }
560 }                                                 560 }
561                                                   561 
562 // -------------------------------------------    562 // --------------------------------------------------------------------
563 void G4GDMLReadStructure::ReplicaRead(            563 void G4GDMLReadStructure::ReplicaRead(
564   const xercesc::DOMElement* const replicaElem    564   const xercesc::DOMElement* const replicaElement, G4LogicalVolume* logvol,
565   G4int number)                                   565   G4int number)
566 {                                                 566 {
567   G4double width  = 0.0;                          567   G4double width  = 0.0;
568   G4double offset = 0.0;                          568   G4double offset = 0.0;
569   G4ThreeVector position(0.0, 0.0, 0.0);          569   G4ThreeVector position(0.0, 0.0, 0.0);
570   G4ThreeVector rotation(0.0, 0.0, 0.0);          570   G4ThreeVector rotation(0.0, 0.0, 0.0);
571   EAxis axis = kUndefined;                        571   EAxis axis = kUndefined;
572   G4String name;                                  572   G4String name;
573                                                   573 
574   for(xercesc::DOMNode* iter = replicaElement-    574   for(xercesc::DOMNode* iter = replicaElement->getFirstChild(); iter != nullptr;
575       iter                   = iter->getNextSi    575       iter                   = iter->getNextSibling())
576   {                                               576   {
577     if(iter->getNodeType() != xercesc::DOMNode    577     if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
578     {                                             578     {
579       continue;                                   579       continue;
580     }                                             580     }
581                                                   581 
582     const xercesc::DOMElement* const child =      582     const xercesc::DOMElement* const child =
583       dynamic_cast<xercesc::DOMElement*>(iter)    583       dynamic_cast<xercesc::DOMElement*>(iter);
584     if(child == nullptr)                          584     if(child == nullptr)
585     {                                             585     {
586       G4Exception("G4GDMLReadStructure::Replic    586       G4Exception("G4GDMLReadStructure::ReplicaRead()", "InvalidRead",
587                   FatalException, "No child fo    587                   FatalException, "No child found!");
588       return;                                     588       return;
589     }                                             589     }
590     const G4String tag = Transcode(child->getT    590     const G4String tag = Transcode(child->getTagName());
591                                                   591 
592     if(tag == "position")                         592     if(tag == "position")
593     {                                             593     {
594       VectorRead(child, position);                594       VectorRead(child, position);
595     }                                             595     }
596     else if(tag == "rotation")                    596     else if(tag == "rotation")
597     {                                             597     {
598       VectorRead(child, rotation);                598       VectorRead(child, rotation);
599     }                                             599     }
600     else if(tag == "positionref")                 600     else if(tag == "positionref")
601     {                                             601     {
602       position = GetPosition(GenerateName(RefR    602       position = GetPosition(GenerateName(RefRead(child)));
603     }                                             603     }
604     else if(tag == "rotationref")                 604     else if(tag == "rotationref")
605     {                                             605     {
606       rotation = GetRotation(GenerateName(RefR    606       rotation = GetRotation(GenerateName(RefRead(child)));
607     }                                             607     }
608     else if(tag == "direction")                   608     else if(tag == "direction")
609     {                                             609     {
610       axis = AxisRead(child);                     610       axis = AxisRead(child);
611     }                                             611     }
612     else if(tag == "width")                       612     else if(tag == "width")
613     {                                             613     {
614       width = QuantityRead(child);                614       width = QuantityRead(child);
615     }                                             615     }
616     else if(tag == "offset")                      616     else if(tag == "offset")
617     {                                             617     {
618       offset = QuantityRead(child);               618       offset = QuantityRead(child);
619     }                                             619     }
620     else                                          620     else
621     {                                             621     {
622       G4String error_msg = "Unknown tag in Rep    622       G4String error_msg = "Unknown tag in ReplicaRead: " + tag;
623       G4Exception("G4GDMLReadStructure::Replic    623       G4Exception("G4GDMLReadStructure::ReplicaRead()", "ReadError",
624                   FatalException, error_msg);     624                   FatalException, error_msg);
625     }                                             625     }
626   }                                               626   }
627                                                   627 
628   G4String pv_name           = logvol->GetName    628   G4String pv_name           = logvol->GetName() + "_PV";
629   G4PhysicalVolumesPair pair = G4ReflectionFac    629   G4PhysicalVolumesPair pair = G4ReflectionFactory::Instance()->Replicate(
630     pv_name, logvol, pMotherLogical, axis, num    630     pv_name, logvol, pMotherLogical, axis, number, width, offset);
631                                                   631 
632   if(pair.first != nullptr)                       632   if(pair.first != nullptr)
633   {                                               633   {
634     GeneratePhysvolName(name, pair.first);        634     GeneratePhysvolName(name, pair.first);
635   }                                               635   }
636   if(pair.second != nullptr)                      636   if(pair.second != nullptr)
637   {                                               637   {
638     GeneratePhysvolName(name, pair.second);       638     GeneratePhysvolName(name, pair.second);
639   }                                               639   }
640 }                                                 640 }
641                                                   641 
642 // -------------------------------------------    642 // --------------------------------------------------------------------
643 EAxis G4GDMLReadStructure::AxisRead(              643 EAxis G4GDMLReadStructure::AxisRead(
644   const xercesc::DOMElement* const axisElement    644   const xercesc::DOMElement* const axisElement)
645 {                                                 645 {
646   EAxis axis = kUndefined;                        646   EAxis axis = kUndefined;
647                                                   647 
648   const xercesc::DOMNamedNodeMap* const attrib    648   const xercesc::DOMNamedNodeMap* const attributes =
649     axisElement->getAttributes();                 649     axisElement->getAttributes();
650   XMLSize_t attributeCount = attributes->getLe    650   XMLSize_t attributeCount = attributes->getLength();
651                                                   651 
652   for(XMLSize_t attribute_index = 0; attribute    652   for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
653       ++attribute_index)                          653       ++attribute_index)
654   {                                               654   {
655     xercesc::DOMNode* attribute_node = attribu    655     xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
656                                                   656 
657     if(attribute_node->getNodeType() != xerces    657     if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
658     {                                             658     {
659       continue;                                   659       continue;
660     }                                             660     }
661                                                   661 
662     const xercesc::DOMAttr* const attribute =     662     const xercesc::DOMAttr* const attribute =
663       dynamic_cast<xercesc::DOMAttr*>(attribut    663       dynamic_cast<xercesc::DOMAttr*>(attribute_node);
664     if(attribute == nullptr)                      664     if(attribute == nullptr)
665     {                                             665     {
666       G4Exception("G4GDMLReadStructure::AxisRe    666       G4Exception("G4GDMLReadStructure::AxisRead()", "InvalidRead",
667                   FatalException, "No attribut    667                   FatalException, "No attribute found!");
668       return axis;                                668       return axis;
669     }                                             669     }
670     const G4String attName  = Transcode(attrib    670     const G4String attName  = Transcode(attribute->getName());
671     const G4String attValue = Transcode(attrib    671     const G4String attValue = Transcode(attribute->getValue());
672     if(attName == "x")                            672     if(attName == "x")
673     {                                             673     {
674       if(eval.Evaluate(attValue) == 1.)           674       if(eval.Evaluate(attValue) == 1.)
675       {                                           675       {
676         axis = kXAxis;                            676         axis = kXAxis;
677       }                                           677       }
678     }                                             678     }
679     else if(attName == "y")                       679     else if(attName == "y")
680     {                                             680     {
681       if(eval.Evaluate(attValue) == 1.)           681       if(eval.Evaluate(attValue) == 1.)
682       {                                           682       {
683         axis = kYAxis;                            683         axis = kYAxis;
684       }                                           684       }
685     }                                             685     }
686     else if(attName == "z")                       686     else if(attName == "z")
687     {                                             687     {
688       if(eval.Evaluate(attValue) == 1.)           688       if(eval.Evaluate(attValue) == 1.)
689       {                                           689       {
690         axis = kZAxis;                            690         axis = kZAxis;
691       }                                           691       }
692     }                                             692     }
693     else if(attName == "rho")                     693     else if(attName == "rho")
694     {                                             694     {
695       if(eval.Evaluate(attValue) == 1.)           695       if(eval.Evaluate(attValue) == 1.)
696       {                                           696       {
697         axis = kRho;                              697         axis = kRho;
698       }                                           698       }
699     }                                             699     }
700     else if(attName == "phi")                     700     else if(attName == "phi")
701     {                                             701     {
702       if(eval.Evaluate(attValue) == 1.)           702       if(eval.Evaluate(attValue) == 1.)
703       {                                           703       {
704         axis = kPhi;                              704         axis = kPhi;
705       }                                           705       }
706     }                                             706     }
707   }                                               707   }
708                                                   708 
709   return axis;                                    709   return axis;
710 }                                                 710 }
711                                                   711 
712 // -------------------------------------------    712 // --------------------------------------------------------------------
713 G4double G4GDMLReadStructure::QuantityRead(       713 G4double G4GDMLReadStructure::QuantityRead(
714   const xercesc::DOMElement* const readElement    714   const xercesc::DOMElement* const readElement)
715 {                                                 715 {
716   G4double value = 0.0;                           716   G4double value = 0.0;
717   G4double unit  = 0.0;                           717   G4double unit  = 0.0;
718   const xercesc::DOMNamedNodeMap* const attrib    718   const xercesc::DOMNamedNodeMap* const attributes =
719     readElement->getAttributes();                 719     readElement->getAttributes();
720   XMLSize_t attributeCount = attributes->getLe    720   XMLSize_t attributeCount = attributes->getLength();
721                                                   721 
722   for(XMLSize_t attribute_index = 0; attribute    722   for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
723       ++attribute_index)                          723       ++attribute_index)
724   {                                               724   {
725     xercesc::DOMNode* attribute_node = attribu    725     xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
726                                                   726 
727     if(attribute_node->getNodeType() != xerces    727     if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
728     {                                             728     {
729       continue;                                   729       continue;
730     }                                             730     }
731     const xercesc::DOMAttr* const attribute =     731     const xercesc::DOMAttr* const attribute =
732       dynamic_cast<xercesc::DOMAttr*>(attribut    732       dynamic_cast<xercesc::DOMAttr*>(attribute_node);
733     if(attribute == nullptr)                      733     if(attribute == nullptr)
734     {                                             734     {
735       G4Exception("G4GDMLReadStructure::Quanti    735       G4Exception("G4GDMLReadStructure::QuantityRead()", "InvalidRead",
736                   FatalException, "No attribut    736                   FatalException, "No attribute found!");
737       return value;                               737       return value;
738     }                                             738     }
739     const G4String attName  = Transcode(attrib    739     const G4String attName  = Transcode(attribute->getName());
740     const G4String attValue = Transcode(attrib    740     const G4String attValue = Transcode(attribute->getValue());
741                                                   741 
742     if(attName == "unit")                         742     if(attName == "unit")
743     {                                             743     {
744       unit = G4UnitDefinition::GetValueOf(attV    744       unit = G4UnitDefinition::GetValueOf(attValue);
745       if(G4UnitDefinition::GetCategory(attValu    745       if(G4UnitDefinition::GetCategory(attValue) != "Length" &&
746          G4UnitDefinition::GetCategory(attValu    746          G4UnitDefinition::GetCategory(attValue) != "Angle")
747       {                                           747       {
748         G4Exception("G4GDMLReadStructure::Quan    748         G4Exception("G4GDMLReadStructure::QuantityRead()", "InvalidRead",
749                     FatalException,               749                     FatalException,
750                     "Invalid unit for length o    750                     "Invalid unit for length or angle (width, offset)!");
751       }                                           751       }
752     }                                             752     }
753     else if(attName == "value")                   753     else if(attName == "value")
754     {                                             754     {
755       value = eval.Evaluate(attValue);            755       value = eval.Evaluate(attValue);
756     }                                             756     }
757   }                                               757   }
758                                                   758 
759   return value * unit;                            759   return value * unit;
760 }                                                 760 }
761                                                   761 
762 // -------------------------------------------    762 // --------------------------------------------------------------------
763 void G4GDMLReadStructure::VolumeRead(             763 void G4GDMLReadStructure::VolumeRead(
764   const xercesc::DOMElement* const volumeEleme    764   const xercesc::DOMElement* const volumeElement)
765 {                                                 765 {
766   G4VSolid* solidPtr      = nullptr;              766   G4VSolid* solidPtr      = nullptr;
767   G4Material* materialPtr = nullptr;              767   G4Material* materialPtr = nullptr;
768   G4GDMLAuxListType auxList;                      768   G4GDMLAuxListType auxList;
769                                                   769 
770   XMLCh* name_attr    = xercesc::XMLString::tr    770   XMLCh* name_attr    = xercesc::XMLString::transcode("name");
771   const G4String name = Transcode(volumeElemen    771   const G4String name = Transcode(volumeElement->getAttribute(name_attr));
772   xercesc::XMLString::release(&name_attr);        772   xercesc::XMLString::release(&name_attr);
773                                                   773 
774   for(xercesc::DOMNode* iter = volumeElement->    774   for(xercesc::DOMNode* iter = volumeElement->getFirstChild(); iter != nullptr;
775       iter                   = iter->getNextSi    775       iter                   = iter->getNextSibling())
776   {                                               776   {
777     if(iter->getNodeType() != xercesc::DOMNode    777     if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
778     {                                             778     {
779       continue;                                   779       continue;
780     }                                             780     }
781                                                   781 
782     const xercesc::DOMElement* const child =      782     const xercesc::DOMElement* const child =
783       dynamic_cast<xercesc::DOMElement*>(iter)    783       dynamic_cast<xercesc::DOMElement*>(iter);
784     if(child == nullptr)                          784     if(child == nullptr)
785     {                                             785     {
786       G4Exception("G4GDMLReadStructure::Volume    786       G4Exception("G4GDMLReadStructure::VolumeRead()", "InvalidRead",
787                   FatalException, "No child fo    787                   FatalException, "No child found!");
788       return;                                     788       return;
789     }                                             789     }
790     const G4String tag = Transcode(child->getT    790     const G4String tag = Transcode(child->getTagName());
791                                                   791 
792     if(tag == "auxiliary")                        792     if(tag == "auxiliary")
793     {                                             793     {
794       auxList.push_back(AuxiliaryRead(child));    794       auxList.push_back(AuxiliaryRead(child));
795     }                                             795     }
796     else if(tag == "materialref")                 796     else if(tag == "materialref")
797     {                                             797     {
798       materialPtr = GetMaterial(GenerateName(R    798       materialPtr = GetMaterial(GenerateName(RefRead(child), true));
799     }                                             799     }
800     else if(tag == "solidref")                    800     else if(tag == "solidref")
801     {                                             801     {
802       solidPtr = GetSolid(GenerateName(RefRead    802       solidPtr = GetSolid(GenerateName(RefRead(child)));
803     }                                             803     }
804   }                                               804   }
805                                                   805 
806   pMotherLogical =                                806   pMotherLogical =
807     new G4LogicalVolume(solidPtr, materialPtr,    807     new G4LogicalVolume(solidPtr, materialPtr, GenerateName(name), 0, 0, 0);
808                                                   808 
809   if(!auxList.empty())                            809   if(!auxList.empty())
810   {                                               810   {
811     auxMap[pMotherLogical] = auxList;             811     auxMap[pMotherLogical] = auxList;
812   }                                               812   }
813                                                   813 
814   Volume_contentRead(volumeElement);              814   Volume_contentRead(volumeElement);
815 }                                                 815 }
816                                                   816 
817 // -------------------------------------------    817 // --------------------------------------------------------------------
818 void G4GDMLReadStructure::AssemblyRead(           818 void G4GDMLReadStructure::AssemblyRead(
819   const xercesc::DOMElement* const assemblyEle    819   const xercesc::DOMElement* const assemblyElement)
820 {                                                 820 {
821   XMLCh* name_attr    = xercesc::XMLString::tr    821   XMLCh* name_attr    = xercesc::XMLString::transcode("name");
822   const G4String name = Transcode(assemblyElem    822   const G4String name = Transcode(assemblyElement->getAttribute(name_attr));
823   xercesc::XMLString::release(&name_attr);        823   xercesc::XMLString::release(&name_attr);
824                                                   824 
825   G4AssemblyVolume* pAssembly = new G4Assembly    825   G4AssemblyVolume* pAssembly = new G4AssemblyVolume();
826   auto aName = GenerateName(name);             << 826   assemblyMap.insert(std::make_pair(GenerateName(name), pAssembly));
827   if(reverseSearch)                            << 
828   {                                            << 
829     assemblyMap.insert_or_assign(aName, pAssem << 
830   }                                            << 
831   else                                         << 
832   {                                            << 
833     assemblyMap.insert(std::make_pair(aName, p << 
834   }                                            << 
835                                                   827 
836   for(xercesc::DOMNode* iter = assemblyElement    828   for(xercesc::DOMNode* iter = assemblyElement->getFirstChild();
837                         iter != nullptr; iter     829                         iter != nullptr; iter = iter->getNextSibling())
838   {                                               830   {
839     if(iter->getNodeType() != xercesc::DOMNode    831     if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
840     {                                             832     {
841       continue;                                   833       continue;
842     }                                             834     }
843     const xercesc::DOMElement* const child =      835     const xercesc::DOMElement* const child =
844       dynamic_cast<xercesc::DOMElement*>(iter)    836       dynamic_cast<xercesc::DOMElement*>(iter);
845     if(child == nullptr)                          837     if(child == nullptr)
846     {                                             838     {
847       G4Exception("G4GDMLReadStructure::Assemb    839       G4Exception("G4GDMLReadStructure::AssemblyRead()", "InvalidRead",
848                   FatalException, "No child fo    840                   FatalException, "No child found!");
849       return;                                     841       return;
850     }                                             842     }
851     const G4String tag = Transcode(child->getT    843     const G4String tag = Transcode(child->getTagName());
852                                                   844 
853     if(tag == "physvol")                          845     if(tag == "physvol")
854     {                                             846     {
855       PhysvolRead(child, pAssembly);              847       PhysvolRead(child, pAssembly);
856     }                                             848     }
857     else                                          849     else
858     {                                             850     {
859       G4cout << "Unsupported GDML tag '" << ta    851       G4cout << "Unsupported GDML tag '" << tag
860              << "' for Geant4 assembly structu    852              << "' for Geant4 assembly structure !" << G4endl;
861     }                                             853     }
862   }                                               854   }
863 }                                                 855 }
864                                                   856 
865 // -------------------------------------------    857 // --------------------------------------------------------------------
866 void G4GDMLReadStructure::SkinSurfaceRead(        858 void G4GDMLReadStructure::SkinSurfaceRead(
867   const xercesc::DOMElement* const skinsurface    859   const xercesc::DOMElement* const skinsurfaceElement)
868 {                                                 860 {
869   G4String name;                                  861   G4String name;
870   G4LogicalVolume* logvol = nullptr;              862   G4LogicalVolume* logvol = nullptr;
871   G4SurfaceProperty* prop = nullptr;              863   G4SurfaceProperty* prop = nullptr;
872                                                   864 
873   const xercesc::DOMNamedNodeMap* const attrib    865   const xercesc::DOMNamedNodeMap* const attributes =
874     skinsurfaceElement->getAttributes();          866     skinsurfaceElement->getAttributes();
875   XMLSize_t attributeCount = attributes->getLe    867   XMLSize_t attributeCount = attributes->getLength();
876                                                   868 
877   for(XMLSize_t attribute_index = 0; attribute    869   for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
878       ++attribute_index)                          870       ++attribute_index)
879   {                                               871   {
880     xercesc::DOMNode* attribute_node = attribu    872     xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
881                                                   873 
882     if(attribute_node->getNodeType() != xerces    874     if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
883     {                                             875     {
884       continue;                                   876       continue;
885     }                                             877     }
886                                                   878 
887     const xercesc::DOMAttr* const attribute =     879     const xercesc::DOMAttr* const attribute =
888       dynamic_cast<xercesc::DOMAttr*>(attribut    880       dynamic_cast<xercesc::DOMAttr*>(attribute_node);
889     if(attribute == nullptr)                      881     if(attribute == nullptr)
890     {                                             882     {
891       G4Exception("G4GDMLReadStructure::Skinsu    883       G4Exception("G4GDMLReadStructure::SkinsurfaceRead()", "InvalidRead",
892                   FatalException, "No attribut    884                   FatalException, "No attribute found!");
893       return;                                     885       return;
894     }                                             886     }
895     const G4String attName  = Transcode(attrib    887     const G4String attName  = Transcode(attribute->getName());
896     const G4String attValue = Transcode(attrib    888     const G4String attValue = Transcode(attribute->getValue());
897                                                   889 
898     if(attName == "name")                         890     if(attName == "name")
899     {                                             891     {
900       name = GenerateName(attValue);              892       name = GenerateName(attValue);
901     }                                             893     }
902     else if(attName == "surfaceproperty")         894     else if(attName == "surfaceproperty")
903     {                                             895     {
904       prop = GetSurfaceProperty(GenerateName(a    896       prop = GetSurfaceProperty(GenerateName(attValue));
905     }                                             897     }
906   }                                               898   }
907                                                   899 
908   for(xercesc::DOMNode* iter = skinsurfaceElem    900   for(xercesc::DOMNode* iter = skinsurfaceElement->getFirstChild();
909                         iter != nullptr; iter     901                         iter != nullptr; iter = iter->getNextSibling())
910   {                                               902   {
911     if(iter->getNodeType() != xercesc::DOMNode    903     if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
912     {                                             904     {
913       continue;                                   905       continue;
914     }                                             906     }
915                                                   907 
916     const xercesc::DOMElement* const child =      908     const xercesc::DOMElement* const child =
917       dynamic_cast<xercesc::DOMElement*>(iter)    909       dynamic_cast<xercesc::DOMElement*>(iter);
918     if(child == nullptr)                          910     if(child == nullptr)
919     {                                             911     {
920       G4Exception("G4GDMLReadStructure::Skinsu    912       G4Exception("G4GDMLReadStructure::SkinsurfaceRead()", "InvalidRead",
921                   FatalException, "No child fo    913                   FatalException, "No child found!");
922       return;                                     914       return;
923     }                                             915     }
924     const G4String tag = Transcode(child->getT    916     const G4String tag = Transcode(child->getTagName());
925                                                   917 
926     if(tag == "volumeref")                        918     if(tag == "volumeref")
927     {                                             919     {
928       logvol = GetVolume(GenerateName(RefRead(    920       logvol = GetVolume(GenerateName(RefRead(child)));
929     }                                             921     }
930     else                                          922     else
931     {                                             923     {
932       G4String error_msg = "Unknown tag in ski    924       G4String error_msg = "Unknown tag in skinsurface: " + tag;
933       G4Exception("G4GDMLReadStructure::Skinsu    925       G4Exception("G4GDMLReadStructure::SkinsurfaceRead()", "ReadError",
934                   FatalException, error_msg);     926                   FatalException, error_msg);
935     }                                             927     }
936   }                                               928   }
937                                                   929 
938   new G4LogicalSkinSurface(Strip(name), logvol    930   new G4LogicalSkinSurface(Strip(name), logvol, prop);
939 }                                                 931 }
940                                                   932 
941 // -------------------------------------------    933 // --------------------------------------------------------------------
942 void G4GDMLReadStructure::Volume_contentRead(     934 void G4GDMLReadStructure::Volume_contentRead(
943   const xercesc::DOMElement* const volumeEleme    935   const xercesc::DOMElement* const volumeElement)
944 {                                                 936 {
945   for(xercesc::DOMNode* iter = volumeElement->    937   for(xercesc::DOMNode* iter = volumeElement->getFirstChild(); iter != nullptr;
946       iter                   = iter->getNextSi    938       iter                   = iter->getNextSibling())
947   {                                               939   {
948     if(iter->getNodeType() != xercesc::DOMNode    940     if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
949     {                                             941     {
950       continue;                                   942       continue;
951     }                                             943     }
952                                                   944 
953     const xercesc::DOMElement* const child =      945     const xercesc::DOMElement* const child =
954       dynamic_cast<xercesc::DOMElement*>(iter)    946       dynamic_cast<xercesc::DOMElement*>(iter);
955     if(child == nullptr)                          947     if(child == nullptr)
956     {                                             948     {
957       G4Exception("G4GDMLReadStructure::Volume    949       G4Exception("G4GDMLReadStructure::Volume_contentRead()", "InvalidRead",
958                   FatalException, "No child fo    950                   FatalException, "No child found!");
959       return;                                     951       return;
960     }                                             952     }
961     const G4String tag = Transcode(child->getT    953     const G4String tag = Transcode(child->getTagName());
962                                                   954 
963     if((tag == "auxiliary") || (tag == "materi    955     if((tag == "auxiliary") || (tag == "materialref") || (tag == "solidref"))
964     {                                             956     {
965       // These are already processed in Volume    957       // These are already processed in VolumeRead()
966     }                                             958     }
967     else if(tag == "paramvol")                    959     else if(tag == "paramvol")
968     {                                             960     {
969       ParamvolRead(child, pMotherLogical);        961       ParamvolRead(child, pMotherLogical);
970     }                                             962     }
971     else if(tag == "physvol")                     963     else if(tag == "physvol")
972     {                                             964     {
973       PhysvolRead(child);                         965       PhysvolRead(child);
974     }                                             966     }
975     else if(tag == "replicavol")                  967     else if(tag == "replicavol")
976     {                                             968     {
977       G4int number = 1;                           969       G4int number = 1;
978       const xercesc::DOMNamedNodeMap* const at    970       const xercesc::DOMNamedNodeMap* const attributes = child->getAttributes();
979       XMLSize_t attributeCount = attributes->g    971       XMLSize_t attributeCount = attributes->getLength();
980       for(XMLSize_t attribute_index = 0; attri    972       for(XMLSize_t attribute_index = 0; attribute_index < attributeCount;
981           ++attribute_index)                      973           ++attribute_index)
982       {                                           974       {
983         xercesc::DOMNode* attribute_node = att    975         xercesc::DOMNode* attribute_node = attributes->item(attribute_index);
984         if(attribute_node->getNodeType() != xe    976         if(attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE)
985         {                                         977         {
986           continue;                               978           continue;
987         }                                         979         }
988         const xercesc::DOMAttr* const attribut    980         const xercesc::DOMAttr* const attribute =
989           dynamic_cast<xercesc::DOMAttr*>(attr    981           dynamic_cast<xercesc::DOMAttr*>(attribute_node);
990         if(attribute == nullptr)                  982         if(attribute == nullptr)
991         {                                         983         {
992           G4Exception("G4GDMLReadStructure::Vo    984           G4Exception("G4GDMLReadStructure::Volume_contentRead()",
993                       "InvalidRead", FatalExce    985                       "InvalidRead", FatalException, "No attribute found!");
994           return;                                 986           return;
995         }                                         987         }
996         const G4String attName  = Transcode(at    988         const G4String attName  = Transcode(attribute->getName());
997         const G4String attValue = Transcode(at    989         const G4String attValue = Transcode(attribute->getValue());
998         if(attName == "number")                   990         if(attName == "number")
999         {                                         991         {
1000           number = eval.EvaluateInteger(attVa    992           number = eval.EvaluateInteger(attValue);
1001         }                                        993         }
1002       }                                          994       }
1003       ReplicavolRead(child, number);             995       ReplicavolRead(child, number);
1004     }                                            996     }
1005     else if(tag == "divisionvol")                997     else if(tag == "divisionvol")
1006     {                                            998     {
1007       DivisionvolRead(child);                    999       DivisionvolRead(child);
1008     }                                            1000     }
1009     else if(tag == "loop")                       1001     else if(tag == "loop")
1010     {                                            1002     {
1011       LoopRead(child, &G4GDMLRead::Volume_con    1003       LoopRead(child, &G4GDMLRead::Volume_contentRead);
1012     }                                            1004     }
1013     else                                         1005     else
1014     {                                            1006     {
1015       G4cout << "Treating unknown GDML tag in    1007       G4cout << "Treating unknown GDML tag in volume '" << tag
1016              << "' as GDML extension..." << G    1008              << "' as GDML extension..." << G4endl;
1017     }                                            1009     }
1018   }                                              1010   }
1019 }                                                1011 }
1020                                                  1012 
1021 // ------------------------------------------    1013 // --------------------------------------------------------------------
1022 void G4GDMLReadStructure::StructureRead(         1014 void G4GDMLReadStructure::StructureRead(
1023   const xercesc::DOMElement* const structureE    1015   const xercesc::DOMElement* const structureElement)
1024 {                                                1016 {
1025 #ifdef G4VERBOSE                                 1017 #ifdef G4VERBOSE
1026   G4cout << "G4GDML: Reading structure..." <<    1018   G4cout << "G4GDML: Reading structure..." << G4endl;
1027 #endif                                           1019 #endif
1028   for(xercesc::DOMNode* iter = structureEleme    1020   for(xercesc::DOMNode* iter = structureElement->getFirstChild();
1029                         iter != nullptr; iter    1021                         iter != nullptr; iter = iter->getNextSibling())
1030   {                                              1022   {
1031     if(iter->getNodeType() != xercesc::DOMNod    1023     if(iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE)
1032     {                                            1024     {
1033       continue;                                  1025       continue;
1034     }                                            1026     }
1035                                                  1027 
1036     const xercesc::DOMElement* const child =     1028     const xercesc::DOMElement* const child =
1037       dynamic_cast<xercesc::DOMElement*>(iter    1029       dynamic_cast<xercesc::DOMElement*>(iter);
1038     if(child == nullptr)                         1030     if(child == nullptr)
1039     {                                            1031     {
1040       G4Exception("G4GDMLReadStructure::Struc    1032       G4Exception("G4GDMLReadStructure::StructureRead()", "InvalidRead",
1041                   FatalException, "No child f    1033                   FatalException, "No child found!");
1042       return;                                    1034       return;
1043     }                                            1035     }
1044     const G4String tag = Transcode(child->get    1036     const G4String tag = Transcode(child->getTagName());
1045                                                  1037 
1046     if(tag == "bordersurface")                   1038     if(tag == "bordersurface")
1047     {                                            1039     {
1048       BorderSurfaceRead(child);                  1040       BorderSurfaceRead(child);
1049     }                                            1041     }
1050     else if(tag == "skinsurface")                1042     else if(tag == "skinsurface")
1051     {                                            1043     {
1052       SkinSurfaceRead(child);                    1044       SkinSurfaceRead(child);
1053     }                                            1045     }
1054     else if(tag == "volume")                     1046     else if(tag == "volume")
1055     {                                            1047     {
1056       VolumeRead(child);                         1048       VolumeRead(child);
1057     }                                            1049     }
1058     else if(tag == "assembly")                   1050     else if(tag == "assembly")
1059     {                                            1051     {
1060       AssemblyRead(child);                       1052       AssemblyRead(child);
1061     }                                            1053     }
1062     else if(tag == "loop")                       1054     else if(tag == "loop")
1063     {                                            1055     {
1064       LoopRead(child, &G4GDMLRead::StructureR    1056       LoopRead(child, &G4GDMLRead::StructureRead);
1065     }                                            1057     }
1066     else                                         1058     else
1067     {                                            1059     {
1068       G4String error_msg = "Unknown tag in st    1060       G4String error_msg = "Unknown tag in structure: " + tag;
1069       G4Exception("G4GDMLReadStructure::Struc    1061       G4Exception("G4GDMLReadStructure::StructureRead()", "ReadError",
1070                   FatalException, error_msg);    1062                   FatalException, error_msg);
1071     }                                            1063     }
1072   }                                              1064   }
1073 }                                                1065 }
1074                                                  1066 
1075 // ------------------------------------------    1067 // --------------------------------------------------------------------
1076 G4VPhysicalVolume* G4GDMLReadStructure::GetPh    1068 G4VPhysicalVolume* G4GDMLReadStructure::GetPhysvol(const G4String& ref) const
1077 {                                                1069 {
1078   G4VPhysicalVolume* physvolPtr               << 1070   G4VPhysicalVolume* physvolPtr =
1079     = G4PhysicalVolumeStore::GetInstance()->G << 1071     G4PhysicalVolumeStore::GetInstance()->GetVolume(ref, false);
1080                                                  1072 
1081   if(physvolPtr == nullptr)                      1073   if(physvolPtr == nullptr)
1082   {                                              1074   {
1083     G4String error_msg = "Referenced physvol     1075     G4String error_msg = "Referenced physvol '" + ref + "' was not found!";
1084     G4Exception("G4GDMLReadStructure::GetPhys    1076     G4Exception("G4GDMLReadStructure::GetPhysvol()", "ReadError",
1085                 FatalException, error_msg);      1077                 FatalException, error_msg);
1086   }                                              1078   }
1087                                                  1079 
1088   return physvolPtr;                             1080   return physvolPtr;
1089 }                                                1081 }
1090                                                  1082 
1091 // ------------------------------------------    1083 // --------------------------------------------------------------------
1092 G4LogicalVolume* G4GDMLReadStructure::GetVolu    1084 G4LogicalVolume* G4GDMLReadStructure::GetVolume(const G4String& ref) const
1093 {                                                1085 {
1094   G4LogicalVolume* volumePtr                  << 1086   G4LogicalVolume* volumePtr =
1095     = G4LogicalVolumeStore::GetInstance()->Ge << 1087     G4LogicalVolumeStore::GetInstance()->GetVolume(ref, false);
1096                                                  1088 
1097   if(volumePtr == nullptr)                       1089   if(volumePtr == nullptr)
1098   {                                              1090   {
1099     G4String error_msg = "Referenced volume '    1091     G4String error_msg = "Referenced volume '" + ref + "' was not found!";
1100     G4Exception("G4GDMLReadStructure::GetVolu    1092     G4Exception("G4GDMLReadStructure::GetVolume()", "ReadError", FatalException,
1101                 error_msg);                      1093                 error_msg);
1102   }                                              1094   }
1103                                                  1095 
1104   return volumePtr;                              1096   return volumePtr;
1105 }                                                1097 }
1106                                                  1098 
1107 // ------------------------------------------    1099 // --------------------------------------------------------------------
1108 G4AssemblyVolume* G4GDMLReadStructure::GetAss    1100 G4AssemblyVolume* G4GDMLReadStructure::GetAssembly(const G4String& ref) const
1109 {                                                1101 {
1110   auto pos = assemblyMap.find(ref);              1102   auto pos = assemblyMap.find(ref);
1111   if(pos != assemblyMap.cend())                  1103   if(pos != assemblyMap.cend())
1112   {                                              1104   {
1113     return pos->second;                          1105     return pos->second;
1114   }                                              1106   }
1115   return nullptr;                                1107   return nullptr;
1116 }                                                1108 }
1117                                                  1109 
1118 // ------------------------------------------    1110 // --------------------------------------------------------------------
1119 G4GDMLAuxListType G4GDMLReadStructure::GetVol    1111 G4GDMLAuxListType G4GDMLReadStructure::GetVolumeAuxiliaryInformation(
1120   G4LogicalVolume* logvol) const                 1112   G4LogicalVolume* logvol) const
1121 {                                                1113 {
1122   auto pos = auxMap.find(logvol);                1114   auto pos = auxMap.find(logvol);
1123   if(pos != auxMap.cend())                       1115   if(pos != auxMap.cend())
1124   {                                              1116   {
1125     return pos->second;                          1117     return pos->second;
1126   }                                              1118   }
1127   else                                           1119   else
1128   {                                              1120   {
1129     return G4GDMLAuxListType();                  1121     return G4GDMLAuxListType();
1130   }                                              1122   }
1131 }                                                1123 }
1132                                                  1124 
1133 // ------------------------------------------    1125 // --------------------------------------------------------------------
1134 G4VPhysicalVolume* G4GDMLReadStructure::GetWo    1126 G4VPhysicalVolume* G4GDMLReadStructure::GetWorldVolume(
1135   const G4String& setupName)                     1127   const G4String& setupName)
1136 {                                                1128 {
1137   G4String sname = GetSetup(setupName);          1129   G4String sname = GetSetup(setupName);
1138   if(sname == "")                                1130   if(sname == "")
1139   {                                              1131   {
1140     return nullptr;                              1132     return nullptr;
1141   }                                              1133   }
1142                                                  1134 
1143   G4LogicalVolume* volume = GetVolume(Generat    1135   G4LogicalVolume* volume = GetVolume(GenerateName(sname, dostrip));
1144   volume->SetVisAttributes(G4VisAttributes::G    1136   volume->SetVisAttributes(G4VisAttributes::GetInvisible());
1145                                                  1137 
1146   G4VPhysicalVolume* pvWorld = nullptr;          1138   G4VPhysicalVolume* pvWorld = nullptr;
1147                                                  1139 
1148   if(setuptoPV[setupName])                       1140   if(setuptoPV[setupName])
1149   {                                              1141   {
1150     pvWorld = setuptoPV[setupName];              1142     pvWorld = setuptoPV[setupName];
1151   }                                              1143   }
1152   else                                           1144   else
1153   {                                              1145   {
1154     pvWorld = new G4PVPlacement(nullptr, G4Th    1146     pvWorld = new G4PVPlacement(nullptr, G4ThreeVector(0, 0, 0), volume,
1155                                 volume->GetNa    1147                                 volume->GetName() + "_PV", 0, 0, 0);
1156     setuptoPV[setupName] = pvWorld;              1148     setuptoPV[setupName] = pvWorld;
1157   }                                              1149   }
1158   return pvWorld;                                1150   return pvWorld;
1159 }                                                1151 }
1160                                                  1152 
1161 // ------------------------------------------    1153 // --------------------------------------------------------------------
1162 void G4GDMLReadStructure::Clear()                1154 void G4GDMLReadStructure::Clear()
1163 {                                                1155 {
1164   eval.Clear();                                  1156   eval.Clear();
1165   setuptoPV.clear();                             1157   setuptoPV.clear();
1166   auxMap.clear();                                1158   auxMap.clear();
1167 }                                                1159 }
1168                                                  1160