60 G4cout <<
"Born ionisation model is constructed " <<
G4endl;
66 fAtomDeexcitation =
nullptr;
68 fpMolWaterDensity =
nullptr;
72 fParticleDef =
nullptr;
105 if (verboseLevel > 3)
107 G4cout <<
"Calling G4DNABornIonisationModel2::Initialise()" <<
G4endl;
110 if(fParticleDef !=
nullptr && particle != fParticleDef)
113 description <<
"You are trying to initialized G4DNABornIonisationModel2 "
117 description <<
"G4DNABornIonisationModel2 was already initialised "
118 "for particle:" << fParticleDef->GetParticleName() <<
G4endl;
119 G4Exception(
"G4DNABornIonisationModel2::Initialise",
"bornIonInit",
123 fParticleDef = particle;
131 std::ostringstream fullFileName;
132 fullFileName << path;
134 if(particleName ==
"e-")
136 fTableFile =
"dna/sigma_ionisation_e_born";
137 fLowEnergyLimit = 11.*eV;
138 fHighEnergyLimit = 1.*MeV;
142 fullFileName <<
"/dna/sigmadiff_cumulated_ionisation_e_born_hp.dat";
146 fullFileName <<
"/dna/sigmadiff_ionisation_e_born.dat";
149 else if(particleName ==
"proton")
151 fTableFile =
"dna/sigma_ionisation_p_born";
152 fLowEnergyLimit = 500. * keV;
153 fHighEnergyLimit = 100. * MeV;
157 fullFileName <<
"/dna/sigmadiff_cumulated_ionisation_p_born_hp.dat";
161 fullFileName <<
"/dna/sigmadiff_ionisation_p_born.dat";
167 G4double scaleFactor = (1.e-22 / 3.343) * m*m;
169 fTableData->LoadData(fTableFile);
173 std::ifstream diffCrossSection(fullFileName.str().c_str());
175 if (!diffCrossSection)
178 description <<
"Missing data file:" <<
G4endl << fullFileName.str() <<
G4endl;
179 G4Exception(
"G4DNABornIonisationModel2::Initialise",
"em0003",
189 for (
int j=0; j<5; j++)
191 fProbaShellMap[j].clear();
192 fDiffCrossSectionData[j].clear();
193 fNrjTransfData[j].clear();
198 fTdummyVec.push_back(0.);
199 while(!diffCrossSection.eof())
203 diffCrossSection>>tDummy>>eDummy;
204 if (tDummy != fTdummyVec.back()) fTdummyVec.push_back(tDummy);
207 for (
int j=0; j<5; j++)
209 diffCrossSection>> tmp;
211 fDiffCrossSectionData[j][tDummy][eDummy] = tmp;
215 fNrjTransfData[j][tDummy][fDiffCrossSectionData[j][tDummy][eDummy]]=eDummy;
216 fProbaShellMap[j][tDummy].push_back(fDiffCrossSectionData[j][tDummy][eDummy]);
220 if (!diffCrossSection.eof() && !fasterCode) fDiffCrossSectionData[j][tDummy][eDummy]*=scaleFactor;
222 if (!fasterCode) fVecm[tDummy].push_back(eDummy);
233 G4cout <<
"Born ionisation model is initialized " <<
G4endl
254 isInitialised =
true;
265 if (verboseLevel > 3)
267 G4cout <<
"Calling CrossSectionPerVolume() of G4DNABornIonisationModel2"
271 if (particleDefinition != fParticleDef)
return 0;
279 if (ekin >= fLowEnergyLimit && ekin <= fHighEnergyLimit)
281 sigma = fTableData->FindValue(ekin);
287 G4double A = 1.39241700556072800000E-009 ;
288 G4double B = -8.52610412942622630000E-002 ;
289 sigma = sigma *
G4Exp(
A*(ekin/eV)+
B);
294 if (verboseLevel > 2)
296 G4cout <<
"__________________________________" <<
G4endl;
297 G4cout <<
"G4DNABornIonisationModel2 - XS INFO START" <<
G4endl;
299 G4cout <<
"Cross section per water molecule (cm^2)=" << sigma/cm/cm <<
G4endl;
300 G4cout <<
"Cross section per water molecule (cm^-1)=" << sigma*waterDensity/(1./cm) <<
G4endl;
301 G4cout <<
"G4DNABornIonisationModel2 - XS INFO END" <<
G4endl;
304 return sigma*waterDensity;
316 if (verboseLevel > 3)
318 G4cout <<
"Calling SampleSecondaries() of G4DNABornIonisationModel2"
324 if (k >= fLowEnergyLimit && k <= fHighEnergyLimit)
328 G4double totalEnergy = k + particleMass;
329 G4double pSquare = k * (totalEnergy + particleMass);
330 G4double totalMomentum = std::sqrt(pSquare);
332 G4int ionizationShell = 0;
334 if (!fasterCode) ionizationShell = RandomSelect(k);
345 ionizationShell = RandomSelect(k);
352 secondaryKinetic = RandomizeEjectedElectronEnergy(particle->
GetDefinition(),k,ionizationShell);
356 secondaryKinetic = RandomizeEjectedElectronEnergyFromCumulatedDcs(particle->
GetDefinition(),k,ionizationShell);
366 if (secondaryKinetic>0)
369 fvect->push_back(dp);
374 G4double deltaTotalMomentum = std::sqrt(secondaryKinetic*(secondaryKinetic + 2.*electron_mass_c2 ));
376 G4double finalPx = totalMomentum*primaryDirection.
x() - deltaTotalMomentum*deltaDirection.
x();
377 G4double finalPy = totalMomentum*primaryDirection.
y() - deltaTotalMomentum*deltaDirection.
y();
378 G4double finalPz = totalMomentum*primaryDirection.
z() - deltaTotalMomentum*deltaDirection.
z();
379 G4double finalMomentum = std::sqrt(finalPx*finalPx + finalPy*finalPy + finalPz*finalPz);
380 finalPx /= finalMomentum;
381 finalPy /= finalMomentum;
382 finalPz /= finalMomentum;
385 direction.
set(finalPx,finalPy,finalPz);
396 std::size_t secNumberInit = 0;
397 std::size_t secNumberFinal = 0;
400 bindingEnergy = waterStructure.IonisationEnergy(ionizationShell);
403 if (k<bindingEnergy)
return;
406 G4double scatteredEnergy = k-bindingEnergy-secondaryKinetic;
409 if((fAtomDeexcitation !=
nullptr) && ionizationShell == 4)
413 secNumberInit = fvect->size();
414 fAtomDeexcitation->GenerateParticles(fvect, shell, Z, 0, 0);
415 secNumberFinal = fvect->size();
417 if(secNumberFinal > secNumberInit)
419 for (std::size_t i=secNumberInit; i<secNumberFinal; ++i)
422 if (bindingEnergy >= ((*fvect)[i])->GetKineticEnergy())
425 bindingEnergy -= ((*fvect)[i])->GetKineticEnergy();
440 if(bindingEnergy < 0.0)
441 G4Exception(
"G4DNAEmfietzoglouIonisatioModel1::SampleSecondaries()",
481 G4double maximumEnergyTransfer = 0.;
483 maximumEnergyTransfer = k;
501 G4double maxEnergy = maximumEnergyTransfer;
502 G4int nEnergySteps = 50;
505 G4double stpEnergy(std::pow(maxEnergy / value,
506 1. /
static_cast<G4double>(nEnergySteps - 1)));
507 G4int step(nEnergySteps);
516 if (differentialCrossSection >= crossSectionMaximum)
517 crossSectionMaximum = differentialCrossSection;
522 G4double secondaryElectronKineticEnergy = 0.;
525 secondaryElectronKineticEnergy =
G4UniformRand()* (maximumEnergyTransfer-waterStructure.IonisationEnergy(shell));
528 (secondaryElectronKineticEnergy+waterStructure.IonisationEnergy(shell))/eV,shell));
530 return secondaryElectronKineticEnergy;
536 G4double maximumKineticEnergyTransfer = 4.
537 * (electron_mass_c2 / proton_mass_c2) * k;
540 for (
G4double value = waterStructure.IonisationEnergy(shell);
541 value <= 4. * waterStructure.IonisationEnergy(shell); value += 0.1 * eV)
548 if (differentialCrossSection >= crossSectionMaximum)
549 crossSectionMaximum = differentialCrossSection;
552 G4double secondaryElectronKineticEnergy = 0.;
555 secondaryElectronKineticEnergy =
G4UniformRand()* maximumKineticEnergyTransfer;
558 (secondaryElectronKineticEnergy+waterStructure.IonisationEnergy(shell))/eV,shell));
560 return secondaryElectronKineticEnergy;
614 G4int ionizationLevelIndex)
618 if (energyTransfer >= waterStructure.IonisationEnergy(ionizationLevelIndex)/eV)
633 if (k==fTdummyVec.back()) k=k*(1.-1e-12);
638 auto t2 = std::upper_bound(fTdummyVec.begin(),
646 if (energyTransfer <= fVecm[(*t1)].back()
647 && energyTransfer <= fVecm[(*t2)].back())
649 auto e12 = std::upper_bound(fVecm[(*t1)].begin(),
654 auto e22 = std::upper_bound(fVecm[(*t2)].begin(),
666 xs11 = fDiffCrossSectionData[ionizationLevelIndex][valueT1][valueE11];
667 xs12 = fDiffCrossSectionData[ionizationLevelIndex][valueT1][valueE12];
668 xs21 = fDiffCrossSectionData[ionizationLevelIndex][valueT2][valueE21];
669 xs22 = fDiffCrossSectionData[ionizationLevelIndex][valueT2][valueE22];
673 G4double xsProduct = xs11 * xs12 * xs21 * xs22;
676 sigma = QuadInterpolator(valueE11,
706 if (e1 != 0 && e2 != 0 && (std::log10(e2) - std::log10(e1)) != 0
709 G4double a = (std::log10(xs2) - std::log10(xs1))
710 / (std::log10(e2) - std::log10(e1));
711 G4double b = std::log10(xs2) - a * std::log10(e2);
712 G4double sigma = a * std::log10(e) + b;
713 value = (std::pow(10., sigma));
727 if ((e2 - e1) != 0 && xs1 != 0 && xs2 != 0 && fasterCode)
731 value = std::pow(10., (d1 + (d2 - d1) * (e - e1) / (e2 - e1)));
737 if ((e2 - e1) != 0 && (xs1 == 0 || xs2 == 0) && fasterCode)
741 value = (d1 + (d2 - d1) * (e - e1) / (e2 - e1));
773 G4double interpolatedvalue1 = Interpolate(e11, e12, e, xs11, xs12);
774 G4double interpolatedvalue2 = Interpolate(e21, e22, e, xs21, xs22);
791 return fTableData->GetComponent(level)->FindValue(kineticEnergy);
809 value += valuesBuffer[i];
820 if (valuesBuffer[i] > value)
822 delete[] valuesBuffer;
825 value -= valuesBuffer[i];
829 delete[] valuesBuffer;
842 G4double secondaryElectronKineticEnergy = 0.;
850 - waterStructure.IonisationEnergy(shell);
853 if (secondaryElectronKineticEnergy < 0.)
857 return secondaryElectronKineticEnergy;
864 G4int ionizationLevelIndex,
883 if (k==fTdummyVec.back()) k=k*(1.-1e-12);
887 auto k2 = std::upper_bound(fTdummyVec.begin(),
904 if (random <= fProbaShellMap[ionizationLevelIndex][(*k1)].back()
905 && random <= fProbaShellMap[ionizationLevelIndex][(*k2)].back())
908 std::upper_bound(fProbaShellMap[ionizationLevelIndex][(*k1)].begin(),
909 fProbaShellMap[ionizationLevelIndex][(*k1)].end(),
912 auto prob11 = prob12 - 1;
915 std::upper_bound(fProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
916 fProbaShellMap[ionizationLevelIndex][(*k2)].end(),
919 auto prob21 = prob22 - 1;
923 valuePROB21 = *prob21;
924 valuePROB22 = *prob22;
925 valuePROB12 = *prob12;
926 valuePROB11 = *prob11;
933 nrjTransf11 = fNrjTransfData[ionizationLevelIndex][valueK1][valuePROB11];
934 nrjTransf12 = fNrjTransfData[ionizationLevelIndex][valueK1][valuePROB12];
935 nrjTransf21 = fNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
936 nrjTransf22 = fNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
948 if (random > fProbaShellMap[ionizationLevelIndex][(*k1)].back())
951 std::upper_bound(fProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
952 fProbaShellMap[ionizationLevelIndex][(*k2)].end(),
955 auto prob21 = prob22 - 1;
959 valuePROB21 = *prob21;
960 valuePROB22 = *prob22;
964 nrjTransf21 = fNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
965 nrjTransf22 = fNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
967 G4double interpolatedvalue2 = Interpolate(valuePROB21,
975 G4double value = Interpolate(valueK1, valueK2, k, 0., interpolatedvalue2);
992 G4double nrjTransfProduct = nrjTransf11 * nrjTransf12 * nrjTransf21
996 if (nrjTransfProduct != 0.)
998 nrj = QuadInterpolator(valuePROB11,
G4double B(G4double temperature)
const char * G4FindDataDir(const char *)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
G4ThreeVector G4ParticleMomentum
CLHEP::Hep3Vector G4ThreeVector
G4GLOB_DLL std::ostream G4cout
void set(double x, double y, double z)
G4double CrossSectionPerVolume(const G4Material *material, const G4ParticleDefinition *p, G4double ekin, G4double emin, G4double emax) override
void Initialise(const G4ParticleDefinition *, const G4DataVector &= *(new G4DataVector())) override
G4double GetPartialCrossSection(const G4Material *, G4int, const G4ParticleDefinition *, G4double) override
G4ParticleChangeForGamma * fParticleChangeForGamma
~G4DNABornIonisationModel2() override
void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy) override
G4double DifferentialCrossSection(G4ParticleDefinition *aParticleDefinition, G4double k, G4double energyTransfer, G4int shell)
G4DNABornIonisationModel2(const G4ParticleDefinition *p=nullptr, const G4String &nam="DNABornIonisationModel")
G4double TransferedEnergy(G4ParticleDefinition *aParticleDefinition, G4double incomingParticleEnergy, G4int shell, G4double random)
static G4DNAChemistryManager * Instance()
void CreateWaterMolecule(ElectronicModification, G4int, const G4Track *)
size_t NumberOfComponents() const override
const G4VEMDataSet * GetComponent(G4int componentId) const override
static G4DNAMolecularMaterial * Instance()
G4double IonisationEnergy(G4int level)
const G4ThreeVector & GetMomentumDirection() const
G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
static G4Electron * ElectronDefinition()
static G4Electron * Electron()
static G4EmParameters * Instance()
G4bool DNAStationary() const
static G4LossTableManager * Instance()
G4VAtomDeexcitation * AtomDeexcitation()
const G4Material * GetMaterial() const
std::size_t GetIndex() const
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
G4double GetPDGMass() const
const G4String & GetParticleName() const
static G4Proton * ProtonDefinition()
virtual G4double FindValue(G4double x, G4int componentId=0) const =0
virtual G4ThreeVector & SampleDirectionForShell(const G4DynamicParticle *dp, G4double finalTotalEnergy, G4int Z, G4int shellID, const G4Material *)
void SetHighEnergyLimit(G4double)
G4VEmAngularDistribution * GetAngularDistribution()
G4ParticleChangeForGamma * GetParticleChangeForGamma()
G4double LowEnergyLimit() const
G4double HighEnergyLimit() const
void SetLowEnergyLimit(G4double)
void SetDeexcitationFlag(G4bool val)
G4VEmModel(const G4String &nam)
void SetAngularDistribution(G4VEmAngularDistribution *)