Import Geant4 10.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2017-12-08 12:52:30 +01:00
parent 98e455a940
commit fc6af9e721
2166 changed files with 276760 additions and 100873 deletions
@@ -60,13 +60,13 @@ G4DNABornIonisationModel1::G4DNABornIonisationModel1(const G4ParticleDefinition*
G4cout << "Born ionisation model is constructed " << G4endl;
}
//Mark this model as "applicable" for atomic deexcitation
// Mark this model as "applicable" for atomic deexcitation
SetDeexcitationFlag(true);
fAtomDeexcitation = 0;
fParticleChangeForGamma = 0;
fpMolWaterDensity = 0;
// define default angular generator
// Define default angular generator
SetAngularDistribution(new G4DNABornAngle());
// Selection of computation method
@@ -161,8 +161,6 @@ void G4DNABornIonisationModel1::Initialise(const G4ParticleDefinition* particle,
FatalException,"Missing data file:/dna/sigmadiff_ionisation_e_born.dat");
}
//
// Clear the arrays for re-initialization case (MT mode)
// March 25th, 2014 - Vaclav Stepan, Sebastien Incerti
@@ -172,7 +170,7 @@ void G4DNABornIonisationModel1::Initialise(const G4ParticleDefinition* particle,
eVecm.clear();
pVecm.clear();
for (int j=0; j<5; j++)
for (G4int j=0; j<5; j++)
{
eProbaShellMap[j].clear();
pProbaShellMap[j].clear();
@@ -183,18 +181,19 @@ void G4DNABornIonisationModel1::Initialise(const G4ParticleDefinition* particle,
eNrjTransfData[j].clear();
pNrjTransfData[j].clear();
}
//
eTdummyVec.push_back(0.);
while(!eDiffCrossSection.eof())
{
double tDummy;
double eDummy;
G4double tDummy;
G4double eDummy;
eDiffCrossSection>>tDummy>>eDummy;
if (tDummy != eTdummyVec.back()) eTdummyVec.push_back(tDummy);
double tmp;
for (int j=0; j<5; j++)
G4double tmp;
for (G4int j=0; j<5; j++)
{
eDiffCrossSection>> tmp;
@@ -252,11 +251,11 @@ void G4DNABornIonisationModel1::Initialise(const G4ParticleDefinition* particle,
pTdummyVec.push_back(0.);
while(!pDiffCrossSection.eof())
{
double tDummy;
double eDummy;
G4double tDummy;
G4double eDummy;
pDiffCrossSection>>tDummy>>eDummy;
if (tDummy != pTdummyVec.back()) pTdummyVec.push_back(tDummy);
for (int j=0; j<5; j++)
for (G4int j=0; j<5; j++)
{
pDiffCrossSection>>pDiffCrossSectionData[j][tDummy][eDummy];
@@ -298,12 +297,16 @@ void G4DNABornIonisationModel1::Initialise(const G4ParticleDefinition* particle,
}
// Initialize water density pointer
fpMolWaterDensity = G4DNAMolecularMaterial::Instance()->
GetNumMolPerVolTableFor(G4Material::GetMaterial("G4_WATER"));
//
// AD
fAtomDeexcitation = G4LossTableManager::Instance()->AtomDeexcitation();
//
if (isInitialised)
{ return;}
fParticleChangeForGamma = GetParticleChangeForGamma();
@@ -322,7 +325,6 @@ G4double G4DNABornIonisationModel1::CrossSectionPerVolume(const G4Material* mate
{
G4cout << "Calling CrossSectionPerVolume() of G4DNABornIonisationModel1"
<< G4endl;
}
if (
@@ -467,6 +469,58 @@ void G4DNABornIonisationModel1::SampleSecondaries(std::vector<G4DynamicParticle*
ionizationShell = RandomSelect(k,particleName);
}while (k<19*eV && ionizationShell==2 && particle->GetDefinition()==G4Electron::ElectronDefinition());
G4double bindingEnergy = 0;
bindingEnergy = waterStructure.IonisationEnergy(ionizationShell);
// SI: additional protection if tcs interpolation method is modified
if (k<bindingEnergy) return;
//
G4double secondaryKinetic=-1000*eV;
if (fasterCode == false)
{
secondaryKinetic = RandomizeEjectedElectronEnergy(particle->GetDefinition(),k,ionizationShell);
}
else
{
secondaryKinetic = RandomizeEjectedElectronEnergyFromCumulatedDcs(particle->GetDefinition(),k,ionizationShell);
}
//
G4int Z = 8;
G4ThreeVector deltaDirection =
GetAngularDistribution()->SampleDirectionForShell(particle, secondaryKinetic,
Z, ionizationShell,
couple->GetMaterial());
if (secondaryKinetic>0)
{
G4DynamicParticle* dp = new G4DynamicParticle (G4Electron::Electron(),deltaDirection,secondaryKinetic);
fvect->push_back(dp);
}
if (particle->GetDefinition() == G4Electron::ElectronDefinition())
{
G4double deltaTotalMomentum = std::sqrt(secondaryKinetic*(secondaryKinetic + 2.*electron_mass_c2 ));
G4double finalPx = totalMomentum*primaryDirection.x() - deltaTotalMomentum*deltaDirection.x();
G4double finalPy = totalMomentum*primaryDirection.y() - deltaTotalMomentum*deltaDirection.y();
G4double finalPz = totalMomentum*primaryDirection.z() - deltaTotalMomentum*deltaDirection.z();
G4double finalMomentum = std::sqrt(finalPx*finalPx + finalPy*finalPy + finalPz*finalPz);
finalPx /= finalMomentum;
finalPy /= finalMomentum;
finalPz /= finalMomentum;
G4ThreeVector direction;
direction.set(finalPx,finalPy,finalPz);
fParticleChangeForGamma->ProposeMomentumDirection(direction.unit());
}
else fParticleChangeForGamma->ProposeMomentumDirection(primaryDirection);
// AM: sample deexcitation
// here we assume that H_{2}O electronic levels are the same as Oxygen.
// this can be considered true with a rough 10% error in energy on K-shell,
@@ -474,14 +528,6 @@ void G4DNABornIonisationModel1::SampleSecondaries(std::vector<G4DynamicParticle*
G4int secNumberInit = 0;// need to know at a certain point the energy of secondaries
G4int secNumberFinal = 0;// So I'll make the diference and then sum the energies
G4double bindingEnergy = 0;
bindingEnergy = waterStructure.IonisationEnergy(ionizationShell);
//SI: additional protection if tcs interpolation method is modified
if (k<bindingEnergy) return;
//
G4int Z = 8;
if(fAtomDeexcitation)
{
G4AtomicShellEnumerator as = fKShell;
@@ -510,45 +556,8 @@ void G4DNABornIonisationModel1::SampleSecondaries(std::vector<G4DynamicParticle*
secNumberFinal = fvect->size();
}
G4double secondaryKinetic=-1000*eV;
// Note that secondaryKinetic is the energy of the delta ray, not of all secondaries.
if (fasterCode == false)
{
secondaryKinetic = RandomizeEjectedElectronEnergy(particle->GetDefinition(),k,ionizationShell);
}
// SI - 01/04/2014
else
{
secondaryKinetic = RandomizeEjectedElectronEnergyFromCumulatedDcs(particle->GetDefinition(),k,ionizationShell);
}
//
G4ThreeVector deltaDirection =
GetAngularDistribution()->SampleDirectionForShell(particle, secondaryKinetic,
Z, ionizationShell,
couple->GetMaterial());
if (particle->GetDefinition() == G4Electron::ElectronDefinition())
{
G4double deltaTotalMomentum = std::sqrt(secondaryKinetic*(secondaryKinetic + 2.*electron_mass_c2 ));
G4double finalPx = totalMomentum*primaryDirection.x() - deltaTotalMomentum*deltaDirection.x();
G4double finalPy = totalMomentum*primaryDirection.y() - deltaTotalMomentum*deltaDirection.y();
G4double finalPz = totalMomentum*primaryDirection.z() - deltaTotalMomentum*deltaDirection.z();
G4double finalMomentum = std::sqrt(finalPx*finalPx + finalPy*finalPy + finalPz*finalPz);
finalPx /= finalMomentum;
finalPy /= finalMomentum;
finalPz /= finalMomentum;
G4ThreeVector direction;
direction.set(finalPx,finalPy,finalPz);
fParticleChangeForGamma->ProposeMomentumDirection(direction.unit());
}
else fParticleChangeForGamma->ProposeMomentumDirection(primaryDirection);
// note that secondaryKinetic is the energy of the delta ray, not of all secondaries.
G4double scatteredEnergy = k-bindingEnergy-secondaryKinetic;
G4double deexSecEnergy = 0;
for (G4int j=secNumberInit; j < secNumberFinal; j++)
@@ -566,15 +575,14 @@ void G4DNABornIonisationModel1::SampleSecondaries(std::vector<G4DynamicParticle*
fParticleChangeForGamma->SetProposedKineticEnergy(k);
fParticleChangeForGamma->ProposeLocalEnergyDeposit(k-scatteredEnergy);
}
// SI - 01/04/2014
if (secondaryKinetic>0)
{
G4DynamicParticle* dp = new G4DynamicParticle (G4Electron::Electron(),deltaDirection,secondaryKinetic);
fvect->push_back(dp);
}
//
// TEST //////////////////////////
// if (secondaryKinetic<0) abort();
// if (scatteredEnergy<0) abort();
// if (k-scatteredEnergy-secondaryKinetic-deexSecEnergy<0) abort();
// if (k-scatteredEnergy<0) abort();
/////////////////////////////////
const G4Track * theIncomingTrack = fParticleChangeForGamma->GetCurrentTrack();
G4DNAChemistryManager::Instance()->CreateWaterMolecule(eIonizedMolecule,
ionizationShell,
@@ -722,14 +730,14 @@ G4double G4DNABornIonisationModel1::RandomizeEjectedElectronEnergy(G4ParticleDef
*/
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
double G4DNABornIonisationModel1::DifferentialCrossSection(G4ParticleDefinition * particleDefinition,
G4double G4DNABornIonisationModel1::DifferentialCrossSection(G4ParticleDefinition * particleDefinition,
G4double k,
G4double energyTransfer,
G4int ionizationLevelIndex)
{
G4double sigma = 0.;
if (energyTransfer >= waterStructure.IonisationEnergy(ionizationLevelIndex))
if (energyTransfer >= waterStructure.IonisationEnergy(ionizationLevelIndex)/eV)
{
G4double valueT1 = 0;
G4double valueT2 = 0;
@@ -747,27 +755,27 @@ double G4DNABornIonisationModel1::DifferentialCrossSection(G4ParticleDefinition
{
// k should be in eV and energy transfer eV also
std::vector<double>::iterator t2 = std::upper_bound(eTdummyVec.begin(),
std::vector<G4double>::iterator t2 = std::upper_bound(eTdummyVec.begin(),
eTdummyVec.end(),
k);
std::vector<double>::iterator t1 = t2 - 1;
std::vector<G4double>::iterator t1 = t2 - 1;
// SI : the following condition avoids situations where energyTransfer >last vector element
if (energyTransfer <= eVecm[(*t1)].back()
&& energyTransfer <= eVecm[(*t2)].back())
{
std::vector<double>::iterator e12 =
std::vector<G4double>::iterator e12 =
std::upper_bound(eVecm[(*t1)].begin(),
eVecm[(*t1)].end(),
energyTransfer);
std::vector<double>::iterator e11 = e12 - 1;
std::vector<G4double>::iterator e11 = e12 - 1;
std::vector<double>::iterator e22 =
std::vector<G4double>::iterator e22 =
std::upper_bound(eVecm[(*t2)].begin(),
eVecm[(*t2)].end(),
energyTransfer);
std::vector<double>::iterator e21 = e22 - 1;
std::vector<G4double>::iterator e21 = e22 - 1;
valueT1 = *t1;
valueT2 = *t2;
@@ -788,20 +796,20 @@ double G4DNABornIonisationModel1::DifferentialCrossSection(G4ParticleDefinition
if (particleDefinition == G4Proton::ProtonDefinition())
{
// k should be in eV and energy transfer eV also
std::vector<double>::iterator t2 = std::upper_bound(pTdummyVec.begin(),
std::vector<G4double>::iterator t2 = std::upper_bound(pTdummyVec.begin(),
pTdummyVec.end(),
k);
std::vector<double>::iterator t1 = t2 - 1;
std::vector<G4double>::iterator t1 = t2 - 1;
std::vector<double>::iterator e12 = std::upper_bound(pVecm[(*t1)].begin(),
std::vector<G4double>::iterator e12 = std::upper_bound(pVecm[(*t1)].begin(),
pVecm[(*t1)].end(),
energyTransfer);
std::vector<double>::iterator e11 = e12 - 1;
std::vector<G4double>::iterator e11 = e12 - 1;
std::vector<double>::iterator e22 = std::upper_bound(pVecm[(*t2)].begin(),
std::vector<G4double>::iterator e22 = std::upper_bound(pVecm[(*t2)].begin(),
pVecm[(*t2)].end(),
energyTransfer);
std::vector<double>::iterator e21 = e22 - 1;
std::vector<G4double>::iterator e21 = e22 - 1;
valueT1 = *t1;
valueT2 = *t2;
@@ -868,7 +876,7 @@ G4double G4DNABornIonisationModel1::Interpolate(G4double e1,
G4double d2 = xs2;
value = (d1 + (d2 - d1)*(e - e1)/ (e2 - e1));
}
*/
*/
// Switch to log-lin interpolation for faster code
if ((e2 - e1) != 0 && xs1 != 0 && xs2 != 0 && fasterCode)
@@ -1023,7 +1031,6 @@ G4double G4DNABornIonisationModel1::RandomizeEjectedElectronEnergyFromCumulatedD
- waterStructure.IonisationEnergy(shell);
//G4cout << RandomTransferedEnergy(particleDefinition, k/eV, shell) << G4endl;
// SI - 01/04/2014
if (secondaryElectronKineticEnergy < 0.)
return 0.;
//
@@ -1055,10 +1062,10 @@ G4double G4DNABornIonisationModel1::TransferedEnergy(G4ParticleDefinition* parti
if (particleDefinition == G4Electron::ElectronDefinition())
{
// k should be in eV
std::vector<double>::iterator k2 = std::upper_bound(eTdummyVec.begin(),
std::vector<G4double>::iterator k2 = std::upper_bound(eTdummyVec.begin(),
eTdummyVec.end(),
k);
std::vector<double>::iterator k1 = k2 - 1;
std::vector<G4double>::iterator k1 = k2 - 1;
/*
G4cout << "----> k=" << k
@@ -1075,19 +1082,19 @@ G4double G4DNABornIonisationModel1::TransferedEnergy(G4ParticleDefinition* parti
if (random <= eProbaShellMap[ionizationLevelIndex][(*k1)].back()
&& random <= eProbaShellMap[ionizationLevelIndex][(*k2)].back())
{
std::vector<double>::iterator prob12 =
std::vector<G4double>::iterator prob12 =
std::upper_bound(eProbaShellMap[ionizationLevelIndex][(*k1)].begin(),
eProbaShellMap[ionizationLevelIndex][(*k1)].end(),
random);
std::vector<double>::iterator prob11 = prob12 - 1;
std::vector<G4double>::iterator prob11 = prob12 - 1;
std::vector<double>::iterator prob22 =
std::vector<G4double>::iterator prob22 =
std::upper_bound(eProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
eProbaShellMap[ionizationLevelIndex][(*k2)].end(),
random);
std::vector<double>::iterator prob21 = prob22 - 1;
std::vector<G4double>::iterator prob21 = prob22 - 1;
valueK1 = *k1;
valueK2 = *k2;
@@ -1118,12 +1125,12 @@ G4double G4DNABornIonisationModel1::TransferedEnergy(G4ParticleDefinition* parti
// Avoids cases where cum xs is zero for k1 and is not for k2 (with always k1<k2)
if (random > eProbaShellMap[ionizationLevelIndex][(*k1)].back())
{
std::vector<double>::iterator prob22 =
std::vector<G4double>::iterator prob22 =
std::upper_bound(eProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
eProbaShellMap[ionizationLevelIndex][(*k2)].end(),
random);
std::vector<double>::iterator prob21 = prob22 - 1;
std::vector<G4double>::iterator prob21 = prob22 - 1;
valueK1 = *k1;
valueK2 = *k2;
@@ -1163,11 +1170,11 @@ G4double G4DNABornIonisationModel1::TransferedEnergy(G4ParticleDefinition* parti
{
// k should be in eV
std::vector<double>::iterator k2 = std::upper_bound(pTdummyVec.begin(),
std::vector<G4double>::iterator k2 = std::upper_bound(pTdummyVec.begin(),
pTdummyVec.end(),
k);
std::vector<double>::iterator k1 = k2 - 1;
std::vector<G4double>::iterator k1 = k2 - 1;
/*
G4cout << "----> k=" << k
@@ -1185,19 +1192,19 @@ G4double G4DNABornIonisationModel1::TransferedEnergy(G4ParticleDefinition* parti
if (random <= pProbaShellMap[ionizationLevelIndex][(*k1)].back()
&& random <= pProbaShellMap[ionizationLevelIndex][(*k2)].back())
{
std::vector<double>::iterator prob12 =
std::vector<G4double>::iterator prob12 =
std::upper_bound(pProbaShellMap[ionizationLevelIndex][(*k1)].begin(),
pProbaShellMap[ionizationLevelIndex][(*k1)].end(),
random);
std::vector<double>::iterator prob11 = prob12 - 1;
std::vector<G4double>::iterator prob11 = prob12 - 1;
std::vector<double>::iterator prob22 =
std::vector<G4double>::iterator prob22 =
std::upper_bound(pProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
pProbaShellMap[ionizationLevelIndex][(*k2)].end(),
random);
std::vector<double>::iterator prob21 = prob22 - 1;
std::vector<G4double>::iterator prob21 = prob22 - 1;
valueK1 = *k1;
valueK2 = *k2;
@@ -1229,12 +1236,12 @@ G4double G4DNABornIonisationModel1::TransferedEnergy(G4ParticleDefinition* parti
if (random > pProbaShellMap[ionizationLevelIndex][(*k1)].back())
{
std::vector<double>::iterator prob22 =
std::vector<G4double>::iterator prob22 =
std::upper_bound(pProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
pProbaShellMap[ionizationLevelIndex][(*k2)].end(),
random);
std::vector<double>::iterator prob21 = prob22 - 1;
std::vector<G4double>::iterator prob21 = prob22 - 1;
valueK1 = *k1;
valueK2 = *k2;
@@ -60,7 +60,8 @@ G4DNABornIonisationModel2::G4DNABornIonisationModel2(const G4ParticleDefinition*
G4cout << "Born ionisation model is constructed " << G4endl;
}
//Mark this model as "applicable" for atomic deexcitation
// Mark this model as "applicable" for atomic deexcitation
SetDeexcitationFlag(true);
fAtomDeexcitation = 0;
fParticleChangeForGamma = 0;
@@ -70,7 +71,8 @@ G4DNABornIonisationModel2::G4DNABornIonisationModel2(const G4ParticleDefinition*
fHighEnergyLimit = 0;
fParticleDef = 0;
// define default angular generator
// Define default angular generator
SetAngularDistribution(new G4DNABornAngle());
// Selection of computation method
@@ -167,6 +169,7 @@ void G4DNABornIonisationModel2::Initialise(const G4ParticleDefinition* particle,
}
// Cross section
G4double scaleFactor = (1.e-22 / 3.343) * m*m;
fTableData = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor );
fTableData->LoadData(fTableFile);
@@ -183,8 +186,6 @@ void G4DNABornIonisationModel2::Initialise(const G4ParticleDefinition* particle,
FatalException,description);
}
//
// Clear the arrays for re-initialization case (MT mode)
// March 25th, 2014 - Vaclav Stepan, Sebastien Incerti
@@ -197,17 +198,18 @@ void G4DNABornIonisationModel2::Initialise(const G4ParticleDefinition* particle,
fDiffCrossSectionData[j].clear();
fNrjTransfData[j].clear();
}
//
fTdummyVec.push_back(0.);
while(!diffCrossSection.eof())
{
double tDummy;
double eDummy;
G4double tDummy;
G4double eDummy;
diffCrossSection>>tDummy>>eDummy;
if (tDummy != fTdummyVec.back()) fTdummyVec.push_back(tDummy);
double tmp;
G4double tmp;
for (int j=0; j<5; j++)
{
diffCrossSection>> tmp;
@@ -243,10 +245,12 @@ void G4DNABornIonisationModel2::Initialise(const G4ParticleDefinition* particle,
}
// Initialize water density pointer
fpMolWaterDensity = G4DNAMolecularMaterial::Instance()->
GetNumMolPerVolTableFor(G4Material::GetMaterial("G4_WATER"));
//
// AD
fAtomDeexcitation = G4LossTableManager::Instance()->AtomDeexcitation();
if (isInitialised)
@@ -349,6 +353,50 @@ void G4DNABornIonisationModel2::SampleSecondaries(std::vector<G4DynamicParticle*
ionizationShell = RandomSelect(k);
}while (k<19*eV && ionizationShell==2 && particle->GetDefinition()==G4Electron::ElectronDefinition());
G4double secondaryKinetic=-1000*eV;
if (fasterCode == false)
{
secondaryKinetic = RandomizeEjectedElectronEnergy(particle->GetDefinition(),k,ionizationShell);
}
else
{
secondaryKinetic = RandomizeEjectedElectronEnergyFromCumulatedDcs(particle->GetDefinition(),k,ionizationShell);
}
G4int Z = 8;
G4ThreeVector deltaDirection =
GetAngularDistribution()->SampleDirectionForShell(particle, secondaryKinetic,
Z, ionizationShell,
couple->GetMaterial());
if (secondaryKinetic>0)
{
G4DynamicParticle* dp = new G4DynamicParticle (G4Electron::Electron(),deltaDirection,secondaryKinetic);
fvect->push_back(dp);
}
if (particle->GetDefinition() == G4Electron::ElectronDefinition())
{
G4double deltaTotalMomentum = std::sqrt(secondaryKinetic*(secondaryKinetic + 2.*electron_mass_c2 ));
G4double finalPx = totalMomentum*primaryDirection.x() - deltaTotalMomentum*deltaDirection.x();
G4double finalPy = totalMomentum*primaryDirection.y() - deltaTotalMomentum*deltaDirection.y();
G4double finalPz = totalMomentum*primaryDirection.z() - deltaTotalMomentum*deltaDirection.z();
G4double finalMomentum = std::sqrt(finalPx*finalPx + finalPy*finalPy + finalPz*finalPz);
finalPx /= finalMomentum;
finalPy /= finalMomentum;
finalPz /= finalMomentum;
G4ThreeVector direction;
direction.set(finalPx,finalPy,finalPz);
fParticleChangeForGamma->ProposeMomentumDirection(direction.unit());
}
else fParticleChangeForGamma->ProposeMomentumDirection(primaryDirection);
// AM: sample deexcitation
// here we assume that H_{2}O electronic levels are the same as Oxygen.
// this can be considered true with a rough 10% error in energy on K-shell,
@@ -359,11 +407,10 @@ void G4DNABornIonisationModel2::SampleSecondaries(std::vector<G4DynamicParticle*
G4double bindingEnergy = 0;
bindingEnergy = waterStructure.IonisationEnergy(ionizationShell);
//SI: additional protection if tcs interpolation method is modified
// SI: additional protection if tcs interpolation method is modified
if (k<bindingEnergy) return;
//
G4int Z = 8;
if(fAtomDeexcitation)
{
G4AtomicShellEnumerator as = fKShell;
@@ -392,45 +439,8 @@ void G4DNABornIonisationModel2::SampleSecondaries(std::vector<G4DynamicParticle*
secNumberFinal = fvect->size();
}
G4double secondaryKinetic=-1000*eV;
// Note that secondaryKinetic is the energy of the delta ray, not of all secondaries.
if (fasterCode == false)
{
secondaryKinetic = RandomizeEjectedElectronEnergy(particle->GetDefinition(),k,ionizationShell);
}
// SI - 01/04/2014
else
{
secondaryKinetic = RandomizeEjectedElectronEnergyFromCumulatedDcs(particle->GetDefinition(),k,ionizationShell);
}
//
G4ThreeVector deltaDirection =
GetAngularDistribution()->SampleDirectionForShell(particle, secondaryKinetic,
Z, ionizationShell,
couple->GetMaterial());
if (particle->GetDefinition() == G4Electron::ElectronDefinition())
{
G4double deltaTotalMomentum = std::sqrt(secondaryKinetic*(secondaryKinetic + 2.*electron_mass_c2 ));
G4double finalPx = totalMomentum*primaryDirection.x() - deltaTotalMomentum*deltaDirection.x();
G4double finalPy = totalMomentum*primaryDirection.y() - deltaTotalMomentum*deltaDirection.y();
G4double finalPz = totalMomentum*primaryDirection.z() - deltaTotalMomentum*deltaDirection.z();
G4double finalMomentum = std::sqrt(finalPx*finalPx + finalPy*finalPy + finalPz*finalPz);
finalPx /= finalMomentum;
finalPy /= finalMomentum;
finalPz /= finalMomentum;
G4ThreeVector direction;
direction.set(finalPx,finalPy,finalPz);
fParticleChangeForGamma->ProposeMomentumDirection(direction.unit());
}
else fParticleChangeForGamma->ProposeMomentumDirection(primaryDirection);
// note that secondaryKinetic is the energy of the delta ray, not of all secondaries.
G4double scatteredEnergy = k-bindingEnergy-secondaryKinetic;
G4double deexSecEnergy = 0;
for (G4int j=secNumberInit; j < secNumberFinal; j++)
@@ -448,14 +458,13 @@ void G4DNABornIonisationModel2::SampleSecondaries(std::vector<G4DynamicParticle*
fParticleChangeForGamma->SetProposedKineticEnergy(k);
fParticleChangeForGamma->ProposeLocalEnergyDeposit(k-scatteredEnergy);
}
// SI - 01/04/2014
if (secondaryKinetic>0)
{
G4DynamicParticle* dp = new G4DynamicParticle (G4Electron::Electron(),deltaDirection,secondaryKinetic);
fvect->push_back(dp);
}
//
// TEST //////////////////////////
// if (secondaryKinetic<0) abort();
// if (scatteredEnergy<0) abort();
// if (k-scatteredEnergy-secondaryKinetic-deexSecEnergy<0) abort();
// if (k-scatteredEnergy<0) abort();
/////////////////////////////////
const G4Track * theIncomingTrack = fParticleChangeForGamma->GetCurrentTrack();
G4DNAChemistryManager::Instance()->CreateWaterMolecule(eIonizedMolecule,
@@ -488,7 +497,7 @@ G4double G4DNABornIonisationModel2::RandomizeEjectedElectronEnergy(G4ParticleDef
G4double differentialCrossSection = DifferentialCrossSection(particleDefinition, k/eV, value/eV, shell);
if(differentialCrossSection >= crossSectionMaximum) crossSectionMaximum = differentialCrossSection;
}
*/
*/
// SI : alternative method
G4double crossSectionMaximum = 0.;
@@ -604,14 +613,14 @@ G4double G4DNABornIonisationModel2::RandomizeEjectedElectronEnergy(G4ParticleDef
*/
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
double G4DNABornIonisationModel2::DifferentialCrossSection(G4ParticleDefinition * /*particleDefinition*/,
G4double G4DNABornIonisationModel2::DifferentialCrossSection(G4ParticleDefinition * /*particleDefinition*/,
G4double k,
G4double energyTransfer,
G4int ionizationLevelIndex)
{
G4double sigma = 0.;
if (energyTransfer >= waterStructure.IonisationEnergy(ionizationLevelIndex))
if (energyTransfer >= waterStructure.IonisationEnergy(ionizationLevelIndex)/eV)
{
G4double valueT1 = 0;
G4double valueT2 = 0;
@@ -627,25 +636,26 @@ double G4DNABornIonisationModel2::DifferentialCrossSection(G4ParticleDefinition
// k should be in eV and energy transfer eV also
std::vector<double>::iterator t2 = std::upper_bound(fTdummyVec.begin(),
std::vector<G4double>::iterator t2 = std::upper_bound(fTdummyVec.begin(),
fTdummyVec.end(),
k);
std::vector<double>::iterator t1 = t2 - 1;
std::vector<G4double>::iterator t1 = t2 - 1;
// SI : the following condition avoids situations where energyTransfer >last vector element
if (energyTransfer <= fVecm[(*t1)].back()
&& energyTransfer <= fVecm[(*t2)].back())
{
std::vector<double>::iterator e12 = std::upper_bound(fVecm[(*t1)].begin(),
std::vector<G4double>::iterator e12 = std::upper_bound(fVecm[(*t1)].begin(),
fVecm[(*t1)].end(),
energyTransfer);
std::vector<double>::iterator e11 = e12 - 1;
std::vector<G4double>::iterator e11 = e12 - 1;
std::vector<double>::iterator e22 = std::upper_bound(fVecm[(*t2)].begin(),
std::vector<G4double>::iterator e22 = std::upper_bound(fVecm[(*t2)].begin(),
fVecm[(*t2)].end(),
energyTransfer);
std::vector<double>::iterator e21 = e22 - 1;
std::vector<G4double>::iterator e21 = e22 - 1;
valueT1 = *t1;
valueT2 = *t2;
@@ -712,7 +722,7 @@ G4double G4DNABornIonisationModel2::Interpolate(G4double e1,
G4double d2 = xs2;
value = (d1 + (d2 - d1)*(e - e1)/ (e2 - e1));
}
*/
*/
// Switch to log-lin interpolation for faster code
if ((e2 - e1) != 0 && xs1 != 0 && xs2 != 0 && fasterCode)
@@ -741,7 +751,7 @@ G4double G4DNABornIonisationModel2::Interpolate(G4double e1,
<< xs2 << " "
<< value
<< G4endl;
*/
*/
return value;
}
@@ -828,7 +838,7 @@ G4double G4DNABornIonisationModel2::RandomizeEjectedElectronEnergyFromCumulatedD
G4double k,
G4int shell)
{
//G4cout << "*** FAST computation for " << " " << particleDefinition->GetParticleName() << G4endl;
// G4cout << "*** FAST computation for " << " " << particleDefinition->GetParticleName() << G4endl;
G4double secondaryElectronKineticEnergy = 0.;
@@ -840,8 +850,7 @@ G4double G4DNABornIonisationModel2::RandomizeEjectedElectronEnergyFromCumulatedD
random) * eV
- waterStructure.IonisationEnergy(shell);
//G4cout << TransferedEnergy(particleDefinition, k/eV, shell, random) << G4endl;
// SI - 01/04/2014
// G4cout << TransferedEnergy(particleDefinition, k/eV, shell, random) << G4endl;
if (secondaryElectronKineticEnergy < 0.)
return 0.;
//
@@ -872,10 +881,10 @@ G4double G4DNABornIonisationModel2::TransferedEnergy(G4ParticleDefinition* /*par
G4double nrjTransf22 = 0;
// k should be in eV
std::vector<double>::iterator k2 = std::upper_bound(fTdummyVec.begin(),
std::vector<G4double>::iterator k2 = std::upper_bound(fTdummyVec.begin(),
fTdummyVec.end(),
k);
std::vector<double>::iterator k1 = k2 - 1;
std::vector<G4double>::iterator k1 = k2 - 1;
/*
G4cout << "----> k=" << k
@@ -886,25 +895,25 @@ G4double G4DNABornIonisationModel2::TransferedEnergy(G4ParticleDefinition* /*par
<< " " << eProbaShellMap[ionizationLevelIndex][(*k1)].back()
<< " " << eProbaShellMap[ionizationLevelIndex][(*k2)].back()
<< G4endl;
*/
*/
// SI : the following condition avoids situations where random >last vector element
if (random <= fProbaShellMap[ionizationLevelIndex][(*k1)].back()
&& random <= fProbaShellMap[ionizationLevelIndex][(*k2)].back())
{
std::vector<double>::iterator prob12 =
std::vector<G4double>::iterator prob12 =
std::upper_bound(fProbaShellMap[ionizationLevelIndex][(*k1)].begin(),
fProbaShellMap[ionizationLevelIndex][(*k1)].end(),
random);
std::vector<double>::iterator prob11 = prob12 - 1;
std::vector<G4double>::iterator prob11 = prob12 - 1;
std::vector<double>::iterator prob22 =
std::vector<G4double>::iterator prob22 =
std::upper_bound(fProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
fProbaShellMap[ionizationLevelIndex][(*k2)].end(),
random);
std::vector<double>::iterator prob21 = prob22 - 1;
std::vector<G4double>::iterator prob21 = prob22 - 1;
valueK1 = *k1;
valueK2 = *k2;
@@ -916,7 +925,7 @@ G4double G4DNABornIonisationModel2::TransferedEnergy(G4ParticleDefinition* /*par
/*
G4cout << " " << random << " " << valuePROB11 << " "
<< valuePROB12 << " " << valuePROB21 << " " << valuePROB22 << G4endl;
*/
*/
nrjTransf11 = fNrjTransfData[ionizationLevelIndex][valueK1][valuePROB11];
nrjTransf12 = fNrjTransfData[ionizationLevelIndex][valueK1][valuePROB12];
@@ -929,25 +938,25 @@ G4double G4DNABornIonisationModel2::TransferedEnergy(G4ParticleDefinition* /*par
G4cout << " " << random << " " << nrjTransf11 << " "
<< nrjTransf12 << " " << nrjTransf21 << " " <<nrjTransf22 << G4endl;
*/
*/
}
// Avoids cases where cum xs is zero for k1 and is not for k2 (with always k1<k2)
if (random > fProbaShellMap[ionizationLevelIndex][(*k1)].back())
{
std::vector<double>::iterator prob22 =
std::vector<G4double>::iterator prob22 =
std::upper_bound(fProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
fProbaShellMap[ionizationLevelIndex][(*k2)].end(),
random);
std::vector<double>::iterator prob21 = prob22 - 1;
std::vector<G4double>::iterator prob21 = prob22 - 1;
valueK1 = *k1;
valueK2 = *k2;
valuePROB21 = *prob21;
valuePROB22 = *prob22;
//G4cout << " " << random << " " << valuePROB21 << " " << valuePROB22 << G4endl;
// G4cout << " " << random << " " << valuePROB21 << " " << valuePROB22 << G4endl;
nrjTransf21 = fNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
nrjTransf22 = fNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
@@ -970,7 +979,7 @@ G4double G4DNABornIonisationModel2::TransferedEnergy(G4ParticleDefinition* /*par
<< nrjTransf12 << " " << nrjTransf21 << " " <<nrjTransf22 << G4endl;
G4cout << "ici" << " " << value << G4endl;
*/
*/
return value;
}
@@ -996,7 +1005,7 @@ G4double G4DNABornIonisationModel2::TransferedEnergy(G4ParticleDefinition* /*par
k,
random);
}
//G4cout << nrj << endl;
// G4cout << nrj << endl;
return nrj;
}
@@ -211,8 +211,8 @@ void G4DNACPA100ElasticModel::Initialise(const G4ParticleDefinition*
while(!eDiffCrossSection.eof())
{
double tDummy;
double eDummy;
G4double tDummy;
G4double eDummy;
eDiffCrossSection>>tDummy>>eDummy;
// SI : mandatory eVecm initialization
@@ -482,16 +482,16 @@ G4double G4DNACPA100ElasticModel::Theta
if (particleDefinition == G4Electron::ElectronDefinition())
{
std::vector<double>::iterator t2 = std::upper_bound(eTdummyVec.begin(),eTdummyVec.end(), k);
std::vector<double>::iterator t1 = t2-1;
std::vector<G4double>::iterator t2 = std::upper_bound(eTdummyVec.begin(),eTdummyVec.end(), k);
std::vector<G4double>::iterator t1 = t2-1;
std::vector<double>::iterator e12 = std::upper_bound(eVecm[(*t1)].begin(),eVecm[(*t1)].end(),
std::vector<G4double>::iterator e12 = std::upper_bound(eVecm[(*t1)].begin(),eVecm[(*t1)].end(),
integrDiff);
std::vector<double>::iterator e11 = e12-1;
std::vector<G4double>::iterator e11 = e12-1;
std::vector<double>::iterator e22 = std::upper_bound(eVecm[(*t2)].begin(),eVecm[(*t2)].end(),
std::vector<G4double>::iterator e22 = std::upper_bound(eVecm[(*t2)].begin(),eVecm[(*t2)].end(),
integrDiff);
std::vector<double>::iterator e21 = e22-1;
std::vector<G4double>::iterator e21 = e22-1;
valueT1 =*t1;
valueT2 =*t2;
@@ -88,6 +88,9 @@ G4DNACPA100IonisationModel::G4DNACPA100IonisationModel(const G4ParticleDefinitio
fasterCode = true;
// Selection of stationary mode
statCode = false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -195,11 +198,11 @@ void G4DNACPA100IonisationModel::Initialise(const G4ParticleDefinition* particle
eTdummyVec.push_back(0.);
while(!eDiffCrossSection.eof())
{
double tDummy;
double eDummy;
G4double tDummy;
G4double eDummy;
eDiffCrossSection>>tDummy>>eDummy;
if (tDummy != eTdummyVec.back()) eTdummyVec.push_back(tDummy);
for (int j=0; j<5; j++)
for (G4int j=0; j<5; j++)
{
eDiffCrossSection>>eDiffCrossSectionData[j][tDummy][eDummy];
@@ -244,7 +247,7 @@ void G4DNACPA100IonisationModel::Initialise(const G4ParticleDefinition* particle
// Initialize water density pointer
fpMolWaterDensity = G4DNAMolecularMaterial::Instance()->GetNumMolPerVolTableFor(G4Material::GetMaterial("G4_WATER"));
//
// AD
fAtomDeexcitation = G4LossTableManager::Instance()->AtomDeexcitation();
if (isInitialised) { return; }
@@ -377,45 +380,9 @@ void G4DNACPA100IonisationModel::SampleSecondaries(std::vector<G4DynamicParticle
//SI: PROTECTION FOR G4LOGLOGINTERPOLATION ON UPPER VALUE
if (k<waterStructure.IonisationEnergy(ionizationShell)) { return; }
// AM: sample deexcitation
// here we assume that H_{2}O electronic levels are the same of Oxigen.
// this can be considered true with a rough 10% error in energy on K-shell,
G4int secNumberInit = 0; // need to know at a certain point the enrgy of secondaries
G4int secNumberFinal = 0; // So I'll make the diference and then sum the energies
G4double bindingEnergy = 0;
bindingEnergy = waterStructure.IonisationEnergy(ionizationShell);
if(fAtomDeexcitation) {
G4int Z = 8;
G4AtomicShellEnumerator as = fKShell;
if (ionizationShell <5 && ionizationShell >1)
{
as = G4AtomicShellEnumerator(4-ionizationShell);
}
else if (ionizationShell <2)
{
as = G4AtomicShellEnumerator(3);
}
// FOR DEBUG ONLY
// if (ionizationShell == 4) {
//
// G4cout << "Z: " << Z << " as: " << as
// << " ionizationShell: " << ionizationShell << " bindingEnergy: "<< bindingEnergy/eV << G4endl;
// G4cout << "Press <Enter> key to continue..." << G4endl;
// G4cin.ignore();
// }
const G4AtomicShell* shell = fAtomDeexcitation->GetAtomicShell(Z, as);
secNumberInit = fvect->size();
fAtomDeexcitation->GenerateParticles(fvect, shell, Z, 0, 0);
secNumberFinal = fvect->size();
}
G4double secondaryKinetic=-1000*eV;
if (useDcs && !fasterCode)
@@ -446,6 +413,14 @@ void G4DNACPA100IonisationModel::SampleSecondaries(std::vector<G4DynamicParticle
G4ThreeVector deltaDirection(dirX,dirY,dirZ);
deltaDirection.rotateUz(primaryDirection);
// SI - For atom. deexc. tagging - 23/05/2017
if (secondaryKinetic>0)
{
G4DynamicParticle* dp = new G4DynamicParticle (G4Electron::Electron(),deltaDirection,secondaryKinetic) ;
fvect->push_back(dp);
}
//
if (particle->GetDefinition() == G4Electron::ElectronDefinition())
{
G4double deltaTotalMomentum = std::sqrt(secondaryKinetic*(secondaryKinetic + 2.*electron_mass_c2 ));
@@ -466,13 +441,49 @@ void G4DNACPA100IonisationModel::SampleSecondaries(std::vector<G4DynamicParticle
else fParticleChangeForGamma->ProposeMomentumDirection(primaryDirection) ;
// note that secondaryKinetic is the energy of the delta ray, not of all secondaries.
// SI - For atom. deexc. tagging - 23/05/2017
// AM: sample deexcitation
// here we assume that H_{2}O electronic levels are the same of Oxigen.
// this can be considered true with a rough 10% error in energy on K-shell,
G4int secNumberInit = 0; // need to know at a certain point the enrgy of secondaries
G4int secNumberFinal = 0; // So I'll make the diference and then sum the energies
if(fAtomDeexcitation) {
G4int Z = 8;
G4AtomicShellEnumerator as = fKShell;
if (ionizationShell <5 && ionizationShell >1)
{
as = G4AtomicShellEnumerator(4-ionizationShell);
}
else if (ionizationShell <2)
{
as = G4AtomicShellEnumerator(3);
}
// FOR DEBUG ONLY
// if (ionizationShell == 4) {
//
// G4cout << "Z: " << Z << " as: " << as
// << " ionizationShell: " << ionizationShell << " bindingEnergy: "<< bindingEnergy/eV << G4endl;
// G4cout << "Press <Enter> key to continue..." << G4endl;
// G4cin.ignore();
// }
const G4AtomicShell* shell = fAtomDeexcitation->GetAtomicShell(Z, as);
secNumberInit = fvect->size();
fAtomDeexcitation->GenerateParticles(fvect, shell, Z, 0, 0);
secNumberFinal = fvect->size();
}
// note that secondaryKinetic is the energy of the delta ray, not of all secondaries.
G4double scatteredEnergy = k-bindingEnergy-secondaryKinetic;
G4double deexSecEnergy = 0;
for (G4int j=secNumberInit; j < secNumberFinal; j++) {
deexSecEnergy = deexSecEnergy + (*fvect)[j]->GetKineticEnergy();
}
if (!statCode)
@@ -486,13 +497,12 @@ void G4DNACPA100IonisationModel::SampleSecondaries(std::vector<G4DynamicParticle
fParticleChangeForGamma->ProposeLocalEnergyDeposit(k-scatteredEnergy);
}
// SI - 29/03/2014
if (secondaryKinetic>0)
{
G4DynamicParticle* dp = new G4DynamicParticle (G4Electron::Electron(),deltaDirection,secondaryKinetic) ;
fvect->push_back(dp);
}
//
// TEST //////////////////////////
// if (secondaryKinetic<0) abort();
// if (scatteredEnergy<0) abort();
// if (k-scatteredEnergy-secondaryKinetic-deexSecEnergy<0) abort();
// if (k-scatteredEnergy<0) abort();
/////////////////////////////////
const G4Track * theIncomingTrack = fParticleChangeForGamma->GetCurrentTrack();
G4DNAChemistryManager::Instance()->CreateWaterMolecule(eIonizedMolecule,
@@ -610,7 +620,7 @@ G4double G4DNACPA100IonisationModel::DifferentialCrossSection(G4ParticleDefiniti
{
G4double sigma = 0.;
if (energyTransfer >= waterStructure.IonisationEnergy(ionizationLevelIndex))
if (energyTransfer >= waterStructure.IonisationEnergy(ionizationLevelIndex)/eV)
{
G4double valueT1 = 0;
G4double valueT2 = 0;
@@ -628,19 +638,19 @@ G4double G4DNACPA100IonisationModel::DifferentialCrossSection(G4ParticleDefiniti
{
// k should be in eV and energy transfer eV also
std::vector<double>::iterator t2 = std::upper_bound(eTdummyVec.begin(),eTdummyVec.end(), k);
std::vector<G4double>::iterator t2 = std::upper_bound(eTdummyVec.begin(),eTdummyVec.end(), k);
std::vector<double>::iterator t1 = t2-1;
std::vector<G4double>::iterator t1 = t2-1;
// SI : the following condition avoids situations where energyTransfer >last vector element
if (energyTransfer <= eVecm[(*t1)].back() && energyTransfer <= eVecm[(*t2)].back() )
{
std::vector<double>::iterator e12 = std::upper_bound(eVecm[(*t1)].begin(),eVecm[(*t1)].end(), energyTransfer);
std::vector<double>::iterator e11 = e12-1;
std::vector<G4double>::iterator e12 = std::upper_bound(eVecm[(*t1)].begin(),eVecm[(*t1)].end(), energyTransfer);
std::vector<G4double>::iterator e11 = e12-1;
std::vector<double>::iterator e22 = std::upper_bound(eVecm[(*t2)].begin(),eVecm[(*t2)].end(), energyTransfer);
std::vector<double>::iterator e21 = e22-1;
std::vector<G4double>::iterator e22 = std::upper_bound(eVecm[(*t2)].begin(),eVecm[(*t2)].end(), energyTransfer);
std::vector<G4double>::iterator e21 = e22-1;
valueT1 =*t1;
valueT2 =*t2;
@@ -886,7 +896,6 @@ G4double G4DNACPA100IonisationModel::RandomizeEjectedElectronEnergyFromCumulated
RandomTransferedEnergy(particleDefinition, k/eV, shell)*eV-waterStructure.IonisationEnergy(shell);
//G4cout << RandomTransferedEnergy(particleDefinition, k/eV, shell) << G4endl;
// SI - 29/03/2014
if (secondaryElectronKineticEnergy<0.) return 0.;
//
@@ -920,9 +929,9 @@ G4double G4DNACPA100IonisationModel::RandomTransferedEnergy
// k should be in eV
std::vector<double>::iterator k2 = std::upper_bound(eTdummyVec.begin(),eTdummyVec.end(), k);
std::vector<G4double>::iterator k2 = std::upper_bound(eTdummyVec.begin(),eTdummyVec.end(), k);
std::vector<double>::iterator k1 = k2-1;
std::vector<G4double>::iterator k1 = k2-1;
/*
G4cout << "----> k=" << k
@@ -942,18 +951,18 @@ G4double G4DNACPA100IonisationModel::RandomTransferedEnergy
{
std::vector<double>::iterator prob12 =
std::vector<G4double>::iterator prob12 =
std::upper_bound(eProbaShellMap[ionizationLevelIndex][(*k1)].begin(),
eProbaShellMap[ionizationLevelIndex][(*k1)].end(), random);
std::vector<double>::iterator prob11 = prob12-1;
std::vector<G4double>::iterator prob11 = prob12-1;
std::vector<double>::iterator prob22 =
std::vector<G4double>::iterator prob22 =
std::upper_bound(eProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
eProbaShellMap[ionizationLevelIndex][(*k2)].end(), random);
std::vector<double>::iterator prob21 = prob22-1;
std::vector<G4double>::iterator prob21 = prob22-1;
valueK1 =*k1;
valueK2 =*k2;
@@ -990,12 +999,12 @@ G4double G4DNACPA100IonisationModel::RandomTransferedEnergy
{
std::vector<double>::iterator prob22 =
std::vector<G4double>::iterator prob22 =
std::upper_bound(eProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
eProbaShellMap[ionizationLevelIndex][(*k2)].end(), random);
std::vector<double>::iterator prob21 = prob22-1;
std::vector<G4double>::iterator prob21 = prob22-1;
valueK1 =*k1;
valueK2 =*k2;
@@ -1198,7 +1207,7 @@ G4double G4DNACPA100IonisationModel::RandomizeEjectedElectronEnergyFromCompositi
return wx3*bb;
*/
// ***** METHOD 2 by M. C. Bordage ***** (optimized)
// ***** METHOD by M. C. Bordage ***** (optimized)
G4double un=1.;
G4double deux=2.;
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNAChampionElasticModel.cc 97520 2016-06-03 14:23:17Z gcosmo $
// $Id: G4DNAChampionElasticModel.cc 105719 2017-08-16 12:36:37Z gcosmo $
//
#include "G4DNAChampionElasticModel.hh"
@@ -178,8 +178,8 @@ void G4DNAChampionElasticModel::Initialise(const G4ParticleDefinition* particle,
while(!eDiffCrossSection.eof())
{
double tDummy;
double eDummy;
G4double tDummy;
G4double eDummy;
eDiffCrossSection >> tDummy >> eDummy;
// SI : mandatory eVecm initialization
@@ -337,19 +337,19 @@ G4double G4DNAChampionElasticModel::Theta(//G4ParticleDefinition * particleDefin
// if (particleDefinition == G4Electron::ElectronDefinition()) // necessaire ?
{
std::vector<double>::iterator t2 = std::upper_bound(eTdummyVec.begin(),
std::vector<G4double>::iterator t2 = std::upper_bound(eTdummyVec.begin(),
eTdummyVec.end(), k);
std::vector<double>::iterator t1 = t2 - 1;
std::vector<G4double>::iterator t1 = t2 - 1;
std::vector<double>::iterator e12 = std::upper_bound(eVecm[(*t1)].begin(),
std::vector<G4double>::iterator e12 = std::upper_bound(eVecm[(*t1)].begin(),
eVecm[(*t1)].end(),
integrDiff);
std::vector<double>::iterator e11 = e12 - 1;
std::vector<G4double>::iterator e11 = e12 - 1;
std::vector<double>::iterator e22 = std::upper_bound(eVecm[(*t2)].begin(),
std::vector<G4double>::iterator e22 = std::upper_bound(eVecm[(*t2)].begin(),
eVecm[(*t2)].end(),
integrDiff);
std::vector<double>::iterator e21 = e22 - 1;
std::vector<G4double>::iterator e21 = e22 - 1;
valueT1 = *t1;
valueT2 = *t2;
@@ -66,13 +66,13 @@ G4DNAEmfietzoglouIonisationModel::G4DNAEmfietzoglouIonisationModel(const G4Parti
G4cout << "Emfietzoglou ionisation model is constructed " << G4endl;
}
//Mark this model as "applicable" for atomic deexcitation
// Mark this model as "applicable" for atomic deexcitation
SetDeexcitationFlag(true);
fAtomDeexcitation = 0;
fParticleChangeForGamma = 0;
fpMolWaterDensity = 0;
// define default angular generator
// Define default angular generator
SetAngularDistribution(new G4DNABornAngle());
SetLowEnergyLimit(10. * eV);
@@ -183,11 +183,11 @@ void G4DNAEmfietzoglouIonisationModel::Initialise(const G4ParticleDefinition* pa
eTdummyVec.push_back(0.);
while(!eDiffCrossSection.eof())
{
double tDummy;
double eDummy;
G4double tDummy;
G4double eDummy;
eDiffCrossSection>>tDummy>>eDummy;
if (tDummy != eTdummyVec.back()) eTdummyVec.push_back(tDummy);
for (int j=0; j<5; j++)
for (G4int j=0; j<5; j++)
{
eDiffCrossSection>>eDiffCrossSectionData[j][tDummy][eDummy];
@@ -227,11 +227,13 @@ void G4DNAEmfietzoglouIonisationModel::Initialise(const G4ParticleDefinition* pa
}
// Initialize water density pointer
fpMolWaterDensity =
G4DNAMolecularMaterial::Instance()->
GetNumMolPerVolTableFor(G4Material::GetMaterial("G4_WATER"));
//
// AD
fAtomDeexcitation = G4LossTableManager::Instance()->AtomDeexcitation();
if (isInitialised)
@@ -370,6 +372,50 @@ SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
ionizationShell = RandomSelect(k,particleName);
G4double bindingEnergy = 0;
bindingEnergy = waterStructure.IonisationEnergy(ionizationShell);
// SI : additional protection if tcs interpolation method is modified
if (k<bindingEnergy) return;
//
G4double secondaryKinetic=-1000*eV;
if (!fasterCode) secondaryKinetic = RandomizeEjectedElectronEnergy(particle->GetDefinition(),k,ionizationShell);
if (fasterCode)
secondaryKinetic = RandomizeEjectedElectronEnergyFromCumulatedDcs(particle->GetDefinition(),k,ionizationShell);
// SI - For atom. deexc. tagging - 23/05/2017
G4int Z = 8;
G4ThreeVector deltaDirection =
GetAngularDistribution()->SampleDirectionForShell(particle, secondaryKinetic,
Z, ionizationShell,
couple->GetMaterial());
if (secondaryKinetic>0)
{
G4DynamicParticle* dp = new G4DynamicParticle (G4Electron::Electron(),deltaDirection,secondaryKinetic);
fvect->push_back(dp);
}
G4double deltaTotalMomentum = std::sqrt(secondaryKinetic*(secondaryKinetic + 2.*electron_mass_c2 ));
G4double finalPx = totalMomentum*primaryDirection.x() - deltaTotalMomentum*deltaDirection.x();
G4double finalPy = totalMomentum*primaryDirection.y() - deltaTotalMomentum*deltaDirection.y();
G4double finalPz = totalMomentum*primaryDirection.z() - deltaTotalMomentum*deltaDirection.z();
G4double finalMomentum = std::sqrt(finalPx*finalPx + finalPy*finalPy + finalPz*finalPz);
finalPx /= finalMomentum;
finalPy /= finalMomentum;
finalPz /= finalMomentum;
G4ThreeVector direction;
direction.set(finalPx,finalPy,finalPz);
fParticleChangeForGamma->ProposeMomentumDirection(direction.unit());
// AM: sample deexcitation
// here we assume that H_{2}O electronic levels are the same as Oxygen.
// this can be considered true with a rough 10% error in energy on K-shell,
@@ -377,14 +423,6 @@ SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
G4int secNumberInit = 0;// need to know at a certain point the energy of secondaries
G4int secNumberFinal = 0;// So I'll make the diference and then sum the energies
G4double bindingEnergy = 0;
bindingEnergy = waterStructure.IonisationEnergy(ionizationShell);
//SI: additional protection if tcs interpolation method is modified
if (k<bindingEnergy) return;
//
G4int Z = 8;
if(fAtomDeexcitation)
{
G4AtomicShellEnumerator as = fKShell;
@@ -413,36 +451,8 @@ SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
secNumberFinal = fvect->size();
}
G4double secondaryKinetic=-1000*eV;
// Note that secondaryKinetic is the energy of the delta ray, not of all secondaries.
if (!fasterCode) secondaryKinetic = RandomizeEjectedElectronEnergy(particle->GetDefinition(),k,ionizationShell);
// SI - 01/04/2014
if (fasterCode)
secondaryKinetic = RandomizeEjectedElectronEnergyFromCumulatedDcs(particle->GetDefinition(),k,ionizationShell);
//
G4ThreeVector deltaDirection =
GetAngularDistribution()->SampleDirectionForShell(particle, secondaryKinetic,
Z, ionizationShell,
couple->GetMaterial());
G4double deltaTotalMomentum = std::sqrt(secondaryKinetic*(secondaryKinetic + 2.*electron_mass_c2 ));
G4double finalPx = totalMomentum*primaryDirection.x() - deltaTotalMomentum*deltaDirection.x();
G4double finalPy = totalMomentum*primaryDirection.y() - deltaTotalMomentum*deltaDirection.y();
G4double finalPz = totalMomentum*primaryDirection.z() - deltaTotalMomentum*deltaDirection.z();
G4double finalMomentum = std::sqrt(finalPx*finalPx + finalPy*finalPy + finalPz*finalPz);
finalPx /= finalMomentum;
finalPy /= finalMomentum;
finalPz /= finalMomentum;
G4ThreeVector direction;
direction.set(finalPx,finalPy,finalPz);
fParticleChangeForGamma->ProposeMomentumDirection(direction.unit());
// note that secondaryKinetic is the energy of the delta ray, not of all secondaries.
G4double scatteredEnergy = k-bindingEnergy-secondaryKinetic;
G4double deexSecEnergy = 0;
for (G4int j=secNumberInit; j < secNumberFinal; j++)
@@ -461,13 +471,12 @@ SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
fParticleChangeForGamma->ProposeLocalEnergyDeposit(k-scatteredEnergy);
}
// SI - 01/04/2014
if (secondaryKinetic>0)
{
G4DynamicParticle* dp = new G4DynamicParticle (G4Electron::Electron(),deltaDirection,secondaryKinetic);
fvect->push_back(dp);
}
//
// TEST //////////////////////////
// if (secondaryKinetic<0) abort();
// if (scatteredEnergy<0) abort();
// if (k-scatteredEnergy-secondaryKinetic-deexSecEnergy<0) abort();
// if (k-scatteredEnergy<0) abort();
/////////////////////////////////
const G4Track * theIncomingTrack = fParticleChangeForGamma->GetCurrentTrack();
G4DNAChemistryManager::Instance()->CreateWaterMolecule(eIonizedMolecule,
@@ -504,7 +513,7 @@ RandomizeEjectedElectronEnergy(G4ParticleDefinition* particleDefinition,
G4double differentialCrossSection = DifferentialCrossSection(particleDefinition, k/eV, value/eV, shell);
if(differentialCrossSection >= crossSectionMaximum) crossSectionMaximum = differentialCrossSection;
}
*/
*/
// SI : alternative method
G4double crossSectionMaximum = 0.;
@@ -591,14 +600,14 @@ RandomizeEjectedElectronEnergy(G4ParticleDefinition* particleDefinition,
*/
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
double G4DNAEmfietzoglouIonisationModel::DifferentialCrossSection(G4ParticleDefinition * particleDefinition,
G4double G4DNAEmfietzoglouIonisationModel::DifferentialCrossSection(G4ParticleDefinition * particleDefinition,
G4double k,
G4double energyTransfer,
G4int ionizationLevelIndex)
{
G4double sigma = 0.;
if(energyTransfer >= waterStructure.IonisationEnergy(ionizationLevelIndex))
if(energyTransfer >= waterStructure.IonisationEnergy(ionizationLevelIndex)/eV)
{
G4double valueT1 = 0;
G4double valueT2 = 0;
@@ -616,27 +625,28 @@ double G4DNAEmfietzoglouIonisationModel::DifferentialCrossSection(G4ParticleDefi
{
// k should be in eV and energy transfer eV also
std::vector<double>::iterator t2 = std::upper_bound(eTdummyVec.begin(),
std::vector<G4double>::iterator t2 = std::upper_bound(eTdummyVec.begin(),
eTdummyVec.end(),
k);
std::vector<double>::iterator t1 = t2 - 1;
std::vector<G4double>::iterator t1 = t2 - 1;
// SI : the following condition avoids situations where energyTransfer >last vector element
if(energyTransfer <= eVecm[(*t1)].back() && energyTransfer
<= eVecm[(*t2)].back())
// added strict limitations (09/08/2017)
if(energyTransfer < eVecm[(*t1)].back() &&
energyTransfer < eVecm[(*t2)].back())
{
std::vector<double>::iterator e12 =
std::vector<G4double>::iterator e12 =
std::upper_bound(eVecm[(*t1)].begin(),
eVecm[(*t1)].end(),
energyTransfer);
std::vector<double>::iterator e11 = e12 - 1;
std::vector<G4double>::iterator e11 = e12 - 1;
std::vector<double>::iterator e22 =
std::vector<G4double>::iterator e22 =
std::upper_bound(eVecm[(*t2)].begin(),
eVecm[(*t2)].end(),
energyTransfer);
std::vector<double>::iterator e21 = e22 - 1;
std::vector<G4double>::iterator e21 = e22 - 1;
valueT1 = *t1;
valueT2 = *t2;
@@ -717,7 +727,7 @@ G4double G4DNAEmfietzoglouIonisationModel::Interpolate(G4double e1,
G4double d2 = xs2;
value = (d1 + (d2 - d1)*(e - e1)/ (e2 - e1));
}
*/
*/
// Switch to log-lin interpolation for faster code
if((e2 - e1) != 0 && xs1 != 0 && xs2 != 0 && fasterCode)
@@ -746,7 +756,7 @@ G4double G4DNAEmfietzoglouIonisationModel::Interpolate(G4double e1,
<< xs2 << " "
<< value
<< G4endl;
*/
*/
return value;
}
@@ -853,9 +863,7 @@ G4double G4DNAEmfietzoglouIonisationModel::RandomizeEjectedElectronEnergyFromCum
- waterStructure.IonisationEnergy(shell);
//G4cout << RandomTransferedEnergy(particleDefinition, k/eV, shell) << G4endl;
// SI - 01/04/2014
if(secondaryElectronKineticEnergy < 0.) return 0.;
//
return secondaryElectronKineticEnergy;
}
@@ -886,9 +894,9 @@ G4double G4DNAEmfietzoglouIonisationModel::RandomTransferedEnergy(G4ParticleDefi
if (particleDefinition == G4Electron::ElectronDefinition())
{
// k should be in eV
std::vector<double>::iterator k2 = std::upper_bound(eTdummyVec.begin(),eTdummyVec.end(), k);
std::vector<G4double>::iterator k2 = std::upper_bound(eTdummyVec.begin(),eTdummyVec.end(), k);
std::vector<double>::iterator k1 = k2-1;
std::vector<G4double>::iterator k1 = k2-1;
/*
G4cout << "----> k=" << k
@@ -906,15 +914,15 @@ G4double G4DNAEmfietzoglouIonisationModel::RandomTransferedEnergy(G4ParticleDefi
&& random <= eProbaShellMap[ionizationLevelIndex][(*k2)].back() )
{
std::vector<double>::iterator prob12 = std::upper_bound(eProbaShellMap[ionizationLevelIndex][(*k1)].begin(),
std::vector<G4double>::iterator prob12 = std::upper_bound(eProbaShellMap[ionizationLevelIndex][(*k1)].begin(),
eProbaShellMap[ionizationLevelIndex][(*k1)].end(), random);
std::vector<double>::iterator prob11 = prob12-1;
std::vector<G4double>::iterator prob11 = prob12-1;
std::vector<double>::iterator prob22 = std::upper_bound(eProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
std::vector<G4double>::iterator prob22 = std::upper_bound(eProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
eProbaShellMap[ionizationLevelIndex][(*k2)].end(), random);
std::vector<double>::iterator prob21 = prob22-1;
std::vector<G4double>::iterator prob21 = prob22-1;
valueK1 =*k1;
valueK2 =*k2;
@@ -948,10 +956,10 @@ G4double G4DNAEmfietzoglouIonisationModel::RandomTransferedEnergy(G4ParticleDefi
if ( random > eProbaShellMap[ionizationLevelIndex][(*k1)].back() )
{
std::vector<double>::iterator prob22 = std::upper_bound(eProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
std::vector<G4double>::iterator prob22 = std::upper_bound(eProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
eProbaShellMap[ionizationLevelIndex][(*k2)].end(), random);
std::vector<double>::iterator prob21 = prob22-1;
std::vector<G4double>::iterator prob21 = prob22-1;
valueK1 =*k1;
valueK2 =*k2;
@@ -199,8 +199,8 @@ G4DNAIonElasticModel::Initialise (
while(!diffCrossSection.eof())
{
double tDummy;
double eDummy;
G4double tDummy;
G4double eDummy;
diffCrossSection>>tDummy>>eDummy;
// SI : mandatory eVecm initialization
@@ -387,19 +387,19 @@ G4DNAIonElasticModel::Theta (G4ParticleDefinition * /*particleDefinition*/,
G4double xs21 = 0;
G4double xs22 = 0;
std::vector<double>::iterator t2 = std::upper_bound(eTdummyVec.begin(),
std::vector<G4double>::iterator t2 = std::upper_bound(eTdummyVec.begin(),
eTdummyVec.end(), k);
std::vector<double>::iterator t1 = t2 - 1;
std::vector<G4double>::iterator t1 = t2 - 1;
std::vector<double>::iterator e12 = std::upper_bound(eVecm[(*t1)].begin(),
std::vector<G4double>::iterator e12 = std::upper_bound(eVecm[(*t1)].begin(),
eVecm[(*t1)].end(),
integrDiff);
std::vector<double>::iterator e11 = e12 - 1;
std::vector<G4double>::iterator e11 = e12 - 1;
std::vector<double>::iterator e22 = std::upper_bound(eVecm[(*t2)].begin(),
std::vector<G4double>::iterator e22 = std::upper_bound(eVecm[(*t2)].begin(),
eVecm[(*t2)].end(),
integrDiff);
std::vector<double>::iterator e21 = e22 - 1;
std::vector<G4double>::iterator e21 = e22 - 1;
valueT1 = *t1;
valueT2 = *t2;
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNAMillerGreenExcitationModel.cc 95948 2016-03-03 10:40:33Z gcosmo $
// $Id: G4DNAMillerGreenExcitationModel.cc 105719 2017-08-16 12:36:37Z gcosmo $
// GEANT4 tag $Name: $
//
@@ -497,7 +497,7 @@ G4int G4DNAMillerGreenExcitationModel::RandomSelect(G4double k,const G4ParticleD
{
G4int i = nLevels;
G4double value = 0.;
std::deque<double> values;
std::deque<G4double> values;
G4DNAGenericIonsManager *instance;
instance = G4DNAGenericIonsManager::Instance();
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNARuddIonisationExtendedModel.cc 104430 2017-05-31 07:43:44Z gcosmo $
// $Id: G4DNARuddIonisationExtendedModel.cc 105034 2017-07-06 08:34:37Z gcosmo $
// GEANT4 tag $Name: $
//
// Modified by Z. Francis, S. Incerti to handle HZE
@@ -37,12 +37,10 @@
#include "G4DNAChemistryManager.hh"
#include "G4DNAMolecularMaterial.hh"
//SEB
#include "G4IonTable.hh"
#include "G4DNARuddAngle.hh"
#include "G4DeltaAngle.hh"
#include "G4Exp.hh"
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -151,7 +149,6 @@ void G4DNARuddIonisationExtendedModel::Initialise(const G4ParticleDefinition* pa
G4ParticleDefinition* alphaPlusDef = instance->GetIon("alpha+");
G4ParticleDefinition* heliumDef = instance->GetIon("helium");
//SEB
//G4ParticleDefinition* carbonDef = instance->GetIon("carbon");
//G4ParticleDefinition* nitrogenDef = instance->GetIon("nitrogen");
//G4ParticleDefinition* oxygenDef = instance->GetIon("oxygen");
@@ -271,7 +268,7 @@ void G4DNARuddIonisationExtendedModel::Initialise(const G4ParticleDefinition* pa
lithium = lithiumDef->GetParticleName();
tableFile[lithium] = fileLithium;
//SEB
//SI
//lowEnergyLimit[carbon] = lowEnergyLimitForA[5] * particle->GetAtomicMass();
//highEnergyLimit[carbon] = 1e6* particle->GetAtomicMass() * MeV;
lowEnergyLimit[lithium] = 0.5*7*MeV;
@@ -291,7 +288,7 @@ void G4DNARuddIonisationExtendedModel::Initialise(const G4ParticleDefinition* pa
beryllium = berylliumDef->GetParticleName();
tableFile[beryllium] = fileBeryllium;
//SEB
//SI
//lowEnergyLimit[carbon] = lowEnergyLimitForA[5] * particle->GetAtomicMass();
//highEnergyLimit[carbon] = 1e6* particle->GetAtomicMass() * MeV;
lowEnergyLimit[beryllium] = 0.5*9*MeV;
@@ -311,7 +308,7 @@ void G4DNARuddIonisationExtendedModel::Initialise(const G4ParticleDefinition* pa
boron = boronDef->GetParticleName();
tableFile[boron] = fileBoron;
//SEB
//SI
//lowEnergyLimit[carbon] = lowEnergyLimitForA[5] * particle->GetAtomicMass();
//highEnergyLimit[carbon] = 1e6* particle->GetAtomicMass() * MeV;
lowEnergyLimit[boron] = 0.5*11*MeV;
@@ -331,7 +328,7 @@ void G4DNARuddIonisationExtendedModel::Initialise(const G4ParticleDefinition* pa
carbon = carbonDef->GetParticleName();
tableFile[carbon] = fileCarbon;
//SEB
//SI
//lowEnergyLimit[carbon] = lowEnergyLimitForA[5] * particle->GetAtomicMass();
//highEnergyLimit[carbon] = 1e6* particle->GetAtomicMass() * MeV;
lowEnergyLimit[carbon] = 0.5*12*MeV;
@@ -351,7 +348,7 @@ void G4DNARuddIonisationExtendedModel::Initialise(const G4ParticleDefinition* pa
oxygen = oxygenDef->GetParticleName();
tableFile[oxygen] = fileOxygen;
//SEB
//SI
//lowEnergyLimit[oxygen] = lowEnergyLimitForA[5]* particle->GetAtomicMass();
//highEnergyLimit[oxygen] = 1e6* particle->GetAtomicMass()* MeV;
lowEnergyLimit[oxygen] = 0.5*16*MeV;
@@ -371,7 +368,7 @@ void G4DNARuddIonisationExtendedModel::Initialise(const G4ParticleDefinition* pa
nitrogen = nitrogenDef->GetParticleName();
tableFile[nitrogen] = fileNitrogen;
//SEB
//SI
//lowEnergyLimit[nitrogen] = lowEnergyLimitForA[5]* particle->GetAtomicMass();
//highEnergyLimit[nitrogen] = 1e6* particle->GetAtomicMass()* MeV;
lowEnergyLimit[nitrogen] = 0.5*14*MeV;
@@ -410,7 +407,7 @@ void G4DNARuddIonisationExtendedModel::Initialise(const G4ParticleDefinition* pa
iron = ironDef->GetParticleName();
tableFile[iron] = fileIron;
//SEB
//SI
//lowEnergyLimit[iron] = lowEnergyLimitForA[5]* particle->GetAtomicMass();
//highEnergyLimit[iron] = 1e6* particle->GetAtomicMass()* MeV;
lowEnergyLimit[iron] = 0.5*56*MeV;
@@ -427,10 +424,10 @@ void G4DNARuddIonisationExtendedModel::Initialise(const G4ParticleDefinition* pa
// **********************************************************************************************
//SEB: not anymore
// SI: not anymore
// ZF Following lines can be replaced by:
//SetLowEnergyLimit(lowEnergyLimit[particle->GetParticleName()]);
//SetHighEnergyLimit(highEnergyLimit[particle->GetParticleName()]);
// SetLowEnergyLimit(lowEnergyLimit[particle->GetParticleName()]);
// SetHighEnergyLimit(highEnergyLimit[particle->GetParticleName()]);
// at least for HZE
if (particle==protonDef)
@@ -543,7 +540,7 @@ G4double G4DNARuddIonisationExtendedModel::CrossSectionPerVolume(const G4Materia
G4double,
G4double)
{
//SEB: particleDefinition->GetParticleName() is for eg. Fe56
//SI: particleDefinition->GetParticleName() is for eg. Fe56
// particleDefinition->GetPDGMass() is correct
// particleDefinition->GetAtomicNumber() is correct
@@ -566,7 +563,7 @@ G4double G4DNARuddIonisationExtendedModel::CrossSectionPerVolume(const G4Materia
&&
particleDefinition != instance->GetIon("helium")
&&
//SEB
// SI
//particleDefinition != instance->GetIon("carbon")
//&&
//particleDefinition != instance->GetIon("nitrogen")
@@ -685,7 +682,7 @@ void G4DNARuddIonisationExtendedModel::SampleSecondaries(std::vector<G4DynamicPa
G4double,
G4double)
{
//SEB: particle->GetDefinition()->GetParticleName() is for eg. Fe56
//SI: particle->GetDefinition()->GetParticleName() is for eg. Fe56
// particle->GetDefinition()->GetPDGMass() is correct
// particle->GetDefinition()->GetAtomicNumber() is correct
// particle->GetDefinition()->GetAtomicMass() is correct
@@ -743,6 +740,7 @@ void G4DNARuddIonisationExtendedModel::SampleSecondaries(std::vector<G4DynamicPa
if (pos2 != highEnergyLimit.end())highLim = pos2->second;
if (k >= lowLim && k <= highLim)
// SI: no strict limits, like in the non extended version of the model
{
G4ParticleDefinition* definition = particle->GetDefinition();
@@ -760,8 +758,6 @@ void G4DNARuddIonisationExtendedModel::SampleSecondaries(std::vector<G4DynamicPa
// here we assume that H_{2}O electronic levels are the same as Oxygen.
// this can be considered true with a rough 10% error in energy on K-shell,
G4int secNumberInit = 0; // need to know at a certain point the energy of secondaries
G4int secNumberFinal = 0; // So I'll make the diference and then sum the energies
G4double bindingEnergy = 0;
bindingEnergy = waterStructure.IonisationEnergy(ionizationShell);
@@ -769,43 +765,22 @@ void G4DNARuddIonisationExtendedModel::SampleSecondaries(std::vector<G4DynamicPa
if (k<bindingEnergy) return;
//
G4int Z = 8;
if(fAtomDeexcitation) {
G4AtomicShellEnumerator as = fKShell;
if (ionizationShell <5 && ionizationShell >1)
{
as = G4AtomicShellEnumerator(4-ionizationShell);
}
else if (ionizationShell <2)
{
as = G4AtomicShellEnumerator(3);
}
// DEBUG
// if (ionizationShell == 4) {
//
// G4cout << "Z: " << Z << " as: " << as
// << " ionizationShell: " << ionizationShell << " bindingEnergy: "<< bindingEnergy/eV << G4endl;
// G4cout << "Press <Enter> key to continue..." << G4endl;
// G4cin.ignore();
// }
const G4AtomicShell* shell = fAtomDeexcitation->GetAtomicShell(Z, as);
secNumberInit = fvect->size();
fAtomDeexcitation->GenerateParticles(fvect, shell, Z, 0, 0);
secNumberFinal = fvect->size();
}
G4double secondaryKinetic = RandomizeEjectedElectronEnergy(definition,k,ionizationShell);
G4int Z = 8;
G4ThreeVector deltaDirection =
GetAngularDistribution()->SampleDirectionForShell(particle, secondaryKinetic,
Z, ionizationShell,
couple->GetMaterial());
G4DynamicParticle* dp = new G4DynamicParticle (G4Electron::Electron(),deltaDirection,secondaryKinetic) ;
fvect->push_back(dp);
fParticleChangeForGamma->ProposeMomentumDirection(primaryDirection);
G4double scatteredEnergy = k-bindingEnergy-secondaryKinetic;
// SI: the following lines are not needed anymore
/*
G4double cosTheta = 0.;
@@ -837,14 +812,41 @@ void G4DNARuddIonisationExtendedModel::SampleSecondaries(std::vector<G4DynamicPa
fParticleChangeForGamma->ProposeMomentumDirection(direction.unit()) ;
*/
G4int secNumberInit = 0; // need to know at a certain point the energy of secondaries
G4int secNumberFinal = 0; // So I'll make the diference and then sum the energies
fParticleChangeForGamma->ProposeMomentumDirection(primaryDirection);
G4double scatteredEnergy = k-bindingEnergy-secondaryKinetic;
if(fAtomDeexcitation) {
G4AtomicShellEnumerator as = fKShell;
if (ionizationShell <5 && ionizationShell >1)
{
as = G4AtomicShellEnumerator(4-ionizationShell);
}
else if (ionizationShell <2)
{
as = G4AtomicShellEnumerator(3);
}
// DEBUG
// if (ionizationShell == 4) {
//
// G4cout << "Z: " << Z << " as: " << as
// << " ionizationShell: " << ionizationShell << " bindingEnergy: "<< bindingEnergy/eV << G4endl;
// G4cout << "Press <Enter> key to continue..." << G4endl;
// G4cin.ignore();
// }
const G4AtomicShell* shell = fAtomDeexcitation->GetAtomicShell(Z, as);
secNumberInit = fvect->size();
fAtomDeexcitation->GenerateParticles(fvect, shell, Z, 0, 0);
secNumberFinal = fvect->size();
}
G4double deexSecEnergy = 0;
for (G4int j=secNumberInit; j < secNumberFinal; j++) {
deexSecEnergy = deexSecEnergy + (*fvect)[j]->GetKineticEnergy();
}
if (!statCode)
@@ -858,8 +860,12 @@ void G4DNARuddIonisationExtendedModel::SampleSecondaries(std::vector<G4DynamicPa
fParticleChangeForGamma->ProposeLocalEnergyDeposit(k-scatteredEnergy);
}
G4DynamicParticle* dp = new G4DynamicParticle (G4Electron::Electron(),deltaDirection,secondaryKinetic) ;
fvect->push_back(dp);
// TEST //////////////////////////
// if (secondaryKinetic<0) abort();
// if (scatteredEnergy<0) abort();
// if (k-scatteredEnergy-secondaryKinetic-deexSecEnergy<0) abort();
// if (k-scatteredEnergy<0) abort();
/////////////////////////////////
const G4Track * theIncomingTrack = fParticleChangeForGamma->GetCurrentTrack();
G4DNAChemistryManager::Instance()->CreateWaterMolecule(eIonizedMolecule,
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNARuddIonisationModel.cc 104430 2017-05-31 07:43:44Z gcosmo $
// $Id: G4DNARuddIonisationModel.cc 105034 2017-07-06 08:34:37Z gcosmo $
// GEANT4 tag $Name: $
//
@@ -77,10 +77,10 @@ G4DNARuddIonisationModel::G4DNARuddIonisationModel(const G4ParticleDefinition*,
G4cout << "Rudd ionisation model is constructed " << G4endl;
}
// define default angular generator
// Define default angular generator
SetAngularDistribution(new G4DNARuddAngle());
//Mark this model as "applicable" for atomic deexcitation
// Mark this model as "applicable" for atomic deexcitation
SetDeexcitationFlag(true);
fAtomDeexcitation = 0;
fParticleChangeForGamma = 0;
@@ -105,7 +105,7 @@ G4DNARuddIonisationModel::~G4DNARuddIonisationModel()
// The following removal is forbidden since G4VEnergyLossmodel takes care of deletion
// Coverity however will signal this as an error
//if (fAtomDeexcitation) {delete fAtomDeexcitation;}
// if (fAtomDeexcitation) {delete fAtomDeexcitation;}
}
@@ -482,13 +482,6 @@ void G4DNARuddIonisationModel::SampleSecondaries(std::vector<G4DynamicParticle*>
G4int ionizationShell = RandomSelect(k,particleName);
// sample deexcitation
// here we assume that H_{2}O electronic levels are the same of Oxigen.
// this can be considered true with a rough 10% error in energy on K-shell,
G4int secNumberInit = 0;// need to know at a certain point the enrgy of secondaries
G4int secNumberFinal = 0;// So I'll make the diference and then sum the energies
G4double bindingEnergy = 0;
bindingEnergy = waterStructure.IonisationEnergy(ionizationShell);
@@ -496,7 +489,47 @@ void G4DNARuddIonisationModel::SampleSecondaries(std::vector<G4DynamicParticle*>
if (k<bindingEnergy) return;
//
// SI - For atom. deexc. tagging - 23/05/2017
G4int Z = 8;
//
G4double secondaryKinetic = RandomizeEjectedElectronEnergy(definition,k,ionizationShell);
G4ThreeVector deltaDirection =
GetAngularDistribution()->SampleDirectionForShell(particle, secondaryKinetic,
Z, ionizationShell,
couple->GetMaterial());
G4DynamicParticle* dp = new G4DynamicParticle (G4Electron::Electron(),deltaDirection,secondaryKinetic);
fvect->push_back(dp);
// Ignored for ions on electrons
/*
G4double deltaTotalMomentum = std::sqrt(secondaryKinetic*(secondaryKinetic + 2.*electron_mass_c2 ));
G4double finalPx = totalMomentum*primaryDirection.x() - deltaTotalMomentum*deltaDirection.x();
G4double finalPy = totalMomentum*primaryDirection.y() - deltaTotalMomentum*deltaDirection.y();
G4double finalPz = totalMomentum*primaryDirection.z() - deltaTotalMomentum*deltaDirection.z();
G4double finalMomentum = std::sqrt(finalPx*finalPx+finalPy*finalPy+finalPz*finalPz);
finalPx /= finalMomentum;
finalPy /= finalMomentum;
finalPz /= finalMomentum;
G4ThreeVector direction;
direction.set(finalPx,finalPy,finalPz);
fParticleChangeForGamma->ProposeMomentumDirection(direction.unit()) ;
*/
fParticleChangeForGamma->ProposeMomentumDirection(primaryDirection);
// sample deexcitation
// here we assume that H_{2}O electronic levels are the same of Oxigen.
// this can be considered true with a rough 10% error in energy on K-shell,
G4int secNumberInit = 0;// need to know at a certain point the enrgy of secondaries
G4int secNumberFinal = 0;// So I'll make the diference and then sum the energies
if(fAtomDeexcitation)
{
G4AtomicShellEnumerator as = fKShell;
@@ -525,39 +558,11 @@ void G4DNARuddIonisationModel::SampleSecondaries(std::vector<G4DynamicParticle*>
secNumberFinal = fvect->size();
}
G4double secondaryKinetic = RandomizeEjectedElectronEnergy(definition,k,ionizationShell);
G4ThreeVector deltaDirection =
GetAngularDistribution()->SampleDirectionForShell(particle, secondaryKinetic,
Z, ionizationShell,
couple->GetMaterial());
// Ignored for ions on electrons
/*
G4double deltaTotalMomentum = std::sqrt(secondaryKinetic*(secondaryKinetic + 2.*electron_mass_c2 ));
G4double finalPx = totalMomentum*primaryDirection.x() - deltaTotalMomentum*deltaDirection.x();
G4double finalPy = totalMomentum*primaryDirection.y() - deltaTotalMomentum*deltaDirection.y();
G4double finalPz = totalMomentum*primaryDirection.z() - deltaTotalMomentum*deltaDirection.z();
G4double finalMomentum = std::sqrt(finalPx*finalPx+finalPy*finalPy+finalPz*finalPz);
finalPx /= finalMomentum;
finalPy /= finalMomentum;
finalPz /= finalMomentum;
G4ThreeVector direction;
direction.set(finalPx,finalPy,finalPz);
fParticleChangeForGamma->ProposeMomentumDirection(direction.unit()) ;
*/
fParticleChangeForGamma->ProposeMomentumDirection(primaryDirection);
G4double scatteredEnergy = k-bindingEnergy-secondaryKinetic;
G4double deexSecEnergy = 0;
for (G4int j=secNumberInit; j < secNumberFinal; j++)
{
deexSecEnergy = deexSecEnergy + (*fvect)[j]->GetKineticEnergy();
}
if (!statCode)
@@ -577,8 +582,12 @@ void G4DNARuddIonisationModel::SampleSecondaries(std::vector<G4DynamicParticle*>
// = bindingEnergy-deexSecEnergy
// SO deexSecEnergy=0 => LocalEnergyDeposit = bindingEnergy
G4DynamicParticle* dp = new G4DynamicParticle (G4Electron::Electron(),deltaDirection,secondaryKinetic);
fvect->push_back(dp);
// TEST //////////////////////////
// if (secondaryKinetic<0) abort();
// if (scatteredEnergy<0) abort();
// if (k-scatteredEnergy-secondaryKinetic-deexSecEnergy<0) abort();
// if (k-scatteredEnergy<0) abort();
/////////////////////////////////
const G4Track * theIncomingTrack = fParticleChangeForGamma->GetCurrentTrack();
G4DNAChemistryManager::Instance()->CreateWaterMolecule(eIonizedMolecule,
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNASancheExcitationModel.cc 98733 2016-08-09 10:51:58Z gcosmo $
// $Id: G4DNASancheExcitationModel.cc 105719 2017-08-16 12:36:37Z gcosmo $
//
// Created by Z. Francis
@@ -153,17 +153,17 @@ Initialise(const G4ParticleDefinition* /*particle*/,
tdummyVec.clear();
//
double t;
double xs;
G4double t;
G4double xs;
while(!input.eof())
{
input>>t;
tdummyVec.push_back(t);
fEnergyLevelXS.push_back(std::vector<double>());
fEnergyLevelXS.push_back(std::vector<G4double>());
fEnergyTotalXS.push_back(0);
std::vector<double>& levelXS = fEnergyLevelXS.back();
std::vector<G4double>& levelXS = fEnergyLevelXS.back();
levelXS.reserve(9);
// G4cout<<t;
@@ -300,19 +300,19 @@ void G4DNASancheExcitationModel::SampleSecondaries(std::vector<
G4double G4DNASancheExcitationModel::PartialCrossSection(G4double t,
G4int level)
{
std::vector<double>::iterator t2 = std::upper_bound(tdummyVec.begin(),
std::vector<G4double>::iterator t2 = std::upper_bound(tdummyVec.begin(),
tdummyVec.end(), t / eV);
std::vector<double>::iterator t1 = t2 - 1;
std::vector<G4double>::iterator t1 = t2 - 1;
size_t i1 = t1 - tdummyVec.begin();
size_t i2 = t2 - tdummyVec.begin();
double sigma = LinInterpolate((*t1), (*t2),
G4double sigma = LinInterpolate((*t1), (*t2),
t / eV,
fEnergyLevelXS[i1][level],
fEnergyLevelXS[i2][level]);
static const double conv_factor = 1e-16 * cm * cm;
static const G4double conv_factor = 1e-16 * cm * cm;
sigma *= conv_factor;
if (sigma == 0.) sigma = 1e-30;
@@ -323,19 +323,19 @@ G4double G4DNASancheExcitationModel::PartialCrossSection(G4double t,
G4double G4DNASancheExcitationModel::TotalCrossSection(G4double t)
{
std::vector<double>::iterator t2 = std::upper_bound(tdummyVec.begin(),
std::vector<G4double>::iterator t2 = std::upper_bound(tdummyVec.begin(),
tdummyVec.end(), t / eV);
std::vector<double>::iterator t1 = t2 - 1;
std::vector<G4double>::iterator t1 = t2 - 1;
size_t i1 = t1 - tdummyVec.begin();
size_t i2 = t2 - tdummyVec.begin();
double sigma = LinInterpolate((*t1), (*t2),
G4double sigma = LinInterpolate((*t1), (*t2),
t / eV,
fEnergyTotalXS[i1],
fEnergyTotalXS[i2]);
static const double conv_factor = 1e-16 * cm * cm;
static const G4double conv_factor = 1e-16 * cm * cm;
sigma *= conv_factor;
if (sigma == 0.) sigma = 1e-30;
@@ -360,7 +360,7 @@ G4int G4DNASancheExcitationModel::RandomSelect(G4double k)
G4int i = nLevels;
G4double value = 0.;
std::deque<double> values;
std::deque<G4double> values;
while (i > 0)
{