Skip to content

Invert Detector Rotations

Simon Spannagel requested to merge invert_rotations into master

This MR continues the discussion which evolved in MR !147 (merged) on the rotation direction of the detectors. Below is a summary of the other thread.

Current situation

We believe that the inversion of the rotation we perform here is wrong. The comment in the line above claims:

Rotation is inverted because it is given as rotation in global coordinates. Thus, going from center to global coordinates, we need to invert it.

and this is not true. The rotation we apply should be from a non-rotated coordinate system to the global one. Otherwise we end up having passive rotations (or the negative angle, that is).

rotations

In addition to this mistake, there is also the issue of Geant4 interpreting rotations differently depending on whether they are wrapped in a G4Transform3D or directly passed to G4PVPlacement (see comment above). This just adds to the confusion.

Possible correction

We think in order to have this correct, the following changes have to be implemented:

  • core/geometry/Detector.cpp: remove the .Inverse() from the rotation
  • modules/GeometryBuilderGeant4/GeomentryConstructionG4.cpp:build_detectors(): Change to use a G4Transfrom3D before creating physical placements of the detector (see comment above for code snippet)
  • modules/MagneticFieldReader/MagneticFieldReader.cpp: Add an .Inverse() to the rotation since the field needs to be rotated the other way than the detector.

Impact

We think this can be done just as-is because it does not affect physics (apart from the CI tests which should produce different numbers) - the detector rotation is just the other way.

Edited by Simon Spannagel

Merge request reports