Skip to content

[geom] Keep reflections through a GDML round trip - #23238

Open
sawenzel wants to merge 1 commit into
root-project:masterfrom
sawenzel:swenzel/gdml-reflection-fix
Open

[geom] Keep reflections through a GDML round trip#23238
sawenzel wants to merge 1 commit into
root-project:masterfrom
sawenzel:swenzel/gdml-reflection-fix

Conversation

@sawenzel

@sawenzel sawenzel commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

This fixes a bug in the GDML writer and reader that could lose reflections when a geometry was exported to GDML and read back.

The writer now preserves reflections combined with rotations by factoring the reflection into a z-mirror and writing the remaining proper rotation. Diagonal reflection matrices keep their existing representation.

The reader now also handles the scale of placements inside assemblies, so reflections are preserved there as well.

A new test exports and re-imports a reflected box with an off-centre daughter, both in the world and in an assembly. It checks the global position, frame handedness and TGeoHMatrix::IsReflection() before and after the round trip.

The ALICE geometry is now correctly exported to GDML, with reflections preserved through the round trip.

This PR fixes #23237

This fixes root-project#23237, a bug in the
GDML writer and reader that could lose reflections when a geometry was
exported to GDML and read back.

The writer now preserves reflections combined with rotations by factoring the
reflection into a z-mirror and writing the remaining proper rotation. Diagonal
reflection matrices keep their existing representation.

The reader now also handles the scale of placements inside assemblies, so
reflections are preserved there as well.

A new test exports and re-imports a reflected box with an off-centre daughter,
both in the world and in an assembly. It checks the global position, frame
handedness and TGeoHMatrix::IsReflection() before and after the round trip.

The ALICE geometry is now correctly exported to GDML, with reflections
preserved through the round trip.

@agheata agheata left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, both the fix and the regression test. Thanks! LGTM

@sawenzel

sawenzel commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @agheata

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

Test Results

    20 files      20 suites   2d 22h 6m 36s ⏱️
 3 865 tests  3 865 ✅ 0 💤 0 ❌
68 440 runs  68 440 ✅ 0 💤 0 ❌

Results for commit 81043cf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[geom] GDML round trip loses reflections: on export, and on import inside assemblies

2 participants