Skip to content

Add a reachability check to the geometry doctor and restore the ZEM geometry - #15750

Open
sawenzel wants to merge 3 commits into
AliceO2Group:devfrom
sawenzel:zem-reachability
Open

Add a reachability check to the geometry doctor and restore the ZEM geometry#15750
sawenzel wants to merge 3 commits into
AliceO2Group:devfrom
sawenzel:zem-reachability

Conversation

@sawenzel

@sawenzel sawenzel commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

This PR improves the geometry doctor with a fast reachability check and restores the ZEM material in the simulation geometry (fixing https://its.cern.ch/jira/browse/O2-7156). The new check tests whether volumes can actually be reached by the navigator, making it possible to detect placements that are present in the geometry but effectively invisible to transport. It runs on the full ALICE geometry in a few seconds and can be used as a build-time check.

The same check also revealed that the ZEM calorimeters were placed outside the volume from which they could be reached. The ZEM geometry has been moved to the barrel volume, removing the resulting extrusions and restoring ZEM hits in simulation. The new position is also consistent with the available survey measurements.

Reachability check in the geometry doctor

The new check asks a simple question for each volume: can the navigator actually reach the space occupied by this volume?

For each node, the geometry doctor samples points inside its own shape and checks whether FindNode() reaches the corresponding volume. A volume that cannot be reached at all does not contribute material to transport and cannot produce hits. If only part of a volume can be reached, it is usually blocked by an overlapping sibling or an extruding placement.

The check does not require a magnetic field. On the full ALICE geometry it takes about three seconds:

$ o2-sim-geometry-doctor --geometry-file o2sim_geometry.root --reachability-only
reachability: 73761 node objects visited, 65526 sampled, 230 too thin to sample
  244 placements the navigator never reaches, 13 it reaches only in part
  unreachable -- these carry no material and produce no hits:
    mother       medium                sampled  path
    caveRB24     ZDC_VoidNoField$           32  /cave_1/caveRB24_1/ZEM_1
    ZETR         ZDC_Lead$                  32  /cave_1/caveRB24_1/ZEM_1/ZETR_1/ZEL0_1
  partially shadowed -- an overlapping sibling or an extruding placement:
    ZDCA         ZDC_Aluminum$           65.6%  /cave_1/ZDCA_1/ZNBH_3

The default sampling is already sufficient for a quick check of the full geometry, while --reachability-samples can be used when more statistics are needed.

Restoring the ZEM geometry

The reachability check identified the ZEM problem. ZEM and its 27 support volumes were placed inside caveRB24, between z = 748 and 858 cm. However, the caveRB24 volume starts at z = 864.6 cm, so the navigator could never enter the ZEM geometry.

The barrel volume already owns this z range, so the ZEM volumes are now placed there instead. The existing +30 cm offset of the barrel is used, avoiding another hard-coded z position. shCaveTR3 is also expanded from R = 80 to R = 105 cm to provide enough space for the ZEM box walls, which extend to R = 95.7 cm.

ZEM is only constructed for layouts that contain it, so this change does not affect the FoCal geometries.

The change was tested with Run 3 (--detectorList ALICE2) using 50 events of 20 muons at 200 GeV with 4.6 < eta < 5.3:

Check Before After
ZDC hits 0 230, at z = 757–781 cm
CheckOverlaps on caveRB24 29 extrusions 0
CheckOverlaps on barrel 36 36
Unreachable placements in the whole geometry 244 5

The 29 placements moved into barrel are now inside the volume without overlapping any solid sibling. They were checked using 100,000 sample points per placement.

There is also an independent validation against the detector survey. The 2014 survey (EDMS 1512802, sigma = 0.5 mm) measured the ZEM box corners at |x| = 14.92–14.95 cm and z = 756.29–851.32 cm. The new geometry places the box at x = 14.940 cm and z = 756.50–851.50 cm, within about 2 mm of the surveyed position. This is comparable to the movement observed between the 2009 and 2014 surveys.

Overall, the change adds a fast way to detect unreachable geometry and restores the ZEM material to transport, giving the expected ZDC hits while removing the previous caveRB24 extrusions.

sawenzel and others added 2 commits September 2, 2026 10:52
This fixes the ZEM calorimeters being placed outside their mother volume, so that
they are simulated again.

- ZEM and its 27 support volumes were placed in caveRB24 at global z 748 to 858 cm,
  while caveRB24 begins at z = 864.6 cm, so TGeo could not reach them and they
  produced no hits.
- The barrel volume has owned that z range since commit 5166902, so the 29
  placements go there, with the +30 cm offset the barrel carries in the cave.
- shCaveTR3 in Cave.cxx grows from R = 80 to R = 105 cm, which the ZEM box walls at
  R = 95.7 cm need. 105 cm is what caveRB24 had in that range before.
- ZEM is not built when FoCal is active, because every point of ZEM lies inside the
  FOCAL box.
- 50 events of 20 muons at 200 GeV into 4.6 < eta < 5.3 give 0 ZDC hits before and
  250 ZEM hits at z 757 to 784 cm after.
- CheckOverlaps on caveRB24 goes from 29 extrusions to 0.

https://its.cern.ch/jira/browse/O2-7156

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This adds a check that every placement occupies the space it was built in, and a
--reachability-only mode that runs it without a magnetic field.

- For each node object the tool draws points inside the placement's own shape and
  asks TGeoManager::FindNode whether the navigator comes back through it.
- A placement the navigator never reaches carries no material and produces no hits;
  one it reaches only in part is shadowed by an overlapping sibling.
- The full ALICE geometry takes 3 s: 73761 node objects visited, 65526 sampled.
- On dev it reports 244 unreachable placements, 239 of which are ZEM.
- The exit code is 3 when anything is unreachable.

https://its.cern.ch/jira/browse/O2-7156

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@sawenzel
sawenzel requested a review from amorsch September 2, 2026 08:56
@amorsch

amorsch commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Thanks for spotting. Indeed, only with the proposed changes ZEM creates hits.

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.

3 participants