In the current implementation there is no SetPosition() member function. In our detector setup various target positions and beam angles (with respect to the detector) are used. Therefore this position offset and the rotation of the primary events have to be added in the generator itself. To allow a modular design of code and to have the ability to use standard primary generators without changes, it would be very helpful to have this additional function. The changes in position and direction then could be done later on.
It already exists with the name SetParticlePosition() in G4ParticleGun. I guess you want to have more than one primary particles starting at a point different to each other. Please note that G4PrimaryParticle does not have position information but G4PrimaryVertex which has primary particles has it. In other words, a primary vertex has primary particles which share the same vertex position. Thus it completely violates the concept of G4PrimaryVertex to have SetPosition() method. Please note that G4Event object can have one or MORE G4PrimaryVertex objects. I advise you to make your own primary generator class which generates many vertices and sets them to the given G4Event object. But in case you want to utilize G4ParticleGun, do the following. void MyGeneratorAction::GeneratePrimaries(G4Event* anEvent) { for(int i=0;i<numberOfPrimaries;i++) { particleGun->SetPrimaryParticlePosition(randomizedPosition); ..... any other set method invokation here ..... particleGun->GeneratePrimaryVertex(anEvent); } } Anyway, this report does not contain any problem in Geant4 code.
Fixes are in the most recent reference tag of geant4-02-00-ref-01.