In my case, in the run.mac file, the step size is 0.05mm. I wanted to confirm this and thus checked in my SteppingAction.cc what they step sizes were. I had the following line written:
Could someone explain why this is the case? I am assuming that the track is a “snapshot of a particle” and the step the “delta information between tracks”.
Am I missing something about the underlying machinery?
Hello!
First of all, please check if you activated the G4StepLimiterPhysics.
If you didn’t, please add something like
#include "G4StepLimiterPhysics.hh"
...
G4StepLimiterPhysics* stepLimitPhys = new G4StepLimiterPhysics();
RegisterPhysics(stepLimitPhys);
when creating the physics lists. In example B2a that you mentioned it is done in the main() function inside the exampleB2a.cc file.
Another thing to check is the particle type. According to the comment in the G4StepLimiterPhysics.hh header, “by default the step limit is applied to charged particles only”. So if you use non-charged particles, you may try to set the fApplyToAll option like this:
#include "G4StepLimiterPhysics.hh"
...
G4StepLimiterPhysics* stepLimitPhys = new G4StepLimiterPhysics();
stepLimitPhys->SetApplyToAll(true); // activates step limit for ALL particles
RegisterPhysics(stepLimitPhys);
I’m running into the same issue as hulsman. I have registered the steplimit, applied it to all particles, but still I see larger than the set step length in the volume.
Relevant parts of my code shown below. Do you have some more ideas as to what goes wrong?
In my detector constructor:
G4Box* siBox = new G4Box("Si", siSizeXY / 2, siSizeXY / 2, siThickness / 2);
G4LogicalVolume* siLogVol = new G4LogicalVolume(siBox, siMaterial, "Si");
// Set the user limits for maximum step size in the Si volume
G4UserLimits* userLimits = new G4UserLimits();
userLimits->SetMaxAllowedStep(1.0 * um);
siLogVol->SetUserLimits(userLimits);