Problem 1794

Summary: G4GenericPolycone give "Dangerous inconsistency"
Product: Geant4 Reporter: Daren Sawkey <daren.sawkey>
Component: geometry/solidsAssignee: Evgueni.Tcherniaev
Status: RESOLVED FIXED    
Severity: normal    
Priority: P5    
Version: 10.1   
Hardware: PC   
OS: Linux   
Attachments: Use this in example basic/B1

Description Daren Sawkey 2015-10-17 00:33:21 CEST
Created attachment 364 [details]
Use this in example basic/B1

G4GenericPolycone gives warnings. Code and warnings below. The attachment can be used as DetectorConstruction.cc for example basic/B1.

I'm using Geant4 10.1.patch2 on Scientific Linux 6.

Notes: the rotation seems to be important to generate the warning, and the rate of warnings can be increased by increasing the number of rz coordinates. (here it occurs in the part-per-million range).

  G4Material* shape2_mat = nist->FindOrBuildMaterial("G4_BONE_COMPACT_ICRU");
  G4ThreeVector pos2 = G4ThreeVector(0., 0*cm, 0*cm);

  const G4int cone1size = 5;

  const G4double r_FF[cone1size] = {
     0.0*mm,  1.9*mm, 13.3*mm,  0.3*mm, 0.0*mm
  };

  const G4double z_FF[cone1size] = {
     -22.4*mm, -22.2*mm, 2.2*mm, -11.1*mm, -11.1*mm
  };

  G4GenericPolycone* solidShape3 =
    new G4GenericPolycone("Shape3",
                          0.*deg,
                          360.*deg,
                          cone1size,
                          r_FF,
                          z_FF);

  G4LogicalVolume* logicShape3 =
    new G4LogicalVolume(solidShape3,
                        shape2_mat,
                        "Shape3");

  G4RotationMatrix* rot = new G4RotationMatrix();
  rot->rotateX(180.0*deg);

  new G4PVPlacement(rot,
                    pos2,
                    logicShape3,
                    "Shape3",
                    logicEnv,
                    false,
                    0,
                    checkOverlaps);



-------- WWWW ------- G4Exception-START -------- WWWW -------            
*** G4Exception : GeomNav0123                                            
      issued by : G4NormalNavigation::ComputeStep()                      
 Dangerous inconsistency in response of solid.                           
    Solid type: G4GenericPolycone    Name= Shape3                        
 Mother volume gives safety > 0 despite being called for *Outside* point 
   Location = (1.62632,2.4064,-11.4708)                                  
   Direction= (-0.144172,-0.213241,-0.966304)                            
   - Safety (Isotropic d) = 2.12166                                      
   - Intersection Distance= 9e+99                                        


*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------

G4WT3 > 
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomNav0003                                
      issued by : G4NormalNavigation::ComputeStep()          
============================================================ 
 WARNING>  Current Point appears to be Outside mother volume !! 
   Response of DistanceToOut was negative or kInfinity when called in G4NormalNavigation::ComputeStep()
   Current physical volume = Shape3                                                                    
   Position (loc)  = (1.626316658,2.406396722,-11.47077165)                                            
   Direction (dir) = (-0.1441719172,-0.2132410623,-0.9663036312)                                       
 For confirmation:                                                                                     
   Response of DistanceToOut (loc, +dir)= 9e+99                                                        
   Response of DistanceToOut (loc, -dir)= 4.317882808                                                  
   Inside responds = 2 , ie:  Inside  -- unexpected / inconsistent response !                          
   Obtain safety(ToIn) = 3.225798228                                                                   
   Obtain safety(ToOut) = 2.121655901                                                                  
 Response of DistanceToIn (loc, +dir)= 9e+99                                                           
 Response of DistanceToIn (loc, -dir)= 9e+99                                                           
 Exit Normal at loc = (-0.4004316945,-0.5925030111,0.6989954506)                                       
     Dir . Normal   = -0.4913648655                                                                    
 Checking points moved from position by distance/dir.  Solid responses:                                
  +eps in direction :    kInside  +eps in Normal  :    kInside                                         
  -eps in direction :    kInside  -eps in Normal  :    kInside                                         
 Parameters of solid:                                                                                  
-----------------------------------------------------------                                            
    *** Dump for solid - Shape3 ***                                                                    
    ===================================================                                                
 Solid type: G4GenericPolycone                                                                         
 Parameters:                                                                                           
    starting phi angle : 0 degrees                                                                     
    ending phi angle   : 360 degrees                                                                   
    number of RZ points: 5                                                                             
              RZ values (corners):                                                                     
                         0, -22.4                                                                      
                         1.9, -22.2                                                                    
                         13.3, 2.2                                                                     
                         0.3, -11.1                                                                    
                         0, -11.1                                                                      
-----------------------------------------------------------                                            
============================================================                                           
*** This is just a warning message. ***                                                                
-------- WWWW -------- G4Exception-END --------- WWWW -------
Comment 1 tatiana.nikitina 2015-11-01 22:46:26 CET
Daren,

Thank you for reporting this error.
This is an error in DistanceToOut(p,v),you can see from printings that point is Inside, but DistanceToOut(p,v) gives kInfinity.
I will investigate this problem.

Best Regards,
Tatiana.
Comment 2 Evgueni.Tcherniaev 2016-03-08 16:29:30 CET
Usage of more relevant precision constant in G4IntersectingCone.cc (DBL_EPSILON instead of 1E-6) has fixed the problem.