69 G4cout <<
"CPA100 ionisation model is constructed " <<
G4endl;
77 fAtomDeexcitation = 0;
79 fpMolWaterDensity = 0;
105 std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos;
106 for (pos = tableData.begin(); pos != tableData.end(); ++pos)
124 if (verboseLevel > 3)
125 G4cout <<
"Calling G4DNACPA100IonisationModel::Initialise()" <<
G4endl;
131 G4String fileElectron(
"dna/sigma_ionisation_e_cpa100_form_rel");
137 G4double scaleFactor = 1.e-20 * m*m;
139 char *path = getenv(
"G4LEDATA");
145 tableFile[electron] = fileElectron;
157 tableData[electron] = tableE;
166 std::ostringstream eFullFileName;
168 if (fasterCode) eFullFileName << path <<
"/dna/sigmadiff_cumulated_ionisation_e_cpa100_rel.dat";
170 if (!fasterCode) eFullFileName << path <<
"/dna/sigmadiff_ionisation_e_cpa100_rel.dat";
172 std::ifstream eDiffCrossSection(eFullFileName.str().c_str());
174 if (!eDiffCrossSection)
176 if (fasterCode)
G4Exception(
"G4DNACPA100IonisationModel::Initialise",
"em0003",
177 FatalException,
"Missing data file:/dna/sigmadiff_cumulated_ionisation_e_cpa100_rel.dat");
179 if (!fasterCode)
G4Exception(
"G4DNACPA100IonisationModel::Initialise",
"em0003",
180 FatalException,
"Missing data file:/dna/sigmadiff_ionisation_e_cpa100_rel.dat");
188 eProbaShellMap->clear();
189 eDiffCrossSectionData->clear();
190 eNrjTransfData->clear();
194 eTdummyVec.push_back(0.);
195 while(!eDiffCrossSection.eof())
199 eDiffCrossSection>>tDummy>>eDummy;
200 if (tDummy != eTdummyVec.back()) eTdummyVec.push_back(tDummy);
201 for (
G4int j=0; j<5; j++)
203 eDiffCrossSection>>eDiffCrossSectionData[j][tDummy][eDummy];
207 eNrjTransfData[j][tDummy][eDiffCrossSectionData[j][tDummy][eDummy]]=eDummy;
208 eProbaShellMap[j][tDummy].push_back(eDiffCrossSectionData[j][tDummy][eDummy]);
212 if (!eDiffCrossSection.eof() && !fasterCode)
213 eDiffCrossSectionData[j][tDummy][eDummy]*=scaleFactor;
215 if (!fasterCode) eVecm[tDummy].push_back(eDummy);
230 G4cout <<
"CPA100 ionisation model is initialized " <<
G4endl
244 if (isInitialised)
return;
246 isInitialised =
true;
258 if (verboseLevel > 3)
259 G4cout <<
"Calling CrossSectionPerVolume() of G4DNACPA100IonisationModel" <<
G4endl;
273 std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos;
274 pos = tableData.find(particleName);
276 if (pos != tableData.end())
279 if (table != 0) sigma = table->
FindValue(ekin);
283 G4Exception(
"G4DNACPA100IonisationModel::CrossSectionPerVolume",
"em0002",
288 if (verboseLevel > 2)
290 G4cout <<
"__________________________________" <<
G4endl;
291 G4cout <<
"G4DNACPA100IonisationModel - XS INFO START" <<
G4endl;
292 G4cout <<
"Kinetic energy(eV)=" << ekin/eV <<
" particle : " << particleName <<
G4endl;
293 G4cout <<
"Cross section per water molecule (cm^2)=" << sigma/cm/cm <<
G4endl;
294 G4cout <<
"Cross section per water molecule (cm^-1)=" << sigma*waterDensity/(1./cm) <<
G4endl;
295 G4cout <<
"G4DNACPA100IonisationModel - XS INFO END" <<
G4endl;
298 return sigma*waterDensity;
309 if (verboseLevel > 3)
310 G4cout <<
"Calling SampleSecondaries() of G4DNACPA100IonisationModel" <<
G4endl;
320 G4double totalEnergy = k + particleMass;
321 G4double pSquare = k * (totalEnergy + particleMass);
322 G4double totalMomentum = std::sqrt(pSquare);
324 G4int ionizationShell = -1;
326 ionizationShell = RandomSelect(k,particleName);
336 if (useDcs && !fasterCode)
337 secondaryKinetic = RandomizeEjectedElectronEnergy(particle->
GetDefinition(),k,ionizationShell);
339 if (useDcs && fasterCode)
340 secondaryKinetic = RandomizeEjectedElectronEnergyFromCumulatedDcs(particle->
GetDefinition(),k,ionizationShell);
343 secondaryKinetic = RandomizeEjectedElectronEnergyFromCompositionSampling(particle->
GetDefinition(),k,ionizationShell);
355 RandomizeEjectedElectronDirection(particle->
GetDefinition(), k,secondaryKinetic, cosTheta, phi);
357 G4double sinTheta = std::sqrt(1.-cosTheta*cosTheta);
358 G4double dirX = sinTheta*std::cos(phi);
359 G4double dirY = sinTheta*std::sin(phi);
362 deltaDirection.
rotateUz(primaryDirection);
365 if (secondaryKinetic>0)
368 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);
398 size_t secNumberInit = 0;
399 size_t secNumberFinal = 0;
401 G4double scatteredEnergy = k-bindingEnergy-secondaryKinetic;
404 if(fAtomDeexcitation && ionizationShell == 4)
409 secNumberInit = fvect->size();
411 secNumberFinal = fvect->size();
413 if(secNumberFinal > secNumberInit)
415 for (
size_t i=secNumberInit; i<secNumberFinal; ++i)
418 if (bindingEnergy >= ((*fvect)[i])->GetKineticEnergy())
421 bindingEnergy -= ((*fvect)[i])->GetKineticEnergy();
436 if(bindingEnergy < 0.0)
437 G4Exception(
"G4DNACPA100IonisatioModel1::SampleSecondaries()",
479 if ((k+waterStructure.
IonisationEnergy(shell))/2. > k) maximumEnergyTransfer=k;
497 G4double maxEnergy = maximumEnergyTransfer;
500 G4int nEnergySteps = 50;
521 G4double stpEnergy(std::pow(maxEnergy/value, 1./
static_cast<G4double>(nEnergySteps-1)));
522 G4int step(nEnergySteps);
523 G4double differentialCrossSection = 0.;
528 if(differentialCrossSection >0)
530 crossSectionMaximum=differentialCrossSection;
538 G4double secondaryElectronKineticEnergy=0.;
544 (secondaryElectronKineticEnergy+waterStructure.
IonisationEnergy(shell))/eV,shell));
546 return secondaryElectronKineticEnergy;
563 G4double sin2O = (1.-secKinetic/k) / (1.+secKinetic/(2.*electron_mass_c2));
564 cosTheta = std::sqrt(1.-sin2O);
573 G4int ionizationLevelIndex)
577 if (energyTransfer >= waterStructure.
IonisationEnergy(ionizationLevelIndex)/eV)
594 if (k==eTdummyVec.back()) k=k*(1.-1e-12);
599 std::vector<G4double>::iterator t2 = std::upper_bound(eTdummyVec.begin(),eTdummyVec.end(), k);
601 std::vector<G4double>::iterator t1 = t2-1;
605 if (energyTransfer <= eVecm[(*t1)].back() && energyTransfer <= eVecm[(*t2)].back() )
607 std::vector<G4double>::iterator e12 = std::upper_bound(eVecm[(*t1)].begin(),eVecm[(*t1)].end(), energyTransfer);
608 std::vector<G4double>::iterator e11 = e12-1;
610 std::vector<G4double>::iterator e22 = std::upper_bound(eVecm[(*t2)].begin(),eVecm[(*t2)].end(), energyTransfer);
611 std::vector<G4double>::iterator e21 = e22-1;
620 xs11 = eDiffCrossSectionData[ionizationLevelIndex][valueT1][valueE11];
621 xs12 = eDiffCrossSectionData[ionizationLevelIndex][valueT1][valueE12];
622 xs21 = eDiffCrossSectionData[ionizationLevelIndex][valueT2][valueE21];
623 xs22 = eDiffCrossSectionData[ionizationLevelIndex][valueT2][valueE22];
629 G4double xsProduct = xs11 * xs12 * xs21 * xs22;
632 sigma = QuadInterpolator( valueE11, valueE12,
657 if (e1!=0 && e2!=0 && (std::log10(e2)-std::log10(e1)) !=0 && !fasterCode && useDcs)
659 G4double a = (std::log10(xs2)-std::log10(xs1)) / (std::log10(e2)-std::log10(e1));
660 G4double b = std::log10(xs2) - a*std::log10(e2);
661 G4double sigma = a*std::log10(e) + b;
662 value = (std::pow(10.,sigma));
677 if ((e2-e1)!=0 && xs1 !=0 && xs2 !=0 && fasterCode && useDcs )
681 value = std::pow(10.,(d1 + (d2 - d1)*(e - e1)/ (e2 - e1)) );
687 if ((e2-e1)!=0 && (xs1 ==0 || xs2 ==0) && fasterCode && useDcs )
691 value = (d1 + (d2 - d1)*(e - e1)/ (e2 - e1));
717 G4double interpolatedvalue1 = Interpolate(e11, e12, e, xs11, xs12);
718 G4double interpolatedvalue2 = Interpolate(e21, e22, e, xs21, xs22);
719 G4double value = Interpolate(t1, t2, t, interpolatedvalue1, interpolatedvalue2);
730 std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator
pos;
731 pos = tableData.find(particle);
733 if (pos != tableData.end())
812 value += valuesBuffer[i];
822 if (valuesBuffer[i] > value)
824 delete[] valuesBuffer;
828 value -= valuesBuffer[i];
831 if (valuesBuffer)
delete[] valuesBuffer;
837 G4Exception(
"G4DNACPA100IonisationModel::RandomSelect",
"em0002",
846G4double G4DNACPA100IonisationModel::RandomizeEjectedElectronEnergyFromCumulatedDcs
851 G4double secondaryElectronKineticEnergy = 0.;
853 secondaryElectronKineticEnergy=
854 RandomTransferedEnergy(particleDefinition, k/eV, shell)*eV-waterStructure.
IonisationEnergy(shell);
857 if (secondaryElectronKineticEnergy<0.)
return 0.;
860 return secondaryElectronKineticEnergy;
865G4double G4DNACPA100IonisationModel::RandomTransferedEnergy
889 if (k==eTdummyVec.back()) k=k*(1.-1e-12);
894 std::vector<G4double>::iterator k2 = std::upper_bound(eTdummyVec.begin(),eTdummyVec.end(), k);
896 std::vector<G4double>::iterator k1 = k2-1;
911 if ( random <= eProbaShellMap[ionizationLevelIndex][(*k1)].back()
912 && random <= eProbaShellMap[ionizationLevelIndex][(*k2)].back() )
916 std::vector<G4double>::iterator prob12 =
917 std::upper_bound(eProbaShellMap[ionizationLevelIndex][(*k1)].begin(),
918 eProbaShellMap[ionizationLevelIndex][(*k1)].end(), random);
920 std::vector<G4double>::iterator prob11 = prob12-1;
923 std::vector<G4double>::iterator prob22 =
924 std::upper_bound(eProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
925 eProbaShellMap[ionizationLevelIndex][(*k2)].end(), random);
927 std::vector<G4double>::iterator prob21 = prob22-1;
931 valuePROB21 =*prob21;
932 valuePROB22 =*prob22;
933 valuePROB12 =*prob12;
934 valuePROB11 =*prob11;
942 nrjTransf11 = eNrjTransfData[ionizationLevelIndex][valueK1][valuePROB11];
943 nrjTransf12 = eNrjTransfData[ionizationLevelIndex][valueK1][valuePROB12];
944 nrjTransf21 = eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
945 nrjTransf22 = eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
960 if ( random > eProbaShellMap[ionizationLevelIndex][(*k1)].back() )
963 std::vector<G4double>::iterator prob22 =
965 std::upper_bound(eProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
966 eProbaShellMap[ionizationLevelIndex][(*k2)].end(), random);
968 std::vector<G4double>::iterator prob21 = prob22-1;
972 valuePROB21 =*prob21;
973 valuePROB22 =*prob22;
977 nrjTransf21 = eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
978 nrjTransf22 = eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
980 G4double interpolatedvalue2 = Interpolate(valuePROB21, valuePROB22, random, nrjTransf21, nrjTransf22);
984 G4double value = Interpolate(valueK1, valueK2, k, 0., interpolatedvalue2);
1003 G4double nrjTransfProduct = nrjTransf11 * nrjTransf12 * nrjTransf21 * nrjTransf22;
1007 if (nrjTransfProduct != 0.)
1009 nrj = QuadInterpolator( valuePROB11, valuePROB12,
1010 valuePROB21, valuePROB22,
1011 nrjTransf11, nrjTransf12,
1012 nrjTransf21, nrjTransf22,
1024G4double G4DNACPA100IonisationModel::RandomizeEjectedElectronEnergyFromCompositionSampling
1177 if (tt<=bb)
return 0.;
1187 G4double a1 = t * tm1 / tu1 / tp12;
1188 G4double a2 = tm1 / tu1 / t / tp1 / deux;
1189 G4double a3 = dlt * (tp12 - deux * deux ) / tu1 / tp12;
1214 else if ((r1>A1) && (r1< A2))
1233 gx=deux*(un-(t-wx)/tp1);
1239 fx=un-r2*(tp12-deux*deux)/tp12;
1242 gx=(un+gg*gg*gg)/deux;
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4GLOB_DLL std::ostream G4cout
void set(double x, double y, double z)
Hep3Vector & rotateUz(const Hep3Vector &)
G4double DifferentialCrossSection(G4ParticleDefinition *aParticleDefinition, G4double k, G4double energyTransfer, G4int shell)
G4DNACPA100IonisationModel(const G4ParticleDefinition *p=0, const G4String &nam="DNACPA100IonisationModel")
virtual G4double CrossSectionPerVolume(const G4Material *material, const G4ParticleDefinition *p, G4double ekin, G4double emin, G4double emax)
virtual ~G4DNACPA100IonisationModel()
G4ParticleChangeForGamma * fParticleChangeForGamma
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &= *(new G4DataVector()))
virtual void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy)
G4double IonisationEnergy(G4int level)
G4double UEnergy(G4int level)
static G4DNAChemistryManager * Instance()
void CreateWaterMolecule(ElectronicModification, G4int, const G4Track *)
virtual G4double FindValue(G4double e, G4int componentId=0) const
virtual size_t NumberOfComponents(void) const
virtual const G4VEMDataSet * GetComponent(G4int componentId) const
virtual G4bool LoadData(const G4String &argFileName)
const std::vector< G4double > * GetNumMolPerVolTableFor(const G4Material *) const
Retrieve a table of molecular densities (number of molecules per unit volume) in the G4 unit system f...
static G4DNAMolecularMaterial * Instance()
const G4ThreeVector & GetMomentumDirection() const
G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
static G4Electron * ElectronDefinition()
static G4Electron * Electron()
static G4LossTableManager * Instance()
G4VAtomDeexcitation * AtomDeexcitation()
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
const G4Track * GetCurrentTrack() const
void SetProposedKineticEnergy(G4double proposedKinEnergy)
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
G4double GetPDGMass() const
const G4String & GetParticleName() const
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
void SetHighEnergyLimit(G4double)
G4ParticleChangeForGamma * GetParticleChangeForGamma()
G4double LowEnergyLimit() const
G4double HighEnergyLimit() const
void SetLowEnergyLimit(G4double)
void SetDeexcitationFlag(G4bool val)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)