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: G4GDMLReadParamvol.cc 90766 2015-06-09 10:13:41Z gcosmo $ 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 #include "G4GDMLReadSolids.hh" 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" 40 #include "G4UnitsTable.hh" 38 41 39 // ------------------------------------------- << 40 G4GDMLReadParamvol::G4GDMLReadParamvol() 42 G4GDMLReadParamvol::G4GDMLReadParamvol() 41 : G4GDMLReadSetup() << 43 : G4GDMLReadSetup(), parameterisation(0) 42 { 44 { 43 } 45 } 44 46 45 G4GDMLReadParamvol::~G4GDMLReadParamvol() 47 G4GDMLReadParamvol::~G4GDMLReadParamvol() 46 { 48 { 47 } 49 } 48 50 49 // ------------------------------------------- << 51 void G4GDMLReadParamvol:: 50 void G4GDMLReadParamvol::Box_dimensionsRead( << 52 Box_dimensionsRead( const xercesc::DOMElement* const element, 51 const xercesc::DOMElement* const element, << 53 G4GDMLParameterisation::PARAMETER& parameter ) 52 G4GDMLParameterisation::PARAMETER& parameter << 54 { 53 { << 55 G4double lunit = 1.0; 54 G4double lunit = 1.0; << 56 55 << 57 const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes(); 56 const xercesc::DOMNamedNodeMap* const attrib << 58 XMLSize_t attributeCount = attributes->getLength(); 57 XMLSize_t attributeCount << 59 58 << 60 for (XMLSize_t attribute_index=0; 59 for(XMLSize_t attribute_index = 0; attribute << 61 attribute_index<attributeCount; attribute_index++) 60 ++attribute_index) << 62 { 61 { << 63 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 62 xercesc::DOMNode* attribute_node = attribu << 64 63 << 65 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 64 if(attribute_node->getNodeType() != xerces << 66 { continue; } 65 { << 67 66 continue; << 68 const xercesc::DOMAttr* const attribute 67 } << 69 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 68 << 70 if (!attribute) 69 const xercesc::DOMAttr* const attribute = << 71 { 70 dynamic_cast<xercesc::DOMAttr*>(attribut << 72 G4Exception("G4GDMLReadParamvol::Box_dimensionsRead()", 71 if(attribute == nullptr) << 73 "InvalidRead", FatalException, "No attribute found!"); 72 { << 74 return; 73 G4Exception("G4GDMLReadParamvol::Box_dim << 75 } 74 FatalException, "No attribut << 76 const G4String attName = Transcode(attribute->getName()); 75 return; << 77 const G4String attValue = Transcode(attribute->getValue()); 76 } << 78 77 const G4String attName = Transcode(attrib << 79 if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue); } else 78 const G4String attValue = Transcode(attrib << 80 if (attName=="x") { parameter.dimension[0] = eval.Evaluate(attValue); } else 79 << 81 if (attName=="y") { parameter.dimension[1] = eval.Evaluate(attValue); } else 80 if(attName == "lunit") << 82 if (attName=="z") { parameter.dimension[2] = eval.Evaluate(attValue); } 81 { << 83 } 82 lunit = G4UnitDefinition::GetValueOf(att << 84 83 if(G4UnitDefinition::GetCategory(attValu << 85 parameter.dimension[0] *= 0.5*lunit; 84 { << 86 parameter.dimension[1] *= 0.5*lunit; 85 G4Exception("G4GDMLReadParamvol::Box_d << 87 parameter.dimension[2] *= 0.5*lunit; 86 FatalException, "Invalid u << 88 } 87 } << 89 88 } << 90 void G4GDMLReadParamvol:: 89 else if(attName == "x") << 91 Trd_dimensionsRead( const xercesc::DOMElement* const element, 90 { << 92 G4GDMLParameterisation::PARAMETER& parameter ) 91 parameter.dimension[0] = eval.Evaluate(a << 93 { 92 } << 94 G4double lunit = 1.0; 93 else if(attName == "y") << 95 94 { << 96 const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes(); 95 parameter.dimension[1] = eval.Evaluate(a << 97 XMLSize_t attributeCount = attributes->getLength(); 96 } << 98 97 else if(attName == "z") << 99 for (XMLSize_t attribute_index=0; 98 { << 100 attribute_index<attributeCount; attribute_index++) 99 parameter.dimension[2] = eval.Evaluate(a << 101 { 100 } << 102 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 101 } << 103 102 << 104 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 103 parameter.dimension[0] *= 0.5 * lunit; << 105 { continue; } 104 parameter.dimension[1] *= 0.5 * lunit; << 106 105 parameter.dimension[2] *= 0.5 * lunit; << 107 const xercesc::DOMAttr* const attribute 106 } << 108 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 107 << 109 if (!attribute) 108 // ------------------------------------------- << 110 { 109 void G4GDMLReadParamvol::Trd_dimensionsRead( << 111 G4Exception("G4GDMLReadParamvol::Trd_dimensionsRead()", 110 const xercesc::DOMElement* const element, << 112 "InvalidRead", FatalException, "No attribute found!"); 111 G4GDMLParameterisation::PARAMETER& parameter << 113 return; 112 { << 114 } 113 G4double lunit = 1.0; << 115 const G4String attName = Transcode(attribute->getName()); 114 << 116 const G4String attValue = Transcode(attribute->getValue()); 115 const xercesc::DOMNamedNodeMap* const attrib << 117 116 XMLSize_t attributeCount << 118 if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue); } else 117 << 119 if (attName=="x1") { parameter.dimension[0]=eval.Evaluate(attValue); } else 118 for(XMLSize_t attribute_index = 0; attribute << 120 if (attName=="x2") { parameter.dimension[1]=eval.Evaluate(attValue); } else 119 ++attribute_index) << 121 if (attName=="y1") { parameter.dimension[2]=eval.Evaluate(attValue); } else 120 { << 122 if (attName=="y2") { parameter.dimension[3]=eval.Evaluate(attValue); } else 121 xercesc::DOMNode* attribute_node = attribu << 123 if (attName=="z") { parameter.dimension[4]=eval.Evaluate(attValue); } 122 << 124 } 123 if(attribute_node->getNodeType() != xerces << 125 124 { << 126 parameter.dimension[0] *= 0.5*lunit; 125 continue; << 127 parameter.dimension[1] *= 0.5*lunit; 126 } << 128 parameter.dimension[2] *= 0.5*lunit; 127 << 129 parameter.dimension[3] *= 0.5*lunit; 128 const xercesc::DOMAttr* const attribute = << 130 parameter.dimension[4] *= 0.5*lunit; 129 dynamic_cast<xercesc::DOMAttr*>(attribut << 131 } 130 if(attribute == nullptr) << 132 131 { << 133 void G4GDMLReadParamvol:: 132 G4Exception("G4GDMLReadParamvol::Trd_dim << 134 Trap_dimensionsRead( const xercesc::DOMElement* const element, 133 FatalException, "No attribut << 135 G4GDMLParameterisation::PARAMETER& parameter ) 134 return; << 136 { 135 } << 137 G4double lunit = 1.0; 136 const G4String attName = Transcode(attrib << 138 G4double aunit = 1.0; 137 const G4String attValue = Transcode(attrib << 139 138 << 140 const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes(); 139 if(attName == "lunit") << 141 XMLSize_t attributeCount = attributes->getLength(); 140 { << 142 141 lunit = G4UnitDefinition::GetValueOf(att << 143 for (XMLSize_t attribute_index=0; 142 if(G4UnitDefinition::GetCategory(attValu << 144 attribute_index<attributeCount; attribute_index++) 143 { << 145 { 144 G4Exception("G4GDMLReadParamvol::Trd_d << 146 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 145 FatalException, "Invalid u << 147 146 } << 148 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 147 } << 149 { continue; } 148 else if(attName == "x1") << 150 149 { << 151 const xercesc::DOMAttr* const attribute 150 parameter.dimension[0] = eval.Evaluate(a << 152 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 151 } << 153 if (!attribute) 152 else if(attName == "x2") << 154 { 153 { << 155 G4Exception("G4GDMLReadParamvol::Trap_dimensionsRead()", 154 parameter.dimension[1] = eval.Evaluate(a << 156 "InvalidRead", FatalException, "No attribute found!"); 155 } << 157 return; 156 else if(attName == "y1") << 158 } 157 { << 159 const G4String attName = Transcode(attribute->getName()); 158 parameter.dimension[2] = eval.Evaluate(a << 160 const G4String attValue = Transcode(attribute->getValue()); 159 } << 161 160 else if(attName == "y2") << 162 if (attName=="lunit") 161 { << 163 { lunit = G4UnitDefinition::GetValueOf(attValue); } else 162 parameter.dimension[3] = eval.Evaluate(a << 164 if (attName=="aunit") 163 } << 165 { aunit = G4UnitDefinition::GetValueOf(attValue); } else 164 else if(attName == "z") << 166 if (attName=="z") 165 { << 167 { parameter.dimension[0] = eval.Evaluate(attValue); } else 166 parameter.dimension[4] = eval.Evaluate(a << 168 if (attName=="theta") 167 } << 169 { parameter.dimension[1] = eval.Evaluate(attValue); } else 168 } << 170 if (attName=="phi") 169 << 171 { parameter.dimension[2] = eval.Evaluate(attValue); } else 170 parameter.dimension[0] *= 0.5 * lunit; << 172 if (attName=="y1") 171 parameter.dimension[1] *= 0.5 * lunit; << 173 { parameter.dimension[3] = eval.Evaluate(attValue); } else 172 parameter.dimension[2] *= 0.5 * lunit; << 174 if (attName=="x1") 173 parameter.dimension[3] *= 0.5 * lunit; << 175 { parameter.dimension[4] = eval.Evaluate(attValue); } else 174 parameter.dimension[4] *= 0.5 * lunit; << 176 if (attName=="x2") 175 } << 177 { parameter.dimension[5] = eval.Evaluate(attValue); } else 176 << 178 if (attName=="alpha1") 177 // ------------------------------------------- << 179 { parameter.dimension[6] = eval.Evaluate(attValue); } else 178 void G4GDMLReadParamvol::Trap_dimensionsRead( << 180 if (attName=="y2") 179 const xercesc::DOMElement* const element, << 181 { parameter.dimension[7] = eval.Evaluate(attValue); } else 180 G4GDMLParameterisation::PARAMETER& parameter << 182 if (attName=="x3") 181 { << 183 { parameter.dimension[8] = eval.Evaluate(attValue); } else 182 G4double lunit = 1.0; << 184 if (attName=="x4") 183 G4double aunit = 1.0; << 185 { parameter.dimension[9] = eval.Evaluate(attValue); } else 184 << 186 if (attName=="alpha2") 185 const xercesc::DOMNamedNodeMap* const attrib << 187 { parameter.dimension[10] = eval.Evaluate(attValue); } 186 XMLSize_t attributeCount << 188 } 187 << 189 188 for(XMLSize_t attribute_index = 0; attribute << 190 parameter.dimension[0] *= 0.5*lunit; 189 ++attribute_index) << 191 parameter.dimension[1] *= aunit; 190 { << 192 parameter.dimension[2] *= aunit; 191 xercesc::DOMNode* attribute_node = attribu << 193 parameter.dimension[3] *= 0.5*lunit; 192 << 194 parameter.dimension[4] *= 0.5*lunit; 193 if(attribute_node->getNodeType() != xerces << 195 parameter.dimension[5] *= 0.5*lunit; 194 { << 196 parameter.dimension[6] *= aunit; 195 continue; << 197 parameter.dimension[7] *= 0.5*lunit; 196 } << 198 parameter.dimension[8] *= 0.5*lunit; 197 << 199 parameter.dimension[9] *= 0.5*lunit; 198 const xercesc::DOMAttr* const attribute = << 200 parameter.dimension[10] *= aunit; 199 dynamic_cast<xercesc::DOMAttr*>(attribut << 201 } 200 if(attribute == nullptr) << 202 201 { << 203 void G4GDMLReadParamvol:: 202 G4Exception("G4GDMLReadParamvol::Trap_di << 204 Tube_dimensionsRead( const xercesc::DOMElement* const element, 203 FatalException, "No attribut << 205 G4GDMLParameterisation::PARAMETER& parameter ) 204 return; << 206 { 205 } << 207 G4double lunit = 1.0; 206 const G4String attName = Transcode(attrib << 208 G4double aunit = 1.0; 207 const G4String attValue = Transcode(attrib << 209 208 << 210 const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes(); 209 if(attName == "lunit") << 211 XMLSize_t attributeCount = attributes->getLength(); 210 { << 212 211 lunit = G4UnitDefinition::GetValueOf(att << 213 for (XMLSize_t attribute_index=0; 212 if(G4UnitDefinition::GetCategory(attValu << 214 attribute_index<attributeCount; attribute_index++) 213 { << 215 { 214 G4Exception("G4GDMLReadParamvol::Trap_ << 216 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 215 FatalException, "Invalid u << 217 216 } << 218 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 217 } << 219 { continue; } 218 else if(attName == "aunit") << 220 219 { << 221 const xercesc::DOMAttr* const attribute 220 aunit = G4UnitDefinition::GetValueOf(att << 222 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 221 if(G4UnitDefinition::GetCategory(attValu << 223 if (!attribute) 222 { << 224 { 223 G4Exception("G4GDMLReadParamvol::Trap_ << 225 G4Exception("G4GDMLReadParamvol::Tube_dimensionsRead()", 224 FatalException, "Invalid u << 226 "InvalidRead", FatalException, "No attribute found!"); 225 } << 227 return; 226 } << 228 } 227 else if(attName == "z") << 229 const G4String attName = Transcode(attribute->getName()); 228 { << 230 const G4String attValue = Transcode(attribute->getValue()); 229 parameter.dimension[0] = eval.Evaluate(a << 231 230 } << 232 if (attName=="lunit") 231 else if(attName == "theta") << 233 { lunit = G4UnitDefinition::GetValueOf(attValue); } else 232 { << 234 if (attName=="aunit") 233 parameter.dimension[1] = eval.Evaluate(a << 235 { aunit = G4UnitDefinition::GetValueOf(attValue); } else 234 } << 236 if (attName=="InR") 235 else if(attName == "phi") << 237 { parameter.dimension[0] = eval.Evaluate(attValue); } else 236 { << 238 if (attName=="OutR") 237 parameter.dimension[2] = eval.Evaluate(a << 239 { parameter.dimension[1] = eval.Evaluate(attValue); } else 238 } << 240 if (attName=="hz") 239 else if(attName == "y1") << 241 { parameter.dimension[2] = eval.Evaluate(attValue); } else 240 { << 242 if (attName=="StartPhi") 241 parameter.dimension[3] = eval.Evaluate(a << 243 { parameter.dimension[3] = eval.Evaluate(attValue); } else 242 } << 244 if (attName=="DeltaPhi") 243 else if(attName == "x1") << 245 { parameter.dimension[4] = eval.Evaluate(attValue); } 244 { << 246 } 245 parameter.dimension[4] = eval.Evaluate(a << 247 246 } << 248 parameter.dimension[0] *= lunit; 247 else if(attName == "x2") << 249 parameter.dimension[1] *= lunit; 248 { << 250 parameter.dimension[2] *= 0.5*lunit; 249 parameter.dimension[5] = eval.Evaluate(a << 251 parameter.dimension[3] *= aunit; 250 } << 252 parameter.dimension[4] *= aunit; 251 else if(attName == "alpha1") << 253 } 252 { << 254 253 parameter.dimension[6] = eval.Evaluate(a << 255 void G4GDMLReadParamvol:: 254 } << 256 Cone_dimensionsRead( const xercesc::DOMElement* const element, 255 else if(attName == "y2") << 257 G4GDMLParameterisation::PARAMETER& parameter ) 256 { << 258 { 257 parameter.dimension[7] = eval.Evaluate(a << 259 G4double lunit = 1.0; 258 } << 260 G4double aunit = 1.0; 259 else if(attName == "x3") << 261 260 { << 262 const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes(); 261 parameter.dimension[8] = eval.Evaluate(a << 263 XMLSize_t attributeCount = attributes->getLength(); 262 } << 264 263 else if(attName == "x4") << 265 for (XMLSize_t attribute_index=0; 264 { << 266 attribute_index<attributeCount; attribute_index++) 265 parameter.dimension[9] = eval.Evaluate(a << 267 { 266 } << 268 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 267 else if(attName == "alpha2") << 269 268 { << 270 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 269 parameter.dimension[10] = eval.Evaluate( << 271 { continue; } 270 } << 272 271 } << 273 const xercesc::DOMAttr* const attribute 272 << 274 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 273 parameter.dimension[0] *= 0.5 * lunit; << 275 if (!attribute) 274 parameter.dimension[1] *= aunit; << 276 { 275 parameter.dimension[2] *= aunit; << 277 G4Exception("G4GDMLReadParamvol::Cone_dimensionsRead()", 276 parameter.dimension[3] *= 0.5 * lunit; << 278 "InvalidRead", FatalException, "No attribute found!"); 277 parameter.dimension[4] *= 0.5 * lunit; << 279 return; 278 parameter.dimension[5] *= 0.5 * lunit; << 280 } 279 parameter.dimension[6] *= aunit; << 281 const G4String attName = Transcode(attribute->getName()); 280 parameter.dimension[7] *= 0.5 * lunit; << 282 const G4String attValue = Transcode(attribute->getValue()); 281 parameter.dimension[8] *= 0.5 * lunit; << 283 282 parameter.dimension[9] *= 0.5 * lunit; << 284 if (attName=="lunit") 283 parameter.dimension[10] *= aunit; << 285 { lunit = G4UnitDefinition::GetValueOf(attValue); } else 284 } << 286 if (attName=="aunit") 285 << 287 { aunit = G4UnitDefinition::GetValueOf(attValue); } else 286 // ------------------------------------------- << 288 if (attName=="rmin1") 287 void G4GDMLReadParamvol::Tube_dimensionsRead( << 289 { parameter.dimension[0] = eval.Evaluate(attValue); } else 288 const xercesc::DOMElement* const element, << 290 if (attName=="rmax1") 289 G4GDMLParameterisation::PARAMETER& parameter << 291 { parameter.dimension[1] = eval.Evaluate(attValue); } else 290 { << 292 if (attName=="rmin2") 291 G4double lunit = 1.0; << 293 { parameter.dimension[2] = eval.Evaluate(attValue); } else 292 G4double aunit = 1.0; << 294 if (attName=="rmax2") 293 << 295 { parameter.dimension[3] = eval.Evaluate(attValue); } else 294 const xercesc::DOMNamedNodeMap* const attrib << 296 if (attName=="z") 295 XMLSize_t attributeCount << 297 { parameter.dimension[4] = eval.Evaluate(attValue); } else 296 << 298 if (attName=="startphi") 297 for(XMLSize_t attribute_index = 0; attribute << 299 { parameter.dimension[5] = eval.Evaluate(attValue); } else 298 ++attribute_index) << 300 if (attName=="deltaphi") 299 { << 301 { parameter.dimension[6] = eval.Evaluate(attValue); } 300 xercesc::DOMNode* attribute_node = attribu << 302 } 301 << 303 302 if(attribute_node->getNodeType() != xerces << 304 parameter.dimension[0] *= lunit; 303 { << 305 parameter.dimension[1] *= lunit; 304 continue; << 306 parameter.dimension[2] *= lunit; 305 } << 307 parameter.dimension[3] *= lunit; 306 << 308 parameter.dimension[4] *= 0.5*lunit; 307 const xercesc::DOMAttr* const attribute = << 309 parameter.dimension[5] *= aunit; 308 dynamic_cast<xercesc::DOMAttr*>(attribut << 310 parameter.dimension[6] *= aunit; 309 if(attribute == nullptr) << 311 } 310 { << 312 311 G4Exception("G4GDMLReadParamvol::Tube_di << 313 void G4GDMLReadParamvol:: 312 FatalException, "No attribut << 314 Sphere_dimensionsRead( const xercesc::DOMElement* const element, 313 return; << 315 G4GDMLParameterisation::PARAMETER& parameter ) 314 } << 316 { 315 const G4String attName = Transcode(attrib << 317 G4double lunit = 1.0; 316 const G4String attValue = Transcode(attrib << 318 G4double aunit = 1.0; 317 << 319 318 if(attName == "lunit") << 320 const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes(); 319 { << 321 XMLSize_t attributeCount = attributes->getLength(); 320 lunit = G4UnitDefinition::GetValueOf(att << 322 321 if(G4UnitDefinition::GetCategory(attValu << 323 for (XMLSize_t attribute_index=0; 322 { << 324 attribute_index<attributeCount; attribute_index++) 323 G4Exception("G4GDMLReadParamvol::Tube_ << 325 { 324 FatalException, "Invalid u << 326 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 325 } << 327 326 } << 328 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 327 else if(attName == "aunit") << 329 { continue; } 328 { << 330 329 aunit = G4UnitDefinition::GetValueOf(att << 331 const xercesc::DOMAttr* const attribute 330 if(G4UnitDefinition::GetCategory(attValu << 332 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 331 { << 333 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 { 334 { 500 G4Exception("G4GDMLReadParamvol::Spher 335 G4Exception("G4GDMLReadParamvol::Sphere_dimensionsRead()", 501 "InvalidRead", FatalExcept << 336 "InvalidRead", FatalException, "No attribute found!"); >> 337 return; 502 } 338 } 503 } << 339 const G4String attName = Transcode(attribute->getName()); 504 else if(attName == "rmin") << 340 const G4String attValue = Transcode(attribute->getValue()); 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 } << 636 } << 637 else if(attName == "rmin") << 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 << 666 // ------------------------------------------- << 667 void G4GDMLReadParamvol::Ellipsoid_dimensionsR << 668 const xercesc::DOMElement* const element, << 669 G4GDMLParameterisation::PARAMETER& parameter << 670 { << 671 G4double lunit << 672 const xercesc::DOMNamedNodeMap* const attrib << 673 XMLSize_t attributeCount << 674 << 675 for(XMLSize_t attribute_index = 0; attribute << 676 ++attribute_index) << 677 { << 678 xercesc::DOMNode* attribute_node = attribu << 679 << 680 if(attribute_node->getNodeType() != xerces << 681 { << 682 continue; << 683 } << 684 << 685 const xercesc::DOMAttr* const attribute = << 686 dynamic_cast<xercesc::DOMAttr*>(attribut << 687 if(attribute == nullptr) << 688 { << 689 G4Exception("G4GDMLReadParamvol::Ellipso << 690 "InvalidRead", FatalExceptio << 691 return; << 692 } << 693 const G4String attName = Transcode(attrib << 694 const G4String attValue = Transcode(attrib << 695 341 696 if(attName == "lunit") << 342 if (attName=="lunit") 697 { << 343 { lunit = G4UnitDefinition::GetValueOf(attValue); } else 698 lunit = G4UnitDefinition::GetValueOf(att << 344 if (attName=="aunit") 699 if(G4UnitDefinition::GetCategory(attValu << 345 { aunit = G4UnitDefinition::GetValueOf(attValue); } else >> 346 if (attName=="rmin") >> 347 { parameter.dimension[0] = eval.Evaluate(attValue); } else >> 348 if (attName=="rmax") >> 349 { parameter.dimension[1] = eval.Evaluate(attValue); } else >> 350 if (attName=="startphi") >> 351 { parameter.dimension[2] = eval.Evaluate(attValue); } else >> 352 if (attName=="deltaphi") >> 353 { parameter.dimension[3] = eval.Evaluate(attValue); } else >> 354 if (attName=="starttheta") >> 355 { parameter.dimension[4] = eval.Evaluate(attValue); } else >> 356 if (attName=="deltatheta") >> 357 { parameter.dimension[5] = eval.Evaluate(attValue); } >> 358 } >> 359 >> 360 parameter.dimension[0] *= lunit; >> 361 parameter.dimension[1] *= lunit; >> 362 parameter.dimension[2] *= aunit; >> 363 parameter.dimension[3] *= aunit; >> 364 parameter.dimension[4] *= aunit; >> 365 parameter.dimension[5] *= aunit; >> 366 } >> 367 >> 368 void G4GDMLReadParamvol:: >> 369 Orb_dimensionsRead( const xercesc::DOMElement* const element, >> 370 G4GDMLParameterisation::PARAMETER& parameter ) >> 371 { >> 372 G4double lunit = 1.0; >> 373 >> 374 const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes(); >> 375 XMLSize_t attributeCount = attributes->getLength(); >> 376 >> 377 for (XMLSize_t attribute_index=0; >> 378 attribute_index<attributeCount; attribute_index++) >> 379 { >> 380 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); >> 381 >> 382 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) >> 383 { continue; } >> 384 >> 385 const xercesc::DOMAttr* const attribute >> 386 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); >> 387 if (!attribute) >> 388 { >> 389 G4Exception("G4GDMLReadParamvol::Orb_dimensionsRead()", >> 390 "InvalidRead", FatalException, "No attribute found!"); >> 391 return; >> 392 } >> 393 const G4String attName = Transcode(attribute->getName()); >> 394 const G4String attValue = Transcode(attribute->getValue()); >> 395 >> 396 if (attName=="lunit") { lunit = G4UnitDefinition::GetValueOf(attValue); } else >> 397 if (attName=="r") { parameter.dimension[0] = eval.Evaluate(attValue); } >> 398 } >> 399 >> 400 parameter.dimension[0] *= lunit; >> 401 } >> 402 >> 403 void G4GDMLReadParamvol:: >> 404 Torus_dimensionsRead( const xercesc::DOMElement* const element, >> 405 G4GDMLParameterisation::PARAMETER& parameter ) >> 406 { >> 407 G4double lunit = 1.0; >> 408 G4double aunit = 1.0; >> 409 >> 410 const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes(); >> 411 XMLSize_t attributeCount = attributes->getLength(); >> 412 >> 413 for (XMLSize_t attribute_index=0; >> 414 attribute_index<attributeCount; attribute_index++) >> 415 { >> 416 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); >> 417 >> 418 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) >> 419 { continue; } >> 420 >> 421 const xercesc::DOMAttr* const attribute >> 422 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); >> 423 if (!attribute) >> 424 { >> 425 G4Exception("G4GDMLReadParamvol::Torus_dimensionsRead()", >> 426 "InvalidRead", FatalException, "No attribute found!"); >> 427 return; >> 428 } >> 429 const G4String attName = Transcode(attribute->getName()); >> 430 const G4String attValue = Transcode(attribute->getValue()); >> 431 >> 432 if (attName=="lunit") >> 433 { lunit = G4UnitDefinition::GetValueOf(attValue); } else >> 434 if (attName=="aunit") >> 435 { aunit = G4UnitDefinition::GetValueOf(attValue); } else >> 436 if (attName=="rmin") >> 437 { parameter.dimension[0] = eval.Evaluate(attValue); } else >> 438 if (attName=="rmax") >> 439 { parameter.dimension[1] = eval.Evaluate(attValue); } else >> 440 if (attName=="rtor") >> 441 { parameter.dimension[2] = eval.Evaluate(attValue); } else >> 442 if (attName=="startphi") >> 443 { parameter.dimension[3] = eval.Evaluate(attValue); } else >> 444 if (attName=="deltaphi") >> 445 { parameter.dimension[4] = eval.Evaluate(attValue); } >> 446 } >> 447 >> 448 parameter.dimension[0] *= lunit; >> 449 parameter.dimension[1] *= lunit; >> 450 parameter.dimension[2] *= lunit; >> 451 parameter.dimension[3] *= aunit; >> 452 parameter.dimension[4] *= aunit; >> 453 } >> 454 >> 455 void G4GDMLReadParamvol:: >> 456 Ellipsoid_dimensionsRead( const xercesc::DOMElement* const element, >> 457 G4GDMLParameterisation::PARAMETER& parameter ) >> 458 { >> 459 G4double lunit = 1.0; >> 460 const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes(); >> 461 XMLSize_t attributeCount = attributes->getLength(); >> 462 >> 463 for (XMLSize_t attribute_index=0; >> 464 attribute_index<attributeCount; attribute_index++) >> 465 { >> 466 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); >> 467 >> 468 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) >> 469 { continue; } >> 470 >> 471 const xercesc::DOMAttr* const attribute >> 472 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); >> 473 if (!attribute) 700 { 474 { 701 G4Exception("G4GDMLReadParamvol::Ellip 475 G4Exception("G4GDMLReadParamvol::Ellipsoid_dimensionsRead()", 702 "InvalidRead", FatalExcept << 476 "InvalidRead", FatalException, "No attribute found!"); 703 } << 477 return; 704 } << 705 else if(attName == "ax") << 706 { << 707 parameter.dimension[0] = eval.Evaluate(a << 708 } << 709 else if(attName == "by") << 710 { << 711 parameter.dimension[1] = eval.Evaluate(a << 712 } << 713 else if(attName == "cz") << 714 { << 715 parameter.dimension[2] = eval.Evaluate(a << 716 } << 717 else if(attName == "zcut1") << 718 { << 719 parameter.dimension[3] = eval.Evaluate(a << 720 } << 721 else if(attName == "zcut2") << 722 { << 723 parameter.dimension[4] = eval.Evaluate(a << 724 } << 725 } << 726 << 727 parameter.dimension[0] *= lunit; << 728 parameter.dimension[1] *= lunit; << 729 parameter.dimension[2] *= lunit; << 730 parameter.dimension[3] *= lunit; << 731 parameter.dimension[4] *= lunit; << 732 } << 733 << 734 // ------------------------------------------- << 735 void G4GDMLReadParamvol::Para_dimensionsRead( << 736 const xercesc::DOMElement* const element, << 737 G4GDMLParameterisation::PARAMETER& parameter << 738 { << 739 G4double lunit = 1.0; << 740 G4double aunit = 1.0; << 741 << 742 const xercesc::DOMNamedNodeMap* const attrib << 743 XMLSize_t attributeCount << 744 << 745 for(XMLSize_t attribute_index = 0; attribute << 746 ++attribute_index) << 747 { << 748 xercesc::DOMNode* attribute_node = attribu << 749 << 750 if(attribute_node->getNodeType() != xerces << 751 { << 752 continue; << 753 } << 754 << 755 const xercesc::DOMAttr* const attribute = << 756 dynamic_cast<xercesc::DOMAttr*>(attribut << 757 if(attribute == nullptr) << 758 { << 759 G4Exception("G4GDMLReadParamvol::Para_di << 760 FatalException, "No attribut << 761 return; << 762 } << 763 const G4String attName = Transcode(attrib << 764 const G4String attValue = Transcode(attrib << 765 << 766 if(attName == "lunit") << 767 { << 768 lunit = G4UnitDefinition::GetValueOf(att << 769 if(G4UnitDefinition::GetCategory(attValu << 770 { << 771 G4Exception("G4GDMLReadParamvol::Para_ << 772 FatalException, "Invalid u << 773 } << 774 } << 775 else if(attName == "aunit") << 776 { << 777 aunit = G4UnitDefinition::GetValueOf(att << 778 if(G4UnitDefinition::GetCategory(attValu << 779 { << 780 G4Exception("G4GDMLReadParamvol::Para_ << 781 FatalException, "Invalid u << 782 } << 783 } << 784 else if(attName == "x") << 785 { << 786 parameter.dimension[0] = eval.Evaluate(a << 787 } << 788 else if(attName == "y") << 789 { << 790 parameter.dimension[1] = eval.Evaluate(a << 791 } << 792 else if(attName == "z") << 793 { << 794 parameter.dimension[2] = eval.Evaluate(a << 795 } << 796 else if(attName == "alpha") << 797 { << 798 parameter.dimension[3] = eval.Evaluate(a << 799 } << 800 else if(attName == "theta") << 801 { << 802 parameter.dimension[4] = eval.Evaluate(a << 803 } << 804 else if(attName == "phi") << 805 { << 806 parameter.dimension[5] = eval.Evaluate(a << 807 } << 808 } << 809 << 810 parameter.dimension[0] = 0.5 * lunit; << 811 parameter.dimension[1] = 0.5 * lunit; << 812 parameter.dimension[2] = 0.5 * lunit; << 813 parameter.dimension[3] = aunit; << 814 parameter.dimension[4] = aunit; << 815 parameter.dimension[5] = aunit; << 816 } << 817 << 818 // ------------------------------------------- << 819 void G4GDMLReadParamvol::Hype_dimensionsRead( << 820 const xercesc::DOMElement* const element, << 821 G4GDMLParameterisation::PARAMETER& parameter << 822 { << 823 G4double lunit = 1.0; << 824 G4double aunit = 1.0; << 825 << 826 const xercesc::DOMNamedNodeMap* const attrib << 827 XMLSize_t attributeCount << 828 << 829 for(XMLSize_t attribute_index = 0; attribute << 830 ++attribute_index) << 831 { << 832 xercesc::DOMNode* attribute_node = attribu << 833 << 834 if(attribute_node->getNodeType() != xerces << 835 { << 836 continue; << 837 } << 838 << 839 const xercesc::DOMAttr* const attribute = << 840 dynamic_cast<xercesc::DOMAttr*>(attribut << 841 if(attribute == nullptr) << 842 { << 843 G4Exception("G4GDMLReadParamvol::Hype_di << 844 FatalException, "No attribut << 845 return; << 846 } << 847 const G4String attName = Transcode(attrib << 848 const G4String attValue = Transcode(attrib << 849 << 850 if(attName == "lunit") << 851 { << 852 lunit = G4UnitDefinition::GetValueOf(att << 853 if(G4UnitDefinition::GetCategory(attValu << 854 { << 855 G4Exception("G4GDMLReadParamvol::Hype_ << 856 FatalException, "Invalid u << 857 } 478 } 858 } << 479 const G4String attName = Transcode(attribute->getName()); 859 else if(attName == "aunit") << 480 const G4String attValue = Transcode(attribute->getValue()); 860 { << 861 aunit = G4UnitDefinition::GetValueOf(att << 862 if(G4UnitDefinition::GetCategory(attValu << 863 { << 864 G4Exception("G4GDMLReadParamvol::Hype_ << 865 FatalException, "Invalid u << 866 } << 867 } << 868 else if(attName == "rmin") << 869 { << 870 parameter.dimension[0] = eval.Evaluate(a << 871 } << 872 else if(attName == "rmax") << 873 { << 874 parameter.dimension[1] = eval.Evaluate(a << 875 } << 876 else if(attName == "inst") << 877 { << 878 parameter.dimension[2] = eval.Evaluate(a << 879 } << 880 else if(attName == "outst") << 881 { << 882 parameter.dimension[3] = eval.Evaluate(a << 883 } << 884 else if(attName == "z") << 885 { << 886 parameter.dimension[4] = eval.Evaluate(a << 887 } << 888 } << 889 << 890 parameter.dimension[0] = lunit; << 891 parameter.dimension[1] = lunit; << 892 parameter.dimension[2] = aunit; << 893 parameter.dimension[3] = aunit; << 894 parameter.dimension[4] = 0.5 * lunit; << 895 } << 896 << 897 // ------------------------------------------- << 898 void G4GDMLReadParamvol::Polycone_dimensionsRe << 899 const xercesc::DOMElement* const element, << 900 G4GDMLParameterisation::PARAMETER& parameter << 901 { << 902 G4double lunit = 1.0; << 903 G4double aunit = 1.0; << 904 << 905 std::vector<zplaneType> zplaneList; << 906 481 907 const xercesc::DOMNamedNodeMap* const attrib << 482 if (attName=="lunit") 908 XMLSize_t attributeCount << 483 { lunit = G4UnitDefinition::GetValueOf(attValue); } else 909 << 484 if (attName=="ax") 910 for(XMLSize_t attribute_index = 0; attribute << 485 { parameter.dimension[0] = eval.Evaluate(attValue); } else 911 ++attribute_index) << 486 if (attName=="by") 912 { << 487 { parameter.dimension[1] = eval.Evaluate(attValue); } else 913 xercesc::DOMNode* attribute_node = attribu << 488 if (attName=="cz") 914 << 489 { parameter.dimension[2] = eval.Evaluate(attValue); } else 915 if(attribute_node->getNodeType() != xerces << 490 if (attName=="zcut1") 916 { << 491 { parameter.dimension[3] = eval.Evaluate(attValue); } else 917 continue; << 492 if (attName=="zcut2") 918 } << 493 { parameter.dimension[4] = eval.Evaluate(attValue); } 919 << 494 } 920 const xercesc::DOMAttr* const attribute = << 495 921 dynamic_cast<xercesc::DOMAttr*>(attribut << 496 parameter.dimension[0] *= lunit; 922 if(attribute == nullptr) << 497 parameter.dimension[1] *= lunit; 923 { << 498 parameter.dimension[2] *= lunit; 924 G4Exception("G4GDMLReadParamvol::Polycon << 499 parameter.dimension[3] *= lunit; 925 "InvalidRead", FatalExceptio << 500 parameter.dimension[4] *= lunit; 926 return; << 501 } 927 } << 502 928 const G4String attName = Transcode(attrib << 503 void G4GDMLReadParamvol:: 929 const G4String attValue = Transcode(attrib << 504 Para_dimensionsRead( const xercesc::DOMElement* const element, 930 << 505 G4GDMLParameterisation::PARAMETER& parameter ) 931 if(attName == "lunit") << 506 { 932 { << 507 G4double lunit = 1.0; 933 lunit = G4UnitDefinition::GetValueOf(att << 508 G4double aunit = 1.0; 934 if(G4UnitDefinition::GetCategory(attValu << 509 >> 510 const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes(); >> 511 XMLSize_t attributeCount = attributes->getLength(); >> 512 >> 513 for (XMLSize_t attribute_index=0; >> 514 attribute_index<attributeCount; attribute_index++) >> 515 { >> 516 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); >> 517 >> 518 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) >> 519 { continue; } >> 520 >> 521 const xercesc::DOMAttr* const attribute >> 522 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); >> 523 if (!attribute) >> 524 { >> 525 G4Exception("G4GDMLReadParamvol::Para_dimensionsRead()", >> 526 "InvalidRead", FatalException, "No attribute found!"); >> 527 return; >> 528 } >> 529 const G4String attName = Transcode(attribute->getName()); >> 530 const G4String attValue = Transcode(attribute->getValue()); >> 531 >> 532 if (attName=="lunit") >> 533 { lunit = G4UnitDefinition::GetValueOf(attValue); } else >> 534 if (attName=="aunit") >> 535 { aunit = G4UnitDefinition::GetValueOf(attValue); } else >> 536 if (attName=="x") >> 537 { parameter.dimension[0] = eval.Evaluate(attValue); } else >> 538 if (attName=="y") >> 539 { parameter.dimension[1] = eval.Evaluate(attValue); } else >> 540 if (attName=="z") >> 541 { parameter.dimension[2] = eval.Evaluate(attValue); } else >> 542 if (attName=="alpha") >> 543 { parameter.dimension[3] = eval.Evaluate(attValue); } else >> 544 if (attName=="theta") >> 545 { parameter.dimension[4] = eval.Evaluate(attValue); } else >> 546 if (attName=="phi") >> 547 { parameter.dimension[5] = eval.Evaluate(attValue); } >> 548 } >> 549 >> 550 parameter.dimension[0] = 0.5*lunit; >> 551 parameter.dimension[1] = 0.5*lunit; >> 552 parameter.dimension[2] = 0.5*lunit; >> 553 parameter.dimension[3] = aunit; >> 554 parameter.dimension[4] = aunit; >> 555 parameter.dimension[5] = aunit; >> 556 } >> 557 >> 558 void G4GDMLReadParamvol:: >> 559 Hype_dimensionsRead( const xercesc::DOMElement* const element, >> 560 G4GDMLParameterisation::PARAMETER& parameter ) >> 561 { >> 562 G4double lunit = 1.0; >> 563 G4double aunit = 1.0; >> 564 >> 565 const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes(); >> 566 XMLSize_t attributeCount = attributes->getLength(); >> 567 >> 568 for (XMLSize_t attribute_index=0; >> 569 attribute_index<attributeCount; attribute_index++) >> 570 { >> 571 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); >> 572 >> 573 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) >> 574 { continue; } >> 575 >> 576 const xercesc::DOMAttr* const attribute >> 577 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); >> 578 if (!attribute) >> 579 { >> 580 G4Exception("G4GDMLReadParamvol::Hype_dimensionsRead()", >> 581 "InvalidRead", FatalException, "No attribute found!"); >> 582 return; >> 583 } >> 584 const G4String attName = Transcode(attribute->getName()); >> 585 const G4String attValue = Transcode(attribute->getValue()); >> 586 >> 587 if (attName=="lunit") >> 588 { lunit = G4UnitDefinition::GetValueOf(attValue); } else >> 589 if (attName=="aunit") >> 590 { aunit = G4UnitDefinition::GetValueOf(attValue); } else >> 591 if (attName=="rmin") >> 592 { parameter.dimension[0] = eval.Evaluate(attValue); } else >> 593 if (attName=="rmax") >> 594 { parameter.dimension[1] = eval.Evaluate(attValue); } else >> 595 if (attName=="inst") >> 596 { parameter.dimension[2] = eval.Evaluate(attValue); } else >> 597 if (attName=="outst") >> 598 { parameter.dimension[3] = eval.Evaluate(attValue); } else >> 599 if (attName=="z") >> 600 { parameter.dimension[4] = eval.Evaluate(attValue); } >> 601 } >> 602 >> 603 parameter.dimension[0] = lunit; >> 604 parameter.dimension[1] = lunit; >> 605 parameter.dimension[2] = aunit; >> 606 parameter.dimension[3] = aunit; >> 607 parameter.dimension[4] = 0.5*lunit; >> 608 } >> 609 >> 610 void G4GDMLReadParamvol:: >> 611 Polycone_dimensionsRead( const xercesc::DOMElement* const element, >> 612 G4GDMLParameterisation::PARAMETER& parameter ) >> 613 { >> 614 G4double lunit = 1.0; >> 615 G4double aunit = 1.0; >> 616 >> 617 std::vector<zplaneType> zplaneList; >> 618 >> 619 const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes(); >> 620 XMLSize_t attributeCount = attributes->getLength(); >> 621 >> 622 for (XMLSize_t attribute_index=0; >> 623 attribute_index<attributeCount; attribute_index++) >> 624 { >> 625 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); >> 626 >> 627 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) >> 628 { continue; } >> 629 >> 630 const xercesc::DOMAttr* const attribute >> 631 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); >> 632 if (!attribute) 935 { 633 { 936 G4Exception("G4GDMLReadParamvol::Polyc 634 G4Exception("G4GDMLReadParamvol::Polycone_dimensionsRead()", 937 "InvalidRead", FatalExcept << 635 "InvalidRead", FatalException, "No attribute found!"); >> 636 return; 938 } 637 } 939 } << 638 const G4String attName = Transcode(attribute->getName()); 940 else if(attName == "aunit") << 639 const G4String attValue = Transcode(attribute->getValue()); 941 { << 640 942 aunit = G4UnitDefinition::GetValueOf(att << 641 if (attName=="lunit") 943 if(G4UnitDefinition::GetCategory(attValu << 642 { lunit = G4UnitDefinition::GetValueOf(attValue); } else >> 643 if (attName=="aunit") >> 644 { aunit = G4UnitDefinition::GetValueOf(attValue); } else >> 645 if (attName=="startPhi") >> 646 { parameter.dimension[0] = eval.Evaluate(attValue); } else >> 647 if (attName=="openPhi") >> 648 { parameter.dimension[1] = eval.Evaluate(attValue); } else >> 649 if (attName=="numRZ") >> 650 { parameter.dimension[2] = eval.Evaluate(attValue); } >> 651 } >> 652 >> 653 parameter.dimension[0] *= aunit; >> 654 parameter.dimension[1] *= aunit; >> 655 >> 656 for (xercesc::DOMNode* iter = element->getFirstChild(); >> 657 iter != 0; iter = iter->getNextSibling()) >> 658 { >> 659 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) { continue; } >> 660 >> 661 const xercesc::DOMElement* const child >> 662 = dynamic_cast<xercesc::DOMElement*>(iter); >> 663 if (!child) >> 664 { >> 665 G4Exception("G4GDMLReadParamVol::Polycone_dimensionsRead()", >> 666 "InvalidRead", FatalException, "No child found!"); >> 667 return; >> 668 } >> 669 const G4String tag = Transcode(child->getTagName()); >> 670 >> 671 if (tag=="zplane") { zplaneList.push_back(ZplaneRead(child)); } >> 672 } >> 673 >> 674 G4int numZPlanes = zplaneList.size(); >> 675 for (G4int i=0; i<numZPlanes; i++) >> 676 { >> 677 parameter.dimension[3+i*3] = zplaneList[i].rmin*lunit; >> 678 parameter.dimension[4+i*3] = zplaneList[i].rmax*lunit; >> 679 parameter.dimension[5+i*3] = zplaneList[i].z*lunit; >> 680 } >> 681 } >> 682 >> 683 void G4GDMLReadParamvol:: >> 684 Polyhedra_dimensionsRead( const xercesc::DOMElement* const element, >> 685 G4GDMLParameterisation::PARAMETER& parameter ) >> 686 { >> 687 G4double lunit = 1.0; >> 688 G4double aunit = 1.0; >> 689 >> 690 std::vector<zplaneType> zplaneList; >> 691 >> 692 const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes(); >> 693 XMLSize_t attributeCount = attributes->getLength(); >> 694 >> 695 for (XMLSize_t attribute_index=0; >> 696 attribute_index<attributeCount; attribute_index++) >> 697 { >> 698 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); >> 699 >> 700 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) >> 701 { continue; } >> 702 >> 703 const xercesc::DOMAttr* const attribute >> 704 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); >> 705 if (!attribute) 944 { 706 { 945 G4Exception("G4GDMLReadParamvol::Polyc 707 G4Exception("G4GDMLReadParamvol::Polycone_dimensionsRead()", 946 "InvalidRead", FatalExcept << 708 "InvalidRead", FatalException, "No attribute found!"); >> 709 return; 947 } 710 } 948 } << 711 const G4String attName = Transcode(attribute->getName()); 949 else if(attName == "startPhi") << 712 const G4String attValue = Transcode(attribute->getValue()); 950 { << 713 951 parameter.dimension[0] = eval.Evaluate(a << 714 if (attName=="lunit") 952 } << 715 { lunit = G4UnitDefinition::GetValueOf(attValue); } else 953 else if(attName == "openPhi") << 716 if (attName=="aunit") 954 { << 717 { aunit = G4UnitDefinition::GetValueOf(attValue); } else 955 parameter.dimension[1] = eval.Evaluate(a << 718 if (attName=="startPhi") 956 } << 719 { parameter.dimension[0] = eval.Evaluate(attValue); } else 957 else if(attName == "numRZ") << 720 if (attName=="openPhi") 958 { << 721 { parameter.dimension[1] = eval.Evaluate(attValue); } else 959 parameter.dimension[2] = eval.Evaluate(a << 722 if (attName=="numRZ") 960 } << 723 { parameter.dimension[2] = eval.Evaluate(attValue); } else 961 } << 724 if (attName=="numSide") 962 << 725 { parameter.dimension[3] = eval.Evaluate(attValue); } 963 parameter.dimension[0] *= aunit; << 726 } 964 parameter.dimension[1] *= aunit; << 727 965 << 728 parameter.dimension[0] *= aunit; 966 for(xercesc::DOMNode* iter = element->getFir << 729 parameter.dimension[1] *= aunit; 967 iter = iter->getNextSi << 730 968 { << 731 for (xercesc::DOMNode* iter = element->getFirstChild(); 969 if(iter->getNodeType() != xercesc::DOMNode << 732 iter != 0; iter = iter->getNextSibling()) 970 { << 733 { 971 continue; << 734 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) { continue; } 972 } << 735 973 << 736 const xercesc::DOMElement* const child 974 const xercesc::DOMElement* const child = << 737 = dynamic_cast<xercesc::DOMElement*>(iter); 975 dynamic_cast<xercesc::DOMElement*>(iter) << 738 if (!child) 976 if(child == nullptr) << 739 { 977 { << 740 G4Exception("G4GDMLReadParamvo::PolyhedraRead()", 978 G4Exception("G4GDMLReadParamVol::Polycon << 741 "InvalidRead", FatalException, "No child found!"); 979 "InvalidRead", FatalExceptio << 742 return; 980 return; << 743 } 981 } << 744 const G4String tag = Transcode(child->getTagName()); 982 const G4String tag = Transcode(child->getT << 745 983 << 746 if (tag=="zplane") { zplaneList.push_back(ZplaneRead(child)); } 984 if(tag == "zplane") << 747 } 985 { << 748 986 zplaneList.push_back(ZplaneRead(child)); << 749 G4int numZPlanes = zplaneList.size(); 987 } << 750 for (G4int i=0; i<numZPlanes; i++) 988 } << 751 { 989 << 752 parameter.dimension[4+i*3] = zplaneList[i].rmin*lunit; 990 std::size_t numZPlanes = zplaneList.size(); << 753 parameter.dimension[5+i*3] = zplaneList[i].rmax*lunit; 991 for(std::size_t i = 0; i < numZPlanes; ++i) << 754 parameter.dimension[6+i*3] = zplaneList[i].z*lunit; 992 { << 755 } 993 parameter.dimension[3 + i * 3] = zplaneLis << 756 } 994 parameter.dimension[4 + i * 3] = zplaneLis << 757 995 parameter.dimension[5 + i * 3] = zplaneLis << 758 void G4GDMLReadParamvol:: 996 } << 759 ParametersRead(const xercesc::DOMElement* const element) 997 } << 760 { 998 << 761 G4ThreeVector rotation(0.0,0.0,0.0); 999 // ------------------------------------------- << 762 G4ThreeVector position(0.0,0.0,0.0); 1000 void G4GDMLReadParamvol::Polyhedra_dimensions << 763 1001 const xercesc::DOMElement* const element, << 764 G4GDMLParameterisation::PARAMETER parameter; 1002 G4GDMLParameterisation::PARAMETER& paramete << 765 1003 { << 766 for (xercesc::DOMNode* iter = element->getFirstChild(); 1004 G4double lunit = 1.0; << 767 iter != 0; iter = iter->getNextSibling()) 1005 G4double aunit = 1.0; << 768 { 1006 << 769 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) { continue; } 1007 std::vector<zplaneType> zplaneList; << 770 1008 << 771 const xercesc::DOMElement* const child 1009 const xercesc::DOMNamedNodeMap* const attri << 772 = dynamic_cast<xercesc::DOMElement*>(iter); 1010 XMLSize_t attributeCount << 773 if (!child) >> 774 { >> 775 G4Exception("G4GDMLReadParamvol::ParametersRead()", >> 776 "InvalidRead", FatalException, "No child found!"); >> 777 return; >> 778 } >> 779 const G4String tag = Transcode(child->getTagName()); >> 780 if (tag=="rotation") { VectorRead(child,rotation); } else >> 781 if (tag=="position") { VectorRead(child,position); } else >> 782 if (tag=="positionref") >> 783 { position = GetPosition(GenerateName(RefRead(child))); } else >> 784 if (tag=="rotationref") >> 785 { rotation = GetRotation(GenerateName(RefRead(child))); } else >> 786 if (tag=="box_dimensions") { Box_dimensionsRead(child,parameter); } else >> 787 if (tag=="trd_dimensions") { Trd_dimensionsRead(child,parameter); } else >> 788 if (tag=="trap_dimensions") { Trap_dimensionsRead(child,parameter); } else >> 789 if (tag=="tube_dimensions") { Tube_dimensionsRead(child,parameter); } else >> 790 if (tag=="cone_dimensions") { Cone_dimensionsRead(child,parameter); } else >> 791 if (tag=="sphere_dimensions") { Sphere_dimensionsRead(child,parameter); } else >> 792 if (tag=="orb_dimensions") { Orb_dimensionsRead(child,parameter); } else >> 793 if (tag=="torus_dimensions") { Torus_dimensionsRead(child,parameter); } else >> 794 if (tag=="ellipsoid_dimensions") { Ellipsoid_dimensionsRead(child,parameter); } else >> 795 if (tag=="para_dimensions") { Para_dimensionsRead(child,parameter); } else >> 796 if (tag=="polycone_dimensions") { Polycone_dimensionsRead(child,parameter); } else >> 797 if (tag=="polyhedra_dimensions") { Polyhedra_dimensionsRead(child,parameter); } else >> 798 if (tag=="hype_dimensions") { Hype_dimensionsRead(child,parameter); } >> 799 else >> 800 { >> 801 G4String error_msg = "Unknown tag in parameters: " + tag; >> 802 G4Exception("G4GDMLReadParamvol::ParametersRead()", "ReadError", >> 803 FatalException, error_msg); >> 804 } >> 805 } >> 806 >> 807 parameter.pRot = new G4RotationMatrix(); >> 808 >> 809 parameter.pRot->rotateX(rotation.x()); >> 810 parameter.pRot->rotateY(rotation.y()); >> 811 parameter.pRot->rotateZ(rotation.z()); >> 812 >> 813 parameter.position = position; >> 814 >> 815 parameterisation->AddParameter(parameter); >> 816 } >> 817 >> 818 void G4GDMLReadParamvol:: >> 819 ParameterisedRead(const xercesc::DOMElement* const element) >> 820 { >> 821 for (xercesc::DOMNode* iter = element->getFirstChild(); >> 822 iter != 0; iter = iter->getNextSibling()) >> 823 { >> 824 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) { continue; } >> 825 >> 826 const xercesc::DOMElement* const child >> 827 = dynamic_cast<xercesc::DOMElement*>(iter); >> 828 if (!child) >> 829 { >> 830 G4Exception("G4GDMLReadParamvol::ParameterisedRead()", >> 831 "InvalidRead", FatalException, "No child found!"); >> 832 return; >> 833 } >> 834 const G4String tag = Transcode(child->getTagName()); >> 835 >> 836 if (tag=="parameters") >> 837 { >> 838 const xercesc::DOMNamedNodeMap* const attributes >> 839 = element->getAttributes(); >> 840 XMLSize_t attributeCount = attributes->getLength(); >> 841 for (XMLSize_t attribute_index=0; >> 842 attribute_index<attributeCount; attribute_index++) >> 843 { >> 844 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 1011 845 1012 for(XMLSize_t attribute_index = 0; attribut << 846 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 1013 ++attribute_index) << 847 { continue; } 1014 { << 1015 xercesc::DOMNode* attribute_node = attrib << 1016 << 1017 if(attribute_node->getNodeType() != xerce << 1018 { << 1019 continue; << 1020 } << 1021 848 1022 const xercesc::DOMAttr* const attribute = << 849 const xercesc::DOMAttr* const attribute 1023 dynamic_cast<xercesc::DOMAttr*>(attribu << 850 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 1024 if(attribute == nullptr) << 851 if (!attribute) 1025 { << 852 { 1026 G4Exception("G4GDMLReadParamvol::Polyco << 853 G4Exception("G4GDMLReadParamvol::ParameterisedRead()", 1027 "InvalidRead", FatalExcepti << 854 "InvalidRead", FatalException, "No attribute found!"); 1028 return; << 855 return; 1029 } << 856 } 1030 const G4String attName = Transcode(attri << 857 const G4String attName = Transcode(attribute->getName()); 1031 const G4String attValue = Transcode(attri << 858 const G4String attValue = Transcode(attribute->getValue()); 1032 859 1033 if(attName == "lunit") << 860 if (attName=="number") { eval.Evaluate(attValue); } 1034 { << 861 } 1035 lunit = G4UnitDefinition::GetValueOf(at << 862 ParametersRead(child); 1036 if(G4UnitDefinition::GetCategory(attVal << 1037 { << 1038 G4Exception("G4GDMLReadParamvol::Poly << 1039 "InvalidRead", FatalExcep << 1040 } 863 } 1041 } << 864 else 1042 else if(attName == "aunit") << 1043 { << 1044 aunit = G4UnitDefinition::GetValueOf(at << 1045 if(G4UnitDefinition::GetCategory(attVal << 1046 { 865 { 1047 G4Exception("G4GDMLReadParamvol::Poly << 866 if (tag=="loop") { LoopRead(child,&G4GDMLRead::Paramvol_contentRead); } 1048 "InvalidRead", FatalExcep << 1049 } 867 } 1050 } 868 } 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 } 869 } 1104 870 1105 // ------------------------------------------ << 871 void G4GDMLReadParamvol:: 1106 void G4GDMLReadParamvol::ParametersRead( << 872 Paramvol_contentRead(const xercesc::DOMElement* const element) 1107 const xercesc::DOMElement* const element) << 1108 { 873 { 1109 G4ThreeVector rotation(0.0, 0.0, 0.0); << 874 for (xercesc::DOMNode* iter = element->getFirstChild(); 1110 G4ThreeVector position(0.0, 0.0, 0.0); << 875 iter != 0; iter = iter->getNextSibling()) 1111 << 876 { 1112 G4GDMLParameterisation::PARAMETER parameter << 877 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) { continue; } 1113 878 1114 for(xercesc::DOMNode* iter = element->getFi << 879 const xercesc::DOMElement* const child 1115 iter = iter->getNextS << 880 = dynamic_cast<xercesc::DOMElement*>(iter); 1116 { << 881 if (!child) 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 } << 1217 << 1218 // ------------------------------------------ << 1219 void G4GDMLReadParamvol::ParameterisedRead( << 1220 const xercesc::DOMElement* const element) << 1221 { << 1222 for(xercesc::DOMNode* iter = element->getFi << 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 { 882 { 1248 xercesc::DOMNode* attribute_node = at << 883 G4Exception("G4GDMLReadParamvol::Paramvol_contentRead()", "InvalidRead", 1249 << 884 FatalException, "No child found!"); 1250 if(attribute_node->getNodeType() != x << 885 return; 1251 { << 1252 continue; << 1253 } << 1254 << 1255 const xercesc::DOMAttr* const attribu << 1256 dynamic_cast<xercesc::DOMAttr*>(att << 1257 if(attribute == nullptr) << 1258 { << 1259 G4Exception("G4GDMLReadParamvol::Pa << 1260 FatalException, "No att << 1261 return; << 1262 } << 1263 const G4String attName = Transcode(a << 1264 const G4String attValue = Transcode(a << 1265 << 1266 if(attName == "number") << 1267 { << 1268 eval.Evaluate(attValue); << 1269 } << 1270 } << 1271 ParametersRead(child); << 1272 } << 1273 else << 1274 { << 1275 if(tag == "loop") << 1276 { << 1277 LoopRead(child, &G4GDMLRead::Paramvol << 1278 } 886 } >> 887 const G4String tag = Transcode(child->getTagName()); >> 888 if (tag=="parameterised_position_size") { ParameterisedRead(child); }else >> 889 if (tag=="loop") { LoopRead(child,&G4GDMLRead::Paramvol_contentRead); } 1279 } 890 } 1280 } << 1281 } 891 } 1282 892 1283 // ------------------------------------------ << 893 void G4GDMLReadParamvol:: 1284 void G4GDMLReadParamvol::Paramvol_contentRead << 894 ParamvolRead(const xercesc::DOMElement* const element, G4LogicalVolume* mother) 1285 const xercesc::DOMElement* const element) << 1286 { 895 { 1287 for(xercesc::DOMNode* iter = element->getFi << 896 G4String volumeref; 1288 iter = iter->getNextS << 1289 { << 1290 if(iter->getNodeType() != xercesc::DOMNod << 1291 { << 1292 continue; << 1293 } << 1294 897 1295 const xercesc::DOMElement* const child = << 898 parameterisation = new G4GDMLParameterisation(); 1296 dynamic_cast<xercesc::DOMElement*>(iter << 899 for (xercesc::DOMNode* iter = element->getFirstChild(); 1297 if(child == nullptr) << 900 iter != 0; iter = iter->getNextSibling()) 1298 { << 901 { 1299 G4Exception("G4GDMLReadParamvol::Paramv << 902 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) { continue; } 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 << 1321 parameterisation = new G4GDMLParameterisati << 1322 for(xercesc::DOMNode* iter = element->getFi << 1323 iter = iter->getNextS << 1324 { << 1325 if(iter->getNodeType() != xercesc::DOMNod << 1326 { << 1327 continue; << 1328 } << 1329 903 1330 const xercesc::DOMElement* const child = << 904 const xercesc::DOMElement* const child 1331 dynamic_cast<xercesc::DOMElement*>(iter << 905 = dynamic_cast<xercesc::DOMElement*>(iter); 1332 if(child == nullptr) << 906 if (!child) 1333 { << 907 { 1334 G4Exception("G4GDMLReadParamvol::Paramv << 908 G4Exception("G4GDMLReadParamvol::ParamvolRead()", "InvalidRead", 1335 FatalException, "No child f << 909 FatalException, "No child found!"); 1336 return; << 910 return; 1337 } << 911 } 1338 const G4String tag = Transcode(child->get << 912 const G4String tag = Transcode(child->getTagName()); 1339 913 1340 if(tag == "volumeref") << 914 if (tag=="volumeref") { volumeref = RefRead(child); } 1341 { << 915 1342 volumeref = RefRead(child); << 916 } 1343 } << 1344 } << 1345 917 1346 Paramvol_contentRead(element); << 918 Paramvol_contentRead(element); 1347 919 1348 G4LogicalVolume* logvol = GetVolume(Generat << 920 G4LogicalVolume* logvol = GetVolume(GenerateName(volumeref)); 1349 921 1350 if(parameterisation->GetSize() == 0) << 922 if (parameterisation->GetSize()==0) 1351 { << 923 { 1352 G4Exception("G4GDMLReadParamvol::Paramvol << 924 G4Exception("G4GDMLReadParamvol::ParamvolRead()", 1353 FatalException, << 925 "ReadError", FatalException, 1354 "No parameters are defined in << 926 "No parameters are defined in parameterised volume!"); 1355 } << 927 } 1356 G4String pv_name = logvol->GetName() + "_pa << 928 G4String pv_name = logvol->GetName() + "_param"; 1357 new G4PVParameterised(pv_name, logvol, moth << 929 new G4PVParameterised(pv_name, logvol, mother, kUndefined, 1358 parameterisation->Get << 930 parameterisation->GetSize(), parameterisation, check); 1359 } 931 } 1360 932