Problem 349

Summary: optimisation problem at G4ReflectedSolid::CalculateExtent
Product: Geant4 Reporter: Pedro.Arce
Component: geometry/managementAssignee: Vladimir.Grichine
Status: RESOLVED FIXED    
Severity: critical CC: Gabriele.Cosmo
Priority: P2    
Version: 4.0   
Hardware: PC   
OS: Linux   

Description Pedro.Arce 2002-02-07 04:34:11 CET
My job crashes in optimizing the geometry when I use the new
G4ReflectionFactory to reflect the CMS muon endcap. It complains that a
volume is completely outside the mother.
I checked the method G4ReflectedSolid::CalculateExtent and I printed a
line each time it was called. What I got seemed strange:

....
G4ReflectedSolid::CalculateExtent. pmin 2820.5 pMax 12690 1
G4ReflectedSolid::CalculateExtent. pmin 3172.5 pMax 14530 1
G4ReflectedSolid::CalculateExtent. pmin 3172.5 pMax 14530 1
G4ReflectedSolid::CalculateExtent. pmin -14530 pMax -3312.5 1
G4ReflectedSolid::CalculateExtent. pmin -14530 pMax -3312.5 1
G4ReflectedSolid::CalculateExtent. pmin 3312.5 pMax 14530 1
G4ReflectedSolid::CalculateExtent. pmin 3312.5 pMax 14530 1
G4ReflectedSolid::CalculateExtent. pmin 3312.5 pMax 14530 1
...

The job crashed after the fourth line, before implementing a correction. The
correction is:
when pMin and pMax are < 0, I interchange them:

G4ReflectedSolid::CalculateExtent. pmin -14530 pMax -3312.5 1
G4ReflectedSolid::CalculateExtent. RECALCULATE: pmin 3312.5 pMax 14530 1
G4ReflectedSolid::CalculateExtent. pmin -14530 pMax -3312.5 1
G4ReflectedSolid::CalculateExtent. RECALCULATE: pmin 3312.5 pMax 14530 1

A bit risky, I know, but it seems to work. The optimisation goees now without
problem, but it happens 21209 times out of the 469328 times it is called,
therefore if the solution is screwing up things, we have a problem.
We need reflections and we need optimisation, therefore the problem is critical
for us.
Comment 1 Gabriele Cosmo 2002-02-07 05:49:59 CET
Can you please specify what kind of solids are involved in the reflection ?
As documented, in Geant4 4.0 only CSG solids have been tested so far.
G4ReflectedSolid::CalculateExtent() is not yet optimised to cope with all
possible scenarios, so it's helpful for us to verify it on different/new test
cases. Thanks.
Comment 2 Vladimir.Grichine 2002-03-27 03:31:59 CET
The signature of G4VSolid::CalculateExtent has G4AffineTransform&. The class
does not support reflections depending of HepRotation matrix having determinant
to be equalt to unit. Therefore the output of the function
G4ReflectedSolid::CalculateExtent can be only approximate with accuracy worse
than usually provided by other G4 solids.
Comment 3 Vladimir.Grichine 2002-05-12 09:45:59 CEST
G4ReflectedSolid::CalculateExtent was implemented based on J. Apostolakis
proposal to use surrounding box. The box vertices then can be reflected as
G4Point3D objects. The implementation overcame internal test as well as CMS
endcap geometry.