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