Modify cross-section during Stepping Action

Dear experts,

I am trying to implement in Geant4 a few electromagnetic processes whose cross-sections depend not only on the energy of the incident particle, but also on the angle between the particle track and a given vector in space. Ideally, I’d modify the G4UserSteppingAction to add:

  1. The calculation of such angle (which is eventually stored in a private variable of a Singleton class, or in any other way I can think of).
  2. The update of the cross-section values used for determining what happens to the particle, calling for example G4VEmModel::ComputeCrossSectionPerAtom (where G4VEmModel is derived from a pre-existing model, such as G4BetheHeitlerModel, with only minor modifications in the ComputeCrossSectionPerAtom method).

I know how to do the first point, but not the second, because in my simulations all the calls to ComputeCrossSectionPerAtom occur only in the preparation of the cross-sections tables and never during a G4Event. So my question is: is it possible to modify the values of the cross-sections of a few processes during a G4Step? Which files should I modify, beyond my implementation of the G4VEmModel class?



please consult Geant4 documentation. First of all Application developer manual. G4UserSteppingAction interface provided for scoring and control on simulation but not for changing/modification/implementation of physics. Results will not be reliable if you do this.