Status of importance sampling for multiple particle types?

Hi,

I’m trying to use importance sampling for neutrons and gammas at the same time, which I tried implementing based on the /extended/B01 example, but now I’ve found two old posts which also reference a bug report saying the importance sampling only happens with the particle that is registered first:
(June '19)
(March '16)

So I guess I can’t do importance sampling for both particle types at the same time like this.

Are there any updates on the status of the importance sampling for multiple particles? Is there any advice on how to modify the /extended/GB03 example to end up with importance sampling for multiple particle types?

Importance sampling works only for one particle type at the moment.

Generic biasing offers more possibilities, and if you’d like to use it for other particles, you need to register it for every particle type:

  G4GenericBiasingPhysics* biasingPhysics = new G4GenericBiasingPhysics();
  biasingPhysics->NonPhysicsBias("neutron");
  biasingPhysics->NonPhysicsBias("gamma");

That way splitting/killing will be done for neutrons and gammas, and you have control of the splitting factor:

    /GB03/biasing/setSplittingFactor 2

which should be equivalent to assigning importance value of 2^n for the n-th layer of the detector (provided your layers are along z-axis).

Thank you for your reply!

In the meantime, I have combined the GB03 example with the importance store from B01. I used parts of the Geant4 standard G4ImportanceProcess and G4ImportanceAlgorithm to make this work. With that I can have individual importances for every volume.

I didn’t know you could just give the particle name to the same G4GenericBiasingPhysics one after the other, so I did this more complicated like this:
PhysicsList* phys = new PhysicsList;

G4GenericBiasingPhysics* biasingPhysics = new G4GenericBiasingPhysics();
biasingPhysics->NonPhysicsBias(“neutron”);
phys->RegisterPhysics(biasingPhysics);

G4GenericBiasingPhysics* biasingPhysics2 = new G4GenericBiasingPhysics();
biasingPhysics2->NonPhysicsBias(“gamma”);
phys->RegisterPhysics(biasingPhysics2);

So I will change this to your version.

1 Like

Dear Elena,

Sorry for the very slow response…

Generic biasing and B01 are essentially independent implementations, and the importance store is not used by the generic biasing.
In the Generic biasing, you are supposed to handle importances by yourself. At least for the time being. We can take as request to provide the interface in the generic biasing with importance store, but this will not be done in the very short term.