From 4ad1dd8c7831333f102fc1e9e899fe4789acb3a0 Mon Sep 17 00:00:00 2001 From: Oliver Lantwin Date: Wed, 22 Jul 2026 16:00:05 +0200 Subject: [PATCH] fix: make SBT beam placement frames right-handed The corner-beam and stiffening-frame builders constructed the local placement frame with columns (b, n, d) but computed b = d x n, giving det = -1: every such placement carried a reflection instead of a pure rotation. GeoModel2G4 forwards these matrices to CLHEP::HepRotation, which emitted a ZMxpvImproperRotation warning for each of the 180 affected placements at Geant4 initialisation. Use b = n x d so the frame is right-handed. The placed shapes are boxes symmetric under local X -> -X and all offsets are applied along n, so the resulting geometry is unchanged: the regenerated database differs only in the sign of the first rotation column of the 180 formerly-improper transforms. --- subsystems/DecayVolume/src/SBTStructureBuilder.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/subsystems/DecayVolume/src/SBTStructureBuilder.cpp b/subsystems/DecayVolume/src/SBTStructureBuilder.cpp index acbe38d..83a8651 100644 --- a/subsystems/DecayVolume/src/SBTStructureBuilder.cpp +++ b/subsystems/DecayVolume/src/SBTStructureBuilder.cpp @@ -154,10 +154,10 @@ void placeHBeamInclined(GeoVPhysVol* parent, const GeoMaterial* mat, const SBTCo nz /= nmag; } - // Third axis: b = d x n (completes right-handed frame) - const double bx = uy * nz - uz * ny; - const double by = uz * nx - ux * nz; - const double bz = ux * ny - uy * nx; + // Third axis: b = n x d (completes right-handed frame with columns (b, n, d)) + const double bx = ny * uz - nz * uy; + const double by = nz * ux - nx * uz; + const double bz = nx * uy - ny * ux; const double xcm = 0.5 * (x0 + x1); const double ycm = 0.5 * (y0 + y1); @@ -326,7 +326,7 @@ void SBTStructureBuilder::build(GeoVPhysVol* mother, const GeoMaterial* steel, c GeoTrf::RotationMatrix3D rotMat; rotMat.col(0) = - Eigen::Vector3d(uy * nz - uz * ny, uz * nx - ux * nz, ux * ny - uy * nx); + Eigen::Vector3d(ny * uz - nz * uy, nz * ux - nx * uz, nx * uy - ny * ux); rotMat.col(1) = Eigen::Vector3d(nx, ny, nz); rotMat.col(2) = Eigen::Vector3d(ux, uy, uz);