| Summary: | Changing position in G4PrimaryVertex | ||
|---|---|---|---|
| Product: | Geant4 | Reporter: | V.Hejny |
| Component: | event | Assignee: | Makoto.Asai |
| Status: | RESOLVED FIXED | ||
| Severity: | enhancement | ||
| Priority: | P2 | ||
| Version: | 2.0 | ||
| Hardware: | All | ||
| OS: | All | ||
|
Description
V.Hejny
2000-07-07 01:45:18 CEST
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. |