Skip to content

Geometry stability fixes: remove nanometre gaps and overlaps caused by float rounding - #15864

Open
sawenzel wants to merge 9 commits into
AliceO2Group:devfrom
sawenzel:swenzel/geometry-float-rounding
Open

sawenzel wants to merge 9 commits into
AliceO2Group:devfrom
sawenzel:swenzel/geometry-float-rounding

Conversation

@sawenzel

@sawenzel sawenzel commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

This PR prepares the ALICE geometry for VecGeom navigation by removing nanometre-scale gaps and overlaps between volumes that are meant to touch in the TOF, FT0, CPV, TRD, PHOS, MCH station 1, ZDC and space-frame geometries.

These artefacts arise from float constants and intermediate calculations, which can cause algebraically identical surfaces to differ by a fraction of a nanometre up to 38 nm. While TGeo tolerates these discrepancies, VecGeom's tighter surface tolerance can lead to zero-length steps and missed hits in sensitive volumes.

The geometry is now constructed consistently in double, and calculations of shared boundaries have been aligned so that touching faces coincide exactly. This reduces near-coincident face pairs (<100 nm) from 2255 in 216 mother volumes to about 680 in 79.

The effect on VecGeom navigation is substantial:

before after TGeo
TOF hits 2 1509 1550
CPV hits 0 6876 7392
TRD hits / TGeo 0.96 1.02 1
FT0 photocathode not reached reached reached

Note that the changes are not intended to alter the geometry itself. With TGeo navigation, 500 paired Pythia8 pp events give the same hit counts and energy deposits as dev within 1σ for all affected detectors. The FT0 stack and radiator-wrap corrections also leave the light yield unchanged within statistical uncertainties.

Overall, this makes the geometry independent of a navigator absorbing nanometre-scale rounding artefacts and provides the numerical consistency needed for VecGeom navigation.

Assisted by Claude Code.

sawenzel and others added 7 commits September 29, 2026 10:00
This widens the six angle arguments of o2::base::Detector::Matrix from
Float_t to Double_t.

- The helper only forwards to TVirtualMC::Matrix, which already takes
  Double_t, so the narrowing served no purpose.
- Every detector that places a rotated volume goes through it, so the
  rotation of every placement was quantised to float.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
(cherry picked from commit 86e074bddc867b1d5278fdc5b6dc42062837cfc3)
This converts the dimensions, positions and angles of the ALICE space
frame from float to double.

- FrameStructure.cxx was already half converted: lbox, xxtru1..4, trd1par
  and dzFB were double while ptrap, ptrd1, ppgon and tpar were float.
- B045cut subtracts a double-fed TGeoTrd1 from a float-fed TGeoTrap, so a
  single composite shape carried both precisions.
- The float intermediates make algebraically identical surface
  expressions land about 0.1 nm apart, which VecGeom rejects with
  DistanceToOut = -1.
- The near-coincident face pairs in the geometry fall from 2255 in 216
  mothers to 2110 in 200.
- createMaterials() keeps float: MaterialManager::Mixture, Material and
  Medium take Float_t, and initFieldTrackingParams takes float&.
- makeHeatScreen, createWebFrame and createTOFRail are private and called
  only from this file, so their signatures move with it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
(cherry picked from commit 4f954326933e7f58a4a0c48a7cda18ee809e16f4)
…ng planes

This removes the sub-nanometre gaps between the layers of the TOF strips and converts the TOF
volume tree from float to double.

- The layer centres of a strip were summed in different orders, so faces that are the same plane
  came out up to 0.34 nm apart, and FPCB was gapped from FRGL by 0.037 nm.
- The stack is now built by two running planes that meet inside the glass slot, which has a
  625 um freon gap either side by design.
- The Geo constants, the aligned-strip tables, their getters and the Detector helpers are double,
  and 45 static_cast<Float_t> inside geometry expressions are removed.
- Material recipes, persisted hit variables and the Float_t* transforms used by the global
  tracking keep float.
- TOF hits under VecGeom navigation go from 2 to 1509, against 1550 with TGeo.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This makes the FT0 photocathode reachable by a navigator other than TGeo's and
puts the reflector strips inside their own mother.

- The layer thicknesses are Float_t and each layer's z was summed in a
  different order, so 0MTO and 0REG were 0.075 nm apart and 0REG and 0MCP
  overlapped by 0.24 nm. VecGeom abandoned 0REG with DistanceToOut = -1, so no
  Cherenkov photon was ever registered.
