Anomalous stepping inside hollow geometries using CADMesh

Dear experts,

I am using the CADMesh.hh from GitHub - christopherpoole/CADMesh: A CAD file interface for GEANT4 (version 2020) to import .stl files into GEANT4.

I performed the following test using electrons (at 10 MeV, along -Z direction) impinging on:

  • a cube, imported from a .stl file, of material “air” in a world of “air”
  • a cube with a cavity inside, imported from a .stl file, of material “air” in a world of “air”

The code is running with any error in both cases, but it seems that for the cube with a cavity there are much more steps along the track, as shown in the following screenshots. This has of course an impact on the computational time.

cube from a .stl file
hollow cube from a .stl file

This effect occurs when using “QBBC_EMZ” as Physics List, but it is not observed when using “QGSP_BERT” for example.

Is this behaviour expected? Is there a way to set the same stepping inside the cavity as outside?

Thank you for your help.

_Geant4 Version:_11.1.1
_Operating System:_Ubuntu 20.04.6 LTS
_Compiler/Version:_gcc 9.4.0
_CMake Version:_3.16.3


Dear @Lorenzo125

Welcome to the Geant4 forum.

Is the effect present when shooting geantinos? (geantinos are special particles that are only transported within the geometry)

In addition, can you share here the geometry in either stl or GDML format? (or even a reproducer)

Thank you for your time.

Best,
Alvaro

Dear @atolosad

Thank you for your availability. The effect seems to be not present when shooting geantinos:

Here you can download the .stl file (I modified the extension of the file from .stl to .txt to upload it) Cube_Hollow.txt (6.5 KB)

Best, Lorenzo.

1 Like

@Lorenzo125

Different Physics are designed for different studies. What you are looking to study is a question ?
If your study aims to know how many steps covered in a track than your screen shot looks okay.

For setting same step size as in world/cavity, you can use G4StepLimiter class and invoke it with volumes.

Remember, in the Geant4 scattering is maximum at boundaries by process called ‘msc’, as particle leaves/enter in new volume, play while adding more cavities and check if you see more scattering as without.

Better to check steps or collect hits in SD, in the analysis file not on GUI.

Geantino is designed to check geometry overlaps not to study Physics.

VRS

Dear @drvijayraj

Thank you for your answer, but it is still not clear to me why there is such a fine stepping. In fact, simulating the same hollow cube by defining:

  auto OuterBox = new G4Box("Outer", 0.05*m, 0.05*m, 0.05*m);
  auto OuterLogical = new G4LogicalVolume(OuterBox, air, "OuterLogical", 0, 0, 0);
  new G4PVPlacement(0, G4ThreeVector(0,0,5*cm), OuterLogical, "OuterPhysical" , worldLogical, false, 0, fcheckOverlaps);

  auto InnerBox = new G4Box("Inner", 0.04*m, 0.04*m, 0.04*m);
  auto InnerLogical = new G4LogicalVolume(InnerBox, air, "InnerLogical", 0, 0, 0);
  new G4PVPlacement(0, G4ThreeVector(0,0,0*cm), InnerLogical, "InnerPhysical" , OuterLogical, false, 0, fcheckOverlaps);

the electron performs much fewer steps (as shown in the next screenshot), although the physics (and geometry) is the same of the hollow cube from .stl previously shown.

image

Best, Lorenzo.

@Lorenzo125

Check #entries using G4event and compare both cases for a single event.

VRS

Dear @drvijayraj

I am sorry, I think I don’t understand your suggestion. All the screenshots I reported represent a single event, and I used also the same seed for each one-primary simulation.

Best, Lorenzo.

The problem is that the volumes are defined such that Geant4 assumes the path has more density than it actually does. You could record every step and see if there is consistency in deposited energy along the track.

The geometry is easy to recreate in GDML, so this might be tried as well.

Dear @phirippu,

Thank you for your reply. I performed a test on the energy distribution of electrons after passing the hollow cube in the two type of “geometries” (i.e. defined from CAD and with G4Box), and I did not observe any significant difference. However, I can’t understand why there is such stepping, that has an impact on computational time.

I might be wrong, but the navigator may impose the same step size for the cavity as for the mother volume. This could be a feature rather than a bug. In any case, subtraction volumes are always hard to implement, unlike simple volumes with evident bounding boxes. I suggest the geometry be reconstructed in GDML. There is pyg4ometry in Python and a GDML workbench in Freecad to convert from CAD STEP to GDML.

Dear @phirippu

In all the reported tests, the hollow box is air, so basically electrons sees air out of the box (“world”), inside the hollow box, and inside the cavity: even if the navigator imposes the same step size for the cavity as for the mother volume, this is in any case a too small stepping in air.

In any case, I will try with GDML, but I found comfortable using STL. Thank you for your suggestion.