239{
241 fParticleChange.InitializeForPostStep(track);
242
245 const G4double totEnergy = kinEnergy + fMass;
246 const G4double beta2 = kinEnergy*(kinEnergy + 2.0*fMass)/(totEnergy*totEnergy);
247
249
250 CLHEP::HepRandomEngine* rndmEngineMod = G4Random::getTheEngine();
252
253
254 do {
256 deltaKinEnergy = fCut*fTmax/(fCut*(1.0 - rndm[0]) + fTmax*rndm[0]);
257 f = 1.0 - beta2*deltaKinEnergy/fTmax;
258
259 } while( rndm[1] > f);
260
262 std::sqrt(deltaKinEnergy * (deltaKinEnergy + 2.0*CLHEP::electron_mass_c2));
263 G4double cost = deltaKinEnergy * (totEnergy + CLHEP::electron_mass_c2) /
264 (deltaMomentum * dp->GetTotalMomentum());
265 cost = std::min(cost, 1.0);
266 const G4double sint = std::sqrt((1.0 - cost)*(1.0 + cost));
267 const G4double phi = CLHEP::twopi*rndmEngineMod->
flat();
268
269 G4ThreeVector deltaDirection(sint*std::cos(phi), sint*std::sin(phi), cost);
270 deltaDirection.rotateUz(dp->GetMomentumDirection());
271
272
273 auto delta = new G4DynamicParticle(theElectron, deltaDirection, deltaKinEnergy);
276 t->SetCreatorModelID(fSecID);
277 fParticleChange.AddSecondary(t);
278
279
280 kinEnergy -= deltaKinEnergy;
281 G4ThreeVector finalP = dp->GetMomentum() - delta->GetMomentum();
282 finalP = finalP.
unit();
283
284 fParticleChange.SetProposedKineticEnergy(kinEnergy);
285 fParticleChange.SetProposedMomentumDirection(finalP);
286 return &fParticleChange;
287}
CLHEP::Hep3Vector G4ThreeVector
virtual void flatArray(const int size, double *vect)=0
G4double GetKineticEnergy() const
const G4ThreeVector & GetPosition() const
G4double GetGlobalTime() const
const G4TouchableHandle & GetTouchableHandle() const
G4double theNumberOfInteractionLengthLeft