_Geant4 Version: 10.04.p03
_Operating System:_Ubuntu 16.04
_Compiler/Version:_gcc 5.4
_CMake Version:_3.5.2
Hello all,
I’m trying to determine the charge at the end of a track, my code looks thus:
G4double x_pos = fTrack->GetPosition().x();
G4double y_pos = fTrack->GetPosition().y();
G4double z_pos = fTrack->GetPosition().z();
if ((z_pos >= 40) || (sqrt(pow(x_pos, 2) + pow(y_pos, 2)) >= 14.5))
{
Total_Target_Hits++;
const G4DynamicParticle* currentParticle = fTrack->GetDynamicParticle();
G4double currentParticleCharge = currentParticle->GetCharge();
G4cout << "Total Target Hits = " << Total_Target_Hits << ", of charge: " << currentParticleCharge << G4endl;
}
However I only ever see “1” even when I set the charge (in the Mac file) as another charge and there is, AFAIK, no process that might change the charge.
Any hints of what I might be doing wrong?
Regards and thans.
Tim