rest-for-physics / restG4

A generic Geant4 code project that uses the REST Geant4 library to define the simulation conditions and collect the simulated results as a ROOT file, in the form of REST c++ objects. restG4 just requires two inputs, and RML file defining the simulation conditions and a GDML geometry file.
3 stars 5 forks source link

Implement modular biasing options #92

Open lobis opened 1 year ago

lobis commented 1 year ago

lobis Large: 524

This PR implements a generic gamma biasing option.

The configuration inside TRestGeant4Metadata is as follows:

<biasing type="split">
    <volume name="shieldingVolume"/>
    <parameter name="splittingFactor" value="2"/>
    <parameter name="center" value="(0,0,0)mm"/>
</biasing>
  1. User selects a biasing volume (typically the shielding) where the biasing takes place.
  2. The splitting factor is selected (> 1)
  3. A biasing center is selected (region of interest)

Currently only bremsstrahlung process is biased.

After each secondary gamma produced via bremsstrahlung the following is performed:

If the gamma points towards the point of interest (dot product is positive), then the gamma is multiplied by the split factor, and the weight is adjusted accordingly.

If otherwise the gamma points away from the point of interest, then the gamma will be killed with a probability of 1 - 1/splitFactor. If it survives the weight will be adjusted accordingly.

This weight is a property of Geant4 tracks and it is propagated correctly to secondaries.

This method will allocate more simulation time to gammas pointing towards the detector.

To compute the background rate, each contribution needs to be multiplied by the final weight in order to account for the increased number of events due to biasing.

The XML tag for this new biasing option is <biasing type="split"> and the default <biasing> tag is being kept in order to preserve backwards compatibility, the original biasing options remain untouched!