This example illustrates how to make a force collision biasing in a way that is essentially the same than the MCNP one.
Generally speaking, the scheme consists of a G4VBiasingOperator that takes decisions on what sort of biasing is to be applied. The operator makes these decision on requests of the G4BiasingProcessInterface process. This process wraps an actual physics process and asks to the operator about what sort of biasing it should apply. This operator selects G4VBiasingOperation objects that implement the actual biasing content.
In the present case, we make use of the biasing operator
To allow several particle types to undergo this force interaction scheme, an other operator is defined
The geometry is simple : a single volume to which an instance of GB02BOptrMultiParticleForceCollision is attached to.
The wrapping of physics processes by G4BiasingProcessInterface processes is simply handled by the G4GenericBiasingPhysics physics constructor, as shown in the main program.
Then, at whatever level (stepping action, or sensitive detector) the statistical weight of the track can be obtained as:
w = track->GetWeight() ;