60 G4cout <<
"Born ionisation model is constructed " <<
G4endl;
65 fAtomDeexcitation =
nullptr;
67 fpMolWaterDensity =
nullptr;
81 std::map<G4String, G4DNACrossSectionDataSet*, std::less<G4String> >::iterator pos;
82 for (pos = tableData.begin(); pos != tableData.end(); ++pos)
100 if (verboseLevel > 3)
102 G4cout <<
"Calling G4DNABornIonisationModel1::Initialise()" <<
G4endl;
107 G4String fileElectron(
"dna/sigma_ionisation_e_born");
108 G4String fileProton(
"dna/sigma_ionisation_p_born");
116 G4double scaleFactor = (1.e-22 / 3.343) * m*m;
124 tableFile[electron] = fileElectron;
126 lowEnergyLimit[electron] = 11. * eV;
127 highEnergyLimit[electron] = 1. * MeV;
132 tableE->LoadData(fileElectron);
134 tableData[electron] = tableE;
138 std::ostringstream eFullFileName;
140 if (fasterCode) eFullFileName << path <<
"/dna/sigmadiff_cumulated_ionisation_e_born_hp.dat";
141 if (!fasterCode) eFullFileName << path <<
"/dna/sigmadiff_ionisation_e_born.dat";
143 std::ifstream eDiffCrossSection(eFullFileName.str().c_str());
145 if (!eDiffCrossSection)
147 if (fasterCode)
G4Exception(
"G4DNABornIonisationModel1::Initialise",
"em0003",
148 FatalException,
"Missing data file:/dna/sigmadiff_cumulated_ionisation_e_born_hp.dat");
150 if (!fasterCode)
G4Exception(
"G4DNABornIonisationModel1::Initialise",
"em0003",
151 FatalException,
"Missing data file:/dna/sigmadiff_ionisation_e_born.dat");
163 for (
G4int j=0; j<5; j++)
165 eProbaShellMap[j].clear();
166 pProbaShellMap[j].clear();
168 eDiffCrossSectionData[j].clear();
169 pDiffCrossSectionData[j].clear();
171 eNrjTransfData[j].clear();
172 pNrjTransfData[j].clear();
177 eTdummyVec.push_back(0.);
178 while(!eDiffCrossSection.eof())
182 eDiffCrossSection>>tDummy>>eDummy;
183 if (tDummy != eTdummyVec.back()) eTdummyVec.push_back(tDummy);
186 for (
G4int j=0; j<5; j++)
188 eDiffCrossSection>> tmp;
190 eDiffCrossSectionData[j][tDummy][eDummy] = tmp;
194 eNrjTransfData[j][tDummy][eDiffCrossSectionData[j][tDummy][eDummy]]=eDummy;
195 eProbaShellMap[j][tDummy].push_back(eDiffCrossSectionData[j][tDummy][eDummy]);
199 if (!eDiffCrossSection.eof() && !fasterCode) eDiffCrossSectionData[j][tDummy][eDummy]*=scaleFactor;
201 if (!fasterCode) eVecm[tDummy].push_back(eDummy);
210 tableFile[proton] = fileProton;
212 lowEnergyLimit[proton] = 500. * keV;
213 highEnergyLimit[proton] = 100. * MeV;
218 tableP->LoadData(fileProton);
220 tableData[proton] = tableP;
224 std::ostringstream pFullFileName;
226 if (fasterCode) pFullFileName << path <<
"/dna/sigmadiff_cumulated_ionisation_p_born_hp.dat";
228 if (!fasterCode) pFullFileName << path <<
"/dna/sigmadiff_ionisation_p_born.dat";
230 std::ifstream pDiffCrossSection(pFullFileName.str().c_str());
232 if (!pDiffCrossSection)
234 if (fasterCode)
G4Exception(
"G4DNABornIonisationModel1::Initialise",
"em0003",
235 FatalException,
"Missing data file:/dna/sigmadiff_cumulated_ionisation_p_born_hp.dat");
237 if (!fasterCode)
G4Exception(
"G4DNABornIonisationModel1::Initialise",
"em0003",
238 FatalException,
"Missing data file:/dna/sigmadiff_ionisation_p_born.dat");
241 pTdummyVec.push_back(0.);
242 while(!pDiffCrossSection.eof())
246 pDiffCrossSection>>tDummy>>eDummy;
247 if (tDummy != pTdummyVec.back()) pTdummyVec.push_back(tDummy);
248 for (
G4int j=0; j<5; j++)
250 pDiffCrossSection>>pDiffCrossSectionData[j][tDummy][eDummy];
254 pNrjTransfData[j][tDummy][pDiffCrossSectionData[j][tDummy][eDummy]]=eDummy;
255 pProbaShellMap[j][tDummy].push_back(pDiffCrossSectionData[j][tDummy][eDummy]);
259 if (!pDiffCrossSection.eof() && !fasterCode) pDiffCrossSectionData[j][tDummy][eDummy]*=scaleFactor;
261 if (!fasterCode) pVecm[tDummy].push_back(eDummy);
267 if (particle==electronDef)
273 if (particle==protonDef)
281 G4cout <<
"Born ionisation model is initialized " <<
G4endl
289 if (isInitialised) {
return; }
304 if (chem->IsChemistryActivated()) {
307 isInitialised =
true;
325 if (verboseLevel > 3)
327 G4cout <<
"Calling CrossSectionPerVolume() of G4DNABornIonisationModel1"
349 std::map< G4String,G4double,std::less<G4String> >::iterator pos1;
350 pos1 = lowEnergyLimit.find(particleName);
351 if (pos1 != lowEnergyLimit.end())
353 lowLim = pos1->second;
356 std::map< G4String,G4double,std::less<G4String> >::iterator pos2;
357 pos2 = highEnergyLimit.find(particleName);
358 if (pos2 != highEnergyLimit.end())
360 highLim = pos2->second;
363 if (ekin >= lowLim && ekin <= highLim)
365 std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos;
366 pos = tableData.find(particleName);
368 if (pos != tableData.end())
371 if (table !=
nullptr)
373 sigma = table->FindValue(ekin);
379 G4double A = 1.39241700556072800000E-009 ;
380 G4double B = -8.52610412942622630000E-002 ;
381 sigma = sigma *
G4Exp(
A*(ekin/eV)+
B);
389 G4Exception(
"G4DNABornIonisationModel1::CrossSectionPerVolume",
"em0002",
394 if (verboseLevel > 2)
396 G4cout <<
"__________________________________" <<
G4endl;
397 G4cout <<
"G4DNABornIonisationModel1 - XS INFO START" <<
G4endl;
398 G4cout <<
"Kinetic energy(eV)=" << ekin/eV <<
" particle : " << particleName <<
G4endl;
399 G4cout <<
"Cross section per water molecule (cm^2)=" << sigma/cm/cm <<
G4endl;
400 G4cout <<
"Cross section per water molecule (cm^-1)=" << sigma*waterDensity/(1./cm) <<
G4endl;
401 G4cout <<
"G4DNABornIonisationModel1 - XS INFO END" <<
G4endl;
404 return sigma*waterDensity;
416 if (verboseLevel > 3)
418 G4cout <<
"Calling SampleSecondaries() of G4DNABornIonisationModel1"
429 std::map< G4String,G4double,std::less<G4String> >::iterator pos1;
430 pos1 = lowEnergyLimit.find(particleName);
432 if (pos1 != lowEnergyLimit.end())
434 lowLim = pos1->second;
437 std::map< G4String,G4double,std::less<G4String> >::iterator pos2;
438 pos2 = highEnergyLimit.find(particleName);
440 if (pos2 != highEnergyLimit.end())
442 highLim = pos2->second;
445 if (k >= lowLim && k <= highLim)
449 G4double totalEnergy = k + particleMass;
450 G4double pSquare = k * (totalEnergy + particleMass);
451 G4double totalMomentum = std::sqrt(pSquare);
453 G4int ionizationShell = 0;
462 ionizationShell = RandomSelect(k,particleName);
465 ionizationShell = RandomSelect(k,particleName);
469 bindingEnergy = waterStructure.IonisationEnergy(ionizationShell);
472 if (k<bindingEnergy)
return;
479 secondaryKinetic = RandomizeEjectedElectronEnergy(particle->
GetDefinition(),k,ionizationShell);
483 secondaryKinetic = RandomizeEjectedElectronEnergyFromCumulatedDcs(particle->
GetDefinition(),k,ionizationShell);
492 if (secondaryKinetic>0)
495 fvect->push_back(dp);
500 G4double deltaTotalMomentum = std::sqrt(secondaryKinetic*(secondaryKinetic + 2.*electron_mass_c2 ));
502 G4double finalPx = totalMomentum*primaryDirection.
x() - deltaTotalMomentum*deltaDirection.
x();
503 G4double finalPy = totalMomentum*primaryDirection.
y() - deltaTotalMomentum*deltaDirection.
y();
504 G4double finalPz = totalMomentum*primaryDirection.
z() - deltaTotalMomentum*deltaDirection.
z();
505 G4double finalMomentum = std::sqrt(finalPx*finalPx + finalPy*finalPy + finalPz*finalPz);
506 finalPx /= finalMomentum;
507 finalPy /= finalMomentum;
508 finalPz /= finalMomentum;
511 direction.
set(finalPx,finalPy,finalPz);
522 std::size_t secNumberInit = 0;
523 std::size_t secNumberFinal = 0;
525 G4double scatteredEnergy = k-bindingEnergy-secondaryKinetic;
528 if((fAtomDeexcitation !=
nullptr) && ionizationShell == 4)
532 secNumberInit = fvect->size();
533 fAtomDeexcitation->GenerateParticles(fvect, shell, Z, 0, 0);
534 secNumberFinal = fvect->size();
540 if(secNumberFinal > secNumberInit)
542 for (std::size_t i=secNumberInit; i<secNumberFinal; ++i)
545 if (bindingEnergy >= ((*fvect)[i])->GetKineticEnergy())
548 bindingEnergy -= ((*fvect)[i])->GetKineticEnergy();
572 if(bindingEnergy < 0.0)
573 G4Exception(
"G4DNABornIonisatioModel1::SampleSecondaries()",
590 if (
nullptr != fChemistry) {
606 G4double maximumEnergyTransfer = 0.;
608 maximumEnergyTransfer = k;
626 G4double maxEnergy = maximumEnergyTransfer;
627 G4int nEnergySteps = 50;
630 G4double stpEnergy(std::pow(maxEnergy / value,
631 1. /
static_cast<G4double>(nEnergySteps - 1)));
632 G4int step(nEnergySteps);
641 if (differentialCrossSection >= crossSectionMaximum)
642 crossSectionMaximum = differentialCrossSection;
647 G4double secondaryElectronKineticEnergy = 0.;
650 secondaryElectronKineticEnergy =
G4UniformRand()* (maximumEnergyTransfer-waterStructure.IonisationEnergy(shell));
653 (secondaryElectronKineticEnergy+waterStructure.IonisationEnergy(shell))/eV,shell));
655 return secondaryElectronKineticEnergy;
661 G4double maximumKineticEnergyTransfer = 4.
662 * (electron_mass_c2 / proton_mass_c2) * k;
665 for (
G4double value = waterStructure.IonisationEnergy(shell);
666 value <= 4. * waterStructure.IonisationEnergy(shell); value += 0.1 * eV)
673 if (differentialCrossSection >= crossSectionMaximum)
674 crossSectionMaximum = differentialCrossSection;
677 G4double secondaryElectronKineticEnergy = 0.;
680 secondaryElectronKineticEnergy =
G4UniformRand()* maximumKineticEnergyTransfer;
683 (secondaryElectronKineticEnergy+waterStructure.IonisationEnergy(shell))/eV,shell));
685 return secondaryElectronKineticEnergy;
695 G4int ionizationLevelIndex)
699 if (energyTransfer >= waterStructure.IonisationEnergy(ionizationLevelIndex)/eV)
717 if (k==eTdummyVec.back()) k=k*(1.-1e-12);
722 auto t2 = std::upper_bound(eTdummyVec.begin(),
729 if (energyTransfer <= eVecm[(*t1)].back()
730 && energyTransfer <= eVecm[(*t2)].back())
733 std::upper_bound(eVecm[(*t1)].begin(),
739 std::upper_bound(eVecm[(*t2)].begin(),
751 xs11 = eDiffCrossSectionData[ionizationLevelIndex][valueT1][valueE11];
752 xs12 = eDiffCrossSectionData[ionizationLevelIndex][valueT1][valueE12];
753 xs21 = eDiffCrossSectionData[ionizationLevelIndex][valueT2][valueE21];
754 xs22 = eDiffCrossSectionData[ionizationLevelIndex][valueT2][valueE22];
763 if (k==pTdummyVec.back()) k=k*(1.-1e-12);
767 auto t2 = std::upper_bound(pTdummyVec.begin(),
772 auto e12 = std::upper_bound(pVecm[(*t1)].begin(),
777 auto e22 = std::upper_bound(pVecm[(*t2)].begin(),
789 xs11 = pDiffCrossSectionData[ionizationLevelIndex][valueT1][valueE11];
790 xs12 = pDiffCrossSectionData[ionizationLevelIndex][valueT1][valueE12];
791 xs21 = pDiffCrossSectionData[ionizationLevelIndex][valueT2][valueE21];
792 xs22 = pDiffCrossSectionData[ionizationLevelIndex][valueT2][valueE22];
796 G4double xsProduct = xs11 * xs12 * xs21 * xs22;
799 sigma = QuadInterpolator(valueE11,
829 if (e1 != 0 && e2 != 0 && (std::log10(e2) - std::log10(e1)) != 0
832 G4double a = (std::log10(xs2) - std::log10(xs1))
833 / (std::log10(e2) - std::log10(e1));
834 G4double b = std::log10(xs2) - a * std::log10(e2);
835 G4double sigma = a * std::log10(e) + b;
836 value = (std::pow(10., sigma));
850 if ((e2 - e1) != 0 && xs1 != 0 && xs2 != 0 && fasterCode)
854 value = std::pow(10., (d1 + (d2 - d1) * (e - e1) / (e2 - e1)));
860 if ((e2 - e1) != 0 && (xs1 == 0 || xs2 == 0) && fasterCode)
864 value = (d1 + (d2 - d1) * (e - e1) / (e2 - e1));
896 G4double interpolatedvalue1 = Interpolate(e11, e12, e, xs11, xs12);
897 G4double interpolatedvalue2 = Interpolate(e21, e22, e, xs21, xs22);
912 std::map<G4String, G4DNACrossSectionDataSet*, std::less<G4String> >::iterator pos;
915 if (pos != tableData.end())
918 return table->GetComponent(level)->FindValue(kineticEnergy);
931 std::map<G4String, G4DNACrossSectionDataSet*, std::less<G4String> >::iterator pos;
932 pos = tableData.find(particle);
934 if (pos != tableData.end())
938 if (table !=
nullptr)
940 auto valuesBuffer =
new G4double[table->NumberOfComponents()];
941 const auto n = (
G4int)table->NumberOfComponents();
948 valuesBuffer[i] = table->GetComponent(i)->FindValue(k);
949 value += valuesBuffer[i];
960 if (valuesBuffer[i] > value)
962 delete[] valuesBuffer;
965 value -= valuesBuffer[i];
969 delete[] valuesBuffer;
974 G4Exception(
"G4DNABornIonisationModel1::RandomSelect",
977 "Model not applicable to particle type.");
991 G4double secondaryElectronKineticEnergy = 0.;
999 - waterStructure.IonisationEnergy(shell);
1003 if (secondaryElectronKineticEnergy < 0.)
1007 return secondaryElectronKineticEnergy;
1014 G4int ionizationLevelIndex,
1034 if (k==eTdummyVec.back()) k=k*(1.-1e-12);
1038 auto k2 = std::upper_bound(eTdummyVec.begin(),
1055 if (random <= eProbaShellMap[ionizationLevelIndex][(*k1)].back()
1056 && random <= eProbaShellMap[ionizationLevelIndex][(*k2)].back())
1059 std::upper_bound(eProbaShellMap[ionizationLevelIndex][(*k1)].begin(),
1060 eProbaShellMap[ionizationLevelIndex][(*k1)].end(),
1063 auto prob11 = prob12 - 1;
1066 std::upper_bound(eProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
1067 eProbaShellMap[ionizationLevelIndex][(*k2)].end(),
1070 auto prob21 = prob22 - 1;
1074 valuePROB21 = *prob21;
1075 valuePROB22 = *prob22;
1076 valuePROB12 = *prob12;
1077 valuePROB11 = *prob11;
1084 nrjTransf11 = eNrjTransfData[ionizationLevelIndex][valueK1][valuePROB11];
1085 nrjTransf12 = eNrjTransfData[ionizationLevelIndex][valueK1][valuePROB12];
1086 nrjTransf21 = eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
1087 nrjTransf22 = eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
1100 if (random > eProbaShellMap[ionizationLevelIndex][(*k1)].back())
1103 std::upper_bound(eProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
1104 eProbaShellMap[ionizationLevelIndex][(*k2)].end(),
1107 auto prob21 = prob22 - 1;
1111 valuePROB21 = *prob21;
1112 valuePROB22 = *prob22;
1116 nrjTransf21 = eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
1117 nrjTransf22 = eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
1119 G4double interpolatedvalue2 = Interpolate(valuePROB21,
1127 G4double value = Interpolate(valueK1, valueK2, k, 0., interpolatedvalue2);
1146 if (k==pTdummyVec.back()) k=k*(1.-1e-12);
1151 auto k2 = std::upper_bound(pTdummyVec.begin(),
1170 if (random <= pProbaShellMap[ionizationLevelIndex][(*k1)].back()
1171 && random <= pProbaShellMap[ionizationLevelIndex][(*k2)].back())
1174 std::upper_bound(pProbaShellMap[ionizationLevelIndex][(*k1)].begin(),
1175 pProbaShellMap[ionizationLevelIndex][(*k1)].end(),
1178 auto prob11 = prob12 - 1;
1181 std::upper_bound(pProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
1182 pProbaShellMap[ionizationLevelIndex][(*k2)].end(),
1185 auto prob21 = prob22 - 1;
1189 valuePROB21 = *prob21;
1190 valuePROB22 = *prob22;
1191 valuePROB12 = *prob12;
1192 valuePROB11 = *prob11;
1199 nrjTransf11 = pNrjTransfData[ionizationLevelIndex][valueK1][valuePROB11];
1200 nrjTransf12 = pNrjTransfData[ionizationLevelIndex][valueK1][valuePROB12];
1201 nrjTransf21 = pNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
1202 nrjTransf22 = pNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
1215 if (random > pProbaShellMap[ionizationLevelIndex][(*k1)].back())
1218 std::upper_bound(pProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
1219 pProbaShellMap[ionizationLevelIndex][(*k2)].end(),
1222 auto prob21 = prob22 - 1;
1226 valuePROB21 = *prob21;
1227 valuePROB22 = *prob22;
1231 nrjTransf21 = pNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
1232 nrjTransf22 = pNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
1234 G4double interpolatedvalue2 = Interpolate(valuePROB21,
1242 G4double value = Interpolate(valueK1, valueK2, k, 0., interpolatedvalue2);
1259 G4double nrjTransfProduct = nrjTransf11 * nrjTransf12 * nrjTransf21
1263 if (nrjTransfProduct != 0.)
1265 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.
G4ThreeVector G4ParticleMomentum
CLHEP::Hep3Vector G4ThreeVector
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
void StartTracking(G4Track *) 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()
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 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 *)