- The stack is now built from one running plane, mirroring the addition the box
  shape uses for its own half-length.
- 0TRE was declared one micron wider than the radiator while each reflector
  strip is four microns thick, so three quarters of every strip lay outside its
  mother. The geometry doctor reports those strips at 23.9 to 27.2 percent
  reachable. The container is now derived from its contents.
- The strips are seated against the radiator in double, closing a 0.33 nm gap.
- Neither change moves the light yield: 41783 +- 564 hits per event before and
  40995 +- 534 after, with the beam aimed into FT0-A.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This removes the gaps between the CPV frame and its active planes and converts the CPV geometry
from float to double.

- The frame and the active planes it touches were placed from two different float sums of the
  same plane, 38 nm apart in twelve pairs, and CPVF and CPVAr were 0.11 nm apart.
- The GeometryParams members and getters, the shape half-lengths and the placement coordinates
  are double; the class version is bumped.
- The twelve near-coincident face pairs in the CPV mother are gone.
- In a PIPE plus CPV geometry, CPV hits under VecGeom navigation go from 0 to 6876, against 7392
  with TGeo.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This converts the TRD volume tree and the constants of TRDBase/GeometryBase.h from float to
double.

- createVolume forwards to the Double_t* overload of Gsvolu, so the 22 shape arrays and the
  placement locals move with it.
- Derived constants such as CH, CHSV, ANODEPOS, FLENGTH and XETHICK were summed in float while
  Geometry.cxx rebuilds the same quantities in double; the constants and their 23 constexpr
  getters are now double.
- rotateBack, kTiltAngle, the pad-plane locals and the PadPlane accessors keep float: they are
  reconstruction values.
- Zero-length exits under VecGeom navigation fall from 307310 to 47851 over the same events, and
  TRD hits go from 96 % to 102 % of TGeo.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This converts the dimensions, positions and angles of the muon station 1
quadrant geometry from float to double.

- Station1Geometry.cxx builds its volumes with TGeo directly, whose API
  is double throughout, so the float constants and locals were the only
  narrowing in the chain.
- SQM1 and SQM2 each carried 112 near-coincident face pairs at 38 nm,
  which VecGeom rejects with DistanceToOut = -1.
- The near-coincident face pairs in the geometry fall from 1279 in 156
  mothers to 1045 in 148.
- The eleven TRAP volumes go through TGeoManager::Volume, which has a
  Double_t* overload.
- Materials.cxx keeps float: Material, Mixture and Medium take Float_t,
  and initFieldTrackingParams takes float&.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
(cherry picked from commit dadef7493cd112317234e3dab392547019e90a35)
sawenzel and others added 2 commits September 29, 2026 11:41
This converts the PHOS GeometryParams singleton and the volume tree
built from it from float to double.

- PTII carried 160 near-coincident face pairs and PTIH 80, at 19 nm,
  which VecGeom rejects with DistanceToOut = -1.
- 24 of the Float_t in Detector.cxx are const Float_t* handles onto the
  GeometryParams tables, so widening the members alone would have
  narrowed them straight back.
- The near-coincident face pairs in the geometry fall from 1045 in 148
  mothers to 785 in 142.
- GeometryParams is a process-local singleton reached through
  GetInstance and no instance is ever written, but its class version is
  bumped since the member layout changes.
- PHOSBase/Geometry keeps float: it is the reconstruction cell mapping,
  shares no number with GeometryParams and places no volume.
- CreateMaterials and the hit variables keep float.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
(cherry picked from commit 6fcb5933ff8e01c86e9567358c07756d52fa923a)
This converts the boxpar array of the ZDC geometry from float to
double.

- The rest of the module was already double: the Geometry.h constants
  and the tubpar, tubspar and conpar arrays.
- boxpar was mixed into double placements, as in
  Gspos(Q12T, ..., tubspar[1] + boxpar[0], ...), so a double seat was
  computed from a float half-length.
- The near-coincident face pairs in the geometry fall from 687 in 80
  mothers to 683 in 79.

The effect on ZDC hits is not measured: a box gun at central rapidity
produces no ZDC hits at all, so this needs a generator that populates
the beam line.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
(cherry picked from commit 62df60a2874d17d9e8b71a080f809ab863e224b3)
@sawenzel
sawenzel force-pushed the swenzel/geometry-float-rounding branch from 1191b63 to 11be4aa Compare September 29, 2026 09:42

This branch has not been deployed

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants