#include <G4GDMLReadSolids.hh>
Inheritance diagram for G4GDMLReadSolids:
Public Member Functions | |
G4VSolid * | GetSolid (const G4String &) const |
G4SurfaceProperty * | GetSurfaceProperty (const G4String &) const |
virtual void | SolidsRead (const xercesc::DOMElement *const) |
Protected Member Functions | |
G4GDMLReadSolids () | |
virtual | ~G4GDMLReadSolids () |
void | BooleanRead (const xercesc::DOMElement *const, const BooleanOp) |
void | BoxRead (const xercesc::DOMElement *const) |
void | ConeRead (const xercesc::DOMElement *const) |
void | ElconeRead (const xercesc::DOMElement *const) |
void | EllipsoidRead (const xercesc::DOMElement *const) |
void | EltubeRead (const xercesc::DOMElement *const) |
void | XtruRead (const xercesc::DOMElement *const) |
void | HypeRead (const xercesc::DOMElement *const) |
void | OrbRead (const xercesc::DOMElement *const) |
void | ParaRead (const xercesc::DOMElement *const) |
void | ParaboloidRead (const xercesc::DOMElement *const) |
void | PolyconeRead (const xercesc::DOMElement *const) |
void | PolyhedraRead (const xercesc::DOMElement *const) |
G4QuadrangularFacet * | QuadrangularRead (const xercesc::DOMElement *const) |
void | ReflectedSolidRead (const xercesc::DOMElement *const) |
G4ExtrudedSolid::ZSection | SectionRead (const xercesc::DOMElement *const, G4double) |
void | SphereRead (const xercesc::DOMElement *const) |
void | TessellatedRead (const xercesc::DOMElement *const) |
void | TetRead (const xercesc::DOMElement *const) |
void | TorusRead (const xercesc::DOMElement *const) |
void | GenTrapRead (const xercesc::DOMElement *const) |
void | TrapRead (const xercesc::DOMElement *const) |
void | TrdRead (const xercesc::DOMElement *const) |
void | TubeRead (const xercesc::DOMElement *const) |
void | CutTubeRead (const xercesc::DOMElement *const) |
void | TwistedboxRead (const xercesc::DOMElement *const) |
void | TwistedtrapRead (const xercesc::DOMElement *const) |
void | TwistedtrdRead (const xercesc::DOMElement *const) |
void | TwistedtubsRead (const xercesc::DOMElement *const) |
G4TriangularFacet * | TriangularRead (const xercesc::DOMElement *const) |
G4TwoVector | TwoDimVertexRead (const xercesc::DOMElement *const, G4double) |
zplaneType | ZplaneRead (const xercesc::DOMElement *const) |
void | OpticalSurfaceRead (const xercesc::DOMElement *const) |
Data Structures | |
struct | zplaneType |
Definition at line 52 of file G4GDMLReadSolids.hh.
G4GDMLReadSolids::G4GDMLReadSolids | ( | ) | [protected] |
G4GDMLReadSolids::~G4GDMLReadSolids | ( | ) | [protected, virtual] |
void G4GDMLReadSolids::BooleanRead | ( | const xercesc::DOMElement * | const, | |
const | BooleanOp | |||
) | [protected] |
Definition at line 80 of file G4GDMLReadSolids.cc.
References FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4GDMLReadDefine::GetPosition(), G4GDMLReadDefine::GetRotation(), G4GDMLReadDefine::GetRotationMatrix(), GetSolid(), position, G4GDMLReadDefine::RefRead(), G4GDMLRead::Transcode(), and G4GDMLReadDefine::VectorRead().
Referenced by SolidsRead().
00081 { 00082 G4String name; 00083 G4String first; 00084 G4String scnd; 00085 G4ThreeVector position(0.0,0.0,0.0); 00086 G4ThreeVector rotation(0.0,0.0,0.0); 00087 G4ThreeVector firstposition(0.0,0.0,0.0); 00088 G4ThreeVector firstrotation(0.0,0.0,0.0); 00089 00090 const xercesc::DOMNamedNodeMap* const attributes 00091 = booleanElement->getAttributes(); 00092 XMLSize_t attributeCount = attributes->getLength(); 00093 00094 for (XMLSize_t attribute_index=0; 00095 attribute_index<attributeCount; attribute_index++) 00096 { 00097 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 00098 00099 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 00100 { continue; } 00101 00102 const xercesc::DOMAttr* const attribute 00103 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 00104 if (!attribute) 00105 { 00106 G4Exception("G4GDMLReadSolids::BooleanRead()", 00107 "InvalidRead", FatalException, "No attribute found!"); 00108 return; 00109 } 00110 const G4String attName = Transcode(attribute->getName()); 00111 const G4String attValue = Transcode(attribute->getValue()); 00112 00113 if (attName=="name") { name = GenerateName(attValue); } 00114 } 00115 00116 for (xercesc::DOMNode* iter = booleanElement->getFirstChild(); 00117 iter != 0;iter = iter->getNextSibling()) 00118 { 00119 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) { continue; } 00120 00121 const xercesc::DOMElement* const child 00122 = dynamic_cast<xercesc::DOMElement*>(iter); 00123 if (!child) 00124 { 00125 G4Exception("G4GDMLReadSolids::BooleanRead()", 00126 "InvalidRead", FatalException, "No child found!"); 00127 return; 00128 } 00129 const G4String tag = Transcode(child->getTagName()); 00130 00131 if (tag=="first") { first = RefRead(child); } else 00132 if (tag=="second") { scnd = RefRead(child); } else 00133 if (tag=="position") { VectorRead(child,position); } else 00134 if (tag=="rotation") { VectorRead(child,rotation); } else 00135 if (tag=="positionref") 00136 { position = GetPosition(GenerateName(RefRead(child))); } else 00137 if (tag=="rotationref") 00138 { rotation = GetRotation(GenerateName(RefRead(child))); } else 00139 if (tag=="firstposition") { VectorRead(child,firstposition); } else 00140 if (tag=="firstrotation") { VectorRead(child,firstrotation); } else 00141 if (tag=="firstpositionref") 00142 { firstposition = GetPosition(GenerateName(RefRead(child))); } else 00143 if (tag=="firstrotationref") 00144 { firstrotation = GetRotation(GenerateName(RefRead(child))); } 00145 else 00146 { 00147 G4String error_msg = "Unknown tag in boolean solid: " + tag; 00148 G4Exception("G4GDMLReadSolids::BooleanRead()", "ReadError", 00149 FatalException, error_msg); 00150 } 00151 } 00152 00153 G4VSolid* firstSolid = GetSolid(GenerateName(first)); 00154 G4VSolid* secondSolid = GetSolid(GenerateName(scnd)); 00155 00156 G4Transform3D transform(GetRotationMatrix(rotation),position); 00157 00158 if (( (firstrotation.x()!=0.0) || (firstrotation.y()!=0.0) 00159 || (firstrotation.z()!=0.0)) 00160 || ( (firstposition.x()!=0.0) || (firstposition.y()!=0.0) 00161 || (firstposition.z()!=0.0))) 00162 { 00163 G4Transform3D firsttransform(GetRotationMatrix(firstrotation), 00164 firstposition); 00165 firstSolid = new G4DisplacedSolid(GenerateName("displaced_"+first), 00166 firstSolid, firsttransform); 00167 } 00168 00169 if (op==UNION) 00170 { new G4UnionSolid(name,firstSolid,secondSolid,transform); } else 00171 if (op==SUBTRACTION) 00172 { new G4SubtractionSolid(name,firstSolid,secondSolid,transform); } else 00173 if (op==INTERSECTION) 00174 { new G4IntersectionSolid(name,firstSolid,secondSolid,transform); } 00175 }
void G4GDMLReadSolids::BoxRead | ( | const xercesc::DOMElement * | const | ) | [protected] |
Definition at line 177 of file G4GDMLReadSolids.cc.
References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), and G4GDMLRead::Transcode().
Referenced by SolidsRead().
00178 { 00179 G4String name; 00180 G4double lunit = 1.0; 00181 G4double x = 0.0; 00182 G4double y = 0.0; 00183 G4double z = 0.0; 00184 00185 const xercesc::DOMNamedNodeMap* const attributes 00186 = boxElement->getAttributes(); 00187 XMLSize_t attributeCount = attributes->getLength(); 00188 00189 for (XMLSize_t attribute_index=0; 00190 attribute_index<attributeCount; attribute_index++) 00191 { 00192 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 00193 00194 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 00195 { continue; } 00196 00197 const xercesc::DOMAttr* const attribute 00198 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 00199 if (!attribute) 00200 { 00201 G4Exception("G4GDMLReadSolids::BoxRead()", 00202 "InvalidRead", FatalException, "No attribute found!"); 00203 return; 00204 } 00205 const G4String attName = Transcode(attribute->getName()); 00206 const G4String attValue = Transcode(attribute->getValue()); 00207 00208 if (attName=="name") { name = GenerateName(attValue); } else 00209 if (attName=="lunit") { lunit = eval.Evaluate(attValue); } else 00210 if (attName=="x") { x = eval.Evaluate(attValue); } else 00211 if (attName=="y") { y = eval.Evaluate(attValue); } else 00212 if (attName=="z") { z = eval.Evaluate(attValue); } 00213 } 00214 00215 x *= 0.5*lunit; 00216 y *= 0.5*lunit; 00217 z *= 0.5*lunit; 00218 00219 new G4Box(name,x,y,z); 00220 }
void G4GDMLReadSolids::ConeRead | ( | const xercesc::DOMElement * | const | ) | [protected] |
Definition at line 222 of file G4GDMLReadSolids.cc.
References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), and G4GDMLRead::Transcode().
Referenced by SolidsRead().
00223 { 00224 G4String name; 00225 G4double lunit = 1.0; 00226 G4double aunit = 1.0; 00227 G4double rmin1 = 0.0; 00228 G4double rmax1 = 0.0; 00229 G4double rmin2 = 0.0; 00230 G4double rmax2 = 0.0; 00231 G4double z = 0.0; 00232 G4double startphi = 0.0; 00233 G4double deltaphi = 0.0; 00234 00235 const xercesc::DOMNamedNodeMap* const attributes 00236 = coneElement->getAttributes(); 00237 XMLSize_t attributeCount = attributes->getLength(); 00238 00239 for (XMLSize_t attribute_index=0; 00240 attribute_index<attributeCount; attribute_index++) 00241 { 00242 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 00243 00244 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 00245 { continue; } 00246 00247 const xercesc::DOMAttr* const attribute 00248 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 00249 if (!attribute) 00250 { 00251 G4Exception("G4GDMLReadSolids::ConeRead()", 00252 "InvalidRead", FatalException, "No attribute found!"); 00253 return; 00254 } 00255 const G4String attName = Transcode(attribute->getName()); 00256 const G4String attValue = Transcode(attribute->getValue()); 00257 00258 if (attName=="name") { name = GenerateName(attValue); } else 00259 if (attName=="lunit") { lunit = eval.Evaluate(attValue); } else 00260 if (attName=="aunit") { aunit = eval.Evaluate(attValue); } else 00261 if (attName=="rmin1") { rmin1 = eval.Evaluate(attValue); } else 00262 if (attName=="rmax1") { rmax1 = eval.Evaluate(attValue); } else 00263 if (attName=="rmin2") { rmin2 = eval.Evaluate(attValue); } else 00264 if (attName=="rmax2") { rmax2 = eval.Evaluate(attValue); } else 00265 if (attName=="z") { z = eval.Evaluate(attValue); } else 00266 if (attName=="startphi") { startphi = eval.Evaluate(attValue); } else 00267 if (attName=="deltaphi") { deltaphi = eval.Evaluate(attValue); } 00268 } 00269 00270 rmin1 *= lunit; 00271 rmax1 *= lunit; 00272 rmin2 *= lunit; 00273 rmax2 *= lunit; 00274 z *= 0.5*lunit; 00275 startphi *= aunit; 00276 deltaphi *= aunit; 00277 00278 new G4Cons(name,rmin1,rmax1,rmin2,rmax2,z,startphi,deltaphi); 00279 }
void G4GDMLReadSolids::CutTubeRead | ( | const xercesc::DOMElement * | const | ) | [protected] |
Definition at line 1496 of file G4GDMLReadSolids.cc.
References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), and G4GDMLRead::Transcode().
Referenced by SolidsRead().
01497 { 01498 G4String name; 01499 G4double lunit = 1.0; 01500 G4double aunit = 1.0; 01501 G4double rmin = 0.0; 01502 G4double rmax = 0.0; 01503 G4double z = 0.0; 01504 G4double startphi = 0.0; 01505 G4double deltaphi = 0.0; 01506 G4ThreeVector lowNorm(0); 01507 G4ThreeVector highNorm(0); 01508 01509 const xercesc::DOMNamedNodeMap* const attributes 01510 = cuttubeElement->getAttributes(); 01511 XMLSize_t attributeCount = attributes->getLength(); 01512 01513 for (XMLSize_t attribute_index=0; 01514 attribute_index<attributeCount; attribute_index++) 01515 { 01516 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 01517 01518 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 01519 { continue; } 01520 01521 const xercesc::DOMAttr* const attribute 01522 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 01523 if (!attribute) 01524 { 01525 G4Exception("G4GDMLReadSolids::CutTubeRead()", 01526 "InvalidRead", FatalException, "No attribute found!"); 01527 return; 01528 } 01529 const G4String attName = Transcode(attribute->getName()); 01530 const G4String attValue = Transcode(attribute->getValue()); 01531 01532 if (attName=="name") { name = GenerateName(attValue); } else 01533 if (attName=="lunit") { lunit = eval.Evaluate(attValue); } else 01534 if (attName=="aunit") { aunit = eval.Evaluate(attValue); } else 01535 if (attName=="rmin") { rmin = eval.Evaluate(attValue); } else 01536 if (attName=="rmax") { rmax = eval.Evaluate(attValue); } else 01537 if (attName=="z") { z = eval.Evaluate(attValue); } else 01538 if (attName=="startphi") { startphi = eval.Evaluate(attValue); } else 01539 if (attName=="deltaphi") { deltaphi = eval.Evaluate(attValue); } else 01540 if (attName=="lowX") { lowNorm.setX (eval.Evaluate(attValue)); } else 01541 if (attName=="lowY") { lowNorm.setY (eval.Evaluate(attValue)); } else 01542 if (attName=="lowZ") { lowNorm.setZ (eval.Evaluate(attValue)); } else 01543 if (attName=="highX") { highNorm.setX (eval.Evaluate(attValue)); } else 01544 if (attName=="highY") { highNorm.setY (eval.Evaluate(attValue)); } else 01545 if (attName=="highZ") { highNorm.setZ (eval.Evaluate(attValue)); } 01546 01547 } 01548 01549 rmin *= lunit; 01550 rmax *= lunit; 01551 z *= 0.5*lunit; 01552 startphi *= aunit; 01553 deltaphi *= aunit; 01554 01555 new G4CutTubs(name,rmin,rmax,z,startphi,deltaphi,lowNorm,highNorm); 01556 }
void G4GDMLReadSolids::ElconeRead | ( | const xercesc::DOMElement * | const | ) | [protected] |
Definition at line 282 of file G4GDMLReadSolids.cc.
References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), and G4GDMLRead::Transcode().
Referenced by SolidsRead().
00283 { 00284 G4String name; 00285 G4double lunit = 1.0; 00286 G4double dx = 0.0; 00287 G4double dy = 0.0; 00288 G4double zmax = 0.0; 00289 G4double zcut = 0.0; 00290 00291 const xercesc::DOMNamedNodeMap* const attributes 00292 = elconeElement->getAttributes(); 00293 XMLSize_t attributeCount = attributes->getLength(); 00294 00295 for (XMLSize_t attribute_index=0; 00296 attribute_index<attributeCount; attribute_index++) 00297 { 00298 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 00299 00300 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 00301 { continue; } 00302 00303 const xercesc::DOMAttr* const attribute 00304 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 00305 if (!attribute) 00306 { 00307 G4Exception("G4GDMLReadSolids::ElconeRead()", 00308 "InvalidRead", FatalException, "No attribute found!"); 00309 return; 00310 } 00311 const G4String attName = Transcode(attribute->getName()); 00312 const G4String attValue = Transcode(attribute->getValue()); 00313 00314 if (attName=="name") { name = GenerateName(attValue); } else 00315 if (attName=="lunit") { lunit = eval.Evaluate(attValue); } else 00316 if (attName=="dx") { dx = eval.Evaluate(attValue); } else 00317 if (attName=="dy") { dy = eval.Evaluate(attValue); } else 00318 if (attName=="zmax") { zmax = eval.Evaluate(attValue); } else 00319 if (attName=="zcut") { zcut = eval.Evaluate(attValue); } 00320 } 00321 00322 zmax *= lunit; 00323 zcut *= lunit; 00324 00325 new G4EllipticalCone(name,dx,dy,zmax,zcut); 00326 }
void G4GDMLReadSolids::EllipsoidRead | ( | const xercesc::DOMElement * | const | ) | [protected] |
Definition at line 329 of file G4GDMLReadSolids.cc.
References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), and G4GDMLRead::Transcode().
Referenced by SolidsRead().
00330 { 00331 G4String name; 00332 G4double lunit = 1.0; 00333 G4double ax = 0.0; 00334 G4double by = 0.0; 00335 G4double cz = 0.0; 00336 G4double zcut1 = 0.0; 00337 G4double zcut2 = 0.0; 00338 00339 const xercesc::DOMNamedNodeMap* const attributes 00340 = ellipsoidElement->getAttributes(); 00341 XMLSize_t attributeCount = attributes->getLength(); 00342 00343 for (XMLSize_t attribute_index=0; 00344 attribute_index<attributeCount; attribute_index++) 00345 { 00346 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 00347 00348 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 00349 { continue; } 00350 00351 const xercesc::DOMAttr* const attribute 00352 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 00353 if (!attribute) 00354 { 00355 G4Exception("G4GDMLReadSolids::EllipsoidRead()", 00356 "InvalidRead", FatalException, "No attribute found!"); 00357 return; 00358 } 00359 const G4String attName = Transcode(attribute->getName()); 00360 const G4String attValue = Transcode(attribute->getValue()); 00361 00362 if (attName=="name") { name = GenerateName(attValue); } else 00363 if (attName=="lunit") { lunit = eval.Evaluate(attValue); } else 00364 if (attName=="ax") { ax = eval.Evaluate(attValue); } else 00365 if (attName=="by") { by = eval.Evaluate(attValue); } else 00366 if (attName=="cz") { cz = eval.Evaluate(attValue); } else 00367 if (attName=="zcut1") { zcut1 = eval.Evaluate(attValue); } else 00368 if (attName=="zcut2") { zcut2 = eval.Evaluate(attValue); } 00369 } 00370 00371 ax *= lunit; 00372 by *= lunit; 00373 cz *= lunit; 00374 zcut1 *= lunit; 00375 zcut2 *= lunit; 00376 00377 new G4Ellipsoid(name,ax,by,cz,zcut1,zcut2); 00378 }
void G4GDMLReadSolids::EltubeRead | ( | const xercesc::DOMElement * | const | ) | [protected] |
Definition at line 381 of file G4GDMLReadSolids.cc.
References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), and G4GDMLRead::Transcode().
Referenced by SolidsRead().
00382 { 00383 G4String name; 00384 G4double lunit = 1.0; 00385 G4double dx = 0.0; 00386 G4double dy = 0.0; 00387 G4double dz = 0.0; 00388 00389 const xercesc::DOMNamedNodeMap* const attributes 00390 = eltubeElement->getAttributes(); 00391 XMLSize_t attributeCount = attributes->getLength(); 00392 00393 for (XMLSize_t attribute_index=0; 00394 attribute_index<attributeCount; attribute_index++) 00395 { 00396 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 00397 00398 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 00399 { continue; } 00400 00401 const xercesc::DOMAttr* const attribute 00402 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 00403 if (!attribute) 00404 { 00405 G4Exception("G4GDMLReadSolids::EltubeRead()", 00406 "InvalidRead", FatalException, "No attribute found!"); 00407 return; 00408 } 00409 const G4String attName = Transcode(attribute->getName()); 00410 const G4String attValue = Transcode(attribute->getValue()); 00411 00412 if (attName=="name") { name = GenerateName(attValue); } else 00413 if (attName=="lunit") { lunit = eval.Evaluate(attValue); } else 00414 if (attName=="dx") { dx = eval.Evaluate(attValue); } else 00415 if (attName=="dy") { dy = eval.Evaluate(attValue); } else 00416 if (attName=="dz") { dz = eval.Evaluate(attValue); } 00417 } 00418 00419 dx *= lunit; 00420 dy *= lunit; 00421 dz *= lunit; 00422 00423 new G4EllipticalTube(name,dx,dy,dz); 00424 }
void G4GDMLReadSolids::GenTrapRead | ( | const xercesc::DOMElement * | const | ) | [protected] |
Definition at line 1209 of file G4GDMLReadSolids.cc.
References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), and G4GDMLRead::Transcode().
Referenced by SolidsRead().
01210 { 01211 G4String name; 01212 G4double lunit = 1.0; 01213 G4double dz =0.0; 01214 G4double v1x=0.0, v1y=0.0, v2x=0.0, v2y=0.0, v3x=0.0, v3y=0.0, 01215 v4x=0.0, v4y=0.0, v5x=0.0, v5y=0.0, v6x=0.0, v6y=0.0, 01216 v7x=0.0, v7y=0.0, v8x=0.0, v8y=0.0; 01217 01218 const xercesc::DOMNamedNodeMap* const attributes 01219 = gtrapElement->getAttributes(); 01220 XMLSize_t attributeCount = attributes->getLength(); 01221 01222 for (XMLSize_t attribute_index=0; 01223 attribute_index<attributeCount; attribute_index++) 01224 { 01225 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 01226 01227 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 01228 { continue; } 01229 01230 const xercesc::DOMAttr* const attribute 01231 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 01232 if (!attribute) 01233 { 01234 G4Exception("G4GDMLReadSolids::GenTrapRead()", 01235 "InvalidRead", FatalException, "No attribute found!"); 01236 return; 01237 } 01238 const G4String attName = Transcode(attribute->getName()); 01239 const G4String attValue = Transcode(attribute->getValue()); 01240 01241 if (attName=="name") { name = GenerateName(attValue); } else 01242 if (attName=="lunit") { lunit = eval.Evaluate(attValue); } else 01243 if (attName=="dz") { dz = eval.Evaluate(attValue); } else 01244 if (attName=="v1x") { v1x = eval.Evaluate(attValue); } else 01245 if (attName=="v1y") { v1y = eval.Evaluate(attValue); } else 01246 if (attName=="v2x") { v2x = eval.Evaluate(attValue); } else 01247 if (attName=="v2y") { v2y = eval.Evaluate(attValue); } else 01248 if (attName=="v3x") { v3x = eval.Evaluate(attValue); } else 01249 if (attName=="v3y") { v3y = eval.Evaluate(attValue); } else 01250 if (attName=="v4x") { v4x = eval.Evaluate(attValue); } else 01251 if (attName=="v4y") { v4y = eval.Evaluate(attValue); } else 01252 if (attName=="v5x") { v5x = eval.Evaluate(attValue); } else 01253 if (attName=="v5y") { v5y = eval.Evaluate(attValue); } else 01254 if (attName=="v6x") { v6x = eval.Evaluate(attValue); } else 01255 if (attName=="v6y") { v6y = eval.Evaluate(attValue); } else 01256 if (attName=="v7x") { v7x = eval.Evaluate(attValue); } else 01257 if (attName=="v7y") { v7y = eval.Evaluate(attValue); } else 01258 if (attName=="v8x") { v8x = eval.Evaluate(attValue); } else 01259 if (attName=="v8y") { v8y = eval.Evaluate(attValue); } 01260 } 01261 01262 dz *= lunit; 01263 std::vector<G4TwoVector> vertices; 01264 vertices.push_back(G4TwoVector(v1x*lunit,v1y*lunit)); 01265 vertices.push_back(G4TwoVector(v2x*lunit,v2y*lunit)); 01266 vertices.push_back(G4TwoVector(v3x*lunit,v3y*lunit)); 01267 vertices.push_back(G4TwoVector(v4x*lunit,v4y*lunit)); 01268 vertices.push_back(G4TwoVector(v5x*lunit,v5y*lunit)); 01269 vertices.push_back(G4TwoVector(v6x*lunit,v6y*lunit)); 01270 vertices.push_back(G4TwoVector(v7x*lunit,v7y*lunit)); 01271 vertices.push_back(G4TwoVector(v8x*lunit,v8y*lunit)); 01272 new G4GenericTrap(name,dz,vertices); 01273 }
Definition at line 2041 of file G4GDMLReadSolids.cc.
References FatalException, G4Exception(), G4SolidStore::GetInstance(), and G4SolidStore::GetSolid().
Referenced by BooleanRead(), ReflectedSolidRead(), and G4GDMLReadStructure::VolumeRead().
02042 { 02043 G4VSolid* solidPtr = G4SolidStore::GetInstance()->GetSolid(ref,false); 02044 02045 if (!solidPtr) 02046 { 02047 G4String error_msg = "Referenced solid '" + ref + "' was not found!"; 02048 G4Exception("G4GDMLReadSolids::GetSolid()", "ReadError", 02049 FatalException, error_msg); 02050 } 02051 02052 return solidPtr; 02053 }
G4SurfaceProperty * G4GDMLReadSolids::GetSurfaceProperty | ( | const G4String & | ) | const |
Definition at line 2056 of file G4GDMLReadSolids.cc.
References FatalException, G4Exception(), and G4SurfaceProperty::GetSurfacePropertyTable().
Referenced by G4GDMLReadStructure::BorderSurfaceRead(), and G4GDMLReadStructure::SkinSurfaceRead().
02057 { 02058 const G4SurfacePropertyTable* surfaceList 02059 = G4SurfaceProperty::GetSurfacePropertyTable(); 02060 const size_t surfaceCount = surfaceList->size(); 02061 02062 for (size_t i=0; i<surfaceCount; i++) 02063 { 02064 if ((*surfaceList)[i]->GetName() == ref) { return (*surfaceList)[i]; } 02065 } 02066 02067 G4String error_msg = "Referenced optical surface '" + ref + "' was not found!"; 02068 G4Exception("G4GDMLReadSolids::GetSurfaceProperty()", "ReadError", 02069 FatalException, error_msg); 02070 02071 return 0; 02072 }
void G4GDMLReadSolids::HypeRead | ( | const xercesc::DOMElement * | const | ) | [protected] |
Definition at line 485 of file G4GDMLReadSolids.cc.
References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), and G4GDMLRead::Transcode().
Referenced by SolidsRead().
00486 { 00487 G4String name; 00488 G4double lunit = 1.0; 00489 G4double aunit = 1.0; 00490 G4double rmin = 0.0; 00491 G4double rmax = 0.0; 00492 G4double inst = 0.0; 00493 G4double outst = 0.0; 00494 G4double z = 0.0; 00495 00496 const xercesc::DOMNamedNodeMap* const attributes 00497 = hypeElement->getAttributes(); 00498 XMLSize_t attributeCount = attributes->getLength(); 00499 00500 for (XMLSize_t attribute_index=0; 00501 attribute_index<attributeCount; attribute_index++) 00502 { 00503 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 00504 00505 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 00506 { continue; } 00507 00508 const xercesc::DOMAttr* const attribute 00509 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 00510 if (!attribute) 00511 { 00512 G4Exception("G4GDMLReadSolids::HypeRead()", 00513 "InvalidRead", FatalException, "No attribute found!"); 00514 return; 00515 } 00516 const G4String attName = Transcode(attribute->getName()); 00517 const G4String attValue = Transcode(attribute->getValue()); 00518 00519 if (attName=="name") { name = GenerateName(attValue); } else 00520 if (attName=="lunit") { lunit = eval.Evaluate(attValue); } else 00521 if (attName=="aunit") { aunit = eval.Evaluate(attValue); } else 00522 if (attName=="rmin") { rmin = eval.Evaluate(attValue); } else 00523 if (attName=="rmax") { rmax = eval.Evaluate(attValue); } else 00524 if (attName=="inst") { inst = eval.Evaluate(attValue); } else 00525 if (attName=="outst") { outst = eval.Evaluate(attValue); } else 00526 if (attName=="z") { z = eval.Evaluate(attValue); } 00527 } 00528 00529 rmin *= lunit; 00530 rmax *= lunit; 00531 inst *= aunit; 00532 outst *= aunit; 00533 z *= 0.5*lunit; 00534 00535 new G4Hype(name,rmin,rmax,inst,outst,z); 00536 }
void G4GDMLReadSolids::OpticalSurfaceRead | ( | const xercesc::DOMElement * | const | ) | [protected] |
Definition at line 1863 of file G4GDMLReadSolids.cc.
References dielectric_dielectric, dielectric_LUT, dielectric_metal, etchedair, etchedlumirrorair, etchedlumirrorglue, etchedteflonair, etchedtioair, etchedtyvekair, etchedvm2000air, etchedvm2000glue, G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, firsov, G4Exception(), G4GDMLRead::GenerateName(), glisur, ground, groundair, groundbackpainted, groundfrontpainted, groundlumirrorair, groundlumirrorglue, groundteflonair, groundtioair, groundtyvekair, groundvm2000air, groundvm2000glue, LUT, polished, polishedair, polishedbackpainted, polishedfrontpainted, polishedlumirrorair, polishedlumirrorglue, polishedteflonair, polishedtioair, polishedtyvekair, polishedvm2000air, polishedvm2000glue, G4GDMLRead::Transcode(), unified, and x_ray.
Referenced by SolidsRead().
01864 { 01865 G4String name; 01866 G4String smodel; 01867 G4String sfinish; 01868 G4String stype; 01869 G4double value = 0.0; 01870 01871 const xercesc::DOMNamedNodeMap* const attributes 01872 = opticalsurfaceElement->getAttributes(); 01873 XMLSize_t attributeCount = attributes->getLength(); 01874 01875 for (XMLSize_t attribute_index=0; 01876 attribute_index<attributeCount; attribute_index++) 01877 { 01878 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 01879 01880 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 01881 { continue; } 01882 01883 const xercesc::DOMAttr* const attribute 01884 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 01885 if (!attribute) 01886 { 01887 G4Exception("G4GDMLReadSolids::OpticalSurfaceRead()", 01888 "InvalidRead", FatalException, "No attribute found!"); 01889 return; 01890 } 01891 const G4String attName = Transcode(attribute->getName()); 01892 const G4String attValue = Transcode(attribute->getValue()); 01893 01894 if (attName=="name") { name = GenerateName(attValue); } else 01895 if (attName=="model") { smodel = attValue; } else 01896 if (attName=="finish") { sfinish = attValue; } else 01897 if (attName=="type") { stype = attValue; } else 01898 if (attName=="value") { value = eval.Evaluate(attValue); } 01899 } 01900 01901 G4OpticalSurfaceModel model; 01902 G4OpticalSurfaceFinish finish; 01903 G4SurfaceType type; 01904 01905 if ((smodel=="glisur") || (smodel=="0")) { model = glisur; } else 01906 if ((smodel=="unified") || (smodel=="1")) { model = unified; } 01907 else { model = LUT; } 01908 01909 if ((sfinish=="polished") || (sfinish=="0")) 01910 { finish = polished; } else 01911 if ((sfinish=="polishedfrontpainted") || (sfinish=="1")) 01912 { finish = polishedfrontpainted; } else 01913 if ((sfinish=="polishedbackpainted") || (sfinish=="2")) 01914 { finish = polishedbackpainted; } else 01915 if ((sfinish=="ground") || (sfinish=="3")) 01916 { finish = ground; } else 01917 if ((sfinish=="groundfrontpainted") || (sfinish=="4")) 01918 { finish = groundfrontpainted; } else 01919 if ((sfinish=="groundbackpainted") || (sfinish=="5")) 01920 { finish = groundbackpainted; } else 01921 if ((sfinish=="polishedlumirrorair") || (sfinish=="6")) 01922 { finish = polishedlumirrorair; } else 01923 if ((sfinish=="polishedlumirrorglue") || (sfinish=="7")) 01924 { finish = polishedlumirrorglue; } else 01925 if ((sfinish=="polishedair") || (sfinish=="8")) 01926 { finish = polishedair; } else 01927 if ((sfinish=="polishedteflonair") || (sfinish=="9")) 01928 { finish = polishedteflonair; } else 01929 if ((sfinish=="polishedtioair") || (sfinish=="10")) 01930 { finish = polishedtioair; } else 01931 if ((sfinish=="polishedtyvekair") || (sfinish=="11")) 01932 { finish = polishedtyvekair; } else 01933 if ((sfinish=="polishedvm2000air") || (sfinish=="12")) 01934 { finish = polishedvm2000air; } else 01935 if ((sfinish=="polishedvm2000glue") || (sfinish=="13")) 01936 { finish = polishedvm2000glue; } else 01937 if ((sfinish=="etchedlumirrorair") || (sfinish=="14")) 01938 { finish = etchedlumirrorair; } else 01939 if ((sfinish=="etchedlumirrorglue") || (sfinish=="15")) 01940 { finish = etchedlumirrorglue; } else 01941 if ((sfinish=="etchedair") || (sfinish=="16")) 01942 { finish = etchedair; } else 01943 if ((sfinish=="etchedteflonair") || (sfinish=="17")) 01944 { finish = etchedteflonair; } else 01945 if ((sfinish=="etchedtioair") || (sfinish=="18")) 01946 { finish = etchedtioair; } else 01947 if ((sfinish=="etchedtyvekair") || (sfinish=="19")) 01948 { finish = etchedtyvekair; } else 01949 if ((sfinish=="etchedvm2000air") || (sfinish=="20")) 01950 { finish = etchedvm2000air; } else 01951 if ((sfinish=="etchedvm2000glue") || (sfinish=="21")) 01952 { finish = etchedvm2000glue; } else 01953 if ((sfinish=="groundlumirrorair") || (sfinish=="22")) 01954 { finish = groundlumirrorair; } else 01955 if ((sfinish=="groundlumirrorglue") || (sfinish=="23")) 01956 { finish = groundlumirrorglue; } else 01957 if ((sfinish=="groundair") || (sfinish=="24")) 01958 { finish = groundair; } else 01959 if ((sfinish=="groundteflonair") || (sfinish=="25")) 01960 { finish = groundteflonair; } else 01961 if ((sfinish=="groundtioair") || (sfinish=="26")) 01962 { finish = groundtioair; } else 01963 if ((sfinish=="groundtyvekair") || (sfinish=="27")) 01964 { finish = groundtyvekair; } else 01965 if ((sfinish=="groundvm2000air") || (sfinish=="28")) 01966 { finish = groundvm2000air; } 01967 else { finish = groundvm2000glue; } 01968 01969 if ((stype=="dielectric_metal") || (stype=="0")) 01970 { type = dielectric_metal; } else 01971 if ((stype=="dielectric_dielectric") || (stype=="1")) 01972 { type = dielectric_dielectric; } else 01973 if ((stype=="dielectric_LUT") || (stype=="2")) 01974 { type = dielectric_LUT; } else 01975 if ((stype=="firsov") || (stype=="3")) 01976 { type = firsov; } 01977 else { type = x_ray; } 01978 01979 new G4OpticalSurface(name,model,finish,type,value); 01980 }
void G4GDMLReadSolids::OrbRead | ( | const xercesc::DOMElement * | const | ) | [protected] |
Definition at line 538 of file G4GDMLReadSolids.cc.
References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), and G4GDMLRead::Transcode().
Referenced by SolidsRead().
00539 { 00540 G4String name; 00541 G4double lunit = 1.0; 00542 G4double r = 0.0; 00543 00544 const xercesc::DOMNamedNodeMap* const attributes 00545 = orbElement->getAttributes(); 00546 XMLSize_t attributeCount = attributes->getLength(); 00547 00548 for (XMLSize_t attribute_index=0; 00549 attribute_index<attributeCount; attribute_index++) 00550 { 00551 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 00552 00553 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 00554 { continue; } 00555 00556 const xercesc::DOMAttr* const attribute 00557 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 00558 if (!attribute) 00559 { 00560 G4Exception("G4GDMLReadSolids::OrbRead()", 00561 "InvalidRead", FatalException, "No attribute found!"); 00562 return; 00563 } 00564 const G4String attName = Transcode(attribute->getName()); 00565 const G4String attValue = Transcode(attribute->getValue()); 00566 00567 if (attName=="name") { name = GenerateName(attValue); } else 00568 if (attName=="lunit") { lunit = eval.Evaluate(attValue); } else 00569 if (attName=="r") { r = eval.Evaluate(attValue); } 00570 } 00571 00572 r *= lunit; 00573 00574 new G4Orb(name,r); 00575 }
void G4GDMLReadSolids::ParaboloidRead | ( | const xercesc::DOMElement * | const | ) | [protected] |
Definition at line 634 of file G4GDMLReadSolids.cc.
References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), and G4GDMLRead::Transcode().
Referenced by SolidsRead().
00635 { 00636 G4String name; 00637 G4double lunit = 1.0; 00638 G4double rlo = 0.0; 00639 G4double rhi = 0.0; 00640 G4double dz = 0.0; 00641 00642 const xercesc::DOMNamedNodeMap* const attributes 00643 = paraElement->getAttributes(); 00644 XMLSize_t attributeCount = attributes->getLength(); 00645 00646 for (XMLSize_t attribute_index=0; 00647 attribute_index<attributeCount; attribute_index++) 00648 { 00649 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 00650 00651 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 00652 { continue; } 00653 00654 const xercesc::DOMAttr* const attribute 00655 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 00656 if (!attribute) 00657 { 00658 G4Exception("G4GDMLReadSolids::ParaboloidRead()", 00659 "InvalidRead", FatalException, "No attribute found!"); 00660 return; 00661 } 00662 const G4String attName = Transcode(attribute->getName()); 00663 const G4String attValue = Transcode(attribute->getValue()); 00664 00665 if (attName=="name") { name = GenerateName(attValue); } else 00666 if (attName=="lunit") { lunit = eval.Evaluate(attValue); } else 00667 if (attName=="rlo") { rlo = eval.Evaluate(attValue); } else 00668 if (attName=="rhi") { rhi = eval.Evaluate(attValue); } else 00669 if (attName=="dz") { dz = eval.Evaluate(attValue); } 00670 } 00671 00672 rlo *= 1.*lunit; 00673 rhi *= 1.*lunit; 00674 dz *= 1.*lunit; 00675 00676 new G4Paraboloid(name,dz,rlo,rhi); 00677 }
void G4GDMLReadSolids::ParaRead | ( | const xercesc::DOMElement * | const | ) | [protected] |
Definition at line 577 of file G4GDMLReadSolids.cc.
References G4InuclParticleNames::alpha, G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), and G4GDMLRead::Transcode().
Referenced by SolidsRead().
00578 { 00579 G4String name; 00580 G4double lunit = 1.0; 00581 G4double aunit = 1.0; 00582 G4double x = 0.0; 00583 G4double y = 0.0; 00584 G4double z = 0.0; 00585 G4double alpha = 0.0; 00586 G4double theta = 0.0; 00587 G4double phi = 0.0; 00588 00589 const xercesc::DOMNamedNodeMap* const attributes 00590 = paraElement->getAttributes(); 00591 XMLSize_t attributeCount = attributes->getLength(); 00592 00593 for (XMLSize_t attribute_index=0; 00594 attribute_index<attributeCount; attribute_index++) 00595 { 00596 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 00597 00598 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 00599 { continue; } 00600 00601 const xercesc::DOMAttr* const attribute 00602 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 00603 if (!attribute) 00604 { 00605 G4Exception("G4GDMLReadSolids::ParaRead()", 00606 "InvalidRead", FatalException, "No attribute found!"); 00607 return; 00608 } 00609 const G4String attName = Transcode(attribute->getName()); 00610 const G4String attValue = Transcode(attribute->getValue()); 00611 00612 if (attName=="name") { name = GenerateName(attValue); } else 00613 if (attName=="lunit") { lunit = eval.Evaluate(attValue); } else 00614 if (attName=="aunit") { aunit = eval.Evaluate(attValue); } else 00615 if (attName=="x") { x = eval.Evaluate(attValue); } else 00616 if (attName=="y") { y = eval.Evaluate(attValue); } else 00617 if (attName=="z") { z = eval.Evaluate(attValue); } else 00618 if (attName=="alpha") { alpha = eval.Evaluate(attValue); } else 00619 if (attName=="theta") { theta = eval.Evaluate(attValue); } else 00620 if (attName=="phi") { phi = eval.Evaluate(attValue); } 00621 } 00622 00623 x *= 0.5*lunit; 00624 y *= 0.5*lunit; 00625 z *= 0.5*lunit; 00626 alpha *= aunit; 00627 theta *= aunit; 00628 phi *= aunit; 00629 00630 new G4Para(name,x,y,z,alpha,theta,phi); 00631 }
void G4GDMLReadSolids::PolyconeRead | ( | const xercesc::DOMElement * | const | ) | [protected] |
Definition at line 680 of file G4GDMLReadSolids.cc.
References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4GDMLRead::Transcode(), and ZplaneRead().
Referenced by SolidsRead().
00681 { 00682 G4String name; 00683 G4double lunit = 1.0; 00684 G4double aunit = 1.0; 00685 G4double startphi = 0.0; 00686 G4double deltaphi = 0.0; 00687 00688 const xercesc::DOMNamedNodeMap* const attributes 00689 = polyconeElement->getAttributes(); 00690 XMLSize_t attributeCount = attributes->getLength(); 00691 00692 for (XMLSize_t attribute_index=0; 00693 attribute_index<attributeCount; attribute_index++) 00694 { 00695 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 00696 00697 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 00698 { continue; } 00699 00700 const xercesc::DOMAttr* const attribute 00701 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 00702 if (!attribute) 00703 { 00704 G4Exception("G4GDMLReadSolids::PolyconeRead()", 00705 "InvalidRead", FatalException, "No attribute found!"); 00706 return; 00707 } 00708 const G4String attName = Transcode(attribute->getName()); 00709 const G4String attValue = Transcode(attribute->getValue()); 00710 00711 if (attName=="name") { name = GenerateName(attValue); } else 00712 if (attName=="lunit") { lunit = eval.Evaluate(attValue); } else 00713 if (attName=="aunit") { aunit = eval.Evaluate(attValue); } else 00714 if (attName=="startphi") { startphi = eval.Evaluate(attValue); }else 00715 if (attName=="deltaphi") { deltaphi = eval.Evaluate(attValue); } 00716 } 00717 00718 startphi *= aunit; 00719 deltaphi *= aunit; 00720 00721 std::vector<zplaneType> zplaneList; 00722 00723 for (xercesc::DOMNode* iter = polyconeElement->getFirstChild(); 00724 iter != 0; iter = iter->getNextSibling()) 00725 { 00726 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) { continue; } 00727 00728 const xercesc::DOMElement* const child 00729 = dynamic_cast<xercesc::DOMElement*>(iter); 00730 if (!child) 00731 { 00732 G4Exception("G4GDMLReadSolids::PolyconeRead()", 00733 "InvalidRead", FatalException, "No child found!"); 00734 return; 00735 } 00736 const G4String tag = Transcode(child->getTagName()); 00737 00738 if (tag=="zplane") { zplaneList.push_back(ZplaneRead(child)); } 00739 } 00740 00741 G4int numZPlanes = zplaneList.size(); 00742 00743 G4double* rmin_array = new G4double[numZPlanes]; 00744 G4double* rmax_array = new G4double[numZPlanes]; 00745 G4double* z_array = new G4double[numZPlanes]; 00746 00747 for (G4int i=0; i<numZPlanes; i++) 00748 { 00749 rmin_array[i] = zplaneList[i].rmin*lunit; 00750 rmax_array[i] = zplaneList[i].rmax*lunit; 00751 z_array[i] = zplaneList[i].z*lunit; 00752 } 00753 00754 new G4Polycone(name,startphi,deltaphi,numZPlanes, 00755 z_array,rmin_array,rmax_array); 00756 }
void G4GDMLReadSolids::PolyhedraRead | ( | const xercesc::DOMElement * | const | ) | [protected] |
Definition at line 759 of file G4GDMLReadSolids.cc.
References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), G4GDMLEvaluator::EvaluateInteger(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4GDMLRead::Transcode(), and ZplaneRead().
Referenced by SolidsRead().
00760 { 00761 G4String name; 00762 G4double lunit = 1.0; 00763 G4double aunit = 1.0; 00764 G4double startphi = 0.0; 00765 G4double deltaphi = 0.0; 00766 G4int numsides = 0; 00767 00768 const xercesc::DOMNamedNodeMap* const attributes 00769 = polyhedraElement->getAttributes(); 00770 XMLSize_t attributeCount = attributes->getLength(); 00771 00772 for (XMLSize_t attribute_index=0; 00773 attribute_index<attributeCount; attribute_index++) 00774 { 00775 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 00776 00777 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 00778 { continue; } 00779 00780 const xercesc::DOMAttr* const attribute 00781 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 00782 if (!attribute) 00783 { 00784 G4Exception("G4GDMLReadSolids::PolyhedraRead()", 00785 "InvalidRead", FatalException, "No attribute found!"); 00786 return; 00787 } 00788 const G4String attName = Transcode(attribute->getName()); 00789 const G4String attValue = Transcode(attribute->getValue()); 00790 00791 if (attName=="name") { name = GenerateName(attValue); } else 00792 if (attName=="lunit") { lunit = eval.Evaluate(attValue); } else 00793 if (attName=="aunit") { aunit = eval.Evaluate(attValue); } else 00794 if (attName=="startphi") { startphi = eval.Evaluate(attValue); } else 00795 if (attName=="deltaphi") { deltaphi = eval.Evaluate(attValue); } else 00796 if (attName=="numsides") { numsides = eval.EvaluateInteger(attValue); } 00797 } 00798 00799 startphi *= aunit; 00800 deltaphi *= aunit; 00801 00802 std::vector<zplaneType> zplaneList; 00803 00804 for (xercesc::DOMNode* iter = polyhedraElement->getFirstChild(); 00805 iter != 0; iter = iter->getNextSibling()) 00806 { 00807 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) { continue; } 00808 00809 const xercesc::DOMElement* const child 00810 = dynamic_cast<xercesc::DOMElement*>(iter); 00811 if (!child) 00812 { 00813 G4Exception("G4GDMLReadSolids::PolyhedraRead()", 00814 "InvalidRead", FatalException, "No child found!"); 00815 return; 00816 } 00817 const G4String tag = Transcode(child->getTagName()); 00818 00819 if (tag=="zplane") { zplaneList.push_back(ZplaneRead(child)); } 00820 } 00821 00822 G4int numZPlanes = zplaneList.size(); 00823 00824 G4double* rmin_array = new G4double[numZPlanes]; 00825 G4double* rmax_array = new G4double[numZPlanes]; 00826 G4double* z_array = new G4double[numZPlanes]; 00827 00828 for (G4int i=0; i<numZPlanes; i++) 00829 { 00830 rmin_array[i] = zplaneList[i].rmin*lunit; 00831 rmax_array[i] = zplaneList[i].rmax*lunit; 00832 z_array[i] = zplaneList[i].z*lunit; 00833 } 00834 00835 new G4Polyhedra(name,startphi,deltaphi,numsides,numZPlanes, 00836 z_array,rmin_array,rmax_array); 00837 00838 }
G4QuadrangularFacet * G4GDMLReadSolids::QuadrangularRead | ( | const xercesc::DOMElement * | const | ) | [protected] |
Definition at line 841 of file G4GDMLReadSolids.cc.
References ABSOLUTE, G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4GDMLReadDefine::GetPosition(), RELATIVE, and G4GDMLRead::Transcode().
Referenced by TessellatedRead().
00842 { 00843 G4ThreeVector vertex1; 00844 G4ThreeVector vertex2; 00845 G4ThreeVector vertex3; 00846 G4ThreeVector vertex4; 00847 G4FacetVertexType type = ABSOLUTE; 00848 G4double lunit = 1.0; 00849 00850 const xercesc::DOMNamedNodeMap* const attributes 00851 = quadrangularElement->getAttributes(); 00852 XMLSize_t attributeCount = attributes->getLength(); 00853 00854 for (XMLSize_t attribute_index=0; 00855 attribute_index<attributeCount; attribute_index++) 00856 { 00857 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 00858 00859 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 00860 { continue; } 00861 00862 const xercesc::DOMAttr* const attribute 00863 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 00864 if (!attribute) 00865 { 00866 G4Exception("G4GDMLReadSolids::QuadrangularRead()", 00867 "InvalidRead", FatalException, "No attribute found!"); 00868 return 0; 00869 } 00870 const G4String attName = Transcode(attribute->getName()); 00871 const G4String attValue = Transcode(attribute->getValue()); 00872 00873 if (attName=="vertex1") 00874 { vertex1 = GetPosition(GenerateName(attValue)); } else 00875 if (attName=="vertex2") 00876 { vertex2 = GetPosition(GenerateName(attValue)); } else 00877 if (attName=="vertex3") 00878 { vertex3 = GetPosition(GenerateName(attValue)); } else 00879 if (attName=="vertex4") 00880 { vertex4 = GetPosition(GenerateName(attValue)); } else 00881 if (attName=="lunit") 00882 { lunit = eval.Evaluate(attValue); } else 00883 if (attName=="type") 00884 { if (attValue=="RELATIVE") { type = RELATIVE; } } 00885 } 00886 00887 return new G4QuadrangularFacet(vertex1*lunit,vertex2*lunit, 00888 vertex3*lunit,vertex4*lunit,type); 00889 }
void G4GDMLReadSolids::ReflectedSolidRead | ( | const xercesc::DOMElement * | const | ) | [protected] |
Definition at line 892 of file G4GDMLReadSolids.cc.
References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4GDMLReadDefine::GetRotationMatrix(), GetSolid(), position, and G4GDMLRead::Transcode().
Referenced by SolidsRead().
00893 { 00894 G4String name; 00895 G4double lunit = 1.0; 00896 G4double aunit = 1.0; 00897 G4String solid; 00898 G4ThreeVector scale(1.0,1.0,1.0); 00899 G4ThreeVector rotation; 00900 G4ThreeVector position; 00901 00902 const xercesc::DOMNamedNodeMap* const attributes 00903 = reflectedSolidElement->getAttributes(); 00904 XMLSize_t attributeCount = attributes->getLength(); 00905 00906 for (XMLSize_t attribute_index=0; 00907 attribute_index<attributeCount; attribute_index++) 00908 { 00909 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 00910 00911 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 00912 { continue; } 00913 00914 const xercesc::DOMAttr* const attribute 00915 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 00916 if (!attribute) 00917 { 00918 G4Exception("G4GDMLReadSolids::ReflectedSolidRead()", 00919 "InvalidRead", FatalException, "No attribute found!"); 00920 return; 00921 } 00922 const G4String attName = Transcode(attribute->getName()); 00923 const G4String attValue = Transcode(attribute->getValue()); 00924 00925 if (attName=="name") { name = GenerateName(attValue); } else 00926 if (attName=="lunit") { lunit = eval.Evaluate(attValue); } else 00927 if (attName=="aunit") { aunit = eval.Evaluate(attValue); } else 00928 if (attName=="solid") { solid = GenerateName(attValue); } else 00929 if (attName=="sx") { scale.setX(eval.Evaluate(attValue)); } else 00930 if (attName=="sy") { scale.setY(eval.Evaluate(attValue)); } else 00931 if (attName=="sz") { scale.setZ(eval.Evaluate(attValue)); } else 00932 if (attName=="rx") { rotation.setX(eval.Evaluate(attValue)); } else 00933 if (attName=="ry") { rotation.setY(eval.Evaluate(attValue)); } else 00934 if (attName=="rz") { rotation.setZ(eval.Evaluate(attValue)); } else 00935 if (attName=="dx") { position.setX(eval.Evaluate(attValue)); } else 00936 if (attName=="dy") { position.setY(eval.Evaluate(attValue)); } else 00937 if (attName=="dz") { position.setZ(eval.Evaluate(attValue)); } 00938 } 00939 00940 rotation *= aunit; 00941 position *= lunit; 00942 00943 G4Transform3D transform(GetRotationMatrix(rotation),position); 00944 transform = transform*G4Scale3D(scale.x(),scale.y(),scale.z()); 00945 00946 new G4ReflectedSolid(name,GetSolid(solid),transform); 00947 }
G4ExtrudedSolid::ZSection G4GDMLReadSolids::SectionRead | ( | const xercesc::DOMElement * | const, | |
G4double | ||||
) | [protected] |
Definition at line 950 of file G4GDMLReadSolids.cc.
References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), and G4GDMLRead::Transcode().
Referenced by XtruRead().
00951 { 00952 G4double zPosition = 0.0; 00953 G4TwoVector Offset; 00954 G4double scalingFactor = 1.0; 00955 00956 const xercesc::DOMNamedNodeMap* const attributes 00957 = sectionElement->getAttributes(); 00958 XMLSize_t attributeCount = attributes->getLength(); 00959 00960 for (XMLSize_t attribute_index=0; 00961 attribute_index<attributeCount; attribute_index++) 00962 { 00963 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 00964 00965 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 00966 { continue; } 00967 00968 const xercesc::DOMAttr* const attribute 00969 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 00970 if (!attribute) 00971 { 00972 G4Exception("G4GDMLReadSolids::SectionRead()", 00973 "InvalidRead", FatalException, "No attribute found!"); 00974 return G4ExtrudedSolid::ZSection(zPosition,Offset,scalingFactor); 00975 } 00976 const G4String attName = Transcode(attribute->getName()); 00977 const G4String attValue = Transcode(attribute->getValue()); 00978 00979 if (attName=="zPosition") 00980 { zPosition = eval.Evaluate(attValue)*lunit; } else 00981 if (attName=="xOffset") 00982 { Offset.setX(eval.Evaluate(attValue)*lunit); } else 00983 if (attName=="yOffset") 00984 { Offset.setY(eval.Evaluate(attValue)*lunit); } else 00985 if (attName=="scalingFactor") 00986 { scalingFactor = eval.Evaluate(attValue); } 00987 } 00988 00989 return G4ExtrudedSolid::ZSection(zPosition,Offset,scalingFactor); 00990 }
void G4GDMLReadSolids::SolidsRead | ( | const xercesc::DOMElement * | const | ) | [virtual] |
Implements G4GDMLRead.
Definition at line 1982 of file G4GDMLReadSolids.cc.
References BooleanRead(), BoxRead(), ConeRead(), CutTubeRead(), G4GDMLReadDefine::DefineRead(), ElconeRead(), EllipsoidRead(), EltubeRead(), FatalException, G4cout, G4endl, G4Exception(), GenTrapRead(), HypeRead(), G4GDMLRead::LoopRead(), OpticalSurfaceRead(), OrbRead(), ParaboloidRead(), ParaRead(), PolyconeRead(), PolyhedraRead(), ReflectedSolidRead(), G4GDMLRead::SolidsRead(), SphereRead(), TessellatedRead(), TetRead(), TorusRead(), G4GDMLRead::Transcode(), TrapRead(), TrdRead(), TubeRead(), TwistedboxRead(), TwistedtrapRead(), TwistedtrdRead(), TwistedtubsRead(), and XtruRead().
01983 { 01984 G4cout << "G4GDML: Reading solids..." << G4endl; 01985 01986 for (xercesc::DOMNode* iter = solidsElement->getFirstChild(); 01987 iter != 0; iter = iter->getNextSibling()) 01988 { 01989 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) { continue; } 01990 01991 const xercesc::DOMElement* const child 01992 = dynamic_cast<xercesc::DOMElement*>(iter); 01993 if (!child) 01994 { 01995 G4Exception("G4GDMLReadSolids::SolidsRead()", 01996 "InvalidRead", FatalException, "No child found!"); 01997 return; 01998 } 01999 const G4String tag = Transcode(child->getTagName()); 02000 if (tag=="define") { DefineRead(child); } else 02001 if (tag=="box") { BoxRead(child); } else 02002 if (tag=="cone") { ConeRead(child); } else 02003 if (tag=="elcone") { ElconeRead(child); } else 02004 if (tag=="ellipsoid") { EllipsoidRead(child); }else 02005 if (tag=="eltube") { EltubeRead(child); } else 02006 if (tag=="xtru") { XtruRead(child); } else 02007 if (tag=="hype") { HypeRead(child); } else 02008 if (tag=="intersection") { BooleanRead(child,INTERSECTION); } else 02009 if (tag=="orb") { OrbRead(child); } else 02010 if (tag=="para") { ParaRead(child); } else 02011 if (tag=="paraboloid") { ParaboloidRead(child); } else 02012 if (tag=="polycone") { PolyconeRead(child); } else 02013 if (tag=="polyhedra") { PolyhedraRead(child); } else 02014 if (tag=="reflectedSolid") { ReflectedSolidRead(child); } else 02015 if (tag=="sphere") { SphereRead(child); } else 02016 if (tag=="subtraction") { BooleanRead(child,SUBTRACTION); } else 02017 if (tag=="tessellated") { TessellatedRead(child); } else 02018 if (tag=="tet") { TetRead(child); } else 02019 if (tag=="torus") { TorusRead(child); } else 02020 if (tag=="arb8") { GenTrapRead(child); } else 02021 if (tag=="trap") { TrapRead(child); } else 02022 if (tag=="trd") { TrdRead(child); } else 02023 if (tag=="tube") { TubeRead(child); } else 02024 if (tag=="cutTube") { CutTubeRead(child); } else 02025 if (tag=="twistedbox") { TwistedboxRead(child); } else 02026 if (tag=="twistedtrap") { TwistedtrapRead(child); } else 02027 if (tag=="twistedtrd") { TwistedtrdRead(child); } else 02028 if (tag=="twistedtubs") { TwistedtubsRead(child); } else 02029 if (tag=="union") { BooleanRead(child,UNION); } else 02030 if (tag=="opticalsurface") { OpticalSurfaceRead(child); } else 02031 if (tag=="loop") { LoopRead(child,&G4GDMLRead::SolidsRead); } 02032 else 02033 { 02034 G4String error_msg = "Unknown tag in solids: " + tag; 02035 G4Exception("G4GDMLReadSolids::SolidsRead()", "ReadError", 02036 FatalException, error_msg); 02037 } 02038 } 02039 }
void G4GDMLReadSolids::SphereRead | ( | const xercesc::DOMElement * | const | ) | [protected] |
Definition at line 993 of file G4GDMLReadSolids.cc.
References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), and G4GDMLRead::Transcode().
Referenced by SolidsRead().
00994 { 00995 G4String name; 00996 G4double lunit = 1.0; 00997 G4double aunit = 1.0; 00998 G4double rmin = 0.0; 00999 G4double rmax = 0.0; 01000 G4double startphi = 0.0; 01001 G4double deltaphi = 0.0; 01002 G4double starttheta = 0.0; 01003 G4double deltatheta = 0.0; 01004 01005 const xercesc::DOMNamedNodeMap* const attributes 01006 = sphereElement->getAttributes(); 01007 XMLSize_t attributeCount = attributes->getLength(); 01008 01009 for (XMLSize_t attribute_index=0; 01010 attribute_index<attributeCount; attribute_index++) 01011 { 01012 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 01013 01014 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 01015 { continue; } 01016 01017 const xercesc::DOMAttr* const attribute 01018 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 01019 if (!attribute) 01020 { 01021 G4Exception("G4GDMLReadSolids::SphereRead()", 01022 "InvalidRead", FatalException, "No attribute found!"); 01023 return; 01024 } 01025 const G4String attName = Transcode(attribute->getName()); 01026 const G4String attValue = Transcode(attribute->getValue()); 01027 01028 if (attName=="name") { name = GenerateName(attValue); } else 01029 if (attName=="lunit") { lunit = eval.Evaluate(attValue); } else 01030 if (attName=="aunit") { aunit = eval.Evaluate(attValue); } else 01031 if (attName=="rmin") { rmin = eval.Evaluate(attValue); } else 01032 if (attName=="rmax") { rmax = eval.Evaluate(attValue); } else 01033 if (attName=="startphi") { startphi = eval.Evaluate(attValue); } else 01034 if (attName=="deltaphi") { deltaphi = eval.Evaluate(attValue); } else 01035 if (attName=="starttheta") { starttheta = eval.Evaluate(attValue); } else 01036 if (attName=="deltatheta") { deltatheta = eval.Evaluate(attValue); } 01037 } 01038 01039 rmin *= lunit; 01040 rmax *= lunit; 01041 startphi *= aunit; 01042 deltaphi *= aunit; 01043 starttheta *= aunit; 01044 deltatheta *= aunit; 01045 01046 new G4Sphere(name,rmin,rmax,startphi,deltaphi,starttheta,deltatheta); 01047 }
void G4GDMLReadSolids::TessellatedRead | ( | const xercesc::DOMElement * | const | ) | [protected] |
Definition at line 1050 of file G4GDMLReadSolids.cc.
References G4TessellatedSolid::AddFacet(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), QuadrangularRead(), G4TessellatedSolid::SetSolidClosed(), G4GDMLRead::Transcode(), and TriangularRead().
Referenced by SolidsRead().
01051 { 01052 G4String name; 01053 01054 const xercesc::DOMNamedNodeMap* const attributes 01055 = tessellatedElement->getAttributes(); 01056 XMLSize_t attributeCount = attributes->getLength(); 01057 01058 for (XMLSize_t attribute_index=0; 01059 attribute_index<attributeCount; attribute_index++) 01060 { 01061 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 01062 01063 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 01064 { continue; } 01065 01066 const xercesc::DOMAttr* const attribute 01067 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 01068 if (!attribute) 01069 { 01070 G4Exception("G4GDMLReadSolids::TessellatedRead()", 01071 "InvalidRead", FatalException, "No attribute found!"); 01072 return; 01073 } 01074 const G4String attName = Transcode(attribute->getName()); 01075 const G4String attValue = Transcode(attribute->getValue()); 01076 01077 if (attName=="name") { name = GenerateName(attValue); } 01078 } 01079 01080 G4TessellatedSolid *tessellated = new G4TessellatedSolid(name); 01081 01082 for (xercesc::DOMNode* iter = tessellatedElement->getFirstChild(); 01083 iter != 0; iter = iter->getNextSibling()) 01084 { 01085 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) { continue; } 01086 01087 const xercesc::DOMElement* const child 01088 = dynamic_cast<xercesc::DOMElement*>(iter); 01089 if (!child) 01090 { 01091 G4Exception("G4GDMLReadSolids::TessellatedRead()", 01092 "InvalidRead", FatalException, "No child found!"); 01093 return; 01094 } 01095 const G4String tag = Transcode(child->getTagName()); 01096 01097 if (tag=="triangular") 01098 { tessellated->AddFacet(TriangularRead(child)); } else 01099 if (tag=="quadrangular") 01100 { tessellated->AddFacet(QuadrangularRead(child)); } 01101 } 01102 01103 tessellated->SetSolidClosed(true); 01104 }
void G4GDMLReadSolids::TetRead | ( | const xercesc::DOMElement * | const | ) | [protected] |
Definition at line 1106 of file G4GDMLReadSolids.cc.
References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4GDMLReadDefine::GetPosition(), and G4GDMLRead::Transcode().
Referenced by SolidsRead().
01107 { 01108 G4String name; 01109 G4ThreeVector vertex1; 01110 G4ThreeVector vertex2; 01111 G4ThreeVector vertex3; 01112 G4ThreeVector vertex4; 01113 G4double lunit = 1.0; 01114 01115 const xercesc::DOMNamedNodeMap* const attributes 01116 = tetElement->getAttributes(); 01117 XMLSize_t attributeCount = attributes->getLength(); 01118 01119 for (XMLSize_t attribute_index=0; 01120 attribute_index<attributeCount;attribute_index++) 01121 { 01122 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 01123 01124 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 01125 { continue; } 01126 01127 const xercesc::DOMAttr* const attribute 01128 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 01129 if (!attribute) 01130 { 01131 G4Exception("G4GDMLReadSolids::TetRead()", 01132 "InvalidRead", FatalException, "No attribute found!"); 01133 return; 01134 } 01135 const G4String attName = Transcode(attribute->getName()); 01136 const G4String attValue = Transcode(attribute->getValue()); 01137 01138 if (attName=="name") 01139 { name = GenerateName(attValue); } else 01140 if (attName=="lunit") 01141 { lunit = eval.Evaluate(attValue); } else 01142 if (attName=="vertex1") 01143 { vertex1 = GetPosition(GenerateName(attValue)); } else 01144 if (attName=="vertex2") 01145 { vertex2 = GetPosition(GenerateName(attValue)); } else 01146 if (attName=="vertex3") 01147 { vertex3 = GetPosition(GenerateName(attValue)); } else 01148 if (attName=="vertex4") 01149 { vertex4 = GetPosition(GenerateName(attValue)); } 01150 } 01151 01152 new G4Tet(name,vertex1*lunit,vertex2*lunit,vertex3*lunit,vertex4*lunit); 01153 }
void G4GDMLReadSolids::TorusRead | ( | const xercesc::DOMElement * | const | ) | [protected] |
Definition at line 1155 of file G4GDMLReadSolids.cc.
References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), and G4GDMLRead::Transcode().
Referenced by SolidsRead().
01156 { 01157 G4String name; 01158 G4double lunit = 1.0; 01159 G4double aunit = 1.0; 01160 G4double rmin = 0.0; 01161 G4double rmax = 0.0; 01162 G4double rtor = 0.0; 01163 G4double startphi = 0.0; 01164 G4double deltaphi = 0.0; 01165 01166 const xercesc::DOMNamedNodeMap* const attributes 01167 = torusElement->getAttributes(); 01168 XMLSize_t attributeCount = attributes->getLength(); 01169 01170 for (XMLSize_t attribute_index=0; 01171 attribute_index<attributeCount; attribute_index++) 01172 { 01173 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 01174 01175 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 01176 { continue; } 01177 01178 const xercesc::DOMAttr* const attribute 01179 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 01180 if (!attribute) 01181 { 01182 G4Exception("G4GDMLReadSolids::TorusRead()", 01183 "InvalidRead", FatalException, "No attribute found!"); 01184 return; 01185 } 01186 const G4String attName = Transcode(attribute->getName()); 01187 const G4String attValue = Transcode(attribute->getValue()); 01188 01189 if (attName=="name") { name = GenerateName(attValue); } else 01190 if (attName=="lunit") { lunit = eval.Evaluate(attValue); } else 01191 if (attName=="aunit") { aunit = eval.Evaluate(attValue); } else 01192 if (attName=="rmin") { rmin = eval.Evaluate(attValue); } else 01193 if (attName=="rmax") { rmax = eval.Evaluate(attValue); } else 01194 if (attName=="rtor") { rtor = eval.Evaluate(attValue); } else 01195 if (attName=="startphi") { startphi = eval.Evaluate(attValue); } else 01196 if (attName=="deltaphi") { deltaphi = eval.Evaluate(attValue); } 01197 } 01198 01199 rmin *= lunit; 01200 rmax *= lunit; 01201 rtor *= lunit; 01202 startphi *= aunit; 01203 deltaphi *= aunit; 01204 01205 new G4Torus(name,rmin,rmax,rtor,startphi,deltaphi); 01206 }
void G4GDMLReadSolids::TrapRead | ( | const xercesc::DOMElement * | const | ) | [protected] |
Definition at line 1275 of file G4GDMLReadSolids.cc.
References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), and G4GDMLRead::Transcode().
Referenced by SolidsRead().
01276 { 01277 G4String name; 01278 G4double lunit = 1.0; 01279 G4double aunit = 1.0; 01280 G4double z = 0.0; 01281 G4double theta = 0.0; 01282 G4double phi = 0.0; 01283 G4double y1 = 0.0; 01284 G4double x1 = 0.0; 01285 G4double x2 = 0.0; 01286 G4double alpha1 = 0.0; 01287 G4double y2 = 0.0; 01288 G4double x3 = 0.0; 01289 G4double x4 = 0.0; 01290 G4double alpha2 = 0.0; 01291 01292 const xercesc::DOMNamedNodeMap* const attributes 01293 = trapElement->getAttributes(); 01294 XMLSize_t attributeCount = attributes->getLength(); 01295 01296 for (XMLSize_t attribute_index=0; 01297 attribute_index<attributeCount; attribute_index++) 01298 { 01299 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 01300 01301 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 01302 { continue; } 01303 01304 const xercesc::DOMAttr* const attribute 01305 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 01306 if (!attribute) 01307 { 01308 G4Exception("G4GDMLReadSolids::TrapRead()", 01309 "InvalidRead", FatalException, "No attribute found!"); 01310 return; 01311 } 01312 const G4String attName = Transcode(attribute->getName()); 01313 const G4String attValue = Transcode(attribute->getValue()); 01314 01315 if (attName=="name") { name = GenerateName(attValue); } else 01316 if (attName=="lunit") { lunit = eval.Evaluate(attValue); } else 01317 if (attName=="aunit") { aunit = eval.Evaluate(attValue); } else 01318 if (attName=="z") { z = eval.Evaluate(attValue); } else 01319 if (attName=="theta") { theta = eval.Evaluate(attValue); } else 01320 if (attName=="phi") { phi = eval.Evaluate(attValue); } else 01321 if (attName=="y1") { y1 = eval.Evaluate(attValue); } else 01322 if (attName=="x1") { x1 = eval.Evaluate(attValue); } else 01323 if (attName=="x2") { x2 = eval.Evaluate(attValue); } else 01324 if (attName=="alpha1") { alpha1 = eval.Evaluate(attValue); } else 01325 if (attName=="y2") { y2 = eval.Evaluate(attValue); } else 01326 if (attName=="x3") { x3 = eval.Evaluate(attValue); } else 01327 if (attName=="x4") { x4 = eval.Evaluate(attValue); } else 01328 if (attName=="alpha2") { alpha2 = eval.Evaluate(attValue); } 01329 } 01330 01331 z *= 0.5*lunit; 01332 theta *= aunit; 01333 phi *= aunit; 01334 y1 *= 0.5*lunit; 01335 x1 *= 0.5*lunit; 01336 x2 *= 0.5*lunit; 01337 alpha1 *= aunit; 01338 y2 *= 0.5*lunit; 01339 x3 *= 0.5*lunit; 01340 x4 *= 0.5*lunit; 01341 alpha2 *= aunit; 01342 01343 new G4Trap(name,z,theta,phi,y1,x1,x2,alpha1,y2,x3,x4,alpha2); 01344 }
void G4GDMLReadSolids::TrdRead | ( | const xercesc::DOMElement * | const | ) | [protected] |
Definition at line 1346 of file G4GDMLReadSolids.cc.
References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), and G4GDMLRead::Transcode().
Referenced by SolidsRead().
01347 { 01348 G4String name; 01349 G4double lunit = 1.0; 01350 G4double x1 = 0.0; 01351 G4double x2 = 0.0; 01352 G4double y1 = 0.0; 01353 G4double y2 = 0.0; 01354 G4double z = 0.0; 01355 01356 const xercesc::DOMNamedNodeMap* const attributes = trdElement->getAttributes(); 01357 XMLSize_t attributeCount = attributes->getLength(); 01358 01359 for (XMLSize_t attribute_index=0; 01360 attribute_index<attributeCount; attribute_index++) 01361 { 01362 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 01363 01364 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 01365 { continue; } 01366 01367 const xercesc::DOMAttr* const attribute 01368 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 01369 if (!attribute) 01370 { 01371 G4Exception("G4GDMLReadSolids::TrdRead()", 01372 "InvalidRead", FatalException, "No attribute found!"); 01373 return; 01374 } 01375 const G4String attName = Transcode(attribute->getName()); 01376 const G4String attValue = Transcode(attribute->getValue()); 01377 01378 if (attName=="name") { name = GenerateName(attValue); } else 01379 if (attName=="lunit") { lunit = eval.Evaluate(attValue); } else 01380 if (attName=="x1") { x1 = eval.Evaluate(attValue); } else 01381 if (attName=="x2") { x2 = eval.Evaluate(attValue); } else 01382 if (attName=="y1") { y1 = eval.Evaluate(attValue); } else 01383 if (attName=="y2") { y2 = eval.Evaluate(attValue); } else 01384 if (attName=="z") { z = eval.Evaluate(attValue); } 01385 } 01386 01387 x1 *= 0.5*lunit; 01388 x2 *= 0.5*lunit; 01389 y1 *= 0.5*lunit; 01390 y2 *= 0.5*lunit; 01391 z *= 0.5*lunit; 01392 01393 new G4Trd(name,x1,x2,y1,y2,z); 01394 }
G4TriangularFacet * G4GDMLReadSolids::TriangularRead | ( | const xercesc::DOMElement * | const | ) | [protected] |
Definition at line 1397 of file G4GDMLReadSolids.cc.
References ABSOLUTE, G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), G4GDMLReadDefine::GetPosition(), RELATIVE, and G4GDMLRead::Transcode().
Referenced by TessellatedRead().
01398 { 01399 G4ThreeVector vertex1; 01400 G4ThreeVector vertex2; 01401 G4ThreeVector vertex3; 01402 G4FacetVertexType type = ABSOLUTE; 01403 G4double lunit = 1.0; 01404 01405 const xercesc::DOMNamedNodeMap* const attributes 01406 = triangularElement->getAttributes(); 01407 XMLSize_t attributeCount = attributes->getLength(); 01408 01409 for (XMLSize_t attribute_index=0; 01410 attribute_index<attributeCount; attribute_index++) 01411 { 01412 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 01413 01414 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 01415 { continue; } 01416 01417 const xercesc::DOMAttr* const attribute 01418 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 01419 if (!attribute) 01420 { 01421 G4Exception("G4GDMLReadSolids::TriangularRead()", 01422 "InvalidRead", FatalException, "No attribute found!"); 01423 return 0; 01424 } 01425 const G4String attName = Transcode(attribute->getName()); 01426 const G4String attValue = Transcode(attribute->getValue()); 01427 01428 if (attName=="vertex1") 01429 { vertex1 = GetPosition(GenerateName(attValue)); } else 01430 if (attName=="vertex2") 01431 { vertex2 = GetPosition(GenerateName(attValue)); } else 01432 if (attName=="vertex3") 01433 { vertex3 = GetPosition(GenerateName(attValue)); } else 01434 if (attName=="lunit") 01435 { lunit = eval.Evaluate(attValue); } else 01436 if (attName=="type") 01437 { if (attValue=="RELATIVE") { type = RELATIVE; } } 01438 } 01439 01440 return new G4TriangularFacet(vertex1*lunit,vertex2*lunit,vertex3*lunit,type); 01441 }
void G4GDMLReadSolids::TubeRead | ( | const xercesc::DOMElement * | const | ) | [protected] |
Definition at line 1443 of file G4GDMLReadSolids.cc.
References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), and G4GDMLRead::Transcode().
Referenced by SolidsRead().
01444 { 01445 G4String name; 01446 G4double lunit = 1.0; 01447 G4double aunit = 1.0; 01448 G4double rmin = 0.0; 01449 G4double rmax = 0.0; 01450 G4double z = 0.0; 01451 G4double startphi = 0.0; 01452 G4double deltaphi = 0.0; 01453 01454 const xercesc::DOMNamedNodeMap* const attributes 01455 = tubeElement->getAttributes(); 01456 XMLSize_t attributeCount = attributes->getLength(); 01457 01458 for (XMLSize_t attribute_index=0; 01459 attribute_index<attributeCount; attribute_index++) 01460 { 01461 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 01462 01463 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 01464 { continue; } 01465 01466 const xercesc::DOMAttr* const attribute 01467 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 01468 if (!attribute) 01469 { 01470 G4Exception("G4GDMLReadSolids::TubeRead()", 01471 "InvalidRead", FatalException, "No attribute found!"); 01472 return; 01473 } 01474 const G4String attName = Transcode(attribute->getName()); 01475 const G4String attValue = Transcode(attribute->getValue()); 01476 01477 if (attName=="name") { name = GenerateName(attValue); } else 01478 if (attName=="lunit") { lunit = eval.Evaluate(attValue); } else 01479 if (attName=="aunit") { aunit = eval.Evaluate(attValue); } else 01480 if (attName=="rmin") { rmin = eval.Evaluate(attValue); } else 01481 if (attName=="rmax") { rmax = eval.Evaluate(attValue); } else 01482 if (attName=="z") { z = eval.Evaluate(attValue); } else 01483 if (attName=="startphi") { startphi = eval.Evaluate(attValue); } else 01484 if (attName=="deltaphi") { deltaphi = eval.Evaluate(attValue); } 01485 } 01486 01487 rmin *= lunit; 01488 rmax *= lunit; 01489 z *= 0.5*lunit; 01490 startphi *= aunit; 01491 deltaphi *= aunit; 01492 01493 new G4Tubs(name,rmin,rmax,z,startphi,deltaphi); 01494 }
void G4GDMLReadSolids::TwistedboxRead | ( | const xercesc::DOMElement * | const | ) | [protected] |
Definition at line 1559 of file G4GDMLReadSolids.cc.
References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), and G4GDMLRead::Transcode().
Referenced by SolidsRead().
01560 { 01561 G4String name; 01562 G4double lunit = 1.0; 01563 G4double aunit = 1.0; 01564 G4double PhiTwist = 0.0; 01565 G4double x = 0.0; 01566 G4double y = 0.0; 01567 G4double z = 0.0; 01568 01569 const xercesc::DOMNamedNodeMap* const attributes 01570 = twistedboxElement->getAttributes(); 01571 XMLSize_t attributeCount = attributes->getLength(); 01572 01573 for (XMLSize_t attribute_index=0; 01574 attribute_index<attributeCount; attribute_index++) 01575 { 01576 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 01577 01578 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 01579 { continue; } 01580 01581 const xercesc::DOMAttr* const attribute 01582 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 01583 if (!attribute) 01584 { 01585 G4Exception("G4GDMLReadSolids::TwistedboxRead()", 01586 "InvalidRead", FatalException, "No attribute found!"); 01587 return; 01588 } 01589 const G4String attName = Transcode(attribute->getName()); 01590 const G4String attValue = Transcode(attribute->getValue()); 01591 01592 if (attName=="name") { name = GenerateName(attValue); } else 01593 if (attName=="lunit") { lunit = eval.Evaluate(attValue); } else 01594 if (attName=="aunit") { aunit = eval.Evaluate(attValue); } else 01595 if (attName=="PhiTwist") { PhiTwist = eval.Evaluate(attValue); } else 01596 if (attName=="x") { x = eval.Evaluate(attValue); } else 01597 if (attName=="y") { y = eval.Evaluate(attValue); } else 01598 if (attName=="z") { z = eval.Evaluate(attValue); } 01599 } 01600 01601 PhiTwist *= aunit; 01602 x *= 0.5*lunit; 01603 y *= 0.5*lunit; 01604 z *= 0.5*lunit; 01605 01606 new G4TwistedBox(name,PhiTwist,x,y,z); 01607 }
void G4GDMLReadSolids::TwistedtrapRead | ( | const xercesc::DOMElement * | const | ) | [protected] |
Definition at line 1610 of file G4GDMLReadSolids.cc.
References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), and G4GDMLRead::Transcode().
Referenced by SolidsRead().
01611 { 01612 G4String name; 01613 G4double lunit = 1.0; 01614 G4double aunit = 1.0; 01615 G4double PhiTwist = 0.0; 01616 G4double z = 0.0; 01617 G4double Theta = 0.0; 01618 G4double Phi = 0.0; 01619 G4double y1 = 0.0; 01620 G4double x1 = 0.0; 01621 G4double x2 = 0.0; 01622 G4double y2 = 0.0; 01623 G4double x3 = 0.0; 01624 G4double x4 = 0.0; 01625 G4double Alph = 0.0; 01626 01627 const xercesc::DOMNamedNodeMap* const attributes 01628 = twistedtrapElement->getAttributes(); 01629 XMLSize_t attributeCount = attributes->getLength(); 01630 01631 for (XMLSize_t attribute_index=0; 01632 attribute_index<attributeCount; attribute_index++) 01633 { 01634 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 01635 01636 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 01637 { continue; } 01638 01639 const xercesc::DOMAttr* const attribute 01640 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 01641 if (!attribute) 01642 { 01643 G4Exception("G4GDMLReadSolids::TwistedtrapRead()", 01644 "InvalidRead", FatalException, "No attribute found!"); 01645 return; 01646 } 01647 const G4String attName = Transcode(attribute->getName()); 01648 const G4String attValue = Transcode(attribute->getValue()); 01649 01650 if (attName=="name") { name = GenerateName(attValue); } else 01651 if (attName=="lunit") { lunit = eval.Evaluate(attValue); } else 01652 if (attName=="aunit") { aunit = eval.Evaluate(attValue); } else 01653 if (attName=="PhiTwist") { PhiTwist = eval.Evaluate(attValue); } else 01654 if (attName=="z") { z = eval.Evaluate(attValue); } else 01655 if (attName=="Theta") { Theta = eval.Evaluate(attValue); } else 01656 if (attName=="Phi") { Phi = eval.Evaluate(attValue); } else 01657 if (attName=="y1") { y1 = eval.Evaluate(attValue); } else 01658 if (attName=="x1") { x1 = eval.Evaluate(attValue); } else 01659 if (attName=="x2") { x2 = eval.Evaluate(attValue); } else 01660 if (attName=="y2") { y2 = eval.Evaluate(attValue); } else 01661 if (attName=="x3") { x3 = eval.Evaluate(attValue); } else 01662 if (attName=="x4") { x4 = eval.Evaluate(attValue); } else 01663 if (attName=="Alph") { Alph = eval.Evaluate(attValue); } 01664 } 01665 01666 01667 PhiTwist *= aunit; 01668 z *= 0.5*lunit; 01669 Theta *= aunit; 01670 Phi *= aunit; 01671 Alph *= aunit; 01672 y1 *= 0.5*lunit; 01673 x1 *= 0.5*lunit; 01674 x2 *= 0.5*lunit; 01675 y2 *= 0.5*lunit; 01676 x3 *= 0.5*lunit; 01677 x4 *= 0.5*lunit; 01678 01679 new G4TwistedTrap(name,PhiTwist,z,Theta,Phi,y1,x1,x2,y2,x3,x4,Alph); 01680 }
void G4GDMLReadSolids::TwistedtrdRead | ( | const xercesc::DOMElement * | const | ) | [protected] |
Definition at line 1683 of file G4GDMLReadSolids.cc.
References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), and G4GDMLRead::Transcode().
Referenced by SolidsRead().
01684 { 01685 G4String name; 01686 G4double lunit = 1.0; 01687 G4double aunit = 1.0; 01688 G4double x1 = 0.0; 01689 G4double x2 = 0.0; 01690 G4double y1 = 0.0; 01691 G4double y2 = 0.0; 01692 G4double z = 0.0; 01693 G4double PhiTwist = 0.0; 01694 01695 const xercesc::DOMNamedNodeMap* const attributes 01696 = twistedtrdElement->getAttributes(); 01697 XMLSize_t attributeCount = attributes->getLength(); 01698 01699 for (XMLSize_t attribute_index=0; 01700 attribute_index<attributeCount; attribute_index++) 01701 { 01702 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 01703 01704 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 01705 { continue; } 01706 01707 const xercesc::DOMAttr* const attribute 01708 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 01709 if (!attribute) 01710 { 01711 G4Exception("G4GDMLReadSolids::TwistedtrdRead()", 01712 "InvalidRead", FatalException, "No attribute found!"); 01713 return; 01714 } 01715 const G4String attName = Transcode(attribute->getName()); 01716 const G4String attValue = Transcode(attribute->getValue()); 01717 01718 if (attName=="name") { name = GenerateName(attValue); } else 01719 if (attName=="lunit") { lunit = eval.Evaluate(attValue); } else 01720 if (attName=="aunit") { aunit = eval.Evaluate(attValue); } else 01721 if (attName=="x1") { x1 = eval.Evaluate(attValue); } else 01722 if (attName=="x2") { x2 = eval.Evaluate(attValue); } else 01723 if (attName=="y1") { y1 = eval.Evaluate(attValue); } else 01724 if (attName=="y2") { y2 = eval.Evaluate(attValue); } else 01725 if (attName=="z") { z = eval.Evaluate(attValue); } else 01726 if (attName=="PhiTwist") { PhiTwist = eval.Evaluate(attValue); } 01727 } 01728 01729 x1 *= 0.5*lunit; 01730 x2 *= 0.5*lunit; 01731 y1 *= 0.5*lunit; 01732 y2 *= 0.5*lunit; 01733 z *= 0.5*lunit; 01734 PhiTwist *= aunit; 01735 01736 new G4TwistedTrd(name,x1,x2,y1,y2,z,PhiTwist); 01737 }
void G4GDMLReadSolids::TwistedtubsRead | ( | const xercesc::DOMElement * | const | ) | [protected] |
Definition at line 1740 of file G4GDMLReadSolids.cc.
References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), and G4GDMLRead::Transcode().
Referenced by SolidsRead().
01741 { 01742 G4String name; 01743 G4double lunit = 1.0; 01744 G4double aunit = 1.0; 01745 G4double twistedangle = 0.0; 01746 G4double endinnerrad = 0.0; 01747 G4double endouterrad = 0.0; 01748 G4double zlen = 0.0; 01749 G4double phi = 0.0; 01750 01751 const xercesc::DOMNamedNodeMap* const attributes 01752 = twistedtubsElement->getAttributes(); 01753 XMLSize_t attributeCount = attributes->getLength(); 01754 01755 for (XMLSize_t attribute_index=0; 01756 attribute_index<attributeCount; attribute_index++) 01757 { 01758 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 01759 01760 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 01761 { continue; } 01762 01763 const xercesc::DOMAttr* const attribute 01764 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 01765 if (!attribute) 01766 { 01767 G4Exception("G4GDMLReadSolids::TwistedtubsRead()", 01768 "InvalidRead", FatalException, "No attribute found!"); 01769 return; 01770 } 01771 const G4String attName = Transcode(attribute->getName()); 01772 const G4String attValue = Transcode(attribute->getValue()); 01773 01774 if (attName=="name") { name = GenerateName(attValue); } else 01775 if (attName=="lunit") { lunit = eval.Evaluate(attValue); } else 01776 if (attName=="aunit") { aunit = eval.Evaluate(attValue); } else 01777 if (attName=="twistedangle") { twistedangle=eval.Evaluate(attValue); } else 01778 if (attName=="endinnerrad") { endinnerrad=eval.Evaluate(attValue); } else 01779 if (attName=="endouterrad") { endouterrad=eval.Evaluate(attValue); } else 01780 if (attName=="zlen") { zlen = eval.Evaluate(attValue); } else 01781 if (attName=="phi") { phi = eval.Evaluate(attValue); } 01782 } 01783 01784 twistedangle *= aunit; 01785 endinnerrad *= lunit; 01786 endouterrad *= lunit; 01787 zlen *= 0.5*lunit; 01788 phi *= aunit; 01789 01790 new G4TwistedTubs(name,twistedangle,endinnerrad,endouterrad,zlen,phi); 01791 }
G4TwoVector G4GDMLReadSolids::TwoDimVertexRead | ( | const xercesc::DOMElement * | const, | |
G4double | ||||
) | [protected] |
Definition at line 1794 of file G4GDMLReadSolids.cc.
References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), and G4GDMLRead::Transcode().
Referenced by XtruRead().
01795 { 01796 G4TwoVector vec; 01797 01798 const xercesc::DOMNamedNodeMap* const attributes = element->getAttributes(); 01799 XMLSize_t attributeCount = attributes->getLength(); 01800 01801 for (XMLSize_t attribute_index=0; 01802 attribute_index<attributeCount; attribute_index++) 01803 { 01804 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 01805 01806 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 01807 { continue; } 01808 01809 const xercesc::DOMAttr* const attribute 01810 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 01811 if (!attribute) 01812 { 01813 G4Exception("G4GDMLReadSolids::TwoDimVertexRead()", 01814 "InvalidRead", FatalException, "No attribute found!"); 01815 return vec; 01816 } 01817 const G4String attName = Transcode(attribute->getName()); 01818 const G4String attValue = Transcode(attribute->getValue()); 01819 01820 if (attName=="x") { vec.setX(eval.Evaluate(attValue)*lunit); } else 01821 if (attName=="y") { vec.setY(eval.Evaluate(attValue)*lunit); } 01822 } 01823 01824 return vec; 01825 }
void G4GDMLReadSolids::XtruRead | ( | const xercesc::DOMElement * | const | ) | [protected] |
Definition at line 426 of file G4GDMLReadSolids.cc.
References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), G4GDMLRead::GenerateName(), SectionRead(), G4GDMLRead::Transcode(), and TwoDimVertexRead().
Referenced by SolidsRead().
00427 { 00428 G4String name; 00429 G4double lunit = 1.0; 00430 00431 const xercesc::DOMNamedNodeMap* const attributes 00432 = xtruElement->getAttributes(); 00433 XMLSize_t attributeCount = attributes->getLength(); 00434 00435 for (XMLSize_t attribute_index=0; 00436 attribute_index<attributeCount; attribute_index++) 00437 { 00438 xercesc::DOMNode* attribute_node = attributes->item(attribute_index); 00439 00440 if (attribute_node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) 00441 { continue; } 00442 00443 const xercesc::DOMAttr* const attribute 00444 = dynamic_cast<xercesc::DOMAttr*>(attribute_node); 00445 if (!attribute) 00446 { 00447 G4Exception("G4GDMLReadSolids::XtruRead()", 00448 "InvalidRead", FatalException, "No attribute found!"); 00449 return; 00450 } 00451 const G4String attName = Transcode(attribute->getName()); 00452 const G4String attValue = Transcode(attribute->getValue()); 00453 00454 if (attName=="name") { name = GenerateName(attValue); } else 00455 if (attName=="lunit") { lunit = eval.Evaluate(attValue); } 00456 } 00457 00458 std::vector<G4TwoVector> twoDimVertexList; 00459 std::vector<G4ExtrudedSolid::ZSection> sectionList; 00460 00461 for (xercesc::DOMNode* iter = xtruElement->getFirstChild(); 00462 iter != 0; iter = iter->getNextSibling()) 00463 { 00464 if (iter->getNodeType() != xercesc::DOMNode::ELEMENT_NODE) { continue; } 00465 00466 const xercesc::DOMElement* const child 00467 = dynamic_cast<xercesc::DOMElement*>(iter); 00468 if (!child) 00469 { 00470 G4Exception("G4GDMLReadSolids::XtruRead()", 00471 "InvalidRead", FatalException, "No child found!"); 00472 return; 00473 } 00474 const G4String tag = Transcode(child->getTagName()); 00475 00476 if (tag=="twoDimVertex") 00477 { twoDimVertexList.push_back(TwoDimVertexRead(child,lunit)); } else 00478 if (tag=="section") 00479 { sectionList.push_back(SectionRead(child,lunit)); } 00480 } 00481 00482 new G4ExtrudedSolid(name,twoDimVertexList,sectionList); 00483 }
G4GDMLReadSolids::zplaneType G4GDMLReadSolids::ZplaneRead | ( | const xercesc::DOMElement * | const | ) | [protected] |
Definition at line 1828 of file G4GDMLReadSolids.cc.
References G4GDMLRead::eval, G4GDMLEvaluator::Evaluate(), FatalException, G4Exception(), and G4GDMLRead::Transcode().
Referenced by PolyconeRead(), and PolyhedraRead().
01829 { 01830 zplaneType zplane = {0.,0.,0.}; 01831 01832 const xercesc::DOMNamedNodeMap* const attributes 01833 = zplaneElement->getAttributes(); 01834 XMLSize_t attributeCount = attributes->getLength(); 01835 01836 for (XMLSize_t attribute_index=0; 01837 attribute_index<attributeCount; attribute_index++) 01838 { 01839 xercesc::DOMNode* node = attributes->item(attribute_index); 01840 01841 if (node->getNodeType() != xercesc::DOMNode::ATTRIBUTE_NODE) { continue; } 01842 01843 const xercesc::DOMAttr* const attribute 01844 = dynamic_cast<xercesc::DOMAttr*>(node); 01845 if (!attribute) 01846 { 01847 G4Exception("G4GDMLReadSolids::ZplaneRead()", 01848 "InvalidRead", FatalException, "No attribute found!"); 01849 return zplane; 01850 } 01851 const G4String attName = Transcode(attribute->getName()); 01852 const G4String attValue = Transcode(attribute->getValue()); 01853 01854 if (attName=="rmin") { zplane.rmin = eval.Evaluate(attValue); } else 01855 if (attName=="rmax") { zplane.rmax = eval.Evaluate(attValue); } else 01856 if (attName=="z") { zplane.z = eval.Evaluate(attValue); } 01857 } 01858 01859 return zplane; 01860 }