| Summary: | Infinite loop for overlap checking in placements for elliptical tube and boolean | ||
|---|---|---|---|
| Product: | Geant4 | Reporter: | Laurie Nevay <laurie.nevay> |
| Component: | geometry | Assignee: | Evgueni.Tcherniaev |
| Status: | RESOLVED FIXED | ||
| Severity: | major | CC: | Gabriele.Cosmo |
| Priority: | P4 | ||
| Version: | 10.3 | ||
| Hardware: | Apple | ||
| OS: | Mac OS X | ||
| Attachments: |
Edited B1 example to reproduce the problem
Screenshot of elliptical geometry as shown in our framework Time profiler screenshot showing time in G4BooleanSolid::GetPointOnSurface |
||
Created attachment 442 [details]
Screenshot of elliptical geometry as shown in our framework
Created attachment 443 [details]
Time profiler screenshot showing time in G4BooleanSolid::GetPointOnSurface
Thank you for reporting the problem. In reality there is no infinite loop in your test, it is just very slow. On my computer userDetector->Construct() takes 10 mins: /run/initialize userDetector->Construct() start. Placing vacuum in container Checking overlaps for volume beampipe_vacuum_pv ... OK! Placing beam pipe in container Checking overlaps for volume beampipe_beampipe_pv ... OK! Placing container in world Checking overlaps for volume beampipe_container_pv ... OK! === Timer: User=593.42s Real=602.26s Sys=2.06s The reason is inefficient implementation of G4CutTubs::GetSurfaceArea(). After correction the test runs much faster: === Timer: User=0.42s Real=0.43s Sys=0s Corrected G4CutTubs is already available in the repository and will be included in the next patch. |
Created attachment 441 [details] Edited B1 example to reproduce the problem In Geant4.10.3 we see infinite loops on overlap checking with lots of solids. The overlap checking never finishes and never reports any warnings. This makes Geant4.10.3 unusable for us. We see no overlaps with the exact same geometry in earlier version of Geant4 and experience no tracking problems. We have a framework that makes Geant4 models of accelerators (BDSIM) and we have factories that produce various shapes of beam pipe (circular, elliptical, rectangular etc). These are composed of straight sections with angled faces. We have a nightly ctest test suite running on ~300 tests that report no geometry problems in Geant4.10.0 -> Geant4.10.2.p03 - no overlaps. This is long standing code that has worked fine and produced desired results. I've edited the B1 example to reproduce the problem and attached it. It should be run like ./exampleB1 exampleB1.in Apart from the geometry, I made minor edits to the stepping action and primary generator by commenting out bits of code to exclude warnings from geometry specific look ups for scoring & coordinate generation. I also attach a screenshot of a time profiler (xcode) showing the code spending all of its time in overlap checking and calling the random number generator for testing the solids. The geometry consists of an elliptical container with angled faces. Inside this are a 'vacuum' volume and a beam pipe volume. The vacuum volume is a similar elliptical tube with angled faces that's just smaller. The beam pipe is a subtraction of two elliptical tubes (to make a hollow elliptical tube) that is then intersected with a cut tubs to give the angled faces. The vacuum volume and beam pipe are placed inside the 'container' with is in turn placed in the world. I also attach a screenshot of roughly what this type of geometry would look like in our application. We see this particularly with G4EllipticalTube + G4IntersectionSolid or G4SubtractionSolid. But also with the same setup but with G4Box used instead of G4EllipticalTube.