91{
92
93 G4TouchableHandle theTouchable =
94 fastTrack.GetPrimaryTrack()->GetTouchableHandle();
95 G4String name = theTouchable->GetVolume()->GetName();
96
97 G4ThreeVector pdirection = fastTrack.GetPrimaryTrack()->GetMomentum().unit();
98 G4ThreeVector localdir = fastTrack.GetPrimaryTrackLocalDirection();
99
100 G4ThreeVector worldPosition = fastTrack.GetPrimaryTrack()->GetPosition();
101 G4ThreeVector localPosition = fastTrack.GetPrimaryTrackLocalPosition();
102
103 double ekin_MeV = fastTrack.GetPrimaryTrack()->GetKineticEnergy() / MeV;
104 G4double globalTime = fastTrack.GetPrimaryTrack()->GetGlobalTime();
105
106 G4String particleName =
107 fastTrack.GetPrimaryTrack()->GetParticleDefinition()->GetParticleName();
108
109 fastStep.KillPrimaryTrack();
110 fastStep.SetPrimaryTrackPathLength(0.0);
111
112 if (particleName == "kaon+") {
113 particleName = "K+";
114 }
115 else if (particleName == "kaon-") {
116 particleName = "K-";
117 }
118 else if (particleName == "anti_proton") {
119 particleName = "anti-proton";
120 }
121
123 localPosition.x() / CLHEP::cm, localPosition.y() / CLHEP::cm,
124 localPosition.z() / CLHEP::cm, localdir.x(), localdir.y(), localdir.z());
125
127
129 std::vector<GarfieldParticle*>* secondaryParticles =
131
132 if (secondaryParticles->size() > 0) {
133 fastStep.SetNumberOfSecondaryTracks(secondaryParticles->size());
134
135 G4double totalEnergySecondaries_MeV = 0;
136
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;
155 }
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;
161 }
162 }
163 }
164 }
165}
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)