59 G4cout <<
"Born ionisation model is constructed " <<
G4endl;
64 fAtomDeexcitation =
nullptr;
66 fpMolWaterDensity =
nullptr;
90 std::map<G4String, G4DNACrossSectionDataSet*, std::less<G4String> >::iterator pos;
91 for (pos = tableData.begin(); pos != tableData.end(); ++pos)
109 if (verboseLevel > 3)
111 G4cout <<
"Calling G4DNABornIonisationModel1::Initialise()" <<
G4endl;
116 G4String fileElectron(
"dna/sigma_ionisation_e_born");
117 G4String fileProton(
"dna/sigma_ionisation_p_born");
125 G4double scaleFactor = (1.e-22 / 3.343) * m*m;
133 tableFile[electron] = fileElectron;
135 lowEnergyLimit[electron] = 11. * eV;
136 highEnergyLimit[electron] = 1. * MeV;
141 tableE->LoadData(fileElectron);
143 tableData[electron] = tableE;
147 std::ostringstream eFullFileName;
149 if (fasterCode) eFullFileName << path <<
"/dna/sigmadiff_cumulated_ionisation_e_born_hp.dat";
150 if (!fasterCode) eFullFileName << path <<
"/dna/sigmadiff_ionisation_e_born.dat";
152 std::ifstream eDiffCrossSection(eFullFileName.str().c_str());
154 if (!eDiffCrossSection)
156 if (fasterCode)
G4Exception(
"G4DNABornIonisationModel1::Initialise",
"em0003",
157 FatalException,
"Missing data file:/dna/sigmadiff_cumulated_ionisation_e_born_hp.dat");
159 if (!fasterCode)
G4Exception(
"G4DNABornIonisationModel1::Initialise",
"em0003",
160 FatalException,
"Missing data file:/dna/sigmadiff_ionisation_e_born.dat");
172 for (
G4int j=0; j<5; j++)
174 eProbaShellMap[j].clear();
175 pProbaShellMap[j].clear();
177 eDiffCrossSectionData[j].clear();
178 pDiffCrossSectionData[j].clear();
180 eNrjTransfData[j].clear();
181 pNrjTransfData[j].clear();
186 eTdummyVec.push_back(0.);
187 while(!eDiffCrossSection.eof())
191 eDiffCrossSection>>tDummy>>eDummy;
192 if (tDummy != eTdummyVec.back()) eTdummyVec.push_back(tDummy);
195 for (
G4int j=0; j<5; j++)
197 eDiffCrossSection>> tmp;
199 eDiffCrossSectionData[j][tDummy][eDummy] = tmp;
203 eNrjTransfData[j][tDummy][eDiffCrossSectionData[j][tDummy][eDummy]]=eDummy;
204 eProbaShellMap[j][tDummy].push_back(eDiffCrossSectionData[j][tDummy][eDummy]);
208 if (!eDiffCrossSection.eof() && !fasterCode) eDiffCrossSectionData[j][tDummy][eDummy]*=scaleFactor;
210 if (!fasterCode) eVecm[tDummy].push_back(eDummy);
219 tableFile[proton] = fileProton;
221 lowEnergyLimit[proton] = 500. * keV;
222 highEnergyLimit[proton] = 100. * MeV;
227 tableP->LoadData(fileProton);
229 tableData[proton] = tableP;
233 std::ostringstream pFullFileName;
235 if (fasterCode) pFullFileName << path <<
"/dna/sigmadiff_cumulated_ionisation_p_born_hp.dat";
237 if (!fasterCode) pFullFileName << path <<
"/dna/sigmadiff_ionisation_p_born.dat";
239 std::ifstream pDiffCrossSection(pFullFileName.str().c_str());
241 if (!pDiffCrossSection)
243 if (fasterCode)
G4Exception(
"G4DNABornIonisationModel1::Initialise",
"em0003",
244 FatalException,
"Missing data file:/dna/sigmadiff_cumulated_ionisation_p_born_hp.dat");
246 if (!fasterCode)
G4Exception(
"G4DNABornIonisationModel1::Initialise",
"em0003",
247 FatalException,
"Missing data file:/dna/sigmadiff_ionisation_p_born.dat");
250 pTdummyVec.push_back(0.);
251 while(!pDiffCrossSection.eof())
255 pDiffCrossSection>>tDummy>>eDummy;
256 if (tDummy != pTdummyVec.back()) pTdummyVec.push_back(tDummy);
257 for (
G4int j=0; j<5; j++)
259 pDiffCrossSection>>pDiffCrossSectionData[j][tDummy][eDummy];
263 pNrjTransfData[j][tDummy][pDiffCrossSectionData[j][tDummy][eDummy]]=eDummy;
264 pProbaShellMap[j][tDummy].push_back(pDiffCrossSectionData[j][tDummy][eDummy]);
268 if (!pDiffCrossSection.eof() && !fasterCode) pDiffCrossSectionData[j][tDummy][eDummy]*=scaleFactor;
270 if (!fasterCode) pVecm[tDummy].push_back(eDummy);
276 if (particle==electronDef)
282 if (particle==protonDef)
290 G4cout <<
"Born ionisation model is initialized " <<
G4endl
312 isInitialised =
true;
323 if (verboseLevel > 3)
325 G4cout <<
"Calling CrossSectionPerVolume() of G4DNABornIonisationModel1"
347 std::map< G4String,G4double,std::less<G4String> >::iterator pos1;
348 pos1 = lowEnergyLimit.find(particleName);
349 if (pos1 != lowEnergyLimit.end())
351 lowLim = pos1->second;
354 std::map< G4String,G4double,std::less<G4String> >::iterator pos2;
355 pos2 = highEnergyLimit.find(particleName);
356 if (pos2 != highEnergyLimit.end())
358 highLim = pos2->second;
361 if (ekin >= lowLim && ekin <= highLim)
363 std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos;
364 pos = tableData.find(particleName);
366 if (pos != tableData.end())
369 if (table !=
nullptr)
377 G4double A = 1.39241700556072800000E-009 ;
378 G4double B = -8.52610412942622630000E-002 ;
379 sigma = sigma *
G4Exp(
A*(ekin/eV)+
B);
387 G4Exception(
"G4DNABornIonisationModel1::CrossSectionPerVolume",
"em0002",
392 if (verboseLevel > 2)
394 G4cout <<
"__________________________________" <<
G4endl;
395 G4cout <<
"G4DNABornIonisationModel1 - XS INFO START" <<
G4endl;
396 G4cout <<
"Kinetic energy(eV)=" << ekin/eV <<
" particle : " << particleName <<
G4endl;
397 G4cout <<
"Cross section per water molecule (cm^2)=" << sigma/cm/cm <<
G4endl;
398 G4cout <<
"Cross section per water molecule (cm^-1)=" << sigma*waterDensity/(1./cm) <<
G4endl;
399 G4cout <<
"G4DNABornIonisationModel1 - XS INFO END" <<
G4endl;
402 return sigma*waterDensity;
414 if (verboseLevel > 3)
416 G4cout <<
"Calling SampleSecondaries() of G4DNABornIonisationModel1"
427 std::map< G4String,G4double,std::less<G4String> >::iterator pos1;
428 pos1 = lowEnergyLimit.find(particleName);
430 if (pos1 != lowEnergyLimit.end())
432 lowLim = pos1->second;
435 std::map< G4String,G4double,std::less<G4String> >::iterator pos2;
436 pos2 = highEnergyLimit.find(particleName);
438 if (pos2 != highEnergyLimit.end())
440 highLim = pos2->second;
443 if (k >= lowLim && k <= highLim)
447 G4double totalEnergy = k + particleMass;
448 G4double pSquare = k * (totalEnergy + particleMass);
449 G4double totalMomentum = std::sqrt(pSquare);
451 G4int ionizationShell = 0;
453 if (!fasterCode) ionizationShell = RandomSelect(k,particleName);
464 ionizationShell = RandomSelect(k,particleName);
471 if (k<bindingEnergy)
return;
478 secondaryKinetic = RandomizeEjectedElectronEnergy(particle->
GetDefinition(),k,ionizationShell);
482 secondaryKinetic = RandomizeEjectedElectronEnergyFromCumulatedDcs(particle->
GetDefinition(),k,ionizationShell);
493 if (secondaryKinetic>0)
496 fvect->push_back(dp);
501 G4double deltaTotalMomentum = std::sqrt(secondaryKinetic*(secondaryKinetic + 2.*electron_mass_c2 ));
503 G4double finalPx = totalMomentum*primaryDirection.
x() - deltaTotalMomentum*deltaDirection.
x();
504 G4double finalPy = totalMomentum*primaryDirection.
y() - deltaTotalMomentum*deltaDirection.
y();
505 G4double finalPz = totalMomentum*primaryDirection.
z() - deltaTotalMomentum*deltaDirection.
z();
506 G4double finalMomentum = std::sqrt(finalPx*finalPx + finalPy*finalPy + finalPz*finalPz);
507 finalPx /= finalMomentum;
508 finalPy /= finalMomentum;
509 finalPz /= finalMomentum;
512 direction.
set(finalPx,finalPy,finalPz);
523 std::size_t secNumberInit = 0;
524 std::size_t secNumberFinal = 0;
526 G4double scatteredEnergy = k-bindingEnergy-secondaryKinetic;
529 if((fAtomDeexcitation !=
nullptr) && ionizationShell == 4)
533 secNumberInit = fvect->size();
535 secNumberFinal = fvect->size();
541 if(secNumberFinal > secNumberInit)
543 for (std::size_t i=secNumberInit; i<secNumberFinal; ++i)
546 if (bindingEnergy >= ((*fvect)[i])->GetKineticEnergy())
549 bindingEnergy -= ((*fvect)[i])->GetKineticEnergy();
573 if(bindingEnergy < 0.0)
574 G4Exception(
"G4DNABornIonisatioModel1::SampleSecondaries()",
614 G4double maximumEnergyTransfer = 0.;
616 maximumEnergyTransfer = k;
634 G4double maxEnergy = maximumEnergyTransfer;
635 G4int nEnergySteps = 50;
638 G4double stpEnergy(std::pow(maxEnergy / value,
639 1. /
static_cast<G4double>(nEnergySteps - 1)));
640 G4int step(nEnergySteps);
649 if (differentialCrossSection >= crossSectionMaximum)
650 crossSectionMaximum = differentialCrossSection;
655 G4double secondaryElectronKineticEnergy = 0.;
661 (secondaryElectronKineticEnergy+waterStructure.
IonisationEnergy(shell))/eV,shell));
663 return secondaryElectronKineticEnergy;
669 G4double maximumKineticEnergyTransfer = 4.
670 * (electron_mass_c2 / proton_mass_c2) * k;
681 if (differentialCrossSection >= crossSectionMaximum)
682 crossSectionMaximum = differentialCrossSection;
685 G4double secondaryElectronKineticEnergy = 0.;
688 secondaryElectronKineticEnergy =
G4UniformRand()* maximumKineticEnergyTransfer;
691 (secondaryElectronKineticEnergy+waterStructure.
IonisationEnergy(shell))/eV,shell));
693 return secondaryElectronKineticEnergy;
747 G4int ionizationLevelIndex)
751 if (energyTransfer >= waterStructure.
IonisationEnergy(ionizationLevelIndex)/eV)
769 if (k==eTdummyVec.back()) k=k*(1.-1e-12);
774 auto t2 = std::upper_bound(eTdummyVec.begin(),
781 if (energyTransfer <= eVecm[(*t1)].back()
782 && energyTransfer <= eVecm[(*t2)].back())
785 std::upper_bound(eVecm[(*t1)].begin(),
791 std::upper_bound(eVecm[(*t2)].begin(),
803 xs11 = eDiffCrossSectionData[ionizationLevelIndex][valueT1][valueE11];
804 xs12 = eDiffCrossSectionData[ionizationLevelIndex][valueT1][valueE12];
805 xs21 = eDiffCrossSectionData[ionizationLevelIndex][valueT2][valueE21];
806 xs22 = eDiffCrossSectionData[ionizationLevelIndex][valueT2][valueE22];
815 if (k==pTdummyVec.back()) k=k*(1.-1e-12);
819 auto t2 = std::upper_bound(pTdummyVec.begin(),
824 auto e12 = std::upper_bound(pVecm[(*t1)].begin(),
829 auto e22 = std::upper_bound(pVecm[(*t2)].begin(),
841 xs11 = pDiffCrossSectionData[ionizationLevelIndex][valueT1][valueE11];
842 xs12 = pDiffCrossSectionData[ionizationLevelIndex][valueT1][valueE12];
843 xs21 = pDiffCrossSectionData[ionizationLevelIndex][valueT2][valueE21];
844 xs22 = pDiffCrossSectionData[ionizationLevelIndex][valueT2][valueE22];
848 G4double xsProduct = xs11 * xs12 * xs21 * xs22;
851 sigma = QuadInterpolator(valueE11,
881 if (e1 != 0 && e2 != 0 && (std::log10(e2) - std::log10(e1)) != 0
884 G4double a = (std::log10(xs2) - std::log10(xs1))
885 / (std::log10(e2) - std::log10(e1));
886 G4double b = std::log10(xs2) - a * std::log10(e2);
887 G4double sigma = a * std::log10(e) + b;
888 value = (std::pow(10., sigma));
902 if ((e2 - e1) != 0 && xs1 != 0 && xs2 != 0 && fasterCode)
906 value = std::pow(10., (d1 + (d2 - d1) * (e - e1) / (e2 - e1)));
912 if ((e2 - e1) != 0 && (xs1 == 0 || xs2 == 0) && fasterCode)
916 value = (d1 + (d2 - d1) * (e - e1) / (e2 - e1));
948 G4double interpolatedvalue1 = Interpolate(e11, e12, e, xs11, xs12);
949 G4double interpolatedvalue2 = Interpolate(e21, e22, e, xs21, xs22);
964 std::map<G4String, G4DNACrossSectionDataSet*, std::less<G4String> >::iterator pos;
967 if (pos != tableData.end())
983 std::map<G4String, G4DNACrossSectionDataSet*, std::less<G4String> >::iterator pos;
984 pos = tableData.find(particle);
986 if (pos != tableData.end())
990 if (table !=
nullptr)
1001 value += valuesBuffer[i];
1012 if (valuesBuffer[i] > value)
1014 delete[] valuesBuffer;
1017 value -= valuesBuffer[i];
1021 delete[] valuesBuffer;
1026 G4Exception(
"G4DNABornIonisationModel1::RandomSelect",
1029 "Model not applicable to particle type.");
1043 G4double secondaryElectronKineticEnergy = 0.;
1055 if (secondaryElectronKineticEnergy < 0.)
1059 return secondaryElectronKineticEnergy;
1066 G4int ionizationLevelIndex,
1086 if (k==eTdummyVec.back()) k=k*(1.-1e-12);
1090 auto k2 = std::upper_bound(eTdummyVec.begin(),
1107 if (random <= eProbaShellMap[ionizationLevelIndex][(*k1)].back()
1108 && random <= eProbaShellMap[ionizationLevelIndex][(*k2)].back())
1111 std::upper_bound(eProbaShellMap[ionizationLevelIndex][(*k1)].begin(),
1112 eProbaShellMap[ionizationLevelIndex][(*k1)].end(),
1115 auto prob11 = prob12 - 1;
1118 std::upper_bound(eProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
1119 eProbaShellMap[ionizationLevelIndex][(*k2)].end(),
1122 auto prob21 = prob22 - 1;
1126 valuePROB21 = *prob21;
1127 valuePROB22 = *prob22;
1128 valuePROB12 = *prob12;
1129 valuePROB11 = *prob11;
1136 nrjTransf11 = eNrjTransfData[ionizationLevelIndex][valueK1][valuePROB11];
1137 nrjTransf12 = eNrjTransfData[ionizationLevelIndex][valueK1][valuePROB12];
1138 nrjTransf21 = eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
1139 nrjTransf22 = eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
1152 if (random > eProbaShellMap[ionizationLevelIndex][(*k1)].back())
1155 std::upper_bound(eProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
1156 eProbaShellMap[ionizationLevelIndex][(*k2)].end(),
1159 auto prob21 = prob22 - 1;
1163 valuePROB21 = *prob21;
1164 valuePROB22 = *prob22;
1168 nrjTransf21 = eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
1169 nrjTransf22 = eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
1171 G4double interpolatedvalue2 = Interpolate(valuePROB21,
1179 G4double value = Interpolate(valueK1, valueK2, k, 0., interpolatedvalue2);
1198 if (k==pTdummyVec.back()) k=k*(1.-1e-12);
1203 auto k2 = std::upper_bound(pTdummyVec.begin(),
1222 if (random <= pProbaShellMap[ionizationLevelIndex][(*k1)].back()
1223 && random <= pProbaShellMap[ionizationLevelIndex][(*k2)].back())
1226 std::upper_bound(pProbaShellMap[ionizationLevelIndex][(*k1)].begin(),
1227 pProbaShellMap[ionizationLevelIndex][(*k1)].end(),
1230 auto prob11 = prob12 - 1;
1233 std::upper_bound(pProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
1234 pProbaShellMap[ionizationLevelIndex][(*k2)].end(),
1237 auto prob21 = prob22 - 1;
1241 valuePROB21 = *prob21;
1242 valuePROB22 = *prob22;
1243 valuePROB12 = *prob12;
1244 valuePROB11 = *prob11;
1251 nrjTransf11 = pNrjTransfData[ionizationLevelIndex][valueK1][valuePROB11];
1252 nrjTransf12 = pNrjTransfData[ionizationLevelIndex][valueK1][valuePROB12];
1253 nrjTransf21 = pNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
1254 nrjTransf22 = pNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
1267 if (random > pProbaShellMap[ionizationLevelIndex][(*k1)].back())
1270 std::upper_bound(pProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
1271 pProbaShellMap[ionizationLevelIndex][(*k2)].end(),
1274 auto prob21 = prob22 - 1;
1278 valuePROB21 = *prob21;
1279 valuePROB22 = *prob22;
1283 nrjTransf21 = pNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
1284 nrjTransf22 = pNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
1286 G4double interpolatedvalue2 = Interpolate(valuePROB21,
1294 G4double value = Interpolate(valueK1, valueK2, k, 0., interpolatedvalue2);
1311 G4double nrjTransfProduct = nrjTransf11 * nrjTransf12 * nrjTransf21
1315 if (nrjTransfProduct != 0.)
1317 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)
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
G4GLOB_DLL std::ostream G4cout
void set(double x, double y, double z)
void Initialise(const G4ParticleDefinition *, const G4DataVector &= *(new G4DataVector())) override
G4double CrossSectionPerVolume(const G4Material *material, const G4ParticleDefinition *p, G4double ekin, G4double emin, G4double emax) override
G4double GetPartialCrossSection(const G4Material *, G4int, const G4ParticleDefinition *, G4double) override
G4double DifferentialCrossSection(G4ParticleDefinition *aParticleDefinition, G4double k, G4double energyTransfer, G4int shell)
~G4DNABornIonisationModel1() override
void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy) override
G4double TransferedEnergy(G4ParticleDefinition *aParticleDefinition, G4double incomingParticleEnergy, G4int shell, G4double random)
G4ParticleChangeForGamma * fParticleChangeForGamma
G4DNABornIonisationModel1(const G4ParticleDefinition *p=nullptr, const G4String &nam="DNABornIonisationModel")
static G4DNAChemistryManager * Instance()
void CreateWaterMolecule(ElectronicModification, G4int, const G4Track *)
size_t NumberOfComponents() const override
const G4VEMDataSet * GetComponent(G4int componentId) const override
G4double FindValue(G4double e, G4int componentId=0) 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 G4LossTableManager * Instance()
G4VAtomDeexcitation * AtomDeexcitation()
const G4Material * GetMaterial() const
std::size_t GetIndex() const
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
void SetProposedKineticEnergy(G4double proposedKinEnergy)
void ProposeMomentumDirection(const G4ThreeVector &Pfinal)
G4double GetPDGMass() const
const G4String & GetParticleName() const
static G4Proton * ProtonDefinition()
virtual const G4AtomicShell * GetAtomicShell(G4int Z, G4AtomicShellEnumerator shell)=0
void GenerateParticles(std::vector< G4DynamicParticle * > *secVect, const G4AtomicShell *, G4int Z, G4int coupleIndex)
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)
void SetAngularDistribution(G4VEmAngularDistribution *)
const G4Track * GetCurrentTrack() const
void ProposeLocalEnergyDeposit(G4double anEnergyPart)