go-hep.org/x/hep@v0.38.1/geo/gdml/solids.go (about) 1 // Copyright ©2018 The go-hep Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package gdml 6 7 import ( 8 "encoding/xml" 9 ) 10 11 type Box struct { 12 XMLName xml.Name `xml:"box"` 13 Name string `xml:"name,attr"` 14 X string `xml:"x,attr"` 15 Y string `xml:"y,attr"` 16 Z string `xml:"z,attr"` 17 LUnit string `xml:"lunit,attr"` 18 } 19 20 type Cone struct { 21 XMLName xml.Name `xml:"cone"` 22 Name string `xml:"name,attr"` 23 RMin1 string `xml:"rmin1,attr"` // inner radius at base of cone 24 RMax1 string `xml:"rmax1,attr"` // outer radius at base of cone 25 RMin2 string `xml:"rmin2,attr"` // inner radius at top of cone 26 RMax2 string `xml:"rmax2,attr"` // outer radius at top of cone 27 Z string `xml:"z,attr"` // height of cone segment 28 StartPhi string `xml:"startphi,attr"` // start angle of the segment 29 DPhi string `xml:"deltaphi,attr"` // angle of the segment 30 AUnit string `xml:"aunit,attr"` 31 LUnit string `xml:"lunit,attr"` 32 } 33 34 type Ellipsoid struct { 35 XMLName xml.Name `xml:"ellipsoid"` 36 Name string `xml:"name,attr"` 37 Ax string `xml:"ax,attr"` // x semi axis 38 By string `xml:"by,attr"` // y semi axis 39 Cz string `xml:"cz,attr"` // z semi axis 40 ZCut1 string `xml:"zcut1,attr"` 41 ZCut2 string `xml:"zcut2,attr"` 42 LUnit string `xml:"lunit,attr"` 43 } 44 45 type EllipticalTube struct { 46 XMLName xml.Name `xml:"eltube"` 47 Name string `xml:"name,attr"` 48 Dx string `xml:"dx,attr"` // x semi axis 49 Dy string `xml:"dy,attr"` // y semi axis 50 Dz string `xml:"dz,attr"` // z semi axis 51 LUnit string `xml:"lunit,attr"` 52 } 53 54 type EllipticalCone struct { 55 XMLName xml.Name `xml:"elcone"` 56 Name string `xml:"name,attr"` 57 Dx string `xml:"dx,attr"` // x semi axis 58 Dy string `xml:"dy,attr"` // y semi axis 59 ZMax string `xml:"zmax,attr"` 60 ZCut string `xml:"zcut,attr"` 61 LUnit string `xml:"lunit,attr"` 62 } 63 64 type Orb struct { 65 XMLName xml.Name `xml:"orb"` 66 Name string `xml:"name,attr"` 67 R string `xml:"r,attr"` // radius 68 LUnit string `xml:"lunit,attr"` 69 } 70 71 type Paraboloid struct { 72 XMLName xml.Name `xml:"paraboloid"` 73 Name string `xml:"name,attr"` 74 Rlo string `xml:"rlo,attr"` // radius at -z 75 Rhi string `xml:"rhi,attr"` // radius at +z 76 Dz string `xml:"dz,attr"` // z length 77 AUnit string `xml:"aunit,attr"` 78 LUnit string `xml:"lunit,attr"` 79 } 80 81 type Parallelepiped struct { 82 XMLName xml.Name `xml:"para"` 83 Name string `xml:"name,attr"` 84 X string `xml:"x,attr"` // length of x 85 Y string `xml:"y,attr"` // length of y 86 Z string `xml:"z,attr"` // length of z 87 Alpha string `xml:"alpha,attr"` // angle between x and z planes 88 Theta string `xml:"theta,attr"` // polar angle of the line joining the centres of the faces at -z and +z 89 Phi string `xml:"phi,attr"` // azimuthal angle of the line joining the centres of the faces at -x and +z 90 AUnit string `xml:"aunit,attr"` 91 LUnit string `xml:"lunit,attr"` 92 } 93 94 type PolyCone struct { 95 XMLName xml.Name `xml:"polycone"` 96 Name string `xml:"name,attr"` 97 AUnit string `xml:"aunit,attr"` 98 LUnit string `xml:"lunit,attr"` 99 StartPhi string `xml:"startphi,attr"` // start angle of the segment - default: 0.0 100 DPhi string `xml:"deltaphi,attr"` // angle of the segment 101 ZPlanes []ZPlane `xml:"zplane"` 102 } 103 104 type ZPlane struct { 105 XMLName xml.Name `xml:"zplane"` 106 RMin string `xml:"rmin,attr"` // inner radius of cone at this point 107 RMax string `xml:"rmax,attr"` // outer radius of cone at this point 108 Z string `xml:"z,attr"` // z coordinate of the plane 109 } 110 111 type GenericPolyCone struct { 112 XMLName xml.Name `xml:"genericPolycone"` 113 Name string `xml:"name,attr"` 114 AUnit string `xml:"aunit,attr"` 115 LUnit string `xml:"lunit,attr"` 116 StartPhi string `xml:"startphi,attr"` // start angle of the segment - default: 0.0 117 DPhi string `xml:"deltaphi,attr"` // angle of the segment 118 RZPoints []RZPoint `xml:"rzpoint"` 119 } 120 121 type RZPoint struct { 122 XMLName xml.Name `xml:"rzpoint"` 123 R string `xml:"r,attr"` // r coordinate of this point 124 Z string `xml:"z,attr"` // z coordinate of this point 125 } 126 127 type PolyHedra struct { 128 XMLName xml.Name `xml:"polyhedra"` 129 Name string `xml:"name,attr"` 130 AUnit string `xml:"aunit,attr"` 131 LUnit string `xml:"lunit,attr"` 132 StartPhi string `xml:"startphi,attr"` // start angle of the segment - default: 0.0 133 DPhi string `xml:"deltaphi,attr"` // angle of the segment 134 NumSides string `xml:"numsides,attr"` // number of sides 135 ZPlanes []ZPlane `xml:"zplane"` 136 } 137 138 type GenericPolyHedra struct { 139 XMLName xml.Name `xml:"genericPolyhedra"` 140 Name string `xml:"name,attr"` 141 AUnit string `xml:"aunit,attr"` 142 LUnit string `xml:"lunit,attr"` 143 StartPhi string `xml:"startphi,attr"` // start angle of the segment - default: 0.0 144 DPhi string `xml:"deltaphi,attr"` // angle of the segment 145 NumSides string `xml:"numsides,attr"` // number of sides 146 RZPoints []RZPoint `xml:"rzpoint"` 147 } 148 149 type Sphere struct { 150 XMLName xml.Name `xml:"sphere"` 151 Name string `xml:"name,attr"` 152 AUnit string `xml:"aunit,attr"` 153 LUnit string `xml:"lunit,attr"` 154 RMin string `xml:"rmin,attr"` // inner radius 155 RMax string `xml:"rmax,attr"` // outer radius 156 StartPhi string `xml:"startphi,attr"` // start angle of the segment - default: 0.0 157 DPhi string `xml:"deltaphi,attr"` // angle of the segment 158 StartTheta string `xml:"starttheta,attr"` // start angle of the segment - default: 0.0 159 DTheta string `xml:"deltatheta,attr"` // angle of the segment 160 } 161 162 type Torus struct { 163 XMLName xml.Name `xml:"torus"` 164 Name string `xml:"name,attr"` 165 AUnit string `xml:"aunit,attr"` 166 LUnit string `xml:"lunit,attr"` 167 RMin string `xml:"rmin,attr"` // inner radius of segment 168 RMax string `xml:"rmax,attr"` // outer radius of segment 169 Rtor string `xml:"rtor,attr"` // swept radius of torus 170 StartPhi string `xml:"startphi,attr"` // start angle of the segment - default: 0.0 171 DPhi string `xml:"deltaphi,attr"` // angle of the segment 172 } 173 174 type Trapezoid struct { 175 XMLName xml.Name `xml:"trd"` 176 Name string `xml:"name,attr"` 177 LUnit string `xml:"lunit,attr"` 178 X1 string `xml:"x1,attr"` // x length at -z 179 X2 string `xml:"x2,attr"` // x length at +z 180 Y1 string `xml:"y1,attr"` // y length at -z 181 Y2 string `xml:"y2,attr"` // y length at +z 182 Z string `xml:"z,attr"` // z length 183 } 184 185 type GeneralTrapezoid struct { 186 XMLName xml.Name `xml:"trap"` 187 Name string `xml:"name,attr"` 188 AUnit string `xml:"aunit,attr"` 189 LUnit string `xml:"lunit,attr"` 190 Z string `xml:"z,attr"` // length along z axis 191 Theta string `xml:"theta,attr"` // polar angle to faces joining at -/+ z 192 Phi string `xml:"phi,attr"` // azimuthal angle of line joining centre of -z to centre of +z face 193 Y1 string `xml:"y1,attr"` // length along y at the face -z 194 X1 string `xml:"x1,attr"` // length along x at side y = -y1 of the face at -z 195 X2 string `xml:"x2,attr"` // length along x at side y = +y1 of the face at -z 196 Alpha1 string `xml:"alpha1,attr"` // angle with respect to the y axis from the centre of side at y = -y1 to centre of y = +y1 of the face at -z 197 Y2 string `xml:"y2,attr"` // length along y at the face +z 198 X3 string `xml:"x3,attr"` // length along x at side y = -y1 of the face at +z 199 X4 string `xml:"x4,attr"` // length along x at side y = +y1 of the face at +z 200 Alpha2 string `xml:"alpha2,attr"` // angle with respect to the y axis from the centre of side at y = -y2 to centre of y = +y2 of the face at +z 201 } 202 203 type HyperbolicTube struct { 204 XMLName xml.Name `xml:"hype"` 205 Name string `xml:"name,attr"` 206 LUnit string `xml:"lunit,attr"` 207 RMin string `xml:"rmin,attr"` // inside radius of tube 208 RMax string `xml:"rmax,attr"` // outside radius of tube 209 InStereo string `xml:"inst,attr"` // inner stereo 210 OutStereo string `xml:"outst,attr"` // outer stereo 211 Z string `xml:"z,attr"` // z length 212 } 213 214 type CutTube struct { 215 XMLName xml.Name `xml:"cutTube"` 216 Name string `xml:"name,attr"` 217 AUnit string `xml:"aunit,attr"` 218 LUnit string `xml:"lunit,attr"` 219 Z string `xml:"z,attr"` // z length 220 RMin string `xml:"rmin,attr"` // inside radius, default:0.0 221 RMax string `xml:"rmax,attr"` // outside radius 222 StartPhi string `xml:"startphi,attr"` // starting phi angle of segment, default:0.0 223 DPhi string `xml:"deltaphi,attr"` // delta phi of angle 224 LowX string `xml:"lowX,attr"` // normal at lower z plane 225 LowY string `xml:"lowY,attr"` // normal at lower z plane 226 LowZ string `xml:"lowZ,attr"` // normal at lower z plane 227 HighX string `xml:"highX,attr"` // normal at upper z plane 228 HighY string `xml:"highY,attr"` // normal at upper z plane 229 HighZ string `xml:"highZ,attr"` // normal at upper z plane 230 } 231 232 type Tube struct { 233 XMLName xml.Name `xml:"tube"` 234 Name string `xml:"name,attr"` 235 AUnit string `xml:"aunit,attr"` 236 LUnit string `xml:"lunit,attr"` 237 Z string `xml:"z,attr"` // z length 238 RMin string `xml:"rmin,attr"` // inside radius, default:0.0 239 RMax string `xml:"rmax,attr"` // outside radius 240 StartPhi string `xml:"startphi,attr"` // starting phi angle of segment, default:0.0 241 DPhi string `xml:"deltaphi,attr"` // delta phi of angle 242 } 243 244 type TwistedBox struct { 245 XMLName xml.Name `xml:"twistedbox"` 246 Name string `xml:"name,attr"` 247 AUnit string `xml:"aunit,attr"` 248 LUnit string `xml:"lunit,attr"` 249 PhiTwist string `xml:"PhiTwist,attr"` 250 X string `xml:"x,attr"` 251 Y string `xml:"y,attr"` 252 Z string `xml:"z,attr"` 253 } 254 255 type TwistedTrapezoid struct { 256 XMLName xml.Name `xml:"twistedtrd"` 257 Name string `xml:"name,attr"` 258 AUnit string `xml:"aunit,attr"` 259 LUnit string `xml:"lunit,attr"` 260 PhiTwist string `xml:"PhiTwist,attr"` 261 X1 string `xml:"x1,attr"` // x length at -z 262 X2 string `xml:"x2,attr"` // x length at +z 263 Y1 string `xml:"y1,attr"` // y length at -z 264 Y2 string `xml:"y2,attr"` // y length at +z 265 Z string `xml:"z,attr"` // z length 266 } 267 268 type TwistedGeneralTrapezoid struct { 269 XMLName xml.Name `xml:"twistedtrap"` 270 Name string `xml:"name,attr"` 271 AUnit string `xml:"aunit,attr"` 272 LUnit string `xml:"lunit,attr"` 273 PhiTwist string `xml:"PhiTwist,attr"` 274 Z string `xml:"z,attr"` // length along z axis 275 Theta string `xml:"theta,attr"` // polar angle to faces joining at -/+ z 276 Phi string `xml:"phi,attr"` // azimuthal angle of line joining centre of -z to centre of +z face 277 Y1 string `xml:"y1,attr"` // length along y at the face -z 278 X1 string `xml:"x1,attr"` // length along x at side y = -y1 of the face at -z 279 X2 string `xml:"x2,attr"` // length along x at side y = +y1 of the face at -z 280 Y2 string `xml:"y2,attr"` // length along y at the face +z 281 X3 string `xml:"x3,attr"` // length along x at side y = -y1 of the face at +z 282 X4 string `xml:"x4,attr"` // length along x at side y = +y1 of the face at +z 283 Alpha string `xml:"Alph,attr"` // angle with respect to the y axis from the centre of side 284 } 285 286 type TwistedTube struct { 287 XMLName xml.Name `xml:"twistedtube"` 288 Name string `xml:"name,attr"` 289 AUnit string `xml:"aunit,attr"` 290 LUnit string `xml:"lunit,attr"` 291 EndInnerRad string `xml:"endinnerrad,attr"` // inside radius at end of segment 292 EndOuterRad string `xml:"endouterrad,attr"` // outside radius at end of segment 293 ZLen string `xml:"zlen,attr"` // z length of tube segment 294 TwistedAngle string `xml:"twistedangle,attr"` // twist angle 295 Phi string `xml:"phi,attr"` // phi angle of segment 296 MidInnerRad string `xml:"midinnerrad,attr"` // inner radius at z=0 297 MidOuterRad string `xml:"midouterrad,attr"` // outer radius at z=0 298 NSeg string `xml:"nseg,attr"` // number of segments in TotPhi 299 TotPhi string `xml:"totphi,attr"` // total angle of all segments 300 } 301 302 type Extruded struct { 303 XMLName xml.Name `xml:"xtru"` 304 Name string `xml:"name,attr"` 305 LUnit string `xml:"lunit,attr"` 306 Vertices []Vertex2D `xml:"twoDimVertex"` // vertices of unbound blueprint polygon 307 Sections []Section `xml:"section"` // z sections 308 } 309 310 type Vertex2D struct { 311 XMLName xml.Name `xml:"twoDimVertex"` 312 X string `xml:"x,attr"` 313 Y string `xml:"y,attr"` 314 } 315 316 type Section struct { 317 XMLName xml.Name `xml:"section"` 318 ZOrder string `xml:"zOrder,attr"` // index of the section 319 ZPos string `xml:"zPosition,attr"` // distance from the plane z=0 320 XOff string `xml:"xOffset,attr"` // x offset from centre point of original plane 321 YOff string `xml:"yOffset,attr"` // y offset from centre point of original plane 322 Fact string `xml:"scalingFactor,attr"` // proportion to original blueprint 323 } 324 325 type ArbitraryTrapezoid struct { 326 XMLName xml.Name `xml:"arb8"` 327 Name string `xml:"name,attr"` 328 LUnit string `xml:"lunit,attr"` 329 V1x string `xml:"v1x,attr"` // vertex 1 x position 330 V1y string `xml:"v1y,attr"` // vertex 1 y position 331 V2x string `xml:"v2x,attr"` // vertex 2 x position 332 V2y string `xml:"v2y,attr"` // vertex 2 y position 333 V3x string `xml:"v3x,attr"` // vertex 3 x position 334 V3y string `xml:"v3y,attr"` // vertex 3 y position 335 V4x string `xml:"v4x,attr"` // vertex 4 x position 336 V4y string `xml:"v4y,attr"` // vertex 4 y position 337 V5x string `xml:"v5x,attr"` // vertex 5 x position 338 V5y string `xml:"v5y,attr"` // vertex 5 y position 339 V6x string `xml:"v6x,attr"` // vertex 6 x position 340 V6y string `xml:"v6y,attr"` // vertex 6 y position 341 V7x string `xml:"v7x,attr"` // vertex 7 x position 342 V7y string `xml:"v7y,attr"` // vertex 7 y position 343 V8x string `xml:"v8x,attr"` // vertex 8 x position 344 V8y string `xml:"v8y,attr"` // vertex 8 y position 345 Dz string `xml:"dz,attr"` // half z length 346 } 347 348 type Tesselated struct { 349 XMLName xml.Name `xml:"tesselated"` 350 Name string `xml:"name,attr"` 351 Tris []Triangular `xml:"triangular"` 352 Quads []Quadrangular `xml:"quadrangular"` 353 } 354 355 type Triangular struct { 356 XMLName xml.Name `xml:"triangular"` 357 Vtx1 string `xml:"vertex1,attr"` 358 Vtx2 string `xml:"vertex2,attr"` 359 Vtx3 string `xml:"vertex3,attr"` 360 Type string `xml:"type,attr"` // vertex type: ABSOLUTE (default) or RELATIVE 361 } 362 363 type Quadrangular struct { 364 XMLName xml.Name `xml:"quadrangular"` 365 Vtx1 string `xml:"vertex1,attr"` 366 Vtx2 string `xml:"vertex2,attr"` 367 Vtx3 string `xml:"vertex3,attr"` 368 Vtx4 string `xml:"vertex4,attr"` 369 Type string `xml:"type,attr"` // vertex type: ABSOLUTE (default) or RELATIVE 370 } 371 372 type TetraHedron struct { 373 XMLName xml.Name `xml:"tet"` 374 Name string `xml:"name,attr"` 375 Vtx1 string `xml:"vertex1,attr"` 376 Vtx2 string `xml:"vertex2,attr"` 377 Vtx3 string `xml:"vertex3,attr"` 378 Vtx4 string `xml:"vertex4,attr"` 379 } 380 381 type ScaledSolid struct { 382 XMLName xml.Name `xml:"scaledSolid"` 383 Name string `xml:"name,attr"` 384 Ref SolidRef `xml:"solidref"` 385 Scale Scale `xml:"scale"` 386 } 387 388 type SolidRef struct { 389 XMLName xml.Name `xml:"solidref"` 390 Ref string `xml:"ref,attr"` 391 }