Hi,
I’m trying to build a mesh to put it in front of a target. Looking at the forum I found a very useful instrument G4MultiUnion. I built an object done by circle and then I subtracted it from a cylinder, to obtain the mesh. In the following the code:
auto meshTemplate
= new G4Tubs("meshTemplate", // its name
0, meshRadius, meshThickness/2., 0.0*deg, 360.0*deg); // its size
G4MultiUnion* munion_solid = new G4MultiUnion("UnitedBoxes");
G4int nHole = (G4int) 2*CLHEP::pi*(meshRadius-holeRadius)/(2*holeRadius)-1;//10
G4cout << "Number of holes " << nHole << G4endl;
for (G4int i = 0; i < nHole; i++) {
G4Tubs *holeTemplate
= new G4Tubs("holeTemplate", // its name
0, holeRadius, meshThickness/2., 0.0*deg, 360.0*deg); // its size
G4ThreeVector pos = G4ThreeVector((meshRadius-holeRadius)*cos(i*2*CLHEP::pi/nHole), (meshRadius-holeRadius)*sin(i*2*CLHEP::pi/nHole), 0);
G4RotationMatrix rot = G4RotationMatrix(0, 0, 0);
G4Transform3D tr = G4Transform3D(rot, pos);
munion_solid -> AddNode( *holeTemplate, tr );
}
munion_solid -> Voxelize();
G4SubtractionSolid *meshS = new G4SubtractionSolid("mesh", meshTemplate, munion_solid);//munion_solid);
auto meshLV
= new G4LogicalVolume(
meshS, // its solid
meshMaterial, // its material
"mesh"); // its name
new G4PVPlacement(
0, // no rotation
G4ThreeVector(0, 0, 0), // at (0,0,0)
meshLV, // its logical volume
"mesh", // its name
worldLV, // its mother volume
false, // no boolean operation
0, // copy number
fCheckOverlaps); // checking overlaps
But when I run the simulation what I find is:
The circles, which constitute the mesh’s holes are in the right place, but now the base of the mesh that should be continuous it’s a cloud of points.
Do you have an idea of about it is happening?