Skip to content

Commit e0e2451

Browse files
committed
Bug fix in parse_origin and parse_rotation in Geant4 extension
In an `AbstractConstructiveGeometry`, if the volume `A` has no volume, the overall `origin` and `rotation` should correspond to those of volume `B` (not `A`).
1 parent 65a5bd9 commit e0e2451

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ext/Geant4/io_gdml.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ using LightXML
1414
@inline parse_origin(e::AbstractVolumePrimitive) = origin(e)
1515

1616
# Returns position vector for leftmost Primitive in geometry tree
17-
@inline parse_origin(e::AbstractConstructiveGeometry) = parse_origin(e.a)
17+
@inline parse_origin(e::AbstractConstructiveGeometry) = parse_origin(has_volume(e.a) ? e.a : e.b)
1818

1919
# Returns rotation matrix for Primitive relative to standard basis
2020
@inline parse_rotation(e::AbstractVolumePrimitive) = rotation(e)
2121

2222
# Returns rotation matrix for leftmost Primitive in geometry tree
23-
@inline parse_rotation(e::AbstractConstructiveGeometry) = parse_rotation(e.a)
23+
@inline parse_rotation(e::AbstractConstructiveGeometry) = parse_rotation(has_volume(e.a) ? e.a : e.b)
2424

2525

2626
# Add <position> to <define> section, referenced in the geometry definition (in <solids>) via the name

0 commit comments

Comments
 (0)