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.
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.
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.
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.