I want to make a hollow box and then place another small box of different material in the hollow region. I used the following code.
G4Box *outerBox = new G4Box("Outer Box",5*mm,5*mm,5*mm);
G4LogicalVolume *outerBoxlogic = new G4LogicalVolume (outerBox, lead, "Outer Box Logic",0,0,0);
new G4PVPlacement (0, G4ThreeVector(0,0,0), outerBoxlogic,"Outer Box Phys", fpWorldLogical, false, 0);
G4VisAttributes *outerBoxVis = new G4VisAttributes (G4Colour(1,0,0));
outerBoxlogic -> SetVisAttributes (outerBoxVis);
G4Box *innerBox = new G4Box("Inner Box",2*mm,2*mm,5*mm);
G4LogicalVolume *innerBoxlogic = new G4LogicalVolume (innerBox, vacuum, "Inner Box Logic",0,0,0);
new G4PVPlacement (0, G4ThreeVector(0,0,0), innerBoxlogic,"Inner Box Phys", fpWorldLogical, false, 0);
G4VisAttributes *innerBoxVis = new G4VisAttributes (G4Colour(1,0,1));
innerBoxlogic -> SetVisAttributes (innerBoxVis);
G4SubtractionSolid *hollowBoxmaking = new G4SubtractionSolid("Hollow Box making",outerBox,innerBox);
G4Box *insidehollow_region = new G4Box("Inside Hollow region",1*mm,1*mm,1*mm);
G4LogicalVolume *insidehollow_region_logic = new G4LogicalVolume (insidehollow_region, water, "Inside Hollow region logic",0,0,0);
new G4PVPlacement (0, G4ThreeVector(0,0,0), insidehollow_region_logic,"Inside Hollow region Phys", fpWorldLogical, false, 0);
G4VisAttributes *hollowBoxVis = new G4VisAttributes (G4Colour(1,1,1));
insidehollow_region_logic -> SetVisAttributes (hollowBoxVis);
The above code doesn’t work for some reason. To check if my code has worked or not, i tried passing beam through it and hits the outer box, even though I have made hollow region inside it by using G4SubtractionSolid. Can someone help me this.
Once this is done successfully, I need to make another hollow box but with cylindrical hollow region.
Thank you very much!