90 const G4FastTrack& fastTrack, G4FastStep& fastStep)
93 G4TouchableHandle theTouchable =
94 fastTrack.GetPrimaryTrack()->GetTouchableHandle();
95 G4String name = theTouchable->GetVolume()->GetName();
97 G4ThreeVector pdirection = fastTrack.GetPrimaryTrack()->GetMomentum().unit();
98 G4ThreeVector localdir = fastTrack.GetPrimaryTrackLocalDirection();
100 G4ThreeVector worldPosition = fastTrack.GetPrimaryTrack()->GetPosition();
101 G4ThreeVector localPosition = fastTrack.GetPrimaryTrackLocalPosition();
103 double ekin_MeV = fastTrack.GetPrimaryTrack()->GetKineticEnergy() / MeV;
104 G4double globalTime = fastTrack.GetPrimaryTrack()->GetGlobalTime();
106 G4String particleName =
107 fastTrack.GetPrimaryTrack()->GetParticleDefinition()->GetParticleName();
109 fastStep.KillPrimaryTrack();
110 fastStep.SetPrimaryTrackPathLength(0.0);
112 if (particleName ==
"kaon+") {
115 else if (particleName ==
"kaon-") {
118 else if (particleName ==
"anti_proton") {
119 particleName =
"anti-proton";
123 localPosition.x() / CLHEP::cm, localPosition.y() / CLHEP::cm,
124 localPosition.z() / CLHEP::cm, localdir.x(), localdir.y(), localdir.z());
129 std::vector<GarfieldParticle*>* secondaryParticles =
132 if (secondaryParticles->size() > 0) {
133 fastStep.SetNumberOfSecondaryTracks(secondaryParticles->size());
135 G4double totalEnergySecondaries_MeV = 0;
137 for (std::vector<GarfieldParticle*>::iterator it =
138 secondaryParticles->begin();
139 it != secondaryParticles->end(); ++it) {
140 G4double x = (*it)->getX_mm();
141 G4double y = (*it)->getY_mm();
142 G4double z = (*it)->getZ_mm();
143 G4double eKin_MeV = (*it)->getEkin_MeV();
144 G4double dx = (*it)->getDX();
145 G4double dy = (*it)->getDY();
146 G4double dz = (*it)->getDZ();
147 G4double time = (*it)->getTime();
148 G4ThreeVector momentumDirection(dx, dy, dz);
149 G4ThreeVector position(x, y, z);
150 if ((*it)->getParticleName() ==
"e-") {
151 G4DynamicParticle particle(
152 G4Electron::ElectronDefinition(), momentumDirection, eKin_MeV);
153 fastStep.CreateSecondaryTrack(particle, position, time,
true);
154 totalEnergySecondaries_MeV += eKin_MeV;
156 else if ((*it)->getParticleName() ==
"gamma") {
157 G4DynamicParticle particle(
158 G4Gamma::GammaDefinition(), momentumDirection, eKin_MeV);
159 fastStep.CreateSecondaryTrack(particle, position, time,
true);
160 totalEnergySecondaries_MeV += eKin_MeV;