Geant4.10.05p1
Ubuntu 16.04
gcc v.5.4.0-6ubuntu1-16.04.11
make v.3.5.2
Hi all,
I have a very modified version of the TestEm7 example and I’m attempting to determine the charge of a heavy ion as it crosses from an attenuator into the absorber.
The ion is defined in the mac file thus:
/gps/particle ion
/gps/ion 88 224 1 0
And I interrogate the particle properties so:
void SteppingAction::UserSteppingAction(const G4Step* step)
{
G4Track* track = step->GetTrack();
......
G4StepPoint* prePoint = step->GetPreStepPoint();
G4StepPoint* postPoint = step->GetPostStepPoint();
G4VPhysicalVolume* prePhysVol = prePoint->GetPhysicalVolume();
G4VPhysicalVolume* postPhysVol = postPoint->GetPhysicalVolume();
if (prePhysVol != postPhysVol)
{
G4double KE = track->GetKineticEnergy();
G4String postPhysVolName = postPhysVol->GetName();
if (postPhysVolName == "Absorber")
{
G4ThreeVector Position = track->GetPosition();
G4ThreeVector Momentum = track->GetMomentum();
G4double Charge = track->GetParticleDefinition()->GetPDGCharge();
etc.
However the getPDGCharge() always returns a value of 88. Completely positively ionised. This is highly unlikely.
Do you know what I might be doing wrong?
Regards
Tim