Launching electrons from file with given EventID and TrackID

Hello,
I have a Geant4 application which can store electron trajectory information when it passes through a plane. I can then launch the electrons again from the file and thus continue the simulation later. However, the eventID and trackID are replaced with new IDs when the simulation is restarted. I would like to keep track of the electrons through several stages of passing through the plane, so I was hoping to restart the electron trajectories with the same EventID and TrackID. My code for the PrimaryGeneratorAction is below and will generate particles from the file if gpsgun is set to false.

I realise there are G4Event::SetEventID() and G4Track::SetTrackID() routines, but if I set a new eventID, then clearly the line:
particleGun2->SetParticleDefinition(particleTable->FindParticle(ParticleType[EID]));
is no longer going to work.
Can anyone advise how I might go about doing this or is there an example I could look at ?
Thanks
Chris

void SEMPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
if (gpsgun) {
particleGun->GeneratePrimaryVertex(anEvent);
} else {
G4int EID = anEvent->GetEventID();
if (EID >= (G4int) (KinEnergy.size())) {
// We ran out of hits in the file, switch to gps source and warn the user
// G4cout << “WARNING: No more hits in the file, switching to gps source!” << G4endl;
// gpsgun=true;
// particleGun->GeneratePrimaryVertex(anEvent);
G4cout << “WARNING: No more hits in the file, aborting run” << G4endl;
G4RunManager::GetRunManager()->AbortRun();

 } else {
    G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
    particleGun2->SetParticleDefinition(particleTable->FindParticle(ParticleType[EID]));

    particleGun2->SetParticleEnergy(KinEnergy[EID]);
    particleGun2->SetParticlePosition(Position[EID]);
    particleGun2->SetParticleMomentumDirection(Direction[EID]);
    particleGun2->GeneratePrimaryVertex(anEvent);
 }

}
}