—World is registered to the default region.
Segmentation fault (core dumped)
‘’’
*** G4Exception : GeomVol1002
issued by : G4PVPlacement::CheckOverlaps()
Overlap with mother volume !
Overlap is detected for volume HollowSphere:0 (G4Orb) with its mother volume Foam (G4Box)
protrusion at mother local point (26.7989,-15.0211,-5.05988) by 298.88 um (max of 65 cases)
NOTE: Reached maximum fixed number -1- of overlaps reports for this volume !
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
Checking overlaps for volume HollowSphere:0 (G4Orb) …
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomVol1002
issued by : G4PVPlacement::CheckOverlaps()
Overlap with mother volume !
Overlap is detected for volume HollowSphere:0 (G4Orb) with its mother volume Foam (G4Box)
protrusion at mother local point (26.7995,-14.9566,4.99714) by 299.474 um (max of 96 cases)
NOTE: Reached maximum fixed number -1- of overlaps reports for this volume !
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
Checking overlaps for volume HollowSphere:0 (G4Orb) …
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomVol1002
issued by : G4PVPlacement::CheckOverlaps()
Overlap with mother volume !
Overlap is detected for volume HollowSphere:0 (G4Orb) with its mother volume Foam (G4Box)
protrusion at mother local point (26.7953,-4.96803,-4.87375) by 295.283 um (max of 77 cases)
NOTE: Reached maximum fixed number -1- of overlaps reports for this volume !
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
Checking overlaps for volume HollowSphere:0 (G4Orb) …
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomVol1002
issued by : G4PVPlacement::CheckOverlaps()
Overlap with mother volume !
Overlap is detected for volume HollowSphere:0 (G4Orb) with its mother volume Foam (G4Box)
protrusion at mother local point (26.7988,-5.05684,4.96933) by 298.841 um (max of 89 cases)
NOTE: Reached maximum fixed number -1- of overlaps reports for this volume !
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
Checking overlaps for volume HollowSphere:0 (G4Orb) …
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomVol1002
issued by : G4PVPlacement::CheckOverlaps()
Overlap with mother volume !
Overlap is detected for volume HollowSphere:0 (G4Orb) with its mother volume Foam (G4Box)
protrusion at mother local point (26.7995,4.96503,-5.02143) by 299.533 um (max of 75 cases)
NOTE: Reached maximum fixed number -1- of overlaps reports for this volume !
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
Checking overlaps for volume HollowSphere:0 (G4Orb) …
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomVol1002
issued by : G4PVPlacement::CheckOverlaps()
Overlap with mother volume !
Overlap is detected for volume HollowSphere:0 (G4Orb) with its mother volume Foam (G4Box)
protrusion at mother local point (26.7975,5.00175,5.09531) by 297.474 um (max of 79 cases)
NOTE: Reached maximum fixed number -1- of overlaps reports for this volume !
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
Checking overlaps for volume HollowSphere:0 (G4Orb) …
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomVol1002
issued by : G4PVPlacement::CheckOverlaps()
Overlap with mother volume !
Overlap is detected for volume HollowSphere:0 (G4Orb) with its mother volume Foam (G4Box)
protrusion at mother local point (26.7996,14.9788,-4.97043) by 299.632 um (max of 82 cases)
NOTE: Reached maximum fixed number -1- of overlaps reports for this volume !
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
Checking overlaps for volume HollowSphere:0 (G4Orb) …
-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomVol1002
issued by : G4PVPlacement::CheckOverlaps()
Overlap with mother volume !
Overlap is detected for volume HollowSphere:0 (G4Orb) with its mother volume Foam (G4Box)
protrusion at mother local point (26.7972,14.953,5.08808) by 297.231 um (max of 80 cases)
NOTE: Reached maximum fixed number -1- of overlaps reports for this volume !
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------
Checking overlaps for volume Foam:0 (G4Box) … OK!
World is registered to the default region.
Segmentation fault (core dumped)
‘’’
You have overlaps between two volumes in the geometry as per the warnings - fix these first using the info printed in those warnings and then see if the set fault disappears.
Sir, my shield contains hollow spheres. Without this, how can I build my shield?
‘’’
G4int latticeSize = 100; // Number of spheres in each dimension
G4double latticeSpacing = 10.0 * mm; // Spacing between spheres
// Create and place hollow spheres periodically inside the cuboid
for (G4int i = 0; i < latticeSize; ++i) {
for (G4int j = 0; j < latticeSize; ++j) {
for (G4int k = 0; k < latticeSize; ++k) {
G4double posX = i * latticeSpacing - (latticeSize - 1) * latticeSpacing / 2.0;
G4double posY = j * latticeSpacing - (latticeSize - 1) * latticeSpacing / 2.0;
G4double posZ = k * latticeSpacing - (latticeSize - 1) * latticeSpacing / 2.0;
auto hollowSphere = new G4Orb("HollowSphere", sphereHollowRadius);
auto logicHollowSphere = new G4LogicalVolume(hollowSphere, world_mat, "HollowSphere");
// Check if the sphere is within the cuboid
if (std::abs(posX) <= foam_dx / 2 && std::abs(posY) <= foam_dy / 2 && std::abs(posZ) <= foam_dz / 2) {
new G4PVPlacement(nullptr, G4ThreeVector(posX, posY, posZ), logicHollowSphere, "HollowSphere", logicFoam, false, 0, checkOverlaps);
}
}
}
}
// Place foam volume inside the hollow cuboid
new G4PVPlacement(nullptr, G4ThreeVector(0,10,0), logicFoam, "Foam", logicWorld, false, 0, checkOverlaps);
‘’’
Check the calculation of whether the sphere is within the cuboid. It doesn’t look to be taking the sphere radius into account.
Sir, all spheres are inside the cuboid. I add the radius of spheres is mentioned not shown here.
The sphere centers may be inside the cuboid, but the entire volume of each sphere must also be enclosed in the cuboid. E.g. say I have a sphere of outer radius 10mm and want to place this in a box of half-length 40mm. If I place that sphere at x=29mm, then it’s fully enclosed. If it’s placed at 30.1mm, then it overlaps.
I’d suspect this is what is happening here, but it depends on the values of foam_dx
etc, and sphereHollowRadius
.
Sir, the Shield problem is resolved still there is the issue in the world
‘’’
userDetector->Construct() start.
Checking overlaps for volume Cs_Source:0 (G4Tubs) … OK!
Checking overlaps for volume chamber2Disc:0 (G4Tubs) … OK!
Checking overlaps for volume Ale:0 (G4Tubs) … OK!
Checking overlaps for volume MgO:0 (G4Tubs) … OK!
Checking overlaps for volume MgOe:0 (G4Tubs) … OK!
Checking overlaps for volume NaI:0 (G4Tubs) … OK!
Checking overlaps for volume Lead:0 (G4Box) … OK!
Checking overlaps for volume Lead1:0 (G4Box) … OK!
Checking overlaps for volume Lead2:0 (G4Box) … OK!
Checking overlaps for volume Lead3:0 (G4Box) … OK!
Checking overlaps for volume Lead4:0 (G4Box) … OK!
Checking overlaps for volume HollowSphere:0 (G4Orb) … OK!
Checking overlaps for volume HollowSphere:0 (G4Orb) … OK!
Checking overlaps for volume HollowSphere:0 (G4Orb) … OK!
Checking overlaps for volume HollowSphere:0 (G4Orb) … OK!
Checking overlaps for volume HollowSphere:0 (G4Orb) … OK!
Checking overlaps for volume HollowSphere:0 (G4Orb) … OK!
Checking overlaps for volume HollowSphere:0 (G4Orb) … OK!
Checking overlaps for volume HollowSphere:0 (G4Orb) … OK!
Checking overlaps for volume HollowSphere:0 (G4Orb) … OK!
Checking overlaps for volume HollowSphere:0 (G4Orb) … OK!
Checking overlaps for volume HollowSphere:0 (G4Orb) … OK!
Checking overlaps for volume HollowSphere:0 (G4Orb) … OK!
Checking overlaps for volume HollowSphere:0 (G4Orb) … OK!
Checking overlaps for volume HollowSphere:0 (G4Orb) … OK!
Checking overlaps for volume HollowSphere:0 (G4Orb) … OK!
Checking overlaps for volume HollowSphere:0 (G4Orb) … OK!
Checking overlaps for volume Foam:0 (G4Box) … OK!
World is registered to the default region.
Segmentation fault (core dumped)
‘’’
If overlap is fixed then there is a possible chance of segmentation fault appearing from the definition of ‘SetVisAttributes’ method defined by G4VisAttributes();
I would rather comment attributes and re-run the code and later fill attributes from visManager explicitly.
You can make a try.
VRS
To track down segmentation faults in general, it’s best to:
-
Build your application (not Geant4 itself) in “Debug” mode, which can be done when configuring it with CMake by running
cmake -DCMAKE_BUILD_TYPE=Debug <otherarguments>
, orCMAKE_BUILD_TYPE
can be set in theccmake
orcmake-gui
. -
Run the resultant application through the
gdb
program, which is usually just a case of doing:$ gdb ./yourprogram
which starts up your application in the
gdb
debugger. You can then typerun
in the interface to execute the program. -
When the segfault occurs, type
bt
orbacktrace
to show the sequence of calls that lead up to it. The first in the list will be the cause, with info about where in the code the problem originates from.
More help and documentation on gdb
itself can be found on its website and searches will bring up plenty more.
Hello VRS,
I commented out all vis attributes, but it still shows the core dump.
Regards,
Ratilal Meher
There might be problem in return value of pointer defining in sensitive region. It is just a guess.
gdb is a good way to look into it.
However, in one of the thread you shared a snapshot with photons and geometry. Primafacia, it looks good and seems application is working.
Nevertheless, I think review your code carefully and play with three mandatory classes to know if the problem is in geometry.
DetectorConst
PrimaryGen
ActionInitial
you can temporary unplug rest classes.
VRS
It’s working, but when I add this class
‘’’
void DetectorConstruction::ConstructSDandField()
‘’’
it shows the core dump
It won’t fix the error, just provide you with a tool that help to track down the origin of the error. Did you try running your application through gdb
and using backtrace
?
So the problem is in the definition of sensitive region. Look logical volume definitions and PVs where you define its mother volume.
Furthermore, the potential problem exists in the hierarchy of geometry you use to define.
you can use gdb ./yourapplication
followed by n or s or r
or use bt which means backtrace.
you must read first how to use gdb.
VRS
This is not a way to share your desired problem on geant4 platform. Avoid screen-shots. As it is cumbersome to read sometimes. Have you gone through the rules.
If not you must look into it. For details you please have a look here.
Point no. 2 .
VRS
Okay, Sir. I will take care next time.