Exactly, I am quite dejected, there seems to be no way to do this and it seems really strange to me!
By the way, I’m following your second tip. I have created a box volume which I will use as an object to subtract from the existing blue volume to create the spherical cap:
G4Box* box = new G4Box("box", r2, r2, 3*cm);
//associate it to a logical volume as a normal solid
G4LogicalVolume* logicbox = new G4LogicalVolume(box,
Olio_Oliva,
"boxLV");
//define displacements for the shapes
new G4PVPlacement(0, // rotation, sostituisci 0 con rotm
G4ThreeVector(0,0,-r1/2), //at (0,0,0)
logicbox, //its logical volume
"boxPhys", //its name
logicSferaIntegratrice, //its mother volume
false, //no boolean operation
0, //copy number
fCheckOverlaps); // checking overlaps
G4VisAttributes* red = new G4VisAttributes(G4Colour::Red());
red->SetVisibility(true);
red->SetForceAuxEdgeVisible(true);
logicbox->SetVisAttributes(red);
Then i made the subtraction:
G4Box* box = new G4Box("box", r2, r2, 3*cm);
/*
//associate it to a logical volume as a normal solid
G4LogicalVolume* logicbox = new G4LogicalVolume(box,
Olio_Oliva,
"boxLV");
//define displacements for the shapes
new G4PVPlacement(0, // rotation, sostituisci 0 con rotm
G4ThreeVector(0,0,-r1/2), //at (0,0,0)
logicbox, //its logical volume
"boxPhys", //its name
logicSferaIntegratrice, //its mother volume
false, //no boolean operation
0, //copy number
fCheckOverlaps); // checking overlaps
G4VisAttributes* red = new G4VisAttributes(G4Colour::Red());
red->SetVisibility(true);
red->SetForceAuxEdgeVisible(true);
logicbox->SetVisAttributes(red);
*/
G4SubtractionSolid* Calotta_Olio_oliva =
new G4SubtractionSolid("Calotta_Olio_oliva", SferaIntegratrice, box);
//associate it to a logical volume as a normal solid
G4LogicalVolume* logicCalotta_Olio_oliva = new G4LogicalVolume(Calotta_Olio_oliva,
Olio_Oliva,
"Calotta_Olio_olivaLV");
//define displacements for the shapes
new G4PVPlacement(0, // rotation, sostituisci 0 con rotm
G4ThreeVector(0,0,0), //at (0,0,0)
logicCalotta_Olio_oliva, //its logical volume
"Calotta_Olio_olivaPhys", //its name
logicSferaIntegratrice, //its mother volume
false, //no boolean operation
0, //copy number
fCheckOverlaps); // checking overlaps
G4VisAttributes* green = new G4VisAttributes(G4Colour::Green());
green->SetVisibility(true);
green->SetForceAuxEdgeVisible(true);
logicCalotta_Olio_oliva->SetVisAttributes(green);
But doesnt work, infact I don’t see blu geometry
and i receive some errors:
Checking overlaps for volume CilindroPhys:0 (G4Tubs) ... OK!
Checking overlaps for volume SferaIntegratricePhys:0 (G4MultiUnion) ... OK!
Checking overlaps for volume Calotta_Olio_olivaPhys:0 (G4SubtractionSolid) ...
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomSolids1001
issued by : G4BooleanSolid::GetPointOnSurface()
Solid - Calotta_Olio_oliva
All 100k attempts to generate a point on the surface have failed!
The solid created may be an invalid Boolean construct!
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomVol1002
issued by : G4PVPlacement::CheckOverlaps()
Sample point is not on the surface !
The issue is detected for volume Calotta_Olio_olivaPhys:0 (G4SubtractionSolid)
generated point (-23.8274,-165.847,-30) is outside
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
Checking overlaps for volume SiPMPhys:0 (G4Tubs) ...
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomSolids1001
issued by : G4BooleanSolid::GetPointOnSurface()
Solid - Calotta_Olio_oliva
All 100k attempts to generate a point on the surface have failed!
The solid created may be an invalid Boolean construct!
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
Where is the error in the subtraction? Thanks so much.