SampleSecondaries Each model must implement SampleSecondaries to decide if a particle will be created after the ModelInterface or if any charateristic of the incident particle will change.
265{
266 if (verboseLevel > 3) {
267 G4cout <<
"Calling SampleSecondaries() of G4DNACPA100IonisationModel" <<
G4endl;
268 }
269 auto k = particle->GetKineticEnergy();
270
272
274
275 auto p = particle->GetDefinition();
276
279
280
281 if (k >= lowLim && k < highLim) {
282 const auto& primaryDirection = particle->GetMomentumDirection();
283 auto particleMass = particle->GetDefinition()->GetPDGMass();
284 auto totalEnergy = k + particleMass;
285 auto pSquare = k * (totalEnergy + particleMass);
286 auto totalMomentum = std::sqrt(pSquare);
291
292 if (k < bindingEnergy) {
293 return;
294 }
295
296 auto info = std::make_tuple(MatID, k, shell);
297
298 secondaryKinetic = -1000 * eV;
299 if (fpG4_WATER->
GetIndex() != MatID) {
300 secondaryKinetic = fpModelData->RandomizeEjectedElectronEnergyFromanalytical(info);
301 }else if(fasterCode){
302 secondaryKinetic = fpModelData->RandomizeEjectedElectronEnergyFromCumulatedDcs(info);
303 }else{
304 secondaryKinetic = fpModelData->RandomizeEjectedElectronEnergy(info);
305 }
306
309 RandomizeEjectedElectronDirection(particle->GetDefinition(), k, secondaryKinetic, cosTheta,
310 phi);
311
312 G4double sinTheta = std::sqrt(1. - cosTheta * cosTheta);
313 G4double dirX = sinTheta * std::cos(phi);
314 G4double dirY = sinTheta * std::sin(phi);
317 deltaDirection.rotateUz(primaryDirection);
318
319
320 if (secondaryKinetic > 0) {
322 fvect->push_back(dp);
323 }
324
325 if (particle->GetDefinition() != fpParticle) {
327 }
328 else {
330 std::sqrt(secondaryKinetic * (secondaryKinetic + 2. * electron_mass_c2));
332 totalMomentum * primaryDirection.x() - deltaTotalMomentum * deltaDirection.x();
334 totalMomentum * primaryDirection.y() - deltaTotalMomentum * deltaDirection.y();
336 totalMomentum * primaryDirection.z() - deltaTotalMomentum * deltaDirection.z();
337 G4double finalMomentum = std::sqrt(finalPx * finalPx + finalPy * finalPy + finalPz * finalPz);
338 finalPx /= finalMomentum;
339 finalPy /= finalMomentum;
340 finalPz /= finalMomentum;
341
343 direction.
set(finalPx, finalPy, finalPz);
344
346 }
347
348
349
350
351
352
353
355
356
357
359 std::size_t secNumberInit = 0;
360 std::size_t secNumberFinal = 0;
361 if ((fAtomDeexcitation != nullptr) && shell == 4) {
364 secNumberInit = fvect->size();
366 secNumberFinal = fvect->size();
367 if (secNumberFinal > secNumberInit) {
368 for (std::size_t i = secNumberInit; i < secNumberFinal; ++i) {
369
370 if (bindingEnergy >= ((*fvect)[i])->GetKineticEnergy()) {
371
373 }
374 else {
375
376
377 delete (*fvect)[i];
378 (*fvect)[i] = nullptr;
379 }
380 }
381 }
382 }
383 }
384
385
386 if (bindingEnergy < 0.0) {
388 "Negative local energy deposit");
389 }
390 if (!statCode) {
393 }
394 else {
397 }
398
399
403 theIncomingTrack);
404 }
405 }
406}
void set(double x, double y, double z)
static G4DNAChemistryManager * Instance()
void CreateWaterMolecule(ElectronicModification, G4int, const G4Track *)
static G4Electron * Electron()
void SetProposedKineticEnergy(G4double proposedKinEnergy)
void ProposeMomentumDirection(const G4ThreeVector &Pfinal)
virtual const G4AtomicShell * GetAtomicShell(G4int Z, G4AtomicShellEnumerator shell)=0
void GenerateParticles(std::vector< G4DynamicParticle * > *secVect, const G4AtomicShell *, G4int Z, G4int coupleIndex)
G4int RandomSelectShell(const G4double &k, const G4ParticleDefinition *particle, const size_t &materialName)
RandomSelectShell Method to randomely select a shell from the data table uploaded....
const G4Track * GetCurrentTrack() const
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
G4double bindingEnergy(G4int A, G4int Z)