86 {
87
88 G4ThreeVector localdir = fastTrack.GetPrimaryTrackLocalDirection();
89 G4ThreeVector localpos = fastTrack.GetPrimaryTrackLocalPosition();
90
91 double ekin_MeV = fastTrack.GetPrimaryTrack()->GetKineticEnergy() / MeV;
92 double globalTime = fastTrack.GetPrimaryTrack()->GetGlobalTime();
93
94 G4String particleName =
95 fastTrack.GetPrimaryTrack()->GetParticleDefinition()->GetParticleName();
96
97 fastStep.KillPrimaryTrack();
98 fastStep.SetPrimaryTrackPathLength(0.0);
99
100 if (particleName == "kaon+") {
101 particleName = "K+";
102 } else if (particleName == "kaon-") {
103 particleName = "K-";
104 } else if (particleName == "anti_proton") {
105 particleName = "anti-proton";
106 }
107
108 fGarfieldPhysics->
DoIt(
109 particleName, ekin_MeV, globalTime, localpos.x() / CLHEP::cm,
110 localpos.y() / CLHEP::cm, localpos.z() / CLHEP::cm,
111 localdir.x(), localdir.y(), localdir.z());
112
114
116 std::vector<GarfieldParticle*>* secondaryParticles =
118
119 if (secondaryParticles->empty()) return;
120 fastStep.SetNumberOfSecondaryTracks(secondaryParticles->size());
121
122 G4double totalEnergySecondaries_MeV = 0;
123
124 for (auto it = secondaryParticles->begin(); it != secondaryParticles->end(); ++it) {
125 G4double eKin_MeV = (*it)->getEkin_MeV();
126 G4double
time = (*it)->getTime();
127 G4ThreeVector momentumDirection((*it)->getDX(), (*it)->getDY(),
128 (*it)->getDZ());
129 G4ThreeVector position((*it)->getX_mm(), (*it)->getY_mm(),
130 (*it)->getZ_mm());
131 if ((*it)->getParticleName() == "e-") {
132 G4DynamicParticle particle(G4Electron::ElectronDefinition(),
133 momentumDirection, eKin_MeV);
134 fastStep.CreateSecondaryTrack(particle, position, time, true);
135 totalEnergySecondaries_MeV += eKin_MeV;
136 } else if ((*it)->getParticleName() == "gamma") {
137 G4DynamicParticle particle(G4Gamma::GammaDefinition(),
138 momentumDirection, eKin_MeV);
139 fastStep.CreateSecondaryTrack(particle, position, time, true);
140 totalEnergySecondaries_MeV += eKin_MeV;
141 }
142 }
143
144}
bool GetCreateSecondariesInGeant4()
std::vector< GarfieldParticle * > * GetSecondaryParticles()
double GetEnergyDeposit_MeV()
void DoIt(std::string particleName, double ekin_MeV, double time, double x_cm, double y_cm, double z_cm, double dx, double dy, double dz)