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 // G4GDMLWriteSolids implementation << 27 // 26 // 28 // Author: Zoltan Torzsok, November 2007 << 27 // >> 28 // class G4GDMLWriteSolids Implementation >> 29 // >> 30 // Original author: Zoltan Torzsok, November 2007 >> 31 // 29 // ------------------------------------------- 32 // -------------------------------------------------------------------- 30 33 31 #include "G4GDMLWriteSolids.hh" 34 #include "G4GDMLWriteSolids.hh" 32 35 33 #include "G4SystemOfUnits.hh" 36 #include "G4SystemOfUnits.hh" 34 #include "G4BooleanSolid.hh" 37 #include "G4BooleanSolid.hh" 35 #include "G4ScaledSolid.hh" 38 #include "G4ScaledSolid.hh" 36 #include "G4Box.hh" 39 #include "G4Box.hh" 37 #include "G4Cons.hh" 40 #include "G4Cons.hh" 38 #include "G4Ellipsoid.hh" 41 #include "G4Ellipsoid.hh" 39 #include "G4EllipticalCone.hh" 42 #include "G4EllipticalCone.hh" 40 #include "G4EllipticalTube.hh" 43 #include "G4EllipticalTube.hh" 41 #include "G4ExtrudedSolid.hh" 44 #include "G4ExtrudedSolid.hh" 42 #include "G4Hype.hh" 45 #include "G4Hype.hh" 43 #include "G4Orb.hh" 46 #include "G4Orb.hh" 44 #include "G4Para.hh" 47 #include "G4Para.hh" 45 #include "G4Paraboloid.hh" 48 #include "G4Paraboloid.hh" 46 #include "G4IntersectionSolid.hh" 49 #include "G4IntersectionSolid.hh" 47 #include "G4Polycone.hh" 50 #include "G4Polycone.hh" 48 #include "G4GenericPolycone.hh" 51 #include "G4GenericPolycone.hh" 49 #include "G4Polyhedra.hh" 52 #include "G4Polyhedra.hh" 50 #include "G4ReflectedSolid.hh" 53 #include "G4ReflectedSolid.hh" 51 #include "G4Sphere.hh" 54 #include "G4Sphere.hh" 52 #include "G4SubtractionSolid.hh" 55 #include "G4SubtractionSolid.hh" 53 #include "G4GenericTrap.hh" 56 #include "G4GenericTrap.hh" 54 #include "G4TessellatedSolid.hh" 57 #include "G4TessellatedSolid.hh" 55 #include "G4Tet.hh" 58 #include "G4Tet.hh" 56 #include "G4Torus.hh" 59 #include "G4Torus.hh" 57 #include "G4Trap.hh" 60 #include "G4Trap.hh" 58 #include "G4Trd.hh" 61 #include "G4Trd.hh" 59 #include "G4Tubs.hh" 62 #include "G4Tubs.hh" 60 #include "G4CutTubs.hh" 63 #include "G4CutTubs.hh" 61 #include "G4TwistedBox.hh" 64 #include "G4TwistedBox.hh" 62 #include "G4TwistedTrap.hh" 65 #include "G4TwistedTrap.hh" 63 #include "G4TwistedTrd.hh" 66 #include "G4TwistedTrd.hh" 64 #include "G4TwistedTubs.hh" 67 #include "G4TwistedTubs.hh" 65 #include "G4UnionSolid.hh" 68 #include "G4UnionSolid.hh" 66 #include "G4OpticalSurface.hh" 69 #include "G4OpticalSurface.hh" 67 #include "G4SurfaceProperty.hh" 70 #include "G4SurfaceProperty.hh" 68 #include "G4MaterialPropertiesTable.hh" 71 #include "G4MaterialPropertiesTable.hh" 69 72 70 // ------------------------------------------- << 71 G4GDMLWriteSolids::G4GDMLWriteSolids() 73 G4GDMLWriteSolids::G4GDMLWriteSolids() 72 : G4GDMLWriteMaterials() << 74 : G4GDMLWriteMaterials(), solidsElement(0) 73 { 75 { 74 } 76 } 75 77 76 // ------------------------------------------- << 77 G4GDMLWriteSolids::~G4GDMLWriteSolids() 78 G4GDMLWriteSolids::~G4GDMLWriteSolids() 78 { 79 { 79 } 80 } 80 81 81 // ------------------------------------------- << 82 void G4GDMLWriteSolids:: 82 void G4GDMLWriteSolids::MultiUnionWrite(xerces << 83 MultiUnionWrite(xercesc::DOMElement* solElement, 83 const << 84 const G4MultiUnion* const munionSolid) 84 { << 85 { 85 G4int numSolids = munionSolid->GetNumberOfSo << 86 G4int numSolids=munionSolid->GetNumberOfSolids(); 86 G4String tag("multiUnion"); << 87 G4String tag("multiUnion"); 87 << 88 88 G4VSolid* solid; << 89 G4VSolid* solid; 89 G4Transform3D transform; << 90 G4Transform3D transform; 90 << 91 91 const G4String& name = GenerateName(munionSo << 92 const G4String& name = GenerateName(munionSolid->GetName(),munionSolid); 92 xercesc::DOMElement* multiUnionElement = New << 93 xercesc::DOMElement* multiUnionElement = NewElement(tag); 93 multiUnionElement->setAttributeNode(NewAttri << 94 multiUnionElement->setAttributeNode(NewAttribute("name",name)); 94 << 95 95 for(G4int i = 0; i < numSolids; ++i) << 96 for (G4int i=0; i<numSolids; ++i) 96 { << 97 { 97 solid = munionSolid->GetSolid(i); << 98 solid = munionSolid->GetSolid(i); 98 transform = munionSolid->GetTransformation << 99 transform = munionSolid->GetTransformation(i); 99 << 100 100 HepGeom::Rotate3D rot3d; << 101 HepGeom::Rotate3D rot3d; 101 HepGeom::Translate3D transl; << 102 HepGeom::Translate3D transl ; 102 HepGeom::Scale3D scale; << 103 HepGeom::Scale3D scale; 103 transform.getDecomposition(scale, rot3d, t << 104 transform.getDecomposition(scale,rot3d,transl); 104 << 105 105 G4ThreeVector pos = transl.getTranslation( << 106 G4ThreeVector pos = transl.getTranslation(); 106 G4RotationMatrix rotm(CLHEP::HepRep3x3(rot << 107 G4RotationMatrix 107 rot << 108 rotm(CLHEP::HepRep3x3(rot3d.xx(), rot3d.xy(), rot3d.xz(), 108 rot << 109 rot3d.yx(), rot3d.yy(), rot3d.yz(), 109 G4ThreeVector rot = GetAngles(rotm); << 110 rot3d.zx(), rot3d.zy(), rot3d.zz())); 110 << 111 G4ThreeVector rot = GetAngles(rotm); 111 AddSolid(solid); << 112 112 const G4String& solidref = GenerateName(so << 113 AddSolid(solid); 113 std::ostringstream os; << 114 const G4String& solidref = GenerateName(solid->GetName(),solid); 114 os << i + 1; << 115 std::ostringstream os; os << i+1; 115 const G4String& nodeName = "Node- << 116 const G4String& nodeName = "Node-" + G4String(os.str()); 116 xercesc::DOMElement* solidElement = NewEle << 117 xercesc::DOMElement* solidElement = NewElement("solid"); 117 solidElement->setAttributeNode(NewAttribut << 118 solidElement->setAttributeNode(NewAttribute("ref",solidref)); 118 xercesc::DOMElement* multiUnionNodeElement << 119 xercesc::DOMElement* multiUnionNodeElement = NewElement("multiUnionNode"); 119 multiUnionNodeElement->setAttributeNode(Ne << 120 multiUnionNodeElement->setAttributeNode(NewAttribute("name", nodeName)); 120 multiUnionNodeElement->appendChild(solidEl << 121 multiUnionNodeElement->appendChild(solidElement); // Append solid to node 121 if((std::fabs(pos.x()) > kLinearPrecision) << 122 if ( (std::fabs(pos.x()) > kLinearPrecision) 122 (std::fabs(pos.y()) > kLinearPrecision) << 123 || (std::fabs(pos.y()) > kLinearPrecision) 123 (std::fabs(pos.z()) > kLinearPrecision) << 124 || (std::fabs(pos.z()) > kLinearPrecision) ) 124 { << 125 { 125 PositionWrite(multiUnionNodeElement,name << 126 PositionWrite(multiUnionNodeElement,name+"_pos",pos); 126 } << 127 } 127 if((std::fabs(rot.x()) > kAngularPrecision << 128 if ( (std::fabs(rot.x()) > kAngularPrecision) 128 (std::fabs(rot.y()) > kAngularPrecision << 129 || (std::fabs(rot.y()) > kAngularPrecision) 129 (std::fabs(rot.z()) > kAngularPrecision << 130 || (std::fabs(rot.z()) > kAngularPrecision) ) 130 { << 131 { 131 RotationWrite(multiUnionNodeElement,name << 132 RotationWrite(multiUnionNodeElement,name+"_rot",rot); 132 } << 133 } 133 multiUnionElement->appendChild(multiUnionN << 134 multiUnionElement->appendChild(multiUnionNodeElement); // Append node 134 } << 135 } 135 << 136 solElement->appendChild(multiUnionElement); << 137 // Add the multiUnion solid AFTER the consti << 138 } << 139 << 140 // ------------------------------------------- << 141 void G4GDMLWriteSolids::BooleanWrite(xercesc:: << 142 const G4B << 143 { << 144 G4int displaced = 0; << 145 << 146 G4String tag("undefined"); << 147 if(dynamic_cast<const G4IntersectionSolid*>( << 148 { << 149 tag = "intersection"; << 150 } << 151 else if(dynamic_cast<const G4SubtractionSoli << 152 { << 153 tag = "subtraction"; << 154 } << 155 else if(dynamic_cast<const G4UnionSolid*>(bo << 156 { << 157 tag = "union"; << 158 } << 159 << 160 G4VSolid* firstPtr = const_cast<G4VSolid*>( << 161 G4VSolid* secondPtr = const_cast<G4VSolid*>( << 162 << 163 G4ThreeVector firstpos, firstrot, pos, rot; << 164 << 165 // Solve possible displacement of referenced << 166 // << 167 while(true) << 168 { << 169 if(displaced > 8) << 170 { << 171 G4String ErrorMessage = "The referenced << 172 +"in the Boolean << 173 +"' was displace << 174 G4Exception("G4GDMLWriteSolids::BooleanW << 175 FatalException, ErrorMessage << 176 } << 177 << 178 if(G4DisplacedSolid* disp = dynamic_cast<G << 179 { << 180 firstpos += disp->GetObjectTranslation() << 181 firstrot += GetAngles(disp->GetObjectRot << 182 firstPtr = disp->GetConstituentMovedSoli << 183 ++displaced; << 184 continue; << 185 } << 186 break; << 187 } << 188 displaced = 0; << 189 while(true) << 190 { << 191 if(displaced > maxTransforms) << 192 { << 193 G4String ErrorMessage = "The referenced << 194 +"in the Boolean << 195 +"' was displace << 196 G4Exception("G4GDMLWriteSolids::BooleanW << 197 FatalException, ErrorMessage << 198 } << 199 << 200 if(G4DisplacedSolid* disp = dynamic_cast<G << 201 { << 202 pos += disp->GetObjectTranslation(); << 203 rot += GetAngles(disp->GetObjectRotation << 204 secondPtr = disp->GetConstituentMovedSol << 205 ++displaced; << 206 continue; << 207 } << 208 break; << 209 } << 210 << 211 AddSolid(firstPtr); // At first add the con << 212 AddSolid(secondPtr); << 213 << 214 const G4String& name = GenerateName(boo << 215 const G4String& firstref = GenerateName(fir << 216 const G4String& secondref = GenerateName(sec << 217 << 218 xercesc::DOMElement* booleanElement = NewEle << 219 booleanElement->setAttributeNode(NewAttribut << 220 xercesc::DOMElement* firstElement = NewEleme << 221 firstElement->setAttributeNode(NewAttribute( << 222 booleanElement->appendChild(firstElement); << 223 xercesc::DOMElement* secondElement = NewElem << 224 secondElement->setAttributeNode(NewAttribute << 225 booleanElement->appendChild(secondElement); << 226 solElement->appendChild(booleanElement); << 227 // Add the boolean solid AFTER the constitue << 228 << 229 if((std::fabs(pos.x()) > kLinearPrecision) | << 230 (std::fabs(pos.y()) > kLinearPrecision) | << 231 (std::fabs(pos.z()) > kLinearPrecision)) << 232 { << 233 PositionWrite(booleanElement, name + "_pos << 234 } << 235 << 236 if((std::fabs(rot.x()) > kAngularPrecision) << 237 (std::fabs(rot.y()) > kAngularPrecision) << 238 (std::fabs(rot.z()) > kAngularPrecision)) << 239 { << 240 RotationWrite(booleanElement, name + "_rot << 241 } << 242 << 243 if((std::fabs(firstpos.x()) > kLinearPrecisi << 244 (std::fabs(firstpos.y()) > kLinearPrecisi << 245 (std::fabs(firstpos.z()) > kLinearPrecisi << 246 { << 247 FirstpositionWrite(booleanElement, name + << 248 } << 249 << 250 if((std::fabs(firstrot.x()) > kAngularPrecis << 251 (std::fabs(firstrot.y()) > kAngularPrecis << 252 (std::fabs(firstrot.z()) > kAngularPrecis << 253 { << 254 FirstrotationWrite(booleanElement, name + << 255 } << 256 } << 257 << 258 // ------------------------------------------- << 259 void G4GDMLWriteSolids::ScaledWrite(xercesc::D << 260 const G4Sc << 261 { << 262 G4String tag("scaledSolid"); << 263 << 264 G4VSolid* solid = const_cast<G4VSoli << 265 G4Scale3D scale = scaled->GetScaleTr << 266 G4ThreeVector sclVector = G4ThreeVector(scal << 267 << 268 AddSolid(solid); // Add the constituent sol << 269 << 270 const G4String& name = GenerateName(scal << 271 const G4String& solidref = GenerateName(soli << 272 << 273 xercesc::DOMElement* scaledElement = NewElem << 274 scaledElement->setAttributeNode(NewAttribute << 275 << 276 xercesc::DOMElement* solidElement = NewEleme << 277 solidElement->setAttributeNode(NewAttribute( << 278 scaledElement->appendChild(solidElement); << 279 << 280 if((std::fabs(scale.xx()) > kLinearPrecision << 281 (std::fabs(scale.yy()) > kLinearPrecision << 282 (std::fabs(scale.zz()) > kLinearPrecision << 283 { << 284 ScaleWrite(scaledElement, name + "_scl", s << 285 } << 286 << 287 solElement->appendChild(scaledElement); << 288 // Add the scaled solid AFTER its constituen << 289 } << 290 << 291 // ------------------------------------------- << 292 void G4GDMLWriteSolids::BoxWrite(xercesc::DOME << 293 const G4Box* << 294 { << 295 const G4String& name = GenerateName(box->Get << 296 << 297 xercesc::DOMElement* boxElement = NewElement << 298 boxElement->setAttributeNode(NewAttribute("n << 299 boxElement->setAttributeNode( << 300 NewAttribute("x", 2.0 * box->GetXHalfLengt << 301 boxElement->setAttributeNode( << 302 NewAttribute("y", 2.0 * box->GetYHalfLengt << 303 boxElement->setAttributeNode( << 304 NewAttribute("z", 2.0 * box->GetZHalfLengt << 305 boxElement->setAttributeNode(NewAttribute("l << 306 solElement->appendChild(boxElement); << 307 } << 308 << 309 // ------------------------------------------- << 310 void G4GDMLWriteSolids::ConeWrite(xercesc::DOM << 311 const G4Cons << 312 { << 313 const G4String& name = GenerateName(cone->Ge << 314 << 315 xercesc::DOMElement* coneElement = NewElemen << 316 coneElement->setAttributeNode(NewAttribute(" << 317 coneElement->setAttributeNode( << 318 NewAttribute("rmin1", cone->GetInnerRadius << 319 coneElement->setAttributeNode( << 320 NewAttribute("rmax1", cone->GetOuterRadius << 321 coneElement->setAttributeNode( << 322 NewAttribute("rmin2", cone->GetInnerRadius << 323 coneElement->setAttributeNode( << 324 NewAttribute("rmax2", cone->GetOuterRadius << 325 coneElement->setAttributeNode( << 326 NewAttribute("z", 2.0 * cone->GetZHalfLeng << 327 coneElement->setAttributeNode( << 328 NewAttribute("startphi", cone->GetStartPhi << 329 coneElement->setAttributeNode( << 330 NewAttribute("deltaphi", cone->GetDeltaPhi << 331 coneElement->setAttributeNode(NewAttribute(" << 332 coneElement->setAttributeNode(NewAttribute(" << 333 solElement->appendChild(coneElement); << 334 } << 335 << 336 // ------------------------------------------- << 337 void G4GDMLWriteSolids::ElconeWrite(xercesc::D << 338 const G4El << 339 { << 340 const G4String& name = GenerateName(elcone-> << 341 << 342 xercesc::DOMElement* elconeElement = NewElem << 343 elconeElement->setAttributeNode(NewAttribute << 344 elconeElement->setAttributeNode( << 345 NewAttribute("dx", elcone->GetSemiAxisX() << 346 elconeElement->setAttributeNode( << 347 NewAttribute("dy", elcone->GetSemiAxisY() << 348 elconeElement->setAttributeNode(NewAttribute << 349 elconeElement->setAttributeNode( << 350 NewAttribute("zcut", elcone->GetZTopCut() << 351 elconeElement->setAttributeNode(NewAttribute << 352 solElement->appendChild(elconeElement); << 353 } << 354 << 355 // ------------------------------------------- << 356 void G4GDMLWriteSolids::EllipsoidWrite(xercesc << 357 const G << 358 { << 359 const G4String& name = GenerateName(ellipsoi << 360 << 361 xercesc::DOMElement* ellipsoidElement = NewE << 362 ellipsoidElement->setAttributeNode(NewAttrib << 363 ellipsoidElement->setAttributeNode( << 364 NewAttribute("ax", ellipsoid->GetSemiAxisM << 365 ellipsoidElement->setAttributeNode( << 366 NewAttribute("by", ellipsoid->GetSemiAxisM << 367 ellipsoidElement->setAttributeNode( << 368 NewAttribute("cz", ellipsoid->GetSemiAxisM << 369 ellipsoidElement->setAttributeNode( << 370 NewAttribute("zcut1", ellipsoid->GetZBotto << 371 ellipsoidElement->setAttributeNode( << 372 NewAttribute("zcut2", ellipsoid->GetZTopCu << 373 ellipsoidElement->setAttributeNode(NewAttrib << 374 solElement->appendChild(ellipsoidElement); << 375 } << 376 << 377 // ------------------------------------------- << 378 void G4GDMLWriteSolids::EltubeWrite(xercesc::D << 379 const G4El << 380 { << 381 const G4String& name = GenerateName(eltube-> << 382 << 383 xercesc::DOMElement* eltubeElement = NewElem << 384 eltubeElement->setAttributeNode(NewAttribute << 385 eltubeElement->setAttributeNode(NewAttribute << 386 eltubeElement->setAttributeNode(NewAttribute << 387 eltubeElement->setAttributeNode(NewAttribute << 388 eltubeElement->setAttributeNode(NewAttribute << 389 solElement->appendChild(eltubeElement); << 390 } << 391 << 392 // ------------------------------------------- << 393 void G4GDMLWriteSolids::XtruWrite(xercesc::DOM << 394 const G4Extr << 395 { << 396 const G4String& name = GenerateName(xtru->Ge << 397 << 398 xercesc::DOMElement* xtruElement = NewElemen << 399 xtruElement->setAttributeNode(NewAttribute(" << 400 xtruElement->setAttributeNode(NewAttribute(" << 401 solElement->appendChild(xtruElement); << 402 << 403 const G4int NumVertex = xtru->GetNofVertices << 404 << 405 for(G4int i = 0; i < NumVertex; ++i) << 406 { << 407 xercesc::DOMElement* twoDimVertexElement = << 408 xtruElement->appendChild(twoDimVertexEleme << 409 << 410 const G4TwoVector& vertex = xtru->GetVerte << 411 << 412 twoDimVertexElement->setAttributeNode(NewA << 413 twoDimVertexElement->setAttributeNode(NewA << 414 } << 415 << 416 const G4int NumSection = xtru->GetNofZSectio << 417 << 418 for(G4int i = 0; i < NumSection; ++i) << 419 { << 420 xercesc::DOMElement* sectionElement = NewE << 421 xtruElement->appendChild(sectionElement); << 422 << 423 const G4ExtrudedSolid::ZSection section = << 424 << 425 sectionElement->setAttributeNode(NewAttrib << 426 sectionElement->setAttributeNode( << 427 NewAttribute("zPosition", section.fZ / m << 428 sectionElement->setAttributeNode( << 429 NewAttribute("xOffset", section.fOffset. << 430 sectionElement->setAttributeNode( << 431 NewAttribute("yOffset", section.fOffset. << 432 sectionElement->setAttributeNode( << 433 NewAttribute("scalingFactor", section.fS << 434 } << 435 } << 436 << 437 // ------------------------------------------- << 438 void G4GDMLWriteSolids::HypeWrite(xercesc::DOM << 439 const G4Hype << 440 { << 441 const G4String& name = GenerateName(hype->Ge << 442 << 443 xercesc::DOMElement* hypeElement = NewElemen << 444 hypeElement->setAttributeNode(NewAttribute(" << 445 hypeElement->setAttributeNode( << 446 NewAttribute("rmin", hype->GetInnerRadius( << 447 hypeElement->setAttributeNode( << 448 NewAttribute("rmax", hype->GetOuterRadius( << 449 hypeElement->setAttributeNode( << 450 NewAttribute("inst", hype->GetInnerStereo( << 451 hypeElement->setAttributeNode( << 452 NewAttribute("outst", hype->GetOuterStereo << 453 hypeElement->setAttributeNode( << 454 NewAttribute("z", 2.0 * hype->GetZHalfLeng << 455 hypeElement->setAttributeNode(NewAttribute(" << 456 hypeElement->setAttributeNode(NewAttribute(" << 457 solElement->appendChild(hypeElement); << 458 } << 459 << 460 // ------------------------------------------- << 461 void G4GDMLWriteSolids::OrbWrite(xercesc::DOME << 462 const G4Orb* << 463 { << 464 const G4String& name = GenerateName(orb->Get << 465 << 466 xercesc::DOMElement* orbElement = NewElement << 467 orbElement->setAttributeNode(NewAttribute("n << 468 orbElement->setAttributeNode(NewAttribute("r << 469 orbElement->setAttributeNode(NewAttribute("l << 470 solElement->appendChild(orbElement); << 471 } << 472 << 473 // ------------------------------------------- << 474 void G4GDMLWriteSolids::ParaWrite(xercesc::DOM << 475 const G4Para << 476 { << 477 const G4String& name = GenerateName(para->Ge << 478 << 479 const G4ThreeVector simaxis = para->GetSymAx << 480 const G4double alpha = std::atan(para << 481 const G4double phi = simaxis.phi(); << 482 const G4double theta = simaxis.theta( << 483 << 484 xercesc::DOMElement* paraElement = NewElemen << 485 paraElement->setAttributeNode(NewAttribute(" << 486 paraElement->setAttributeNode( << 487 NewAttribute("x", 2.0 * para->GetXHalfLeng << 488 paraElement->setAttributeNode( << 489 NewAttribute("y", 2.0 * para->GetYHalfLeng << 490 paraElement->setAttributeNode( << 491 NewAttribute("z", 2.0 * para->GetZHalfLeng << 492 paraElement->setAttributeNode(NewAttribute(" << 493 paraElement->setAttributeNode(NewAttribute(" << 494 paraElement->setAttributeNode(NewAttribute(" << 495 paraElement->setAttributeNode(NewAttribute(" << 496 paraElement->setAttributeNode(NewAttribute(" << 497 solElement->appendChild(paraElement); << 498 } << 499 << 500 // ------------------------------------------- << 501 void G4GDMLWriteSolids::ParaboloidWrite(xerces << 502 const << 503 { << 504 const G4String& name = GenerateName(parabolo << 505 136 506 xercesc::DOMElement* paraboloidElement = New << 137 solElement->appendChild(multiUnionElement); 507 paraboloidElement->setAttributeNode(NewAttri << 138 // Add the multiUnion solid AFTER the constituent nodes! 508 paraboloidElement->setAttributeNode( << 509 NewAttribute("rlo", paraboloid->GetRadiusM << 510 paraboloidElement->setAttributeNode( << 511 NewAttribute("rhi", paraboloid->GetRadiusP << 512 paraboloidElement->setAttributeNode( << 513 NewAttribute("dz", paraboloid->GetZHalfLen << 514 paraboloidElement->setAttributeNode(NewAttri << 515 solElement->appendChild(paraboloidElement); << 516 } 139 } 517 140 518 // ------------------------------------------- << 141 void G4GDMLWriteSolids:: 519 void G4GDMLWriteSolids::PolyconeWrite(xercesc: << 142 BooleanWrite(xercesc::DOMElement* solElement, 520 const G4 << 143 const G4BooleanSolid* const boolean) 521 { << 144 { 522 const G4String& name = GenerateName(polycone << 145 G4int displaced=0; 523 << 146 524 xercesc::DOMElement* polyconeElement = NewEl << 147 G4String tag("undefined"); 525 polyconeElement->setAttributeNode(NewAttribu << 148 if (dynamic_cast<const G4IntersectionSolid*>(boolean)) 526 polyconeElement->setAttributeNode(NewAttribu << 149 { tag = "intersection"; } else 527 "startphi", polycone->GetOriginalParameter << 150 if (dynamic_cast<const G4SubtractionSolid*>(boolean)) 528 polyconeElement->setAttributeNode(NewAttribu << 151 { tag = "subtraction"; } else 529 "deltaphi", polycone->GetOriginalParameter << 152 if (dynamic_cast<const G4UnionSolid*>(boolean)) 530 polyconeElement->setAttributeNode(NewAttribu << 153 { tag = "union"; } 531 polyconeElement->setAttributeNode(NewAttribu << 154 532 solElement->appendChild(polyconeElement); << 155 G4VSolid* firstPtr = const_cast<G4VSolid*>(boolean->GetConstituentSolid(0)); 533 << 156 G4VSolid* secondPtr = const_cast<G4VSolid*>(boolean->GetConstituentSolid(1)); 534 const std::size_t num_zplanes << 157 535 = polycone->GetOriginalParameters()->N << 158 G4ThreeVector firstpos,firstrot,pos,rot; 536 const G4double* z_array = polycone->GetOr << 159 537 const G4double* rmin_array = polycone->GetOr << 160 // Solve possible displacement of referenced solids! 538 const G4double* rmax_array = polycone->GetOr << 161 // 539 << 162 while (true) 540 for(std::size_t i = 0; i < num_zplanes; ++i) << 163 { 541 { << 164 if ( displaced>8 ) 542 ZplaneWrite(polyconeElement, z_array[i], r << 165 { 543 } << 166 G4String ErrorMessage = "The referenced solid '" 544 } << 167 + firstPtr->GetName() + >> 168 + "in the Boolean shape '" + >> 169 + boolean->GetName() + >> 170 + "' was displaced too many times!"; >> 171 G4Exception("G4GDMLWriteSolids::BooleanWrite()", >> 172 "InvalidSetup", FatalException, ErrorMessage); >> 173 } 545 174 546 // ------------------------------------------- << 175 if (G4DisplacedSolid* disp = dynamic_cast<G4DisplacedSolid*>(firstPtr)) 547 void G4GDMLWriteSolids::GenericPolyconeWrite( << 176 { 548 xercesc::DOMElement* solElement, const G4Gen << 177 firstpos += disp->GetObjectTranslation(); 549 { << 178 firstrot += GetAngles(disp->GetObjectRotation()); 550 const G4String& name = GenerateName(polycone << 179 firstPtr = disp->GetConstituentMovedSolid(); 551 xercesc::DOMElement* polyconeElement = NewEl << 180 displaced++; 552 const G4double startPhi = polyc << 181 continue; 553 polyconeElement->setAttributeNode(NewAttribu << 182 } 554 polyconeElement->setAttributeNode( << 183 break; 555 NewAttribute("startphi", startPhi / degree << 184 } 556 polyconeElement->setAttributeNode( << 185 displaced = 0; 557 NewAttribute("deltaphi", (polycone->GetEnd << 186 while (true) 558 polyconeElement->setAttributeNode(NewAttribu << 187 { 559 polyconeElement->setAttributeNode(NewAttribu << 188 if ( displaced>maxTransforms ) 560 solElement->appendChild(polyconeElement); << 189 { 561 << 190 G4String ErrorMessage = "The referenced solid '" 562 const G4int num_rzpoints = (G4int)polycone-> << 191 + secondPtr->GetName() + 563 for(G4int i = 0; i < num_rzpoints; ++i) << 192 + "in the Boolean shape '" + 564 { << 193 + boolean->GetName() + 565 const G4double r_point = polycone->GetCorn << 194 + "' was displaced too many times!"; 566 const G4double z_point = polycone->GetCorn << 195 G4Exception("G4GDMLWriteSolids::BooleanWrite()", 567 RZPointWrite(polyconeElement, r_point, z_p << 196 "InvalidSetup", FatalException, ErrorMessage); 568 } << 197 } 569 } << 570 198 571 // ------------------------------------------- << 199 if (G4DisplacedSolid* disp = dynamic_cast<G4DisplacedSolid*>(secondPtr)) 572 void G4GDMLWriteSolids::PolyhedraWrite(xercesc << 200 { 573 const G << 201 pos += disp->GetObjectTranslation(); 574 { << 202 rot += GetAngles(disp->GetObjectRotation()); 575 const G4String& name = GenerateName(polyhedr << 203 secondPtr = disp->GetConstituentMovedSolid(); 576 if(polyhedra->IsGeneric() == false) << 204 displaced++; 577 { << 205 continue; 578 xercesc::DOMElement* polyhedraElement = Ne << 206 } 579 polyhedraElement->setAttributeNode(NewAttr << 207 break; 580 polyhedraElement->setAttributeNode(NewAttr << 208 } 581 "startphi", polyhedra->GetOriginalParame << 582 polyhedraElement->setAttributeNode(NewAttr << 583 "deltaphi", polyhedra->GetOriginalParame << 584 polyhedraElement->setAttributeNode( << 585 NewAttribute("numsides", polyhedra->GetO << 586 polyhedraElement->setAttributeNode(NewAttr << 587 polyhedraElement->setAttributeNode(NewAttr << 588 solElement->appendChild(polyhedraElement); << 589 << 590 const std::size_t num_zplanes << 591 = polyhedra->GetOriginalParameters() << 592 const G4double* z_array = polyhedra->GetO << 593 const G4double* rmin_array = polyhedra->Ge << 594 const G4double* rmax_array = polyhedra->Ge << 595 << 596 const G4double convertRad = << 597 std::cos(0.5 * polyhedra->GetOriginalPar << 598 polyhedra->GetOriginalParameter << 599 209 600 for(std::size_t i = 0; i < num_zplanes; ++ << 210 AddSolid(firstPtr); // At first add the constituent solids! 601 { << 211 AddSolid(secondPtr); 602 ZplaneWrite(polyhedraElement, z_array[i] << 603 rmax_array[i] * convertRad); << 604 } << 605 } << 606 else // generic polyhedra << 607 { << 608 xercesc::DOMElement* polyhedraElement = Ne << 609 polyhedraElement->setAttributeNode(NewAttr << 610 polyhedraElement->setAttributeNode(NewAttr << 611 "startphi", polyhedra->GetOriginalParame << 612 polyhedraElement->setAttributeNode(NewAttr << 613 "deltaphi", polyhedra->GetOriginalParame << 614 polyhedraElement->setAttributeNode( << 615 NewAttribute("numsides", polyhedra->GetO << 616 polyhedraElement->setAttributeNode(NewAttr << 617 polyhedraElement->setAttributeNode(NewAttr << 618 solElement->appendChild(polyhedraElement); << 619 212 620 const G4int num_rzpoints = (G4int)polyhedr << 213 const G4String& name = GenerateName(boolean->GetName(),boolean); >> 214 const G4String& firstref = GenerateName(firstPtr->GetName(),firstPtr); >> 215 const G4String& secondref = GenerateName(secondPtr->GetName(),secondPtr); >> 216 >> 217 xercesc::DOMElement* booleanElement = NewElement(tag); >> 218 booleanElement->setAttributeNode(NewAttribute("name",name)); >> 219 xercesc::DOMElement* firstElement = NewElement("first"); >> 220 firstElement->setAttributeNode(NewAttribute("ref",firstref)); >> 221 booleanElement->appendChild(firstElement); >> 222 xercesc::DOMElement* secondElement = NewElement("second"); >> 223 secondElement->setAttributeNode(NewAttribute("ref",secondref)); >> 224 booleanElement->appendChild(secondElement); >> 225 solElement->appendChild(booleanElement); >> 226 // Add the boolean solid AFTER the constituent solids! >> 227 >> 228 if ( (std::fabs(pos.x()) > kLinearPrecision) >> 229 || (std::fabs(pos.y()) > kLinearPrecision) >> 230 || (std::fabs(pos.z()) > kLinearPrecision) ) >> 231 { >> 232 PositionWrite(booleanElement,name+"_pos",pos); >> 233 } >> 234 >> 235 if ( (std::fabs(rot.x()) > kAngularPrecision) >> 236 || (std::fabs(rot.y()) > kAngularPrecision) >> 237 || (std::fabs(rot.z()) > kAngularPrecision) ) >> 238 { >> 239 RotationWrite(booleanElement,name+"_rot",rot); >> 240 } >> 241 >> 242 if ( (std::fabs(firstpos.x()) > kLinearPrecision) >> 243 || (std::fabs(firstpos.y()) > kLinearPrecision) >> 244 || (std::fabs(firstpos.z()) > kLinearPrecision) ) >> 245 { >> 246 FirstpositionWrite(booleanElement,name+"_fpos",firstpos); >> 247 } >> 248 >> 249 if ( (std::fabs(firstrot.x()) > kAngularPrecision) >> 250 || (std::fabs(firstrot.y()) > kAngularPrecision) >> 251 || (std::fabs(firstrot.z()) > kAngularPrecision) ) >> 252 { >> 253 FirstrotationWrite(booleanElement,name+"_frot",firstrot); >> 254 } >> 255 } >> 256 >> 257 void G4GDMLWriteSolids:: >> 258 ScaledWrite(xercesc::DOMElement* solElement, >> 259 const G4ScaledSolid* const scaled) >> 260 { >> 261 G4String tag("scaledSolid"); >> 262 >> 263 G4VSolid* solid = const_cast<G4VSolid*>(scaled->GetUnscaledSolid()); >> 264 G4Scale3D scale = scaled->GetScaleTransform(); >> 265 G4ThreeVector sclVector = G4ThreeVector(scale.xx(), scale.yy(), scale.zz()); >> 266 >> 267 AddSolid(solid); // Add the constituent solid! >> 268 >> 269 const G4String& name = GenerateName(scaled->GetName(),scaled); >> 270 const G4String& solidref = GenerateName(solid->GetName(),solid); >> 271 >> 272 xercesc::DOMElement* scaledElement = NewElement(tag); >> 273 scaledElement->setAttributeNode(NewAttribute("name",name)); >> 274 >> 275 xercesc::DOMElement* solidElement = NewElement("solidref"); >> 276 solidElement->setAttributeNode(NewAttribute("ref",solidref)); >> 277 scaledElement->appendChild(solidElement); >> 278 >> 279 if ( (std::fabs(scale.xx()) > kLinearPrecision) >> 280 && (std::fabs(scale.yy()) > kLinearPrecision) >> 281 && (std::fabs(scale.zz()) > kLinearPrecision) ) >> 282 { >> 283 ScaleWrite(scaledElement, name+"_scl", sclVector); >> 284 } >> 285 >> 286 solElement->appendChild(scaledElement); >> 287 // Add the scaled solid AFTER its constituent solid! >> 288 } >> 289 >> 290 void G4GDMLWriteSolids:: >> 291 BoxWrite(xercesc::DOMElement* solElement, const G4Box* const box) >> 292 { >> 293 const G4String& name = GenerateName(box->GetName(),box); >> 294 >> 295 xercesc::DOMElement* boxElement = NewElement("box"); >> 296 boxElement->setAttributeNode(NewAttribute("name",name)); >> 297 boxElement->setAttributeNode(NewAttribute("x",2.0*box->GetXHalfLength()/mm)); >> 298 boxElement->setAttributeNode(NewAttribute("y",2.0*box->GetYHalfLength()/mm)); >> 299 boxElement->setAttributeNode(NewAttribute("z",2.0*box->GetZHalfLength()/mm)); >> 300 boxElement->setAttributeNode(NewAttribute("lunit","mm")); >> 301 solElement->appendChild(boxElement); >> 302 } >> 303 >> 304 void G4GDMLWriteSolids:: >> 305 ConeWrite(xercesc::DOMElement* solElement, const G4Cons* const cone) >> 306 { >> 307 const G4String& name = GenerateName(cone->GetName(),cone); >> 308 >> 309 xercesc::DOMElement* coneElement = NewElement("cone"); >> 310 coneElement->setAttributeNode(NewAttribute("name",name)); >> 311 coneElement-> >> 312 setAttributeNode(NewAttribute("rmin1",cone->GetInnerRadiusMinusZ()/mm)); >> 313 coneElement-> >> 314 setAttributeNode(NewAttribute("rmax1",cone->GetOuterRadiusMinusZ()/mm)); >> 315 coneElement-> >> 316 setAttributeNode(NewAttribute("rmin2",cone->GetInnerRadiusPlusZ()/mm)); >> 317 coneElement-> >> 318 setAttributeNode(NewAttribute("rmax2",cone->GetOuterRadiusPlusZ()/mm)); >> 319 coneElement-> >> 320 setAttributeNode(NewAttribute("z",2.0*cone->GetZHalfLength()/mm)); >> 321 coneElement-> >> 322 setAttributeNode(NewAttribute("startphi",cone->GetStartPhiAngle()/degree)); >> 323 coneElement-> >> 324 setAttributeNode(NewAttribute("deltaphi",cone->GetDeltaPhiAngle()/degree)); >> 325 coneElement->setAttributeNode(NewAttribute("aunit","deg")); >> 326 coneElement->setAttributeNode(NewAttribute("lunit","mm")); >> 327 solElement->appendChild(coneElement); >> 328 } >> 329 >> 330 void G4GDMLWriteSolids:: >> 331 ElconeWrite(xercesc::DOMElement* solElement, >> 332 const G4EllipticalCone* const elcone) >> 333 { >> 334 const G4String& name = GenerateName(elcone->GetName(),elcone); >> 335 >> 336 xercesc::DOMElement* elconeElement = NewElement("elcone"); >> 337 elconeElement->setAttributeNode(NewAttribute("name",name)); >> 338 elconeElement->setAttributeNode(NewAttribute("dx",elcone->GetSemiAxisX()/mm)); >> 339 elconeElement->setAttributeNode(NewAttribute("dy",elcone->GetSemiAxisY()/mm)); >> 340 elconeElement->setAttributeNode(NewAttribute("zmax",elcone->GetZMax()/mm)); >> 341 elconeElement->setAttributeNode(NewAttribute("zcut",elcone->GetZTopCut()/mm)); >> 342 elconeElement->setAttributeNode(NewAttribute("lunit","mm")); >> 343 solElement->appendChild(elconeElement); >> 344 } >> 345 >> 346 void G4GDMLWriteSolids:: >> 347 EllipsoidWrite(xercesc::DOMElement* solElement, >> 348 const G4Ellipsoid* const ellipsoid) >> 349 { >> 350 const G4String& name = GenerateName(ellipsoid->GetName(),ellipsoid); >> 351 >> 352 xercesc::DOMElement* ellipsoidElement = NewElement("ellipsoid"); >> 353 ellipsoidElement->setAttributeNode(NewAttribute("name",name)); >> 354 ellipsoidElement-> >> 355 setAttributeNode(NewAttribute("ax",ellipsoid->GetSemiAxisMax(0)/mm)); >> 356 ellipsoidElement-> >> 357 setAttributeNode(NewAttribute("by",ellipsoid->GetSemiAxisMax(1)/mm)); >> 358 ellipsoidElement-> >> 359 setAttributeNode(NewAttribute("cz",ellipsoid->GetSemiAxisMax(2)/mm)); >> 360 ellipsoidElement-> >> 361 setAttributeNode(NewAttribute("zcut1",ellipsoid->GetZBottomCut()/mm)); >> 362 ellipsoidElement-> >> 363 setAttributeNode(NewAttribute("zcut2",ellipsoid->GetZTopCut()/mm)); >> 364 ellipsoidElement-> >> 365 setAttributeNode(NewAttribute("lunit","mm")); >> 366 solElement->appendChild(ellipsoidElement); >> 367 } >> 368 >> 369 void G4GDMLWriteSolids:: >> 370 EltubeWrite(xercesc::DOMElement* solElement, >> 371 const G4EllipticalTube* const eltube) >> 372 { >> 373 const G4String& name = GenerateName(eltube->GetName(),eltube); >> 374 >> 375 xercesc::DOMElement* eltubeElement = NewElement("eltube"); >> 376 eltubeElement->setAttributeNode(NewAttribute("name",name)); >> 377 eltubeElement->setAttributeNode(NewAttribute("dx",eltube->GetDx()/mm)); >> 378 eltubeElement->setAttributeNode(NewAttribute("dy",eltube->GetDy()/mm)); >> 379 eltubeElement->setAttributeNode(NewAttribute("dz",eltube->GetDz()/mm)); >> 380 eltubeElement->setAttributeNode(NewAttribute("lunit","mm")); >> 381 solElement->appendChild(eltubeElement); >> 382 } >> 383 >> 384 void G4GDMLWriteSolids:: >> 385 XtruWrite(xercesc::DOMElement* solElement, >> 386 const G4ExtrudedSolid* const xtru) >> 387 { >> 388 const G4String& name = GenerateName(xtru->GetName(),xtru); >> 389 >> 390 xercesc::DOMElement* xtruElement = NewElement("xtru"); >> 391 xtruElement->setAttributeNode(NewAttribute("name",name)); >> 392 xtruElement->setAttributeNode(NewAttribute("lunit","mm")); >> 393 solElement->appendChild(xtruElement); >> 394 >> 395 const G4int NumVertex = xtru->GetNofVertices(); >> 396 >> 397 for (G4int i=0;i<NumVertex;i++) >> 398 { >> 399 xercesc::DOMElement* twoDimVertexElement = NewElement("twoDimVertex"); >> 400 xtruElement->appendChild(twoDimVertexElement); >> 401 >> 402 const G4TwoVector& vertex = xtru->GetVertex(i); >> 403 >> 404 twoDimVertexElement->setAttributeNode(NewAttribute("x",vertex.x()/mm)); >> 405 twoDimVertexElement->setAttributeNode(NewAttribute("y",vertex.y()/mm)); >> 406 } >> 407 >> 408 const G4int NumSection = xtru->GetNofZSections(); >> 409 >> 410 for (G4int i=0;i<NumSection;i++) >> 411 { >> 412 xercesc::DOMElement* sectionElement = NewElement("section"); >> 413 xtruElement->appendChild(sectionElement); >> 414 >> 415 const G4ExtrudedSolid::ZSection section = xtru->GetZSection(i); >> 416 >> 417 sectionElement->setAttributeNode(NewAttribute("zOrder",i)); >> 418 sectionElement->setAttributeNode(NewAttribute("zPosition",section.fZ/mm)); >> 419 sectionElement-> >> 420 setAttributeNode(NewAttribute("xOffset",section.fOffset.x()/mm)); >> 421 sectionElement-> >> 422 setAttributeNode(NewAttribute("yOffset",section.fOffset.y()/mm)); >> 423 sectionElement-> >> 424 setAttributeNode(NewAttribute("scalingFactor",section.fScale)); >> 425 } >> 426 } >> 427 >> 428 void G4GDMLWriteSolids:: >> 429 HypeWrite(xercesc::DOMElement* solElement, const G4Hype* const hype) >> 430 { >> 431 const G4String& name = GenerateName(hype->GetName(),hype); >> 432 >> 433 xercesc::DOMElement* hypeElement = NewElement("hype"); >> 434 hypeElement->setAttributeNode(NewAttribute("name",name)); >> 435 hypeElement->setAttributeNode(NewAttribute("rmin", >> 436 hype->GetInnerRadius()/mm)); >> 437 hypeElement->setAttributeNode(NewAttribute("rmax", >> 438 hype->GetOuterRadius()/mm)); >> 439 hypeElement->setAttributeNode(NewAttribute("inst", >> 440 hype->GetInnerStereo()/degree)); >> 441 hypeElement->setAttributeNode(NewAttribute("outst", >> 442 hype->GetOuterStereo()/degree)); >> 443 hypeElement->setAttributeNode(NewAttribute("z", >> 444 2.0*hype->GetZHalfLength()/mm)); >> 445 hypeElement->setAttributeNode(NewAttribute("aunit","deg")); >> 446 hypeElement->setAttributeNode(NewAttribute("lunit","mm")); >> 447 solElement->appendChild(hypeElement); >> 448 } >> 449 >> 450 void G4GDMLWriteSolids:: >> 451 OrbWrite(xercesc::DOMElement* solElement, const G4Orb* const orb) >> 452 { >> 453 const G4String& name = GenerateName(orb->GetName(),orb); >> 454 >> 455 xercesc::DOMElement* orbElement = NewElement("orb"); >> 456 orbElement->setAttributeNode(NewAttribute("name",name)); >> 457 orbElement->setAttributeNode(NewAttribute("r",orb->GetRadius()/mm)); >> 458 orbElement->setAttributeNode(NewAttribute("lunit","mm")); >> 459 solElement->appendChild(orbElement); >> 460 } >> 461 >> 462 void G4GDMLWriteSolids:: >> 463 ParaWrite(xercesc::DOMElement* solElement, const G4Para* const para) >> 464 { >> 465 const G4String& name = GenerateName(para->GetName(),para); >> 466 >> 467 const G4ThreeVector simaxis = para->GetSymAxis(); >> 468 const G4double alpha = std::atan(para->GetTanAlpha()); >> 469 const G4double phi = simaxis.phi(); >> 470 const G4double theta = simaxis.theta(); >> 471 >> 472 xercesc::DOMElement* paraElement = NewElement("para"); >> 473 paraElement->setAttributeNode(NewAttribute("name",name)); >> 474 paraElement->setAttributeNode(NewAttribute("x", >> 475 2.0*para->GetXHalfLength()/mm)); >> 476 paraElement->setAttributeNode(NewAttribute("y", >> 477 2.0*para->GetYHalfLength()/mm)); >> 478 paraElement->setAttributeNode(NewAttribute("z", >> 479 2.0*para->GetZHalfLength()/mm)); >> 480 paraElement->setAttributeNode(NewAttribute("alpha",alpha/degree)); >> 481 paraElement->setAttributeNode(NewAttribute("theta",theta/degree)); >> 482 paraElement->setAttributeNode(NewAttribute("phi",phi/degree)); >> 483 paraElement->setAttributeNode(NewAttribute("aunit","deg")); >> 484 paraElement->setAttributeNode(NewAttribute("lunit","mm")); >> 485 solElement->appendChild(paraElement); >> 486 } >> 487 >> 488 void G4GDMLWriteSolids:: >> 489 ParaboloidWrite(xercesc::DOMElement* solElement, >> 490 const G4Paraboloid* const paraboloid) >> 491 { >> 492 const G4String& name = GenerateName(paraboloid->GetName(),paraboloid); >> 493 >> 494 xercesc::DOMElement* paraboloidElement = NewElement("paraboloid"); >> 495 paraboloidElement->setAttributeNode(NewAttribute("name",name)); >> 496 paraboloidElement->setAttributeNode(NewAttribute("rlo", >> 497 paraboloid->GetRadiusMinusZ()/mm)); >> 498 paraboloidElement->setAttributeNode(NewAttribute("rhi", >> 499 paraboloid->GetRadiusPlusZ()/mm)); >> 500 paraboloidElement->setAttributeNode(NewAttribute("dz", >> 501 paraboloid->GetZHalfLength()/mm)); >> 502 paraboloidElement->setAttributeNode(NewAttribute("lunit","mm")); >> 503 solElement->appendChild(paraboloidElement); >> 504 } >> 505 void G4GDMLWriteSolids:: >> 506 PolyconeWrite(xercesc::DOMElement* solElement, >> 507 const G4Polycone* const polycone) >> 508 { >> 509 const G4String& name = GenerateName(polycone->GetName(),polycone); >> 510 >> 511 xercesc::DOMElement* polyconeElement = NewElement("polycone"); >> 512 polyconeElement->setAttributeNode(NewAttribute("name",name)); >> 513 polyconeElement->setAttributeNode(NewAttribute("startphi", >> 514 polycone->GetOriginalParameters()->Start_angle/degree)); >> 515 polyconeElement->setAttributeNode(NewAttribute("deltaphi", >> 516 polycone->GetOriginalParameters()->Opening_angle/degree)); >> 517 polyconeElement->setAttributeNode(NewAttribute("aunit","deg")); >> 518 polyconeElement->setAttributeNode(NewAttribute("lunit","mm")); >> 519 solElement->appendChild(polyconeElement); >> 520 >> 521 const size_t num_zplanes = polycone->GetOriginalParameters()->Num_z_planes; >> 522 const G4double* z_array = polycone->GetOriginalParameters()->Z_values; >> 523 const G4double* rmin_array = polycone->GetOriginalParameters()->Rmin; >> 524 const G4double* rmax_array = polycone->GetOriginalParameters()->Rmax; 621 525 622 for(G4int i = 0; i < num_rzpoints; ++i) << 526 for (size_t i=0; i<num_zplanes; i++) 623 { 527 { 624 const G4double r_point = polyhedra->GetC << 528 ZplaneWrite(polyconeElement,z_array[i],rmin_array[i],rmax_array[i]); 625 const G4double z_point = polyhedra->GetC << 626 RZPointWrite(polyhedraElement, r_point, << 627 } 529 } 628 } << 530 629 } << 531 630 << 631 // ------------------------------------------- << 632 void G4GDMLWriteSolids::SphereWrite(xercesc::D << 633 const G4Sp << 634 { << 635 const G4String& name = GenerateName(sphere-> << 636 << 637 xercesc::DOMElement* sphereElement = NewElem << 638 sphereElement->setAttributeNode(NewAttribute << 639 sphereElement->setAttributeNode( << 640 NewAttribute("rmin", sphere->GetInnerRadiu << 641 sphereElement->setAttributeNode( << 642 NewAttribute("rmax", sphere->GetOuterRadiu << 643 sphereElement->setAttributeNode( << 644 NewAttribute("startphi", sphere->GetStartP << 645 sphereElement->setAttributeNode( << 646 NewAttribute("deltaphi", sphere->GetDeltaP << 647 sphereElement->setAttributeNode( << 648 NewAttribute("starttheta", sphere->GetStar << 649 sphereElement->setAttributeNode( << 650 NewAttribute("deltatheta", sphere->GetDelt << 651 sphereElement->setAttributeNode(NewAttribute << 652 sphereElement->setAttributeNode(NewAttribute << 653 solElement->appendChild(sphereElement); << 654 } 532 } 655 533 656 // ------------------------------------------- << 534 void G4GDMLWriteSolids:: 657 void G4GDMLWriteSolids::TessellatedWrite( << 535 GenericPolyconeWrite(xercesc::DOMElement* solElement, 658 xercesc::DOMElement* solElement, const G4Tes << 536 const G4GenericPolycone* const polycone) 659 { << 537 { 660 const G4String& solid_name = tessellated->Ge << 538 const G4String& name = GenerateName(polycone->GetName(),polycone); 661 const G4String& name = GenerateName(so << 539 xercesc::DOMElement* polyconeElement = NewElement("genericPolycone"); 662 << 540 const G4double startPhi=polycone->GetStartPhi(); 663 xercesc::DOMElement* tessellatedElement = Ne << 541 polyconeElement->setAttributeNode(NewAttribute("name",name)); 664 tessellatedElement->setAttributeNode(NewAttr << 542 polyconeElement->setAttributeNode(NewAttribute("startphi", 665 tessellatedElement->setAttributeNode(NewAttr << 543 startPhi/degree)); 666 tessellatedElement->setAttributeNode(NewAttr << 544 polyconeElement->setAttributeNode(NewAttribute("deltaphi", 667 solElement->appendChild(tessellatedElement); << 545 (polycone->GetEndPhi()-startPhi)/degree)); 668 << 546 polyconeElement->setAttributeNode(NewAttribute("aunit","deg")); 669 std::map<G4ThreeVector, G4String, G4ThreeVec << 547 polyconeElement->setAttributeNode(NewAttribute("lunit","mm")); >> 548 solElement->appendChild(polyconeElement); 670 549 671 const std::size_t NumFacets = tessellated->G << 550 const size_t num_rzpoints = polycone->GetNumRZCorner(); 672 std::size_t NumVertex = 0; << 551 for (size_t i=0; i<num_rzpoints; i++) 673 << 674 for(std::size_t i = 0; i < NumFacets; ++i) << 675 { << 676 const G4VFacet* facet = tessellat << 677 const size_t NumVertexPerFacet = facet->Ge << 678 << 679 G4String FacetTag; << 680 << 681 if(NumVertexPerFacet == 3) << 682 { << 683 FacetTag = "triangular"; << 684 } << 685 else if(NumVertexPerFacet == 4) << 686 { << 687 FacetTag = "quadrangular"; << 688 } << 689 else << 690 { 552 { 691 G4Exception("G4GDMLWriteSolids::Tessella << 553 const G4double r_point=polycone->GetCorner(i).r; 692 FatalException, "Facet shoul << 554 const G4double z_point=polycone->GetCorner(i).z; >> 555 RZPointWrite(polyconeElement,r_point,z_point); 693 } 556 } >> 557 } 694 558 695 xercesc::DOMElement* facetElement = NewEle << 559 void G4GDMLWriteSolids:: 696 tessellatedElement->appendChild(facetEleme << 560 PolyhedraWrite(xercesc::DOMElement* solElement, 697 << 561 const G4Polyhedra* const polyhedra) 698 for(std::size_t j = 0; j < NumVertexPerFac << 562 { 699 { << 563 const G4String& name = GenerateName(polyhedra->GetName(),polyhedra); 700 std::stringstream name_stream; << 564 if(polyhedra->IsGeneric() == false) 701 std::stringstream ref_stream; << 565 { 702 << 566 xercesc::DOMElement* polyhedraElement = NewElement("polyhedra"); 703 name_stream << "vertex" << (j + 1); << 567 polyhedraElement->setAttributeNode(NewAttribute("name",name)); 704 ref_stream << solid_name << "_v" << NumV << 568 polyhedraElement->setAttributeNode(NewAttribute("startphi", 705 << 569 polyhedra->GetOriginalParameters()->Start_angle/degree)); 706 const G4String& fname = name_stream.str( << 570 polyhedraElement->setAttributeNode(NewAttribute("deltaphi", 707 G4String ref = ref_stream.str() << 571 polyhedra->GetOriginalParameters()->Opening_angle/degree)); 708 << 572 polyhedraElement->setAttributeNode(NewAttribute("numsides", 709 // Now search for the existance of the c << 573 polyhedra->GetOriginalParameters()->numSide)); 710 // map of cached vertices. If existing, << 574 polyhedraElement->setAttributeNode(NewAttribute("aunit","deg")); 711 // position in the GDML file, so avoidin << 575 polyhedraElement->setAttributeNode(NewAttribute("lunit","mm")); 712 // cache it in the local map and add it << 576 solElement->appendChild(polyhedraElement); 713 // "define" section of the GDML file. << 577 714 << 578 const size_t num_zplanes = 715 const G4ThreeVector& vertex = facet->Get << 579 polyhedra->GetOriginalParameters()->Num_z_planes; 716 << 580 const G4double* z_array = 717 if(vertexMap.find(vertex) != vertexMap.c << 581 polyhedra->GetOriginalParameters()->Z_values; 718 { << 582 const G4double* rmin_array = polyhedra->GetOriginalParameters()->Rmin; 719 ref = vertexMap[vertex]; // Set the p << 583 const G4double* rmax_array = polyhedra->GetOriginalParameters()->Rmax; 720 } << 584 721 else // Vertex not found << 585 const G4double convertRad = >> 586 std::cos(0.5*polyhedra->GetOriginalParameters()->Opening_angle >> 587 / polyhedra->GetOriginalParameters()->numSide); >> 588 >> 589 for (size_t i=0;i<num_zplanes;i++) >> 590 { >> 591 ZplaneWrite(polyhedraElement,z_array[i], >> 592 rmin_array[i]*convertRad, rmax_array[i]*convertRad); >> 593 } >> 594 } >> 595 else // generic polyhedra >> 596 { >> 597 xercesc::DOMElement* polyhedraElement = NewElement("genericPolyhedra"); >> 598 polyhedraElement->setAttributeNode(NewAttribute("name",name)); >> 599 polyhedraElement->setAttributeNode(NewAttribute("startphi", >> 600 polyhedra->GetOriginalParameters()->Start_angle/degree)); >> 601 polyhedraElement->setAttributeNode(NewAttribute("deltaphi", >> 602 polyhedra->GetOriginalParameters()->Opening_angle/degree)); >> 603 polyhedraElement->setAttributeNode(NewAttribute("numsides", >> 604 polyhedra->GetOriginalParameters()->numSide)); >> 605 polyhedraElement->setAttributeNode(NewAttribute("aunit","deg")); >> 606 polyhedraElement->setAttributeNode(NewAttribute("lunit","mm")); >> 607 solElement->appendChild(polyhedraElement); >> 608 >> 609 const size_t num_rzpoints = polyhedra->GetNumRZCorner(); >> 610 >> 611 for (size_t i=0;i<num_rzpoints;i++) >> 612 { >> 613 const G4double r_point = polyhedra->GetCorner(i).r; >> 614 const G4double z_point = polyhedra->GetCorner(i).z; >> 615 RZPointWrite(polyhedraElement,r_point,z_point); >> 616 } >> 617 } >> 618 } >> 619 >> 620 void G4GDMLWriteSolids:: >> 621 SphereWrite(xercesc::DOMElement* solElement, const G4Sphere* const sphere) >> 622 { >> 623 const G4String& name = GenerateName(sphere->GetName(),sphere); >> 624 >> 625 xercesc::DOMElement* sphereElement = NewElement("sphere"); >> 626 sphereElement->setAttributeNode(NewAttribute("name",name)); >> 627 sphereElement->setAttributeNode(NewAttribute("rmin", >> 628 sphere->GetInnerRadius()/mm)); >> 629 sphereElement->setAttributeNode(NewAttribute("rmax", >> 630 sphere->GetOuterRadius()/mm)); >> 631 sphereElement->setAttributeNode(NewAttribute("startphi", >> 632 sphere->GetStartPhiAngle()/degree)); >> 633 sphereElement->setAttributeNode(NewAttribute("deltaphi", >> 634 sphere->GetDeltaPhiAngle()/degree)); >> 635 sphereElement->setAttributeNode(NewAttribute("starttheta", >> 636 sphere->GetStartThetaAngle()/degree)); >> 637 sphereElement->setAttributeNode(NewAttribute("deltatheta", >> 638 sphere->GetDeltaThetaAngle()/degree)); >> 639 sphereElement->setAttributeNode(NewAttribute("aunit","deg")); >> 640 sphereElement->setAttributeNode(NewAttribute("lunit","mm")); >> 641 solElement->appendChild(sphereElement); >> 642 } >> 643 >> 644 void G4GDMLWriteSolids:: >> 645 TessellatedWrite(xercesc::DOMElement* solElement, >> 646 const G4TessellatedSolid* const tessellated) >> 647 { >> 648 const G4String& solid_name = tessellated->GetName(); >> 649 const G4String& name = GenerateName(solid_name, tessellated); >> 650 >> 651 xercesc::DOMElement* tessellatedElement = NewElement("tessellated"); >> 652 tessellatedElement->setAttributeNode(NewAttribute("name",name)); >> 653 tessellatedElement->setAttributeNode(NewAttribute("aunit","deg")); >> 654 tessellatedElement->setAttributeNode(NewAttribute("lunit","mm")); >> 655 solElement->appendChild(tessellatedElement); >> 656 >> 657 std::map<G4ThreeVector, G4String, G4ThreeVectorCompare> vertexMap; >> 658 >> 659 const size_t NumFacets = tessellated->GetNumberOfFacets(); >> 660 size_t NumVertex = 0; >> 661 >> 662 for (size_t i=0;i<NumFacets;i++) >> 663 { >> 664 const G4VFacet* facet = tessellated->GetFacet(i); >> 665 const size_t NumVertexPerFacet = facet->GetNumberOfVertices(); >> 666 >> 667 G4String FacetTag; >> 668 >> 669 if (NumVertexPerFacet==3) { FacetTag="triangular"; } else >> 670 if (NumVertexPerFacet==4) { FacetTag="quadrangular"; } >> 671 else 722 { 672 { 723 if ( ! vertexMap.insert(std::make_pair << 673 G4Exception("G4GDMLWriteSolids::TessellatedWrite()", "InvalidSetup", 724 { << 674 FatalException, "Facet should contain 3 or 4 vertices!"); 725 G4ExceptionDescription description; << 726 description << "Failed to insert [ve << 727 << ref << " in map."; << 728 G4Exception("G4GDMLWriteSolids::Tess << 729 JustWarning, descriptio << 730 } << 731 AddPosition(ref, vertex); // ... add << 732 ++NumVertex; << 733 } 675 } 734 676 735 // Now create association of the vertex << 677 xercesc::DOMElement* facetElement = NewElement(FacetTag); 736 // << 678 tessellatedElement->appendChild(facetElement); 737 facetElement->setAttributeNode(NewAttrib << 738 } << 739 } << 740 } << 741 << 742 // ------------------------------------------- << 743 void G4GDMLWriteSolids::TetWrite(xercesc::DOME << 744 const G4Tet* << 745 { << 746 const G4String& solid_name = tet->GetName(); << 747 const G4String& name = GenerateName(so << 748 << 749 std::vector<G4ThreeVector> vertexList = tet- << 750 << 751 xercesc::DOMElement* tetElement = NewElement << 752 tetElement->setAttributeNode(NewAttribute("n << 753 tetElement->setAttributeNode(NewAttribute("v << 754 tetElement->setAttributeNode(NewAttribute("v << 755 tetElement->setAttributeNode(NewAttribute("v << 756 tetElement->setAttributeNode(NewAttribute("v << 757 tetElement->setAttributeNode(NewAttribute("l << 758 solElement->appendChild(tetElement); << 759 << 760 AddPosition(solid_name + "_v1", vertexList[0 << 761 AddPosition(solid_name + "_v2", vertexList[1 << 762 AddPosition(solid_name + "_v3", vertexList[2 << 763 AddPosition(solid_name + "_v4", vertexList[3 << 764 } << 765 << 766 // ------------------------------------------- << 767 void G4GDMLWriteSolids::TorusWrite(xercesc::DO << 768 const G4Tor << 769 { << 770 const G4String& name = GenerateName(torus->G << 771 << 772 xercesc::DOMElement* torusElement = NewEleme << 773 torusElement->setAttributeNode(NewAttribute( << 774 torusElement->setAttributeNode(NewAttribute( << 775 torusElement->setAttributeNode(NewAttribute( << 776 torusElement->setAttributeNode(NewAttribute( << 777 torusElement->setAttributeNode( << 778 NewAttribute("startphi", torus->GetSPhi() << 779 torusElement->setAttributeNode( << 780 NewAttribute("deltaphi", torus->GetDPhi() << 781 torusElement->setAttributeNode(NewAttribute( << 782 torusElement->setAttributeNode(NewAttribute( << 783 solElement->appendChild(torusElement); << 784 } << 785 << 786 // ------------------------------------------- << 787 void G4GDMLWriteSolids::GenTrapWrite(xercesc:: << 788 const G4G << 789 { << 790 const G4String& name = GenerateName(gtrap->G << 791 << 792 std::vector<G4TwoVector> vertices = gtrap->G << 793 << 794 xercesc::DOMElement* gtrapElement = NewEleme << 795 gtrapElement->setAttributeNode(NewAttribute( << 796 gtrapElement->setAttributeNode( << 797 NewAttribute("dz", gtrap->GetZHalfLength() << 798 gtrapElement->setAttributeNode(NewAttribute( << 799 gtrapElement->setAttributeNode(NewAttribute( << 800 gtrapElement->setAttributeNode(NewAttribute( << 801 gtrapElement->setAttributeNode(NewAttribute( << 802 gtrapElement->setAttributeNode(NewAttribute( << 803 gtrapElement->setAttributeNode(NewAttribute( << 804 gtrapElement->setAttributeNode(NewAttribute( << 805 gtrapElement->setAttributeNode(NewAttribute( << 806 gtrapElement->setAttributeNode(NewAttribute( << 807 gtrapElement->setAttributeNode(NewAttribute( << 808 gtrapElement->setAttributeNode(NewAttribute( << 809 gtrapElement->setAttributeNode(NewAttribute( << 810 gtrapElement->setAttributeNode(NewAttribute( << 811 gtrapElement->setAttributeNode(NewAttribute( << 812 gtrapElement->setAttributeNode(NewAttribute( << 813 gtrapElement->setAttributeNode(NewAttribute( << 814 gtrapElement->setAttributeNode(NewAttribute( << 815 solElement->appendChild(gtrapElement); << 816 } << 817 << 818 // ------------------------------------------- << 819 void G4GDMLWriteSolids::TrapWrite(xercesc::DOM << 820 const G4Trap << 821 { << 822 const G4String& name = GenerateName(trap->Ge << 823 << 824 const G4ThreeVector& simaxis = trap->GetSymA << 825 const G4double phi = simaxis.phi() << 826 const G4double theta = simaxis.theta << 827 const G4double alpha1 = std::atan(tra << 828 const G4double alpha2 = std::atan(tra << 829 << 830 xercesc::DOMElement* trapElement = NewElemen << 831 trapElement->setAttributeNode(NewAttribute(" << 832 trapElement->setAttributeNode( << 833 NewAttribute("z", 2.0 * trap->GetZHalfLeng << 834 trapElement->setAttributeNode(NewAttribute(" << 835 trapElement->setAttributeNode(NewAttribute(" << 836 trapElement->setAttributeNode( << 837 NewAttribute("y1", 2.0 * trap->GetYHalfLen << 838 trapElement->setAttributeNode( << 839 NewAttribute("x1", 2.0 * trap->GetXHalfLen << 840 trapElement->setAttributeNode( << 841 NewAttribute("x2", 2.0 * trap->GetXHalfLen << 842 trapElement->setAttributeNode(NewAttribute(" << 843 trapElement->setAttributeNode( << 844 NewAttribute("y2", 2.0 * trap->GetYHalfLen << 845 trapElement->setAttributeNode( << 846 NewAttribute("x3", 2.0 * trap->GetXHalfLen << 847 trapElement->setAttributeNode( << 848 NewAttribute("x4", 2.0 * trap->GetXHalfLen << 849 trapElement->setAttributeNode(NewAttribute(" << 850 trapElement->setAttributeNode(NewAttribute(" << 851 trapElement->setAttributeNode(NewAttribute(" << 852 solElement->appendChild(trapElement); << 853 } << 854 679 855 // ------------------------------------------- << 680 for (size_t j=0; j<NumVertexPerFacet; j++) 856 void G4GDMLWriteSolids::TrdWrite(xercesc::DOME << 681 { 857 const G4Trd* << 682 std::stringstream name_stream; 858 { << 683 std::stringstream ref_stream; 859 const G4String& name = GenerateName(trd->Get << 860 << 861 xercesc::DOMElement* trdElement = NewElement << 862 trdElement->setAttributeNode(NewAttribute("n << 863 trdElement->setAttributeNode( << 864 NewAttribute("x1", 2.0 * trd->GetXHalfLeng << 865 trdElement->setAttributeNode( << 866 NewAttribute("x2", 2.0 * trd->GetXHalfLeng << 867 trdElement->setAttributeNode( << 868 NewAttribute("y1", 2.0 * trd->GetYHalfLeng << 869 trdElement->setAttributeNode( << 870 NewAttribute("y2", 2.0 * trd->GetYHalfLeng << 871 trdElement->setAttributeNode( << 872 NewAttribute("z", 2.0 * trd->GetZHalfLengt << 873 trdElement->setAttributeNode(NewAttribute("l << 874 solElement->appendChild(trdElement); << 875 } << 876 << 877 // ------------------------------------------- << 878 void G4GDMLWriteSolids::TubeWrite(xercesc::DOM << 879 const G4Tubs << 880 { << 881 const G4String& name = GenerateName(tube->Ge << 882 << 883 xercesc::DOMElement* tubeElement = NewElemen << 884 tubeElement->setAttributeNode(NewAttribute(" << 885 tubeElement->setAttributeNode( << 886 NewAttribute("rmin", tube->GetInnerRadius( << 887 tubeElement->setAttributeNode( << 888 NewAttribute("rmax", tube->GetOuterRadius( << 889 tubeElement->setAttributeNode( << 890 NewAttribute("z", 2.0 * tube->GetZHalfLeng << 891 tubeElement->setAttributeNode( << 892 NewAttribute("startphi", tube->GetStartPhi << 893 tubeElement->setAttributeNode( << 894 NewAttribute("deltaphi", tube->GetDeltaPhi << 895 tubeElement->setAttributeNode(NewAttribute(" << 896 tubeElement->setAttributeNode(NewAttribute(" << 897 solElement->appendChild(tubeElement); << 898 } << 899 << 900 // ------------------------------------------- << 901 void G4GDMLWriteSolids::CutTubeWrite(xercesc:: << 902 const G4C << 903 { << 904 const G4String& name = GenerateName(cuttube- << 905 << 906 xercesc::DOMElement* cuttubeElement = NewEle << 907 cuttubeElement->setAttributeNode(NewAttribut << 908 cuttubeElement->setAttributeNode( << 909 NewAttribute("rmin", cuttube->GetInnerRadi << 910 cuttubeElement->setAttributeNode( << 911 NewAttribute("rmax", cuttube->GetOuterRadi << 912 cuttubeElement->setAttributeNode( << 913 NewAttribute("z", 2.0 * cuttube->GetZHalfL << 914 cuttubeElement->setAttributeNode( << 915 NewAttribute("startphi", cuttube->GetStart << 916 cuttubeElement->setAttributeNode( << 917 NewAttribute("deltaphi", cuttube->GetDelta << 918 cuttubeElement->setAttributeNode( << 919 NewAttribute("lowX", cuttube->GetLowNorm() << 920 cuttubeElement->setAttributeNode( << 921 NewAttribute("lowY", cuttube->GetLowNorm() << 922 cuttubeElement->setAttributeNode( << 923 NewAttribute("lowZ", cuttube->GetLowNorm() << 924 cuttubeElement->setAttributeNode( << 925 NewAttribute("highX", cuttube->GetHighNorm << 926 cuttubeElement->setAttributeNode( << 927 NewAttribute("highY", cuttube->GetHighNorm << 928 cuttubeElement->setAttributeNode( << 929 NewAttribute("highZ", cuttube->GetHighNorm << 930 cuttubeElement->setAttributeNode(NewAttribut << 931 cuttubeElement->setAttributeNode(NewAttribut << 932 solElement->appendChild(cuttubeElement); << 933 } << 934 << 935 // ------------------------------------------- << 936 void G4GDMLWriteSolids::TwistedboxWrite(xerces << 937 const << 938 { << 939 const G4String& name = GenerateName(twistedb << 940 << 941 xercesc::DOMElement* twistedboxElement = New << 942 twistedboxElement->setAttributeNode(NewAttri << 943 twistedboxElement->setAttributeNode( << 944 NewAttribute("x", 2.0 * twistedbox->GetXHa << 945 twistedboxElement->setAttributeNode( << 946 NewAttribute("y", 2.0 * twistedbox->GetYHa << 947 twistedboxElement->setAttributeNode( << 948 NewAttribute("z", 2.0 * twistedbox->GetZHa << 949 twistedboxElement->setAttributeNode( << 950 NewAttribute("PhiTwist", twistedbox->GetPh << 951 twistedboxElement->setAttributeNode(NewAttri << 952 twistedboxElement->setAttributeNode(NewAttri << 953 solElement->appendChild(twistedboxElement); << 954 } << 955 << 956 // ------------------------------------------- << 957 void G4GDMLWriteSolids::TwistedtrapWrite(xerce << 958 const << 959 { << 960 const G4String& name = GenerateName(twistedt << 961 << 962 xercesc::DOMElement* twistedtrapElement = Ne << 963 twistedtrapElement->setAttributeNode(NewAttr << 964 twistedtrapElement->setAttributeNode( << 965 NewAttribute("y1", 2.0 * twistedtrap->GetY << 966 twistedtrapElement->setAttributeNode( << 967 NewAttribute("x1", 2.0 * twistedtrap->GetX << 968 twistedtrapElement->setAttributeNode( << 969 NewAttribute("x2", 2.0 * twistedtrap->GetX << 970 twistedtrapElement->setAttributeNode( << 971 NewAttribute("y2", 2.0 * twistedtrap->GetY << 972 twistedtrapElement->setAttributeNode( << 973 NewAttribute("x3", 2.0 * twistedtrap->GetX << 974 twistedtrapElement->setAttributeNode( << 975 NewAttribute("x4", 2.0 * twistedtrap->GetX << 976 twistedtrapElement->setAttributeNode( << 977 NewAttribute("z", 2.0 * twistedtrap->GetZH << 978 twistedtrapElement->setAttributeNode( << 979 NewAttribute("Alph", twistedtrap->GetTiltA << 980 twistedtrapElement->setAttributeNode( << 981 NewAttribute("Theta", twistedtrap->GetPola << 982 twistedtrapElement->setAttributeNode( << 983 NewAttribute("Phi", twistedtrap->GetAzimut << 984 twistedtrapElement->setAttributeNode( << 985 NewAttribute("PhiTwist", twistedtrap->GetP << 986 twistedtrapElement->setAttributeNode(NewAttr << 987 twistedtrapElement->setAttributeNode(NewAttr << 988 << 989 solElement->appendChild(twistedtrapElement); << 990 } << 991 << 992 // ------------------------------------------- << 993 void G4GDMLWriteSolids::TwistedtrdWrite(xerces << 994 const << 995 { << 996 const G4String& name = GenerateName(twistedt << 997 684 998 xercesc::DOMElement* twistedtrdElement = New << 685 name_stream << "vertex" << (j+1); 999 twistedtrdElement->setAttributeNode(NewAttri << 686 ref_stream << solid_name << "_v" << NumVertex; 1000 twistedtrdElement->setAttributeNode( << 1001 NewAttribute("x1", 2.0 * twistedtrd->GetX << 1002 twistedtrdElement->setAttributeNode( << 1003 NewAttribute("x2", 2.0 * twistedtrd->GetX << 1004 twistedtrdElement->setAttributeNode( << 1005 NewAttribute("y1", 2.0 * twistedtrd->GetY << 1006 twistedtrdElement->setAttributeNode( << 1007 NewAttribute("y2", 2.0 * twistedtrd->GetY << 1008 twistedtrdElement->setAttributeNode( << 1009 NewAttribute("z", 2.0 * twistedtrd->GetZH << 1010 twistedtrdElement->setAttributeNode( << 1011 NewAttribute("PhiTwist", twistedtrd->GetP << 1012 twistedtrdElement->setAttributeNode(NewAttr << 1013 twistedtrdElement->setAttributeNode(NewAttr << 1014 solElement->appendChild(twistedtrdElement); << 1015 } << 1016 687 1017 // ------------------------------------------ << 688 const G4String& fname = name_stream.str(); // facet's tag variable 1018 void G4GDMLWriteSolids::TwistedtubsWrite(xerc << 689 G4String ref = ref_stream.str(); // vertex tag to be associated 1019 cons << 1020 { << 1021 const G4String& name = GenerateName(twisted << 1022 << 1023 xercesc::DOMElement* twistedtubsElement = N << 1024 twistedtubsElement->setAttributeNode(NewAtt << 1025 twistedtubsElement->setAttributeNode( << 1026 NewAttribute("twistedangle", twistedtubs- << 1027 twistedtubsElement->setAttributeNode( << 1028 NewAttribute("midinnerrad", twistedtubs-> << 1029 twistedtubsElement->setAttributeNode( << 1030 NewAttribute("midouterrad", twistedtubs-> << 1031 twistedtubsElement->setAttributeNode( << 1032 NewAttribute("negativeEndz", twistedtubs- << 1033 twistedtubsElement->setAttributeNode( << 1034 NewAttribute("positiveEndz", twistedtubs- << 1035 twistedtubsElement->setAttributeNode( << 1036 NewAttribute("phi", twistedtubs->GetDPhi( << 1037 twistedtubsElement->setAttributeNode(NewAtt << 1038 twistedtubsElement->setAttributeNode(NewAtt << 1039 solElement->appendChild(twistedtubsElement) << 1040 } << 1041 690 1042 // ------------------------------------------ << 691 // Now search for the existance of the current vertex in the 1043 void G4GDMLWriteSolids::ZplaneWrite(xercesc:: << 692 // map of cached vertices. If existing, do NOT store it as 1044 const G4d << 693 // position in the GDML file, so avoiding duplication; otherwise 1045 const G4d << 694 // cache it in the local map and add it as position in the 1046 { << 695 // "define" section of the GDML file. 1047 xercesc::DOMElement* zplaneElement = NewEle << 696 1048 zplaneElement->setAttributeNode(NewAttribut << 697 const G4ThreeVector& vertex = facet->GetVertex(j); 1049 zplaneElement->setAttributeNode(NewAttribut << 698 1050 zplaneElement->setAttributeNode(NewAttribut << 699 if(vertexMap.find(vertex) != vertexMap.end()) // Vertex is cached 1051 element->appendChild(zplaneElement); << 700 { >> 701 ref = vertexMap[vertex]; // Set the proper tag for it >> 702 } >> 703 else // Vertex not found >> 704 { >> 705 vertexMap.insert(std::make_pair(vertex,ref)); // Cache vertex and ... >> 706 AddPosition(ref, vertex); // ... add it to define section! >> 707 NumVertex++; >> 708 } >> 709 >> 710 // Now create association of the vertex with its facet >> 711 // >> 712 facetElement->setAttributeNode(NewAttribute(fname,ref)); >> 713 } >> 714 } 1052 } 715 } 1053 716 1054 // ------------------------------------------ << 717 void G4GDMLWriteSolids:: 1055 void G4GDMLWriteSolids::RZPointWrite(xercesc: << 718 TetWrite(xercesc::DOMElement* solElement, const G4Tet* const tet) 1056 const G4 << 1057 { 719 { 1058 xercesc::DOMElement* rzpointElement = NewEl << 720 const G4String& solid_name = tet->GetName(); 1059 rzpointElement->setAttributeNode(NewAttribu << 721 const G4String& name = GenerateName(solid_name, tet); 1060 rzpointElement->setAttributeNode(NewAttribu << 1061 element->appendChild(rzpointElement); << 1062 } << 1063 722 1064 // ------------------------------------------ << 723 std::vector<G4ThreeVector> vertexList = tet->GetVertices(); 1065 void G4GDMLWriteSolids::OpticalSurfaceWrite(x << 724 1066 c << 725 xercesc::DOMElement* tetElement = NewElement("tet"); 1067 { << 726 tetElement->setAttributeNode(NewAttribute("name",name)); 1068 xercesc::DOMElement* optElement = NewElemen << 727 tetElement->setAttributeNode(NewAttribute("vertex1",solid_name+"_v1")); 1069 G4OpticalSurfaceModel smodel = surf->Get << 728 tetElement->setAttributeNode(NewAttribute("vertex2",solid_name+"_v2")); 1070 G4double sval = << 729 tetElement->setAttributeNode(NewAttribute("vertex3",solid_name+"_v3")); 1071 (smodel == glisur) ? surf->GetPolish() : << 730 tetElement->setAttributeNode(NewAttribute("vertex4",solid_name+"_v4")); 1072 const G4String& name = GenerateName(surf->G << 731 tetElement->setAttributeNode(NewAttribute("lunit","mm")); 1073 << 732 solElement->appendChild(tetElement); 1074 optElement->setAttributeNode(NewAttribute(" << 733 1075 optElement->setAttributeNode(NewAttribute(" << 734 AddPosition(solid_name+"_v1",vertexList[0]); 1076 optElement->setAttributeNode(NewAttribute(" << 735 AddPosition(solid_name+"_v2",vertexList[1]); 1077 optElement->setAttributeNode(NewAttribute(" << 736 AddPosition(solid_name+"_v3",vertexList[2]); 1078 optElement->setAttributeNode(NewAttribute(" << 737 AddPosition(solid_name+"_v4",vertexList[3]); 1079 << 738 } 1080 // Write any property attached to the optic << 739 1081 // << 740 void G4GDMLWriteSolids:: 1082 if(surf->GetMaterialPropertiesTable()) << 741 TorusWrite(xercesc::DOMElement* solElement, const G4Torus* const torus) 1083 { << 742 { 1084 PropertyWrite(optElement, surf); << 743 const G4String& name = GenerateName(torus->GetName(),torus); 1085 } << 744 >> 745 xercesc::DOMElement* torusElement = NewElement("torus"); >> 746 torusElement->setAttributeNode(NewAttribute("name",name)); >> 747 torusElement->setAttributeNode(NewAttribute("rmin",torus->GetRmin()/mm)); >> 748 torusElement->setAttributeNode(NewAttribute("rmax",torus->GetRmax()/mm)); >> 749 torusElement->setAttributeNode(NewAttribute("rtor",torus->GetRtor()/mm)); >> 750 torusElement-> >> 751 setAttributeNode(NewAttribute("startphi",torus->GetSPhi()/degree)); >> 752 torusElement-> >> 753 setAttributeNode(NewAttribute("deltaphi",torus->GetDPhi()/degree)); >> 754 torusElement->setAttributeNode(NewAttribute("aunit","deg")); >> 755 torusElement->setAttributeNode(NewAttribute("lunit","mm")); >> 756 solElement->appendChild(torusElement); >> 757 } >> 758 >> 759 void G4GDMLWriteSolids:: >> 760 GenTrapWrite(xercesc::DOMElement* solElement, >> 761 const G4GenericTrap* const gtrap) >> 762 { >> 763 const G4String& name = GenerateName(gtrap->GetName(),gtrap); >> 764 >> 765 std::vector<G4TwoVector> vertices = gtrap->GetVertices(); >> 766 >> 767 xercesc::DOMElement* gtrapElement = NewElement("arb8"); >> 768 gtrapElement->setAttributeNode(NewAttribute("name",name)); >> 769 gtrapElement->setAttributeNode(NewAttribute("dz", >> 770 gtrap->GetZHalfLength()/mm)); >> 771 gtrapElement->setAttributeNode(NewAttribute("v1x", vertices[0].x())); >> 772 gtrapElement->setAttributeNode(NewAttribute("v1y", vertices[0].y())); >> 773 gtrapElement->setAttributeNode(NewAttribute("v2x", vertices[1].x())); >> 774 gtrapElement->setAttributeNode(NewAttribute("v2y", vertices[1].y())); >> 775 gtrapElement->setAttributeNode(NewAttribute("v3x", vertices[2].x())); >> 776 gtrapElement->setAttributeNode(NewAttribute("v3y", vertices[2].y())); >> 777 gtrapElement->setAttributeNode(NewAttribute("v4x", vertices[3].x())); >> 778 gtrapElement->setAttributeNode(NewAttribute("v4y", vertices[3].y())); >> 779 gtrapElement->setAttributeNode(NewAttribute("v5x", vertices[4].x())); >> 780 gtrapElement->setAttributeNode(NewAttribute("v5y", vertices[4].y())); >> 781 gtrapElement->setAttributeNode(NewAttribute("v6x", vertices[5].x())); >> 782 gtrapElement->setAttributeNode(NewAttribute("v6y", vertices[5].y())); >> 783 gtrapElement->setAttributeNode(NewAttribute("v7x", vertices[6].x())); >> 784 gtrapElement->setAttributeNode(NewAttribute("v7y", vertices[6].y())); >> 785 gtrapElement->setAttributeNode(NewAttribute("v8x", vertices[7].x())); >> 786 gtrapElement->setAttributeNode(NewAttribute("v8y", vertices[7].y())); >> 787 gtrapElement->setAttributeNode(NewAttribute("lunit","mm")); >> 788 solElement->appendChild(gtrapElement); >> 789 } >> 790 >> 791 void G4GDMLWriteSolids:: >> 792 TrapWrite(xercesc::DOMElement* solElement, const G4Trap* const trap) >> 793 { >> 794 const G4String& name = GenerateName(trap->GetName(),trap); >> 795 >> 796 const G4ThreeVector& simaxis = trap->GetSymAxis(); >> 797 const G4double phi = simaxis.phi(); >> 798 const G4double theta = simaxis.theta(); >> 799 const G4double alpha1 = std::atan(trap->GetTanAlpha1()); >> 800 const G4double alpha2 = std::atan(trap->GetTanAlpha2()); >> 801 >> 802 xercesc::DOMElement* trapElement = NewElement("trap"); >> 803 trapElement->setAttributeNode(NewAttribute("name",name)); >> 804 trapElement->setAttributeNode(NewAttribute("z", >> 805 2.0*trap->GetZHalfLength()/mm)); >> 806 trapElement->setAttributeNode(NewAttribute("theta",theta/degree)); >> 807 trapElement->setAttributeNode(NewAttribute("phi",phi/degree)); >> 808 trapElement->setAttributeNode(NewAttribute("y1", >> 809 2.0*trap->GetYHalfLength1()/mm)); >> 810 trapElement->setAttributeNode(NewAttribute("x1", >> 811 2.0*trap->GetXHalfLength1()/mm)); >> 812 trapElement->setAttributeNode(NewAttribute("x2", >> 813 2.0*trap->GetXHalfLength2()/mm)); >> 814 trapElement->setAttributeNode(NewAttribute("alpha1",alpha1/degree)); >> 815 trapElement->setAttributeNode(NewAttribute("y2", >> 816 2.0*trap->GetYHalfLength2()/mm)); >> 817 trapElement->setAttributeNode(NewAttribute("x3", >> 818 2.0*trap->GetXHalfLength3()/mm)); >> 819 trapElement->setAttributeNode(NewAttribute("x4", >> 820 2.0*trap->GetXHalfLength4()/mm)); >> 821 trapElement->setAttributeNode(NewAttribute("alpha2",alpha2/degree)); >> 822 trapElement->setAttributeNode(NewAttribute("aunit","deg")); >> 823 trapElement->setAttributeNode(NewAttribute("lunit","mm")); >> 824 solElement->appendChild(trapElement); >> 825 } >> 826 >> 827 void G4GDMLWriteSolids:: >> 828 TrdWrite(xercesc::DOMElement* solElement, const G4Trd* const trd) >> 829 { >> 830 const G4String& name = GenerateName(trd->GetName(),trd); >> 831 >> 832 xercesc::DOMElement* trdElement = NewElement("trd"); >> 833 trdElement->setAttributeNode(NewAttribute("name",name)); >> 834 trdElement->setAttributeNode(NewAttribute("x1", >> 835 2.0*trd->GetXHalfLength1()/mm)); >> 836 trdElement->setAttributeNode(NewAttribute("x2", >> 837 2.0*trd->GetXHalfLength2()/mm)); >> 838 trdElement->setAttributeNode(NewAttribute("y1", >> 839 2.0*trd->GetYHalfLength1()/mm)); >> 840 trdElement->setAttributeNode(NewAttribute("y2", >> 841 2.0*trd->GetYHalfLength2()/mm)); >> 842 trdElement->setAttributeNode(NewAttribute("z", >> 843 2.0*trd->GetZHalfLength()/mm)); >> 844 trdElement->setAttributeNode(NewAttribute("lunit","mm")); >> 845 solElement->appendChild(trdElement); >> 846 } >> 847 >> 848 void G4GDMLWriteSolids:: >> 849 TubeWrite(xercesc::DOMElement* solElement, const G4Tubs* const tube) >> 850 { >> 851 const G4String& name = GenerateName(tube->GetName(),tube); >> 852 >> 853 xercesc::DOMElement* tubeElement = NewElement("tube"); >> 854 tubeElement->setAttributeNode(NewAttribute("name",name)); >> 855 tubeElement->setAttributeNode(NewAttribute("rmin", >> 856 tube->GetInnerRadius()/mm)); >> 857 tubeElement->setAttributeNode(NewAttribute("rmax", >> 858 tube->GetOuterRadius()/mm)); >> 859 tubeElement->setAttributeNode(NewAttribute("z", >> 860 2.0*tube->GetZHalfLength()/mm)); >> 861 tubeElement->setAttributeNode(NewAttribute("startphi", >> 862 tube->GetStartPhiAngle()/degree)); >> 863 tubeElement->setAttributeNode(NewAttribute("deltaphi", >> 864 tube->GetDeltaPhiAngle()/degree)); >> 865 tubeElement->setAttributeNode(NewAttribute("aunit","deg")); >> 866 tubeElement->setAttributeNode(NewAttribute("lunit","mm")); >> 867 solElement->appendChild(tubeElement); >> 868 } >> 869 >> 870 void G4GDMLWriteSolids:: >> 871 CutTubeWrite(xercesc::DOMElement* solElement, const G4CutTubs* const cuttube) >> 872 { >> 873 const G4String& name = GenerateName(cuttube->GetName(),cuttube); >> 874 >> 875 xercesc::DOMElement* cuttubeElement = NewElement("cutTube"); >> 876 cuttubeElement->setAttributeNode(NewAttribute("name",name)); >> 877 cuttubeElement->setAttributeNode(NewAttribute("rmin", >> 878 cuttube->GetInnerRadius()/mm)); >> 879 cuttubeElement->setAttributeNode(NewAttribute("rmax", >> 880 cuttube->GetOuterRadius()/mm)); >> 881 cuttubeElement->setAttributeNode(NewAttribute("z", >> 882 2.0*cuttube->GetZHalfLength()/mm)); >> 883 cuttubeElement->setAttributeNode(NewAttribute("startphi", >> 884 cuttube->GetStartPhiAngle()/degree)); >> 885 cuttubeElement->setAttributeNode(NewAttribute("deltaphi", >> 886 cuttube->GetDeltaPhiAngle()/degree)); >> 887 cuttubeElement->setAttributeNode(NewAttribute("lowX", >> 888 cuttube->GetLowNorm().getX()/mm)); >> 889 cuttubeElement->setAttributeNode(NewAttribute("lowY", >> 890 cuttube->GetLowNorm().getY()/mm)); >> 891 cuttubeElement->setAttributeNode(NewAttribute("lowZ", >> 892 cuttube->GetLowNorm().getZ()/mm)); >> 893 cuttubeElement->setAttributeNode(NewAttribute("highX", >> 894 cuttube->GetHighNorm().getX()/mm)); >> 895 cuttubeElement->setAttributeNode(NewAttribute("highY", >> 896 cuttube->GetHighNorm().getY()/mm)); >> 897 cuttubeElement->setAttributeNode(NewAttribute("highZ", >> 898 cuttube->GetHighNorm().getZ()/mm)); >> 899 cuttubeElement->setAttributeNode(NewAttribute("aunit","deg")); >> 900 cuttubeElement->setAttributeNode(NewAttribute("lunit","mm")); >> 901 solElement->appendChild(cuttubeElement); >> 902 } >> 903 >> 904 void G4GDMLWriteSolids:: >> 905 TwistedboxWrite(xercesc::DOMElement* solElement, >> 906 const G4TwistedBox* const twistedbox) >> 907 { >> 908 const G4String& name = GenerateName(twistedbox->GetName(),twistedbox); >> 909 >> 910 xercesc::DOMElement* twistedboxElement = NewElement("twistedbox"); >> 911 twistedboxElement->setAttributeNode(NewAttribute("name",name)); >> 912 twistedboxElement->setAttributeNode(NewAttribute("x", >> 913 2.0*twistedbox->GetXHalfLength()/mm)); >> 914 twistedboxElement->setAttributeNode(NewAttribute("y", >> 915 2.0*twistedbox->GetYHalfLength()/mm)); >> 916 twistedboxElement->setAttributeNode(NewAttribute("z", >> 917 2.0*twistedbox->GetZHalfLength()/mm)); >> 918 twistedboxElement->setAttributeNode(NewAttribute("PhiTwist", >> 919 twistedbox->GetPhiTwist()/degree)); >> 920 twistedboxElement->setAttributeNode(NewAttribute("aunit","deg")); >> 921 twistedboxElement->setAttributeNode(NewAttribute("lunit","mm")); >> 922 solElement->appendChild(twistedboxElement); >> 923 } >> 924 >> 925 void G4GDMLWriteSolids:: >> 926 TwistedtrapWrite(xercesc::DOMElement* solElement, >> 927 const G4TwistedTrap* const twistedtrap) >> 928 { >> 929 const G4String& name = GenerateName(twistedtrap->GetName(),twistedtrap); >> 930 >> 931 xercesc::DOMElement* twistedtrapElement = NewElement("twistedtrap"); >> 932 twistedtrapElement->setAttributeNode(NewAttribute("name",name)); >> 933 twistedtrapElement->setAttributeNode(NewAttribute("y1", >> 934 2.0*twistedtrap->GetY1HalfLength()/mm)); >> 935 twistedtrapElement->setAttributeNode(NewAttribute("x1", >> 936 2.0*twistedtrap->GetX1HalfLength()/mm)); >> 937 twistedtrapElement->setAttributeNode(NewAttribute("x2", >> 938 2.0*twistedtrap->GetX2HalfLength()/mm)); >> 939 twistedtrapElement->setAttributeNode(NewAttribute("y2", >> 940 2.0*twistedtrap->GetY2HalfLength()/mm)); >> 941 twistedtrapElement->setAttributeNode(NewAttribute("x3", >> 942 2.0*twistedtrap->GetX3HalfLength()/mm)); >> 943 twistedtrapElement->setAttributeNode(NewAttribute("x4", >> 944 2.0*twistedtrap->GetX4HalfLength()/mm)); >> 945 twistedtrapElement->setAttributeNode(NewAttribute("z", >> 946 2.0*twistedtrap->GetZHalfLength()/mm)); >> 947 twistedtrapElement->setAttributeNode(NewAttribute("Alph", >> 948 twistedtrap->GetTiltAngleAlpha()/degree)); >> 949 twistedtrapElement->setAttributeNode(NewAttribute("Theta", >> 950 twistedtrap->GetPolarAngleTheta()/degree)); >> 951 twistedtrapElement->setAttributeNode(NewAttribute("Phi", >> 952 twistedtrap->GetAzimuthalAnglePhi()/degree)); >> 953 twistedtrapElement->setAttributeNode(NewAttribute("PhiTwist", >> 954 twistedtrap->GetPhiTwist()/degree)); >> 955 twistedtrapElement->setAttributeNode(NewAttribute("aunit","deg")); >> 956 twistedtrapElement->setAttributeNode(NewAttribute("lunit","mm")); >> 957 >> 958 solElement->appendChild(twistedtrapElement); >> 959 } >> 960 >> 961 void G4GDMLWriteSolids:: >> 962 TwistedtrdWrite(xercesc::DOMElement* solElement, >> 963 const G4TwistedTrd* const twistedtrd) >> 964 { >> 965 const G4String& name = GenerateName(twistedtrd->GetName(),twistedtrd); >> 966 >> 967 xercesc::DOMElement* twistedtrdElement = NewElement("twistedtrd"); >> 968 twistedtrdElement->setAttributeNode(NewAttribute("name",name)); >> 969 twistedtrdElement->setAttributeNode(NewAttribute("x1", >> 970 2.0*twistedtrd->GetX1HalfLength()/mm)); >> 971 twistedtrdElement->setAttributeNode(NewAttribute("x2", >> 972 2.0*twistedtrd->GetX2HalfLength()/mm)); >> 973 twistedtrdElement->setAttributeNode(NewAttribute("y1", >> 974 2.0*twistedtrd->GetY1HalfLength()/mm)); >> 975 twistedtrdElement->setAttributeNode(NewAttribute("y2", >> 976 2.0*twistedtrd->GetY2HalfLength()/mm)); >> 977 twistedtrdElement->setAttributeNode(NewAttribute("z", >> 978 2.0*twistedtrd->GetZHalfLength()/mm)); >> 979 twistedtrdElement->setAttributeNode(NewAttribute("PhiTwist", >> 980 twistedtrd->GetPhiTwist()/degree)); >> 981 twistedtrdElement->setAttributeNode(NewAttribute("aunit","deg")); >> 982 twistedtrdElement->setAttributeNode(NewAttribute("lunit","mm")); >> 983 solElement->appendChild(twistedtrdElement); >> 984 } >> 985 >> 986 void G4GDMLWriteSolids:: >> 987 TwistedtubsWrite(xercesc::DOMElement* solElement, >> 988 const G4TwistedTubs* const twistedtubs) >> 989 { >> 990 const G4String& name = GenerateName(twistedtubs->GetName(),twistedtubs); >> 991 >> 992 xercesc::DOMElement* twistedtubsElement = NewElement("twistedtubs"); >> 993 twistedtubsElement->setAttributeNode(NewAttribute("name",name)); >> 994 twistedtubsElement->setAttributeNode(NewAttribute("twistedangle", >> 995 twistedtubs->GetPhiTwist()/degree)); >> 996 twistedtubsElement->setAttributeNode(NewAttribute("midinnerrad", >> 997 twistedtubs->GetInnerRadius()/mm)); >> 998 twistedtubsElement->setAttributeNode(NewAttribute("midouterrad", >> 999 twistedtubs->GetOuterRadius()/mm)); >> 1000 twistedtubsElement->setAttributeNode(NewAttribute("negativeEndz", >> 1001 twistedtubs->GetEndZ(0)/mm)); >> 1002 twistedtubsElement->setAttributeNode(NewAttribute("positiveEndz", >> 1003 twistedtubs->GetEndZ(1)/mm)); >> 1004 twistedtubsElement->setAttributeNode(NewAttribute("phi", >> 1005 twistedtubs->GetDPhi()/degree)); >> 1006 twistedtubsElement->setAttributeNode(NewAttribute("aunit","deg")); >> 1007 twistedtubsElement->setAttributeNode(NewAttribute("lunit","mm")); >> 1008 solElement->appendChild(twistedtubsElement); >> 1009 } >> 1010 >> 1011 void G4GDMLWriteSolids:: >> 1012 ZplaneWrite(xercesc::DOMElement* element, const G4double& z, >> 1013 const G4double& rmin, const G4double& rmax) >> 1014 { >> 1015 xercesc::DOMElement* zplaneElement = NewElement("zplane"); >> 1016 zplaneElement->setAttributeNode(NewAttribute("z",z/mm)); >> 1017 zplaneElement->setAttributeNode(NewAttribute("rmin",rmin/mm)); >> 1018 zplaneElement->setAttributeNode(NewAttribute("rmax",rmax/mm)); >> 1019 element->appendChild(zplaneElement); >> 1020 } >> 1021 >> 1022 void G4GDMLWriteSolids:: >> 1023 RZPointWrite(xercesc::DOMElement* element, const G4double& r, >> 1024 const G4double& z) >> 1025 { >> 1026 xercesc::DOMElement* rzpointElement = NewElement("rzpoint"); >> 1027 rzpointElement->setAttributeNode(NewAttribute("r",r/mm)); >> 1028 rzpointElement->setAttributeNode(NewAttribute("z",z/mm)); >> 1029 element->appendChild(rzpointElement); >> 1030 } >> 1031 >> 1032 void G4GDMLWriteSolids:: >> 1033 OpticalSurfaceWrite(xercesc::DOMElement* solElement, >> 1034 const G4OpticalSurface* const surf) >> 1035 { >> 1036 xercesc::DOMElement* optElement = NewElement("opticalsurface"); >> 1037 G4OpticalSurfaceModel smodel = surf->GetModel(); >> 1038 G4double sval = (smodel==glisur) ? surf->GetPolish() : surf->GetSigmaAlpha(); >> 1039 const G4String& name = GenerateName(surf->GetName(), surf); >> 1040 >> 1041 optElement->setAttributeNode(NewAttribute("name", name)); >> 1042 optElement->setAttributeNode(NewAttribute("model", smodel)); >> 1043 optElement->setAttributeNode(NewAttribute("finish", surf->GetFinish())); >> 1044 optElement->setAttributeNode(NewAttribute("type", surf->GetType())); >> 1045 optElement->setAttributeNode(NewAttribute("value", sval)); >> 1046 >> 1047 // Write any property attached to the optical surface... >> 1048 // >> 1049 if (surf->GetMaterialPropertiesTable()) >> 1050 { >> 1051 PropertyWrite(optElement, surf); >> 1052 } 1086 1053 1087 solElement->appendChild(optElement); << 1054 solElement->appendChild(optElement); 1088 } 1055 } 1089 1056 1090 // ------------------------------------------ << 1091 void G4GDMLWriteSolids::PropertyWrite(xercesc 1057 void G4GDMLWriteSolids::PropertyWrite(xercesc::DOMElement* optElement, 1092 const G << 1058 const G4OpticalSurface* const surf) 1093 { 1059 { 1094 xercesc::DOMElement* propElement; << 1060 xercesc::DOMElement* propElement; 1095 G4MaterialPropertiesTable* ptable = surf->G << 1061 G4MaterialPropertiesTable* ptable = surf->GetMaterialPropertiesTable(); 1096 auto pvec = ptable->GetProperties(); << 1062 const std::map< G4int, G4PhysicsOrderedFreeVector*, 1097 auto cvec = ptable->GetConstProperties(); << 1063 std::less<G4int> >* pmap = ptable->GetPropertyMap(); 1098 << 1064 const std::map< G4int, G4double, 1099 for(size_t i = 0; i < pvec.size(); ++i) << 1065 std::less<G4int> >* cmap = ptable->GetConstPropertyMap(); 1100 { << 1066 std::map< G4int, G4PhysicsOrderedFreeVector*, 1101 if(pvec[i] != nullptr) { << 1067 std::less<G4int> >::const_iterator mpos; >> 1068 std::map< G4int, G4double, >> 1069 std::less<G4int> >::const_iterator cpos; >> 1070 for (mpos=pmap->begin(); mpos!=pmap->end(); mpos++) >> 1071 { 1102 propElement = NewElement("property"); 1072 propElement = NewElement("property"); 1103 propElement->setAttributeNode( << 1073 propElement->setAttributeNode(NewAttribute("name", 1104 NewAttribute("name", ptable->GetMater << 1074 ptable->GetMaterialPropertyNames()[mpos->first])); 1105 propElement->setAttributeNode(NewAttrib << 1075 propElement->setAttributeNode(NewAttribute("ref", 1106 "ref", GenerateName(ptable->GetMateri << 1076 GenerateName(ptable->GetMaterialPropertyNames()[mpos->first], 1107 pvec[i]))); << 1077 mpos->second))); 1108 PropertyVectorWrite(ptable->GetMaterial << 1078 if (mpos->second) 1109 pvec[i]); << 1079 { 1110 optElement->appendChild(propElement); << 1080 PropertyVectorWrite(ptable->GetMaterialPropertyNames()[mpos->first], 1111 } << 1081 mpos->second); 1112 } << 1082 optElement->appendChild(propElement); 1113 for(size_t i = 0; i < cvec.size(); ++i) << 1083 } 1114 { << 1084 else 1115 if (cvec[i].second == true) { << 1085 { >> 1086 G4String warn_message = "Null pointer for material property -" >> 1087 + ptable->GetMaterialPropertyNames()[mpos->first] >> 1088 + "- of optical surface -" + surf->GetName() + "- !"; >> 1089 G4Exception("G4GDMLWriteSolids::PropertyWrite()", "NullPointer", >> 1090 JustWarning, warn_message); >> 1091 continue; >> 1092 } >> 1093 } >> 1094 for (cpos=cmap->begin(); cpos!=cmap->end(); cpos++) >> 1095 { 1116 propElement = NewElement("property"); 1096 propElement = NewElement("property"); 1117 propElement->setAttributeNode(NewAttrib << 1097 propElement->setAttributeNode(NewAttribute("name", 1118 "name", ptable->GetMaterialConstPrope << 1098 ptable->GetMaterialConstPropertyNames()[cpos->first])); 1119 propElement->setAttributeNode(NewAttrib << 1099 propElement->setAttributeNode(NewAttribute("ref", 1120 "ref", ptable->GetMaterialConstProper << 1100 ptable->GetMaterialConstPropertyNames()[cpos->first])); 1121 xercesc::DOMElement* constElement = New 1101 xercesc::DOMElement* constElement = NewElement("constant"); 1122 constElement->setAttributeNode(NewAttri << 1102 constElement->setAttributeNode(NewAttribute("name", 1123 "name", ptable->GetMaterialConstPrope << 1103 ptable->GetMaterialConstPropertyNames()[cpos->first])); 1124 constElement->setAttributeNode(NewAttri << 1104 constElement->setAttributeNode(NewAttribute("value", cpos->second)); 1125 defineElement->appendChild(constElement 1105 defineElement->appendChild(constElement); 1126 optElement->appendChild(propElement); 1106 optElement->appendChild(propElement); 1127 } << 1107 } 1128 } << 1129 } 1108 } 1130 1109 1131 // ------------------------------------------ << 1132 void G4GDMLWriteSolids::SolidsWrite(xercesc:: 1110 void G4GDMLWriteSolids::SolidsWrite(xercesc::DOMElement* gdmlElement) 1133 { 1111 { 1134 #ifdef G4VERBOSE 1112 #ifdef G4VERBOSE 1135 G4cout << "G4GDML: Writing solids..." << G4 << 1113 G4cout << "G4GDML: Writing solids..." << G4endl; 1136 #endif 1114 #endif 1137 solidsElement = NewElement("solids"); << 1115 solidsElement = NewElement("solids"); 1138 gdmlElement->appendChild(solidsElement); << 1116 gdmlElement->appendChild(solidsElement); 1139 1117 1140 solidList.clear(); << 1118 solidList.clear(); 1141 } 1119 } 1142 1120 1143 // ------------------------------------------ << 1144 void G4GDMLWriteSolids::AddSolid(const G4VSol 1121 void G4GDMLWriteSolids::AddSolid(const G4VSolid* const solidPtr) 1145 { 1122 { 1146 for(std::size_t i = 0; i < solidList.size() << 1123 for (size_t i=0; i<solidList.size(); i++) // Check if solid is 1147 { << 1124 { // already in the list! 1148 if(solidList[i] == solidPtr) << 1125 if (solidList[i] == solidPtr) { return; } 1149 { << 1126 } 1150 return; << 1127 1151 } << 1128 solidList.push_back(solidPtr); 1152 } << 1129 1153 << 1130 if (const G4BooleanSolid* const booleanPtr 1154 solidList.push_back(solidPtr); << 1131 = dynamic_cast<const G4BooleanSolid*>(solidPtr)) 1155 << 1132 { BooleanWrite(solidsElement,booleanPtr); } else 1156 if(const G4BooleanSolid* const booleanPtr = << 1133 if (const G4ScaledSolid* const scaledPtr 1157 dynamic_cast<const G4BooleanSolid*>(so << 1134 = dynamic_cast<const G4ScaledSolid*>(solidPtr)) 1158 { << 1135 { ScaledWrite(solidsElement,scaledPtr); } else 1159 BooleanWrite(solidsElement, booleanPtr); << 1136 if (solidPtr->GetEntityType()=="G4MultiUnion") 1160 } << 1137 { const G4MultiUnion* const munionPtr 1161 else if(const G4ScaledSolid* const scaledPt << 1138 = static_cast<const G4MultiUnion*>(solidPtr); 1162 dynamic_cast<const G4ScaledSolid* << 1139 MultiUnionWrite(solidsElement,munionPtr); } else 1163 { << 1140 if (solidPtr->GetEntityType()=="G4Box") 1164 ScaledWrite(solidsElement, scaledPtr); << 1141 { const G4Box* const boxPtr 1165 } << 1142 = static_cast<const G4Box*>(solidPtr); 1166 else if(solidPtr->GetEntityType() == "G4Mul << 1143 BoxWrite(solidsElement,boxPtr); } else 1167 { << 1144 if (solidPtr->GetEntityType()=="G4Cons") 1168 const G4MultiUnion* const munionPtr = << 1145 { const G4Cons* const conePtr 1169 static_cast<const G4MultiUnion*>(solidP << 1146 = static_cast<const G4Cons*>(solidPtr); 1170 MultiUnionWrite(solidsElement, munionPtr) << 1147 ConeWrite(solidsElement,conePtr); } else 1171 } << 1148 if (solidPtr->GetEntityType()=="G4EllipticalCone") 1172 else if(solidPtr->GetEntityType() == "G4Box << 1149 { const G4EllipticalCone* const elconePtr 1173 { << 1150 = static_cast<const G4EllipticalCone*>(solidPtr); 1174 const G4Box* const boxPtr = static_cast<c << 1151 ElconeWrite(solidsElement,elconePtr); } else 1175 BoxWrite(solidsElement, boxPtr); << 1152 if (solidPtr->GetEntityType()=="G4Ellipsoid") 1176 } << 1153 { const G4Ellipsoid* const ellipsoidPtr 1177 else if(solidPtr->GetEntityType() == "G4Con << 1154 = static_cast<const G4Ellipsoid*>(solidPtr); 1178 { << 1155 EllipsoidWrite(solidsElement,ellipsoidPtr); } else 1179 const G4Cons* const conePtr = static_cast << 1156 if (solidPtr->GetEntityType()=="G4EllipticalTube") 1180 ConeWrite(solidsElement, conePtr); << 1157 { const G4EllipticalTube* const eltubePtr 1181 } << 1158 = static_cast<const G4EllipticalTube*>(solidPtr); 1182 else if(solidPtr->GetEntityType() == "G4Ell << 1159 EltubeWrite(solidsElement,eltubePtr); } else 1183 { << 1160 if (solidPtr->GetEntityType()=="G4ExtrudedSolid") 1184 const G4EllipticalCone* const elconePtr = << 1161 { const G4ExtrudedSolid* const xtruPtr 1185 static_cast<const G4EllipticalCone*>(so << 1162 = static_cast<const G4ExtrudedSolid*>(solidPtr); 1186 ElconeWrite(solidsElement, elconePtr); << 1163 XtruWrite(solidsElement,xtruPtr); } else 1187 } << 1164 if (solidPtr->GetEntityType()=="G4Hype") 1188 else if(solidPtr->GetEntityType() == "G4Ell << 1165 { const G4Hype* const hypePtr 1189 { << 1166 = static_cast<const G4Hype*>(solidPtr); 1190 const G4Ellipsoid* const ellipsoidPtr = << 1167 HypeWrite(solidsElement,hypePtr); } else 1191 static_cast<const G4Ellipsoid*>(solidPt << 1168 if (solidPtr->GetEntityType()=="G4Orb") 1192 EllipsoidWrite(solidsElement, ellipsoidPt << 1169 { const G4Orb* const orbPtr 1193 } << 1170 = static_cast<const G4Orb*>(solidPtr); 1194 else if(solidPtr->GetEntityType() == "G4Ell << 1171 OrbWrite(solidsElement,orbPtr); } else 1195 { << 1172 if (solidPtr->GetEntityType()=="G4Para") 1196 const G4EllipticalTube* const eltubePtr = << 1173 { const G4Para* const paraPtr 1197 static_cast<const G4EllipticalTube*>(so << 1174 = static_cast<const G4Para*>(solidPtr); 1198 EltubeWrite(solidsElement, eltubePtr); << 1175 ParaWrite(solidsElement,paraPtr); } else 1199 } << 1176 if (solidPtr->GetEntityType()=="G4Paraboloid") 1200 else if(solidPtr->GetEntityType() == "G4Ext << 1177 { const G4Paraboloid* const paraboloidPtr 1201 { << 1178 = static_cast<const G4Paraboloid*>(solidPtr); 1202 const G4ExtrudedSolid* const xtruPtr = << 1179 ParaboloidWrite(solidsElement,paraboloidPtr); } else 1203 static_cast<const G4ExtrudedSolid*>(sol << 1180 if (solidPtr->GetEntityType()=="G4Polycone") 1204 XtruWrite(solidsElement, xtruPtr); << 1181 { const G4Polycone* const polyconePtr 1205 } << 1182 = static_cast<const G4Polycone*>(solidPtr); 1206 else if(solidPtr->GetEntityType() == "G4Hyp << 1183 PolyconeWrite(solidsElement,polyconePtr); } else 1207 { << 1184 if (solidPtr->GetEntityType()=="G4GenericPolycone") 1208 const G4Hype* const hypePtr = static_cast << 1185 { const G4GenericPolycone* const genpolyconePtr 1209 HypeWrite(solidsElement, hypePtr); << 1186 = static_cast<const G4GenericPolycone*>(solidPtr); 1210 } << 1187 GenericPolyconeWrite(solidsElement,genpolyconePtr); } else 1211 else if(solidPtr->GetEntityType() == "G4Orb << 1188 if (solidPtr->GetEntityType()=="G4Polyhedra") 1212 { << 1189 { const G4Polyhedra* const polyhedraPtr 1213 const G4Orb* const orbPtr = static_cast<c << 1190 = static_cast<const G4Polyhedra*>(solidPtr); 1214 OrbWrite(solidsElement, orbPtr); << 1191 PolyhedraWrite(solidsElement,polyhedraPtr); } else 1215 } << 1192 if (solidPtr->GetEntityType()=="G4Sphere") 1216 else if(solidPtr->GetEntityType() == "G4Par << 1193 { const G4Sphere* const spherePtr 1217 { << 1194 = static_cast<const G4Sphere*>(solidPtr); 1218 const G4Para* const paraPtr = static_cast << 1195 SphereWrite(solidsElement,spherePtr); } else 1219 ParaWrite(solidsElement, paraPtr); << 1196 if (solidPtr->GetEntityType()=="G4TessellatedSolid") 1220 } << 1197 { const G4TessellatedSolid* const tessellatedPtr 1221 else if(solidPtr->GetEntityType() == "G4Par << 1198 = static_cast<const G4TessellatedSolid*>(solidPtr); 1222 { << 1199 TessellatedWrite(solidsElement,tessellatedPtr); } else 1223 const G4Paraboloid* const paraboloidPtr = << 1200 if (solidPtr->GetEntityType()=="G4Tet") 1224 static_cast<const G4Paraboloid*>(solidP << 1201 { const G4Tet* const tetPtr 1225 ParaboloidWrite(solidsElement, paraboloid << 1202 = static_cast<const G4Tet*>(solidPtr); 1226 } << 1203 TetWrite(solidsElement,tetPtr); } else 1227 else if(solidPtr->GetEntityType() == "G4Pol << 1204 if (solidPtr->GetEntityType()=="G4Torus") 1228 { << 1205 { const G4Torus* const torusPtr 1229 const G4Polycone* const polyconePtr = << 1206 = static_cast<const G4Torus*>(solidPtr); 1230 static_cast<const G4Polycone*>(solidPtr << 1207 TorusWrite(solidsElement,torusPtr); } else 1231 PolyconeWrite(solidsElement, polyconePtr) << 1208 if (solidPtr->GetEntityType()=="G4GenericTrap") 1232 } << 1209 { const G4GenericTrap* const gtrapPtr 1233 else if(solidPtr->GetEntityType() == "G4Gen << 1210 = static_cast<const G4GenericTrap*>(solidPtr); 1234 { << 1211 GenTrapWrite(solidsElement,gtrapPtr); } else 1235 const G4GenericPolycone* const genpolycon << 1212 if (solidPtr->GetEntityType()=="G4Trap") 1236 static_cast<const G4GenericPolycone*>(s << 1213 { const G4Trap* const trapPtr 1237 GenericPolyconeWrite(solidsElement, genpo << 1214 = static_cast<const G4Trap*>(solidPtr); 1238 } << 1215 TrapWrite(solidsElement,trapPtr); } else 1239 else if(solidPtr->GetEntityType() == "G4Pol << 1216 if (solidPtr->GetEntityType()=="G4Trd") 1240 { << 1217 { const G4Trd* const trdPtr 1241 const G4Polyhedra* const polyhedraPtr = << 1218 = static_cast<const G4Trd*>(solidPtr); 1242 static_cast<const G4Polyhedra*>(solidPt << 1219 TrdWrite(solidsElement,trdPtr); } else 1243 PolyhedraWrite(solidsElement, polyhedraPt << 1220 if (solidPtr->GetEntityType()=="G4Tubs") 1244 } << 1221 { const G4Tubs* const tubePtr 1245 else if(solidPtr->GetEntityType() == "G4Sph << 1222 = static_cast<const G4Tubs*>(solidPtr); 1246 { << 1223 TubeWrite(solidsElement,tubePtr); } else 1247 const G4Sphere* const spherePtr = static_ << 1224 if (solidPtr->GetEntityType()=="G4CutTubs") 1248 SphereWrite(solidsElement, spherePtr); << 1225 { const G4CutTubs* const cuttubePtr 1249 } << 1226 = static_cast<const G4CutTubs*>(solidPtr); 1250 else if(solidPtr->GetEntityType() == "G4Tes << 1227 CutTubeWrite(solidsElement,cuttubePtr); } else 1251 { << 1228 if (solidPtr->GetEntityType()=="G4TwistedBox") 1252 const G4TessellatedSolid* const tessellat << 1229 { const G4TwistedBox* const twistedboxPtr 1253 static_cast<const G4TessellatedSolid*>( << 1230 = static_cast<const G4TwistedBox*>(solidPtr); 1254 TessellatedWrite(solidsElement, tessellat << 1231 TwistedboxWrite(solidsElement,twistedboxPtr); } else 1255 } << 1232 if (solidPtr->GetEntityType()=="G4TwistedTrap") 1256 else if(solidPtr->GetEntityType() == "G4Tet << 1233 { const G4TwistedTrap* const twistedtrapPtr 1257 { << 1234 = static_cast<const G4TwistedTrap*>(solidPtr); 1258 const G4Tet* const tetPtr = static_cast<c << 1235 TwistedtrapWrite(solidsElement,twistedtrapPtr); } else 1259 TetWrite(solidsElement, tetPtr); << 1236 if (solidPtr->GetEntityType()=="G4TwistedTrd") 1260 } << 1237 { const G4TwistedTrd* const twistedtrdPtr 1261 else if(solidPtr->GetEntityType() == "G4Tor << 1238 = static_cast<const G4TwistedTrd*>(solidPtr); 1262 { << 1239 TwistedtrdWrite(solidsElement,twistedtrdPtr); } else 1263 const G4Torus* const torusPtr = static_ca << 1240 if (solidPtr->GetEntityType()=="G4TwistedTubs") 1264 TorusWrite(solidsElement, torusPtr); << 1241 { const G4TwistedTubs* const twistedtubsPtr 1265 } << 1242 = static_cast<const G4TwistedTubs*>(solidPtr); 1266 else if(solidPtr->GetEntityType() == "G4Gen << 1243 TwistedtubsWrite(solidsElement,twistedtubsPtr); } 1267 { << 1244 else 1268 const G4GenericTrap* const gtrapPtr = << 1245 { 1269 static_cast<const G4GenericTrap*>(solid << 1246 G4String error_msg = "Unknown solid: " + solidPtr->GetName() 1270 GenTrapWrite(solidsElement, gtrapPtr); << 1247 + "; Type: " + solidPtr->GetEntityType(); 1271 } << 1248 G4Exception("G4GDMLWriteSolids::AddSolid()", "WriteError", 1272 else if(solidPtr->GetEntityType() == "G4Tra << 1249 FatalException, error_msg); 1273 { << 1250 } 1274 const G4Trap* const trapPtr = static_cast << 1275 TrapWrite(solidsElement, trapPtr); << 1276 } << 1277 else if(solidPtr->GetEntityType() == "G4Trd << 1278 { << 1279 const G4Trd* const trdPtr = static_cast<c << 1280 TrdWrite(solidsElement, trdPtr); << 1281 } << 1282 else if(solidPtr->GetEntityType() == "G4Tub << 1283 { << 1284 const G4Tubs* const tubePtr = static_cast << 1285 TubeWrite(solidsElement, tubePtr); << 1286 } << 1287 else if(solidPtr->GetEntityType() == "G4Cut << 1288 { << 1289 const G4CutTubs* const cuttubePtr = stati << 1290 CutTubeWrite(solidsElement, cuttubePtr); << 1291 } << 1292 else if(solidPtr->GetEntityType() == "G4Twi << 1293 { << 1294 const G4TwistedBox* const twistedboxPtr = << 1295 static_cast<const G4TwistedBox*>(solidP << 1296 TwistedboxWrite(solidsElement, twistedbox << 1297 } << 1298 else if(solidPtr->GetEntityType() == "G4Twi << 1299 { << 1300 const G4TwistedTrap* const twistedtrapPtr << 1301 static_cast<const G4TwistedTrap*>(solid << 1302 TwistedtrapWrite(solidsElement, twistedtr << 1303 } << 1304 else if(solidPtr->GetEntityType() == "G4Twi << 1305 { << 1306 const G4TwistedTrd* const twistedtrdPtr = << 1307 static_cast<const G4TwistedTrd*>(solidP << 1308 TwistedtrdWrite(solidsElement, twistedtrd << 1309 } << 1310 else if(solidPtr->GetEntityType() == "G4Twi << 1311 { << 1312 const G4TwistedTubs* const twistedtubsPtr << 1313 static_cast<const G4TwistedTubs*>(solid << 1314 TwistedtubsWrite(solidsElement, twistedtu << 1315 } << 1316 else << 1317 { << 1318 G4String error_msg = "Unknown solid: " + << 1319 "; Type: " + solidPt << 1320 G4Exception("G4GDMLWriteSolids::AddSolid( << 1321 error_msg); << 1322 } << 1323 } 1251 } 1324 1252