From ba67c3cc5e07ef1fe944837418736934321efe18 Mon Sep 17 00:00:00 2001 From: Sandro Wenzel Date: Thu, 26 Nov 2026 20:25:20 +0100 Subject: [PATCH] Take TRD hit local coordinates from the current volume This is fixing the local coordinates of TRD hits with the VecGeom backend. The hit creation can no longer rely on the state of gGeoManager, which follows the step only when Geant4 navigates with TGeo. The transformation now comes from the MC engine (fMC->Gmtod). As a side effect, hits on volume boundaries are now also transformed in their own volume under TGeo. https://its.cern.ch/jira/browse/O2-7358 --- Detectors/TRD/simulation/src/Detector.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Detectors/TRD/simulation/src/Detector.cxx b/Detectors/TRD/simulation/src/Detector.cxx index 6760da57f2d52..d247550411c02 100644 --- a/Detectors/TRD/simulation/src/Detector.cxx +++ b/Detectors/TRD/simulation/src/Detector.cxx @@ -290,7 +290,7 @@ bool Detector::ProcessHits(FairVolume* v) const int trackID = stack->GetCurrentTrackNumber(); double pos[3] = {xp, yp, zp}; double loc[3] = {-99, -99, -99}; - gGeoManager->MasterToLocal(pos, loc); // Go to the local coordinate system (locR, locC, locT) + fMC->Gmtod(pos, loc, 1); // Go to the local coordinate system (locR, locC, locT) of the current volume float locC = loc[0], locR = loc[1], locT = loc[2]; if (drRegion) { locT = locT - 0.5 * (Geometry::drThick() + Geometry::amThick()); // Relative to middle of amplification region @@ -381,7 +381,7 @@ void Detector::createTRhit(int det) // prepare local coordinates double pos[3] = {x, y, z}; double loc[3] = {-99, -99, -99}; - gGeoManager->MasterToLocal(pos, loc); // Go to the local coordinate system (locR, locC, locT) + fMC->Gmtod(pos, loc, 1); // Go to the local coordinate system (locR, locC, locT) of the current volume float locC = loc[0], locR = loc[1], locT = loc[2]; locT = locT - 0.5 * (Geometry::drThick() + Geometry::amThick()); // Relative to middle of amplification region addHit(x, y, z, locC, locR, locT, tof, totalChargeDep, trackID, det, true); // All TR hits are in drift region