Skip to content

TGeoChecker::ComputeOverlap skips every mesh point with x < 0 and y < 0 (missing TMath::Abs?) #24293

Open

Description

@bauj

Check duplicate issues.

  • Checked for duplicates

Description

In geom/geomchecker/src/TGeoChecker.cxx, TGeoChecker::ComputeOverlap skips points with this test in three of its four point loops:

if (local[0] < 1e-10 && local[1] < 1e-10)
  continue;

The coordinates are compared signed, with no absolute value. So the test doesn't only skip points on the z axis, which is presumably the intent. It skips every mesh point of the shape that lies in the quadrant x ≤ 0, y ≤ 0 of its local frame.

The other loop, over the daughter's points in the extrusion case, uses absolute values:

if (TMath::Abs(local[0]) < tolerance && TMath::Abs(local[1]) < tolerance)
  continue;

Reproducer

A small box A lies wholly inside a large box B, its sibling. Both are placed without a transform. A is centred at (15, 15, 0), then at (−15, −15, 0).

// overlap_quadrant.C macro
void overlap_quadrant()
{
   for (double s : {+1., -1.}) {
      delete gGeoManager;
      new TGeoManager("q", "q");
      TGeoMedium *med = new TGeoMedium("vac", 1, new TGeoMaterial("vac", 0, 0, 0));
      TGeoVolume *top = gGeoManager->MakeBox("TOP", med, 200, 200, 200);
      gGeoManager->SetTopVolume(top);
      TGeoVolume *b = gGeoManager->MakeBox("B", med, 100, 100, 100);
      double origin[3] = {15 * s, 15 * s, 0};
      TGeoVolume *a = new TGeoVolume("A", new TGeoBBox(5, 5, 5, origin), med);
      top->AddNode(b, 1);
      top->AddNode(a, 1);
      gGeoManager->CloseGeometry();
      gGeoManager->CheckOverlaps(0.1);
      printf("A centred at (%+g, %+g, 0): %d overlap(s) found\n", origin[0], origin[1],
             gGeoManager->GetListOfOverlaps()->GetEntriesFast());
   }
}

Output with ROOT 6.40.02:

A centred at (+15, +15, 0): 1 overlap(s) found
A centred at (-15, -15, 0): 0 overlap(s) found

In the second case A is still wholly inside B, but all of its mesh points have x < 0 and y < 0, so they are all skipped. B's points are far from A, so nothing is reported.

ROOT version

| Welcome to ROOT 6.40.02                        https://root.cern |
| (c) 1995-2025, The ROOT Team; conception: R. Brun, F. Rademakers |
| Built for linuxx8664gcc on Jun 10 2026, 10:43:59                 |
| From tags/v6-40-02@v6-40-02                                      |
| With c++ (GCC) 16.1.1 20260515 (Red Hat 16.1.1-2) std202302      |
| Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q'  |

Installation method

Built from source

Operating system

Fedora 44

Additional context

The signed test may have been written this way on purpose. If so, could you explain why these points are skipped, and why only in these three loops and not in the daughter loop?

Activity

  1. agheata commented on Nov 23, 2026

    @agheata
    Member

    @bauj, thanks for catching this! Those three checks are missing absolute values. This is fixed by #24298

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions