Lowering the step-size in a particular G4 geometry

Hi,

I am working on a specific simulation that is modified from the Magnetic Monopole code in Geant4 (/extended/exoticphysics/monopole). This simulation contains the geometry of a long (2-3m), thin (~1mm) cylindrical pipe made from Beryllium. I am propagating monopoles, initially from vacuum, towards the pipe. The simulation has a strong magnetic field of a few teslas along the z direction. The trajectories are curved due to the magnetic field. I understand that in vacuum, the monopole is expected to take a very long steps, if any. However, when it enters the beryllium volume (1mm thickness), I should be able to control the step length and the number of steps it takes in the volume, before the particle exits. However, no amount of stepping parameters that I change has any effect on the step-size.
I have attached



the stepping verbose of two monopoles, which take 3-4 steps in the pipe volume before they exit. I would like to decrease the step size and have the particles take a larger number of steps in the simulation (sure, it will increase the simulation time, but also the accuracy of results).

For decreasing the step-size, thus far, I’ve tried the following (but the modification does not affect the simulation).

  1. In the FieldSetup source file (attached), I have changed the fMinStep value of 1mm (default) to a much lower value.
  2. I included other parameters (from the application developers guide) such as deltaChord, deltaOneStep, deltaIntersection, epsMin, epsMax.
  3. I have also written a DetectorMessenger with a function SetMaxStepSize (defined in DetectorConstruction) and set it to 0.0001mm using a macro file.
  4. In the G4mplIonisationWithDeltaModel source code (for monopole ionization), I have changed the emin (LowEnergyLimit) to a very low value ~eV to lower the thresholds in the simulation.
  5. Similarly, in G4MonopoleTransportation, I had lower the value of fThreshold_Warning_Energy to a few eVs to lower thresholds.
    G4MonopoleFieldSetup.cc (4.6 KB)

If anyone could guide me further regarding the changes I could make in the simulation to control (lower) the step-size, I would be very thankful. Let me know if you have any questions.

Thanks
Aditya

Hi Aupreti,

To reduce the step size, you can add :

include “G4UserLimits.hh” → [detectorConstruction.]

e.g.
include “G4UserLimits.hh”

G4double maxStep = 1.*mm;
myStepLimit = new G4UserLimits(maxStep);
yourLV->SetUserLimits(myStepLimit);

Make changes in the PhysicsList as well;

include “G4StepLimiterPhysics.hh”
RegisterPhysics(new G4StepLimiterPhysics());

The above will change stepsize in the logical volume of your choice.

Greetings and Regards.
:slight_smile:
VRS

1 Like

Hi Dr. Vijay Raj,

Thank you for your suggestions.
I have, however, already included these in my simulation.
The volume is a gdml model that is parsed into Geant4. In the DetectorConstruction, I have defined a function SetMaxStepSize as follows, and set the step size to a small value (either by calling this function in RunAction or through the macro);

void DetectorConstruction::SetMaxStepSize(G4double step)
{
        fMaxStepSize = step;
        G4int daughters = lWorldLogVol->GetNoDaughters();

        for (G4int i=0; i<daughters; i++)
        {
                daughter[i] = lWorldLogVol->GetDaughter(i);
                G4cout << daughter[i]->GetName() << G4endl;
                if(daughter[i]->GetName().at(0)=='B')
                {
                        daughter[i]->GetLogicalVolume()->SetUserLimits(new G4UserLimits(fMaxStepSize));
                }
        }
        G4cout << "---------Max step size in the volume is ---------------" << fMaxStepSize << G4endl;
}

The G4StepLimiterPhysics is also registered in the main source file. Still I haven’t been able to modify the step size in the simulation.

Please let me know if you have any other suggestions.
Thanks
Aditya

just a wild guess, but maybe you need to call either of these (or something similar) after your modification of the step limits:

  G4RunManager::GeometryHasBeenModified();
  G4RunManager::PhysicsHasBeenModified();

, as you probably have called G4RunManager::Initialize(); already at that point?

Hi Weller,

Thanks for your reply. However, including those lines still does not modify the step limits. I’m not sure if the issue is inherent to the Geant4 geometry that is in the form of a gdml file, with thickness of the pipe around 1mm, surrounded in vacuum.

Thanks
Aditya

Hi,

anything in this previous thread that could help?

Alvaro.

Hi all,

Thank you for your comments. Just to update this discussion, I am able to increase the # of steps a particle takes in the geometry by setting the deltaChord, deltaOneStep, deltaIntersection and epsilon parameters to very low values. (the deltas are set to 1e-7mm, and epsilon is 1e-10mm). In the attached picture, I was able to increase the number of steps a particle takes in the 1mm geometry. It seems, with these parameters I have reached the highest possible precision for this geometry. I say this because, if I decrease epsilon to 1e-12mm (while keeping the rest of the parameters constant), I get warning from G4IntegrationDriver - “Stepsize underflow in Stepper!”. On the other hand, if I decrease deltaChord to 1e-8mm, I get calls from the TransportationManager that it is killing the track that’s looping or stuck. The modification of these field parameters is the only thing that worked, thus far, to increase the number of steps a particle takes in the geometry.