I’m using a user-developed kind of GDML based geometry configuration and it appears to be causing problems with importance biasing, because the boundaries between volumes are defined as the world volume. Whenever a step hits the exact boundary, the resulting volume is the world volume and therefore the importance is 1. So instead of the process seeing two adjacent volumes with importance of for example 5000 and 6000 and doing splitting, it sees 5000 and 1 and kills off the track with high likelihood.
All I need for this to work, is to know the volume that is just a tiny bit further along the momentum direction of the current track, because then I could get the correct importance and proceed from there.
Playing around with the G4Navigator and LocateGlobalPointAndSetup so far only yielded it giving me still the world volume despite the position being moved, or warnings.
I have found old answers about this problem like for example by Peter Gumplinger in 2013 (somehow it doesn’t let me post a link):
I suggest you do not modify the current track in such a radical way as to transpose its position - far away. I am afraid that the G4Navigator will be ‘confused’. It’s better to clone it, give the clone a position, and then the G4Navigator ‘knows’ that it needs to re-seed its geometry memory.
So I have been trying to do that. I’ve got so far:
G4StepPoint postpoint = step->GetPostStepPoint();
G4ThreeVector pos = postpoint->GetPosition();
G4ThreeVector mom = postpoint->GetMomentum();
mom * = 0.01; // not sure if a good value for that
G4ThreeVector pos2 = pos+mom;
G4Track clone = new G4Track(*track);
But when I try to retrieve a volume via clone->GetVolume() I get a seg fault. I’m assuming this is because the transportation manager hasn’t figured out where this new track is supposed to be? So how do I get G4Navigator to “re-seed its geometry memory”?
I intend to use
to kill the clone again just like for the russian roulette of the importance sampling, after I have retrieved the volume and importance information so that it doesn’t interfere in the tracking. Does that make sense?