Problem 1136

Summary: G4ExtrudedSolid volumes disappear in visualization after Boolean subtraction
Product: Geant4 Reporter: Chuong <chuong.nguyen>
Component: visualizationAssignee: perl
Status: RESOLVED INVALID    
Severity: normal CC: John.Allison
Priority: P1    
Version: other   
Hardware: PC   
OS: Linux   

Description Chuong 2010-08-17 10:39:41 CEST
Hi,

I am using geant4-09-03-patch-01 (9-April-2010). I try to make a collimator from 2 G4ExtrudedSolid objects, one is called "collquarter1", the other one is "collsl1" as in the example codes below. I need to subtract "collsl1" from "collquarter1" to make a slit opening. Whenever I perform subtraction with G4SubtractionSolid, "collquarter1" disappears from my HepRApp and DAWN visualisations. I also get this error message from geant4 prompt: 
  BooleanProcessor: corrapted input polyhedron

Could any one please give an insight into this problem and how to solve it? Thanks a lot.

Chuong


// example codes

//Create collquarter1
vector<G4TwoVector> polygon;
polygon.push_back(G4TwoVector(-10.0, 10));
polygon.push_back(G4TwoVector(-30.0, 30.0));
polygon.push_back(G4TwoVector(30.0, 30.0));
polygon.push_back(G4TwoVector(10.0, 10.0));
G4VSolid* collquarter1 = new G4ExtrudedSolid("ncollquarter1",polygon,2.5,G4TwoVector(0.0,0.0),1.0,G4TwoVector(0.0,0.0),1.0);

//Create collsl1
vector<G4TwoVector> polygon2;
polygon2.push_back(G4TwoVector(-2.5, 6.23016));
polygon2.push_back(G4TwoVector(-2.5, 8.775));
polygon2.push_back(G4TwoVector(-1.5017, 8.83323));
polygon2.push_back(G4TwoVector(2.5, 11.0237));
polygon2.push_back(G4TwoVector(2.5, 9.06667));
polygon2.push_back(G4TwoVector(1.5017, 9.00843));
G4VSolid* collsl1 = new G4ExtrudedSolid("ncollsl1",polygon2,2.5,G4TwoVector(0.0,0.0),1.0,G4TwoVector(0.0,0.0),1.0);

//Perform subtraction
collquarter1 = new G4SubtractionSolid("ncollquarter1", collquarter1, collsl1, 0, G4ThreeVector(0.0,0.0,0.0));

//Create a physical object from collquarter1
collquarter1_log = new G4LogicalVolume(collquarter1,coll_mat,"ncollquarter1_log");

collquarter1_phys = new G4PVPlacement(aprot, G4ThreeVector(0.0,0.0,0.0), collquarter1_log, "ncollquarter1_phys", dummycoll_log, false,0);
Comment 1 Chuong 2010-08-19 10:10:46 CEST
Hi again,

I later found out that was due to the limited visualization ability in HepRApp and DAWN. The object though disappearing from the visualization still blocked the gamma rays hitting it.

However, I found another problem with Boolean subtraction using G4SubtractionSolid. When I subtracted a G4ExtrudedSolid object with more than one other G4ExtrudedSolid objects, the resulting object did not respond to gamma rays correctly, i.e gamma rays could easily go through at some solid parts of the resulted object. There must be some bugs in G4SubtractionSolid relating to G4ExtrudedSolid. 

Luckily I have found a way to create my collimator without having to use G4SubtractionSolid and G4ExtrudedSolid. Thanks for reading this.

Chuong
Comment 2 Gabriele Cosmo 2010-08-20 09:02:42 CEST
If you noticed an effect in tracking due to Boolean subtraction it is most likely due to the positioning of the constituent volumes. Any shared facet or vertex which may be involved in the subtraction can cause side effects (in the visualization as well) and should be avoided.