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