Import Geant4 11.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2022-12-09 14:43:28 +01:00
parent c07cea1fe0
commit 9f34590941
3810 changed files with 200490 additions and 182326 deletions
@@ -234,8 +234,8 @@ G4int G4DNABornExcitationModel1::RandomSelect(G4double k)
G4int level = 0;
G4double* valuesBuffer = new G4double[fTableData->NumberOfComponents()];
const size_t n(fTableData->NumberOfComponents());
size_t i(n);
const G4int n = (G4int)fTableData->NumberOfComponents();
G4int i(n);
G4double value = 0.;
while (i > 0)
@@ -131,24 +131,24 @@ void G4DNABornExcitationModel2::Initialise(const G4ParticleDefinition* particle,
fTableData = new G4PhysicsTable();
fTableData->RetrievePhysicsTable(fullFileName.str().c_str(), true);
/*
for(size_t level = 0; level<fTableData->size(); ++level)
for(std::size_t level = 0; level<fTableData->size(); ++level)
{
//(*fTableData)(level)->ScaleVector(1,scaleFactor);
}
*/
size_t finalBin_i = 2000;
std::size_t finalBin_i = 2000;
G4double E_min = fLowEnergy;
G4double E_max = fHighEnergy;
fTotalXS = new G4PhysicsLogVector(E_min, E_max, finalBin_i, true);
G4double energy;
G4double finalXS;
for(size_t energy_i = 0; energy_i < finalBin_i; ++energy_i)
for(std::size_t energy_i = 0; energy_i < finalBin_i; ++energy_i)
{
energy = fTotalXS->Energy(energy_i);
finalXS = 0;
for(size_t level = 0; level<fTableData->size(); ++level)
for(std::size_t level = 0; level<fTableData->size(); ++level)
{
finalXS += (*fTableData)(level)->Value(energy);
}
@@ -207,7 +207,7 @@ G4double G4DNABornExcitationModel2::CrossSectionPerVolume(const G4Material* mate
{
sigma = fTotalXS->Value(ekin, fLastBinCallForFinalXS);
// for(size_t i = 0; i < 5; ++i)
// for(std::size_t i = 0; i < 5; ++i)
// sigma += (*fTableData)[i]->Value(ekin);
if(sigma == 0)
@@ -288,8 +288,8 @@ G4double G4DNABornExcitationModel2::GetPartialCrossSection(const G4Material*,
G4int G4DNABornExcitationModel2::RandomSelect(G4double k)
{
const size_t n(fTableData->size());
size_t i(n);
const std::size_t n(fTableData->size());
std::size_t i(n);
G4double value = fTotalXS->Value(k, fLastBinCallForFinalXS);
@@ -305,7 +305,7 @@ G4int G4DNABornExcitationModel2::RandomSelect(G4double k)
partialXS = (*fTableData)(i)->Value(k);
if (partialXS > value)
{
return i;
return (G4int)i;
}
value -= partialXS;
}
@@ -520,8 +520,8 @@ void G4DNABornIonisationModel1::SampleSecondaries(std::vector<G4DynamicParticle*
// 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,
size_t secNumberInit = 0;// need to know at a certain point the energy of secondaries
size_t secNumberFinal = 0;// So I'll make the diference and then sum the energies
std::size_t secNumberInit = 0;// need to know at a certain point the energy of secondaries
std::size_t secNumberFinal = 0;// So I'll make the diference and then sum the energies
G4double scatteredEnergy = k-bindingEnergy-secondaryKinetic;
@@ -540,7 +540,7 @@ void G4DNABornIonisationModel1::SampleSecondaries(std::vector<G4DynamicParticle*
if(secNumberFinal > secNumberInit)
{
for (size_t i=secNumberInit; i<secNumberFinal; ++i)
for (std::size_t i=secNumberInit; i<secNumberFinal; ++i)
{
//Check if there is enough residual energy
if (bindingEnergy >= ((*fvect)[i])->GetKineticEnergy())
@@ -990,8 +990,8 @@ G4int G4DNABornIonisationModel1::RandomSelect(G4double k,
if (table != 0)
{
G4double* valuesBuffer = new G4double[table->NumberOfComponents()];
const size_t n(table->NumberOfComponents());
size_t i(n);
const G4int n = (G4int)table->NumberOfComponents();
G4int i(n);
G4double value = 0.;
while (i > 0)
@@ -397,8 +397,8 @@ void G4DNABornIonisationModel2::SampleSecondaries(std::vector<G4DynamicParticle*
// 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,
size_t secNumberInit = 0;
size_t secNumberFinal = 0;
std::size_t secNumberInit = 0;
std::size_t secNumberFinal = 0;
G4double bindingEnergy = 0;
bindingEnergy = waterStructure.IonisationEnergy(ionizationShell);
@@ -420,7 +420,7 @@ void G4DNABornIonisationModel2::SampleSecondaries(std::vector<G4DynamicParticle*
if(secNumberFinal > secNumberInit)
{
for (size_t i=secNumberInit; i<secNumberFinal; ++i)
for (std::size_t i=secNumberInit; i<secNumberFinal; ++i)
{
//Check if there is enough residual energy
if (bindingEnergy >= ((*fvect)[i])->GetKineticEnergy())
@@ -802,8 +802,8 @@ G4int G4DNABornIonisationModel2::RandomSelect(G4double k)
G4int level = 0;
G4double* valuesBuffer = new G4double[fTableData->NumberOfComponents()];
const size_t n(fTableData->NumberOfComponents());
size_t i(n);
const G4int n = (G4int)fTableData->NumberOfComponents();
G4int i(n);
G4double value = 0.;
while (i > 0)
@@ -344,8 +344,8 @@ G4int G4DNACPA100ExcitationModel::RandomSelect(G4double k, const G4String& parti
if (table != 0)
{
G4double* valuesBuffer = new G4double[table->NumberOfComponents()];
const size_t n(table->NumberOfComponents());
size_t i(n);
const G4int n = (G4int)table->NumberOfComponents();
G4int i(n);
G4double value = 0.;
//Verification
@@ -395,8 +395,8 @@ void G4DNACPA100IonisationModel::SampleSecondaries(std::vector<G4DynamicParticle
// 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,
size_t secNumberInit = 0;// need to know at a certain point the energy of secondaries
size_t secNumberFinal = 0;// So I'll make the diference and then sum the energies
std::size_t secNumberInit = 0;// need to know at a certain point the energy of secondaries
std::size_t secNumberFinal = 0;// So I'll make the diference and then sum the energies
G4double scatteredEnergy = k-bindingEnergy-secondaryKinetic;
@@ -412,7 +412,7 @@ void G4DNACPA100IonisationModel::SampleSecondaries(std::vector<G4DynamicParticle
if(secNumberFinal > secNumberInit)
{
for (size_t i=secNumberInit; i<secNumberFinal; ++i)
for (std::size_t i=secNumberInit; i<secNumberFinal; ++i)
{
//Check if there is enough residual energy
if (bindingEnergy >= ((*fvect)[i])->GetKineticEnergy())
@@ -737,8 +737,8 @@ G4int G4DNACPA100IonisationModel::RandomSelect(G4double k, const G4String& parti
if (table != 0)
{
G4double* valuesBuffer = new G4double[table->NumberOfComponents()];
const size_t n(table->NumberOfComponents());
size_t i(n);
const G4int n = (G4int)table->NumberOfComponents();
G4int i(n);
G4double value = 0.;
//Verification
@@ -47,7 +47,6 @@ G4DNADingfelderChargeDecreaseModel::G4DNADingfelderChargeDecreaseModel(const G4P
const G4String& nam) :
G4VEmModel(nam), isInitialised(false)
{
fpMolWaterDensity = 0;
numberOfPartialCrossSections[0] = 0;
numberOfPartialCrossSections[1] = 0;
numberOfPartialCrossSections[2] = 0;
@@ -64,8 +63,6 @@ G4VEmModel(nam), isInitialised(false)
{
G4cout << "Dingfelder charge decrease model is constructed " << G4endl;
}
fParticleChangeForGamma = 0;
// Selection of stationary mode
statCode = false;
@@ -73,12 +70,6 @@ G4VEmModel(nam), isInitialised(false)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4DNADingfelderChargeDecreaseModel::~G4DNADingfelderChargeDecreaseModel()
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4DNADingfelderChargeDecreaseModel::Initialise(const G4ParticleDefinition* particle,
const G4DataVector& /*cuts*/)
{
@@ -279,16 +279,18 @@ G4int G4DNADiracRMatrixExcitationModel::RandomSelect
G4double kineticEnergy)
{
G4double value = 0.;
std::size_t NOfComp = fTableData->NumberOfComponents();
G4double* valuesBuffer = new G4double[fTableData->NumberOfComponents()];
auto valuesBuffer = new G4double[NOfComp];
const size_t n(fTableData->NumberOfComponents());
const G4int n = (G4int)fTableData->NumberOfComponents();
size_t i(n);
G4int i(n);
while (i > 0)
{
i--;
--i;
if
((fLowEnergyLimit<=kineticEnergy)&&(kineticEnergy<fExperimentalEnergyLimit))
{
@@ -306,7 +308,7 @@ G4int G4DNADiracRMatrixExcitationModel::RandomSelect
i = n;
while (i > 0)
{
i--;
--i;
if (valuesBuffer[i] > value)
{
delete[] valuesBuffer;
@@ -53,14 +53,14 @@ G4VEmModel(nam), isInitialised(false)
G4ProductionCutsTable* theCoupleTable =
G4ProductionCutsTable::GetProductionCutsTable();
G4int numOfCouples = theCoupleTable->GetTableSize();
G4int numOfCouples = (G4int)theCoupleTable->GetTableSize();
for(G4int i=0; i<numOfCouples; ++i)
{
const G4MaterialCutsCouple* couple =
theCoupleTable->GetMaterialCutsCouple(i);
const G4Material* material = couple->GetMaterial();
G4int nelm = material->GetNumberOfElements();
G4int nelm = (G4int)material->GetNumberOfElements();
const G4ElementVector* theElementVector = material->GetElementVector();
if(nelm==1)
@@ -163,7 +163,7 @@ const G4DataVector& )
G4ProductionCutsTable* theCoupleTable =
G4ProductionCutsTable::GetProductionCutsTable();
G4int numOfCouples = theCoupleTable->GetTableSize();
G4int numOfCouples = (G4int)theCoupleTable->GetTableSize();
// UNIT OF TCS
G4double scaleFactor = 1.*cm*cm;
@@ -182,7 +182,7 @@ const G4DataVector& )
const G4Material* material = couple->GetMaterial();
const G4ElementVector* theElementVector = material->GetElementVector();
G4int nelm = material->GetNumberOfElements();
G4int nelm = (G4int)material->GetNumberOfElements();
if (nelm==1){// Protection: only for single element
G4int Z = G4lrint((*theElementVector)[0]->GetZ());
if (Z!=79)// Protection: only for GOLD
@@ -404,10 +404,11 @@ G4double G4DNAELSEPAElasticModel::CrossSectionPerVolume
G4double sigma=0;
const G4ElementVector* theElementVector = material->GetElementVector();
G4int nelm = material->GetNumberOfElements();
if (nelm==1) {// Protection: only for single element
std::size_t nelm = material->GetNumberOfElements();
if (nelm==1) // Protection: only for single element
{
// Protection: only for GOLD
if (material->GetZ()!=79) return 0;
if (material->GetZ()!=79) return 0.0;
G4int Z = G4lrint((*theElementVector)[0]->GetZ());
@@ -458,46 +459,48 @@ G4double G4DNAELSEPAElasticModel::CrossSectionPerVolume
<< sigma*atomicNDensity/(1./cm) << G4endl;
G4cout << "=== G4DNAELSEPAElasticModel - XS INFO END" << G4endl;
}
}else{
fpMolDensity =
G4DNAMolecularMaterial::Instance()->
GetNumMolPerVolTableFor(G4Material::GetMaterial("G4_WATER"));
atomicNDensity = (*fpMolDensity)[material->GetIndex()];
if(atomicNDensity!= 0.0)
{
if (ekin < HighEnergyLimit() && ekin >= LowEnergyLimit())
{
//std::map< G4int,G4DNACrossSectionDataSet*,
//std::less<G4String> >::iterator pos;
////pos = tableZData_H2O.find(0); // the data is stored as Z=0
//pos = tableZData.find(0); // the data is stored as Z=0
////SI : XS must not be zero
//// otherwise sampling of secondaries method ignored
////if (pos != tableZData_H2O.end())
//if (pos != tableZData.end())
//{
// G4DNACrossSectionDataSet* table = pos->second;
// if (table != 0)
// {
// sigma = table->FindValue(ekin);
// }
//}
}
else
{
fpMolDensity =
G4DNAMolecularMaterial::Instance()->
GetNumMolPerVolTableFor(G4Material::GetMaterial("G4_WATER"));
atomicNDensity = (*fpMolDensity)[material->GetIndex()];
if(atomicNDensity!= 0.0)
{
if (ekin < HighEnergyLimit() && ekin >= LowEnergyLimit())
{
//std::map< G4int,G4DNACrossSectionDataSet*,
//std::less<G4String> >::iterator pos;
////pos = tableZData_H2O.find(0); // the data is stored as Z=0
//pos = tableZData.find(0); // the data is stored as Z=0
////SI : XS must not be zero
//// otherwise sampling of secondaries method ignored
////if (pos != tableZData_H2O.end())
//if (pos != tableZData.end())
//{
// G4DNACrossSectionDataSet* table = pos->second;
// if (table != 0)
// {
// sigma = table->FindValue(ekin);
// }
//}
sigma = fpData_H2O->FindValue(ekin);
}
}
if (verboseLevel > 2)
{
G4cout << "__________________________________" << G4endl;
G4cout << "=== G4DNAELSEPAElasticModel - XS INFO START" << G4endl;
G4cout << "=== Kinetic energy(eV)=" << ekin/eV
<< " particle : " << particle->GetParticleName() << G4endl;
G4cout << "=== Cross section per water molecule (cm^2)="
<< sigma/cm/cm << G4endl;
G4cout << "=== Cross section per water molecule (cm^-1)="
<< sigma*atomicNDensity/(1./cm) << G4endl;
G4cout << "=== G4DNAELSEPAElasticModel - XS INFO END" << G4endl;
}
sigma = fpData_H2O->FindValue(ekin);
}
}
if (verboseLevel > 2)
{
G4cout << "__________________________________" << G4endl;
G4cout << "=== G4DNAELSEPAElasticModel - XS INFO START" << G4endl;
G4cout << "=== Kinetic energy(eV)=" << ekin/eV
<< " particle : " << particle->GetParticleName() << G4endl;
G4cout << "=== Cross section per water molecule (cm^2)="
<< sigma/cm/cm << G4endl;
G4cout << "=== Cross section per water molecule (cm^-1)="
<< sigma*atomicNDensity/(1./cm) << G4endl;
G4cout << "=== G4DNAELSEPAElasticModel - XS INFO END" << G4endl;
}
}
return sigma*atomicNDensity;
@@ -523,8 +526,9 @@ void G4DNAELSEPAElasticModel::SampleSecondaries(
const G4Material* material = couple->GetMaterial();
const G4ElementVector* theElementVector = material->GetElementVector();
G4int nelm = material->GetNumberOfElements();
if (nelm==1){// Protection: only for single element
std::size_t nelm = material->GetNumberOfElements();
if (nelm==1) // Protection: only for single element
{
G4int Z = G4lrint((*theElementVector)[0]->GetZ());
if (Z!=79) return;
if (electronEnergy0 < fkillBelowEnergy_Au)
@@ -539,9 +543,12 @@ void G4DNAELSEPAElasticModel::SampleSecondaries(
if(electronEnergy0>= fkillBelowEnergy_Au && electronEnergy0 < fhighEnergyLimit)
{
G4double cosTheta = 0;
if (electronEnergy0>=10*eV){
cosTheta = RandomizeCosTheta(Z,electronEnergy0);
}else {
if (electronEnergy0>=10*eV)
{
cosTheta = RandomizeCosTheta(Z,electronEnergy0);
}
else
{
cosTheta = RandomizeCosTheta(Z,10*eV);
}
@@ -561,8 +568,11 @@ void G4DNAELSEPAElasticModel::SampleSecondaries(
fParticleChangeForGamma->SetProposedKineticEnergy(electronEnergy0);
}
}else{
if(material->GetName()=="G4_WATER"){
}
else
{
if(material->GetName()=="G4_WATER")
{
//The data for water is stored as Z=0
G4double cosTheta = RandomizeCosTheta(0,electronEnergy0);
@@ -242,8 +242,8 @@ G4int G4DNAEmfietzoglouExcitationModel::RandomSelect(G4double k, const G4String&
if (table != 0)
{
G4double* valuesBuffer = new G4double[table->NumberOfComponents()];
const size_t n(table->NumberOfComponents());
size_t i(n);
const G4int n = (G4int)table->NumberOfComponents();
G4int i(n);
G4double value = 0.;
//Check reading of initial xs file
@@ -256,7 +256,7 @@ G4int G4DNAEmfietzoglouExcitationModel::RandomSelect(G4double k, const G4String&
//G4cout << table->GetComponent(6)->FindValue(k)/ ((1.e-22 / 3.343) * m*m) << G4endl;
//abort();
while (i>0)
while (i>0)
{
i--;
valuesBuffer[i] = table->GetComponent(i)->FindValue(k);
@@ -751,18 +751,17 @@ G4int G4DNAEmfietzoglouIonisationModel::RandomSelect(G4double k,
{
G4int level = 0;
std::map<G4String, G4DNACrossSectionDataSet*, std::less<G4String> >::iterator pos;
pos = tableData.find(particle);
auto pos = tableData.find(particle);
if(pos != tableData.end())
if(pos != tableData.cend())
{
G4DNACrossSectionDataSet* table = pos->second;
if(table != 0)
{
G4double* valuesBuffer = new G4double[table->NumberOfComponents()];
const size_t n(table->NumberOfComponents());
size_t i(n);
const G4int n = (G4int)table->NumberOfComponents();
G4int i(n);
G4double value = 0.;
while(i > 0)
@@ -125,6 +125,14 @@ void G4DNAIRT::Initialize(){
SpaceBinning(); // 1. binning the space
IRTSampling(); // 2. Sampling of the IRT
//hoang : if the first IRTSampling won't give any reactions, end the simu.
if(fReactionSet->Empty())
{
for (auto pTrack : *fTrackHolder->GetMainList())
{
pTrack->SetGlobalTime(G4Scheduler::Instance()->GetEndTime());
}
}
}
void G4DNAIRT::SpaceBinning(){
@@ -150,7 +150,7 @@ G4DNAIRTMoleculeEncounterStepper::CalculateStep(const G4Track& trackA,
return DBL_MAX;
}
G4int nbReactives = pReactantList->size();
G4int nbReactives = (G4int)pReactantList->size();
if (nbReactives == 0)
{
@@ -178,7 +178,7 @@ G4DNAIRTMoleculeEncounterStepper::CalculateStep(const G4Track& trackA,
//__________________________________________________________________
// Start looping on possible reactants
for (G4int i = 0; i < nbReactives; i++)
for (G4int i = 0; i < nbReactives; ++i)
{
auto pMoleculeB = (*pReactantList)[i];
@@ -117,7 +117,7 @@ G4double G4DNAIndependentReactionTimeStepper::CalculateStep(
return DBL_MAX;
}
G4int nbReactives = pReactantList->size();
G4int nbReactives = (G4int)pReactantList->size();
if(nbReactives == 0)
{
@@ -142,7 +142,7 @@ G4double G4DNAIndependentReactionTimeStepper::CalculateStep(
}
fReactants = std::make_shared<vector<G4Track*>>();
fReactionModel->Initialise(pMolConfA, trackA);
for(G4int i = 0; i < nbReactives; i++)
for(G4int i = 0; i < nbReactives; ++i)
{
auto pMoleculeB = (*pReactantList)[i];
G4int key = pMoleculeB->GetMoleculeID();
@@ -177,48 +177,52 @@ G4double G4DNAIndependentReactionTimeStepper::CalculateStep(
"::CalculateStep()",
"G4DNAIndependentReactionTimeStepper007", FatalException,
exceptionDescription);
}
if(fCheckedTracks.find(pTrackB->GetTrackID()) != fCheckedTracks.end())
}else
{
continue;
}
Utils utils(trackA, *pTrackB);
auto pMolB = GetMolecule(pTrackB);
auto pMolConfB = pMolB->GetMolecularConfiguration();
G4double distance = (trackA.GetPosition() - pTrackB->GetPosition()).mag();
if(distance * distance < Reff * Reff)
{
auto reactionData =
fMolecularReactionTable->GetReactionData(pMolConfA, pMolConfB);
if(reactionData->GetProbability() > G4UniformRand())
if(fCheckedTracks.find(pTrackB->GetTrackID()) != fCheckedTracks.end())
{
if(!fHasAlreadyReachedNullTime)
continue;
}
Utils utils(trackA, *pTrackB);
auto pMolB = GetMolecule(pTrackB);
auto pMolConfB = pMolB->GetMolecularConfiguration();
G4double distance = (trackA.GetPosition() - pTrackB->GetPosition()).mag();
if(distance * distance < Reff * Reff)
{
auto reactionData =
fMolecularReactionTable->GetReactionData(pMolConfA, pMolConfB);
if(G4Scheduler::Instance()->GetGlobalTime() == G4Scheduler::Instance()->GetStartTime())
{
fReactants->clear();
fHasAlreadyReachedNullTime = true;
if(reactionData->GetProbability() > G4UniformRand())
{
if(!fHasAlreadyReachedNullTime)
{
fReactants->clear();
fHasAlreadyReachedNullTime = true;
}
fSampledMinTimeStep = 0.;
CheckAndRecordResults(utils);
}
}
fSampledMinTimeStep = 0.;
}
else
{
G4double tempMinET = GetTimeToEncounter(trackA, *pTrackB);
if(tempMinET < 0 || tempMinET > G4Scheduler::Instance()->GetEndTime())
{
continue;
}
if(tempMinET >= fSampledMinTimeStep)
{
continue;
}
fSampledMinTimeStep = tempMinET;
fReactants->clear();
CheckAndRecordResults(utils);
}
}
else
{
G4double tempMinET = GetTimeToEncounter(trackA, *pTrackB);
if(tempMinET < 0 || tempMinET > G4Scheduler::Instance()->GetEndTime())
{
continue;
}
if(tempMinET >= fSampledMinTimeStep)
{
continue;
}
fSampledMinTimeStep = tempMinET;
fReactants->clear();
CheckAndRecordResults(utils);
}
}
}
@@ -189,12 +189,14 @@ G4DNAMakeReaction::FindReaction(G4ITReactionSet* pReactionSet,
{
std::vector<std::unique_ptr<G4ITReactionChange>> ReactionInfo;
ReactionInfo.clear();
auto pReactionChange = dynamic_cast<G4DNAIndependentReactionTimeStepper*>(fpTimeStepper)->
FindReaction(pReactionSet,currentStepTime);
if (pReactionChange != nullptr)
{
auto stepper = dynamic_cast<G4DNAIndependentReactionTimeStepper*>(fpTimeStepper);
if(stepper != nullptr){
auto pReactionChange = stepper->
FindReaction(pReactionSet,currentStepTime);
if (pReactionChange != nullptr)
{
ReactionInfo.push_back(std::move(pReactionChange));
}
}
return ReactionInfo;
}
@@ -45,16 +45,16 @@ G4DNAModelInterface::G4DNAModelInterface(const G4String &nam)
G4DNAModelInterface::~G4DNAModelInterface()
{
// Loop on all the registered models to properly delete them (free the memory)
for(unsigned int i=0, ie = fRegisteredModels.size(); i<ie; ++i)
for(std::size_t i=0, ie = fRegisteredModels.size(); i<ie; ++i)
{
if(fRegisteredModels.at(i) != nullptr) delete fRegisteredModels.at(i);
if(fRegisteredModels.at(i) != nullptr) delete fRegisteredModels.at(i);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4DNAModelInterface::Initialise(const G4ParticleDefinition* particle,
const G4DataVector& cuts)
const G4DataVector& cuts)
{
// Those two statements are necessary to override the energy limits set in the G4DNAProcesses (ionisation, elastic, etc...).
// Indeed, with the ModelInterface system, the model define themselves their energy limits per material and particle.
@@ -66,9 +66,9 @@ void G4DNAModelInterface::Initialise(const G4ParticleDefinition* particle,
fpParticleChangeForGamma = GetParticleChangeForGamma();
// Loop on all the registered models to initialise them
for(unsigned int i=0, ie = fRegisteredModels.size(); i<ie; ++i)
for(std::size_t i=0, ie = fRegisteredModels.size(); i<ie; ++i)
{
fRegisteredModels.at(i)->Initialise(particle, cuts, fpParticleChangeForGamma);
fRegisteredModels.at(i)->Initialise(particle, cuts, fpParticleChangeForGamma);
}
@@ -153,11 +153,11 @@ G4double G4DNAModelInterface::CrossSectionPerVolume(const G4Material* material,
std::map<G4Material*, G4double>::const_iterator it = componentsMap.begin();
// Get the size
unsigned int componentNumber = componentsMap.size();
std::size_t componentNumber = componentsMap.size();
// Loop on all the components
//for(it = material->GetMatComponents().begin(); it!=material->GetMatComponents().end();++it)
for(unsigned int i=0; i<componentNumber; ++i)
for(std::size_t i=0; i<componentNumber; ++i)
{
// Get the current component
G4Material* component = it->first;
@@ -348,7 +348,7 @@ void G4DNAModelInterface::BuildMaterialParticleModelTable(const G4ParticleDefini
std::map<G4Material*, G4double> componentMap = mat->GetMatComponents();
// Get the number of component within the composite
unsigned int compositeSize = componentMap.size();
std::size_t compositeSize = componentMap.size();
// Check that the material is not a composite material
if(componentMap.empty())
@@ -457,7 +457,7 @@ void G4DNAModelInterface::InsertModelInTable(const G4String& matName, const G4St
// Loop on all models registered in the simulation to check:
// 1- if they can be applied to the current material
// 2- if they can be applied to the current particle
for(unsigned int i=0, ie=fRegisteredModels.size(); i<ie; ++i)
for(std::size_t i=0, ie=fRegisteredModels.size(); i<ie; ++i)
{
// check if the model is correct for material and particle (previous 1 and 2)
if(fRegisteredModels[i]->IsParticleExistingInModelForMaterial(pName, matName))
@@ -492,7 +492,7 @@ void G4DNAModelInterface::InsertModelInTable(const G4String& matName, const G4St
// Loop on all the model for the current couple
// and fill a map with [lim] = modelNumber
for(unsigned int ii=0, em=models.size(); ii<em; ++ii)
for(std::size_t ii=0, em=models.size(); ii<em; ++ii)
{
G4double lowLim = models[ii]->GetLowELimit(matName, pName);
G4double highLim = models[ii]->GetHighELimit(matName, pName);
@@ -502,14 +502,14 @@ void G4DNAModelInterface::InsertModelInTable(const G4String& matName, const G4St
lowLim += smallDiff;
}
sortMap[lowLim] = ii;
sortMap[lowLim] = (G4int)ii;
if(sortMap.find(highLim) != sortMap.end() )
{
highLim -= smallDiff;
}
sortMap[highLim] = ii;
sortMap[highLim] = (G4int)ii;
}
// The map has been created and ordered at this point.
@@ -524,7 +524,7 @@ void G4DNAModelInterface::InsertModelInTable(const G4String& matName, const G4St
// Loop on all the models again.
// The goal is to check if for each limit pairs we have the same model number
// and that the upper and lower limit are consistent.
for(unsigned int ii=0, eii=models.size(); ii<eii; ++ii)
for(std::size_t ii=0, eii=models.size(); ii<eii; ++ii)
{
G4double lim1 = it->first - smallDiff;
G4int count1 = it->second;
@@ -551,7 +551,7 @@ void G4DNAModelInterface::InsertModelInTable(const G4String& matName, const G4St
oss<<" have several models registered for the "<<fName<<" interaction and their energy ranges ";
oss<<"do not match. \nEnergy ranges: \n";
for(int iii=0, eiii=models.size(); iii<eiii; ++iii)
for(std::size_t iii=0, eiii=models.size(); iii<eiii; ++iii)
{
oss<<models[iii]->GetName()<<"\n";
oss<<"low: "<<models[iii]->GetLowELimit(matName, pName)/eV<<" eV \n";
@@ -596,7 +596,7 @@ G4VDNAModel *G4DNAModelInterface::GetDNAModel(const G4String &material, const G4
//G4bool isOneModelSelected = false;
// Loop on all the models within the models vector and check if ekin is within the energy range.
for(int i=0, ie=models.size(); i<ie; ++i)
for(std::size_t i=0, ie=models.size(); i<ie; ++i)
{
// ekin is in the energy range: we select the model and stop the loop.
if( ekin >= models[i]->GetLowELimit(material, particle)
@@ -163,7 +163,7 @@ G4DNAMoleculeEncounterStepper::CalculateStep(const G4Track& trackA,
return DBL_MAX;
}
G4int nbReactives = pReactantList->size();
G4int nbReactives = (G4int)pReactantList->size();
if (nbReactives == 0)
{
@@ -82,6 +82,16 @@ void G4DNAPTBElasticModel::Initialise(const G4ParticleDefinition* particle,
{
G4String particleName = particle->GetParticleName();
// MPietrzak, adding paths for N2
AddCrossSectionData("N2",
particleName,
"dna/sigma_elastic_e-_PTB_N2",
"dna/sigmadiff_cumulated_elastic_e-_PTB_N2",
scaleFactor);
SetLowELimit("N2", particleName, 10*eV);
SetHighELimit("N2", particleName, 1.02*MeV);
// MPietrzak
AddCrossSectionData("THF",
particleName,
"dna/sigma_elastic_e-_PTB_THF",
@@ -163,6 +163,15 @@ void G4DNAPTBExcitationModel::Initialise(const G4ParticleDefinition* particle,
scaleFactor*33./50);
SetLowELimit("backbone_TMP", particleName, 9.*eV);
SetHighELimit("backbone_TMP", particleName, 1.*keV);
// MPietrzak, adding paths for N2
AddCrossSectionData("N2",
particleName,
"dna/sigma_excitation_e-_PTB_N2",
scaleFactor);
SetLowELimit("N2", particleName, 13.*eV);
SetHighELimit("N2", particleName, 1.02*MeV);
// MPietrzak
}
//*******************************************************
@@ -233,7 +242,7 @@ G4double G4DNAPTBExcitationModel::CrossSectionPerVolume(const G4Material* /*mate
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4DNAPTBExcitationModel::SampleSecondaries(std::vector<G4DynamicParticle*>* /*fvect*/,
void G4DNAPTBExcitationModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
const G4MaterialCutsCouple* /*couple*/,
const G4String& materialName,
const G4DynamicParticle* aDynamicParticle,
@@ -246,42 +255,90 @@ void G4DNAPTBExcitationModel::SampleSecondaries(std::vector<G4DynamicParticle*>*
// Get the incident particle kinetic energy
G4double k = aDynamicParticle->GetKineticEnergy();
//Get the particle name
const G4String& particleName = aDynamicParticle->GetDefinition()->GetParticleName();
// Get the energy limits
G4double lowLim = GetLowELimit(materialName, particleName);
G4double highLim = GetHighELimit(materialName, particleName);
if(materialName!="G4_WATER")
// Check if we are in the correct energy range
if (k >= lowLim && k < highLim)
{
// Retrieve the excitation energy for the current material
G4double excitationEnergy = tableMeanEnergyPTB[materialName];
// Calculate the new energy of the particle
G4double newEnergy = k - excitationEnergy;
// Check that the new energy is above zero before applying it the particle.
// Otherwise, do nothing.
if (newEnergy > 0)
if(materialName=="N2")
{
particleChangeForGamma->ProposeMomentumDirection(aDynamicParticle->GetMomentumDirection());
particleChangeForGamma->SetProposedKineticEnergy(newEnergy);
particleChangeForGamma->ProposeLocalEnergyDeposit(excitationEnergy);
// Retrieve the excitation energy for the current material
G4int level = RandomSelectShell(k,particleName,materialName);
G4double excitationEnergy = ptbExcitationStructure.ExcitationEnergy(level, materialName);
// Calculate the new energy of the particle
G4double newEnergy = k - excitationEnergy;
// Check that the new energy is above zero before applying it the particle.
// Otherwise, do nothing.
if (newEnergy > 0)
{
particleChangeForGamma->ProposeMomentumDirection(aDynamicParticle->GetMomentumDirection());
particleChangeForGamma->SetProposedKineticEnergy(newEnergy);
particleChangeForGamma->ProposeLocalEnergyDeposit(excitationEnergy);
G4double ioniThres = ptbIonisationStructure.IonisationEnergy(0,materialName);
// if excitation energy greater than ionisation threshold, then autoionisaiton
if((excitationEnergy>ioniThres)&&(G4UniformRand()<0.5))
{
particleChangeForGamma->ProposeLocalEnergyDeposit(ioniThres);
// energy of ejected electron
G4double secondaryKinetic = excitationEnergy - ioniThres;
// random direction
G4double cosTheta = 2*G4UniformRand() - 1., phi = CLHEP::twopi*G4UniformRand();
G4double sinTheta = std::sqrt(1. - cosTheta*cosTheta);
G4double ux = sinTheta*std::cos(phi),
uy = sinTheta*std::sin(phi),
uz = cosTheta;
G4ThreeVector deltaDirection(ux,uy,uz);
// Create the new particle with its characteristics
G4DynamicParticle* dp = new G4DynamicParticle (G4Electron::Electron(),deltaDirection,secondaryKinetic) ;
fvect->push_back(dp);
}
} else {
G4ExceptionDescription description;
description<<"Kinetic energy <= 0 at "<<materialName<<" material !!!";
G4Exception("G4DNAPTBExcitationModel::SampleSecondaries","",FatalException,description);
}
} else if(materialName!="G4_WATER"){
// Retrieve the excitation energy for the current material
G4double excitationEnergy = tableMeanEnergyPTB[materialName];
// Calculate the new energy of the particle
G4double newEnergy = k - excitationEnergy;
// Check that the new energy is above zero before applying it the particle.
// Otherwise, do nothing.
if (newEnergy > 0){
particleChangeForGamma->ProposeMomentumDirection(aDynamicParticle->GetMomentumDirection());
particleChangeForGamma->SetProposedKineticEnergy(newEnergy);
particleChangeForGamma->ProposeLocalEnergyDeposit(excitationEnergy);
} else {
G4ExceptionDescription description;
description<<"Kinetic energy <= 0 at "<<materialName<<" material !!!";
G4Exception("G4DNAPTBExcitationModel::SampleSecondaries","",FatalException,description);
}
} else {
G4int level = RandomSelectShell(k,particleName, materialName);
G4double excitationEnergy = waterStructure.ExcitationEnergy(level);
G4double newEnergy = k - excitationEnergy;
if (newEnergy > 0){
particleChangeForGamma->ProposeMomentumDirection(aDynamicParticle->GetMomentumDirection());
particleChangeForGamma->SetProposedKineticEnergy(newEnergy);
particleChangeForGamma->ProposeLocalEnergyDeposit(excitationEnergy);
const G4Track * theIncomingTrack = particleChangeForGamma->GetCurrentTrack();
G4DNAChemistryManager::Instance()->CreateWaterMolecule(eExcitedMolecule,
level,
theIncomingTrack);
} else {
G4ExceptionDescription description;
description<<"Kinetic energy <= 0 at "<<materialName<<" material !!!";
G4Exception("G4DNAPTBExcitationModel::SampleSecondaries","",FatalException,description);
}
}
}
else
{
const G4String& particleName = aDynamicParticle->GetDefinition()->GetParticleName();
G4int level = RandomSelectShell(k,particleName, materialName);
G4double excitationEnergy = waterStructure.ExcitationEnergy(level);
G4double newEnergy = k - excitationEnergy;
if (newEnergy > 0)
{
particleChangeForGamma->ProposeMomentumDirection(aDynamicParticle->GetMomentumDirection());
particleChangeForGamma->SetProposedKineticEnergy(newEnergy);
particleChangeForGamma->ProposeLocalEnergyDeposit(excitationEnergy);
}
const G4Track * theIncomingTrack = particleChangeForGamma->GetCurrentTrack();
G4DNAChemistryManager::Instance()->CreateWaterMolecule(eExcitedMolecule,
level,
theIncomingTrack);
}
}
@@ -98,6 +98,16 @@ void G4DNAPTBIonisationModel::Initialise(const G4ParticleDefinition* particle,
// Raw materials
//
// MPietrzak
AddCrossSectionData("N2",
particleName,
"dna/sigma_ionisation_e-_PTB_N2",
"dna/sigmadiff_cumulated_ionisation_e-_PTB_N2",
scaleFactor);
SetLowELimit("N2", particleName, 15.5*eV);
SetHighELimit("N2", particleName, 1.02*MeV);
// MPietrzak
AddCrossSectionData("THF",
particleName,
"dna/sigma_ionisation_e-_PTB_THF",
@@ -98,7 +98,7 @@ void G4DNAQuinnPlasmonExcitationModel::Initialise
G4ProductionCutsTable* theCoupleTable =
G4ProductionCutsTable::GetProductionCutsTable();
G4int numOfCouples = theCoupleTable->GetTableSize();
G4int numOfCouples = (G4int)theCoupleTable->GetTableSize();
for(G4int i=0;i<numOfCouples;i++){
@@ -109,10 +109,19 @@ void G4DNAQuinnPlasmonExcitationModel::Initialise
const G4ElementVector* theElementVector =material->GetElementVector();
G4int nelm = material->GetNumberOfElements();
if (nelm==1){// Protection: only for single element
std::size_t nelm = material->GetNumberOfElements();
if (nelm==1) // Protection: only for single element
{
G4int z = G4lrint((*theElementVector)[0]->GetZ());
if(z<=100){nValenceElectron[z] = GetNValenceElectron(z);}
if(z<=100)
{
nValenceElectron[z] = GetNValenceElectron(z);
}
else
{
G4Exception("G4DNAQuinnPlasmonExcitationModel::Initialise","em0002",
FatalException,"The model is not applied for z>100");
}
}
//for(G4int j=0;j<nelm;j++){
// G4int z=G4lrint((*theElementVector)[j]->GetZ());
@@ -23,14 +23,17 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// Reference:
// A.D. Dominguez-Munoz, M.I. Gallardo, M.C. Bordage,
// Z. Francis, S. Incerti, M.A. Cortes-Giraldo,
// Radiat. Phys. Chem. 199 (2022) 110363.
//
// Created on 2022/03/03
// Class authors:
// A.D. Dominguez-Munoz
// M.A. Cortes-Giraldo (miancortes -at- us.es)
//
// Class creation: 2022-03-03
//
// Authors: A.D. Dominguez-Munoz, M.I. Gallardo, M.C. Bordage,
// Z. Francis, S. Incerti, M.A. Cortes-Giraldo
//
// Contact: M.A. Cortes-Giraldo (miancortes -at- us.es)
//
//
#include "G4DNARPWBAExcitationModel.hh"
@@ -87,8 +90,13 @@ void G4DNARPWBAExcitationModel::Initialise(const G4ParticleDefinition* particle,
fLowEnergy = 100. * MeV;
fHighEnergy = 300. * MeV;
//SetLowEnergyLimit(fLowEnergy);
//SetHighEnergyLimit(fHighEnergy);
if(LowEnergyLimit() < fLowEnergy || HighEnergyLimit() > fHighEnergy)
{
G4ExceptionDescription ed;
ed << "Model is applicable from "<<fLowEnergy<<" to "<<fHighEnergy;
G4Exception("G4DNARPWBAExcitationModel::Initialise", "em0004",
FatalException, ed);
}
G4double scaleFactor = 1 * cm * cm;
fTableData = make_unique<G4DNACrossSectionDataSet>(new G4LogLogInterpolation,
@@ -229,13 +237,13 @@ G4int G4DNARPWBAExcitationModel::RandomSelect(G4double k)
G4int level = 0;
G4double* valuesBuffer = new G4double[fTableData->NumberOfComponents()];
const size_t n(fTableData->NumberOfComponents());
size_t i(n);
const G4int n = (G4int)fTableData->NumberOfComponents();
G4int i(n);
G4double value = 0.;
while(i > 0)
{
i--;
--i;
valuesBuffer[i] = fTableData->GetComponent(i)->FindValue(k);
value += valuesBuffer[i];
}
@@ -245,7 +253,7 @@ G4int G4DNARPWBAExcitationModel::RandomSelect(G4double k)
while(i > 0)
{
i--;
--i;
if(valuesBuffer[i] > value)
{
@@ -23,14 +23,17 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// Reference:
// A.D. Dominguez-Munoz, M.I. Gallardo, M.C. Bordage,
// Z. Francis, S. Incerti, M.A. Cortes-Giraldo,
// Radiat. Phys. Chem. 199 (2022) 110363.
//
// Created on 2022/03/03
// Class authors:
// A.D. Dominguez-Munoz
// M.A. Cortes-Giraldo (miancortes -at- us.es)
//
// Class creation: 2022-03-03
//
// Authors: A.D. Dominguez-Munoz, M.I. Gallardo, M.C. Bordage,
// Z. Francis, S. Incerti, M.A. Cortes-Giraldo
//
// Contact: M.A. Cortes-Giraldo (miancortes -at- us.es)
//
//
#include "G4DNARPWBAIonisationModel.hh"
@@ -95,7 +98,7 @@ void G4DNARPWBAIonisationModel::InitialiseForProton(
{
if(part != fProtonDef)
{
G4Exception("G4DNARPWBAIonisationModel::CrossSectionPerVolume", "em0002",
G4Exception("G4DNARPWBAIonisationModel::InitialiseForProton", "em0002",
FatalException, "Model not applicable to particle type.");
}
// Energy limits
@@ -104,6 +107,15 @@ void G4DNARPWBAIonisationModel::InitialiseForProton(
const char *path = G4FindDataDir("G4LEDATA");
lowEnergyLimit = 100. * MeV;
highEnergyLimit = 300. * MeV;
if(LowEnergyLimit() < lowEnergyLimit || HighEnergyLimit() > highEnergyLimit)
{
G4ExceptionDescription ed;
ed << "Model is applicable from "<<lowEnergyLimit<<" to "<<highEnergyLimit;
G4Exception("G4DNARPWBAIonisationModel::InitialiseForProton", "em0004",
FatalException, ed);
}
fpTotalCrossSection = make_unique<G4DNACrossSectionDataSet>(
new G4LogLogInterpolation, eV, scaleFactor);
fpTotalCrossSection->LoadData(fileProton);
@@ -112,14 +124,14 @@ void G4DNARPWBAIonisationModel::InitialiseForProton(
std::ostringstream pFullFileName;
fasterCode ? pFullFileName
<< path << "/dna/sigmadiff_cumulated_ionisation_p_RPWBA.dat.dat"
<< path << "/dna/sigmadiff_cumulated_ionisation_p_RPWBA.dat"
: pFullFileName << path << "/dna/sigmadiff_ionisation_p_RPWBA.dat";
std::ifstream pDiffCrossSection(pFullFileName.str().c_str());
if(!pDiffCrossSection)
{
G4ExceptionDescription exceptionDescription;
exceptionDescription << "Missing data file: " + pFullFileName.str();
G4Exception("G4DNARPWBAIonisationModel::Initialise", "em0003",
G4Exception("G4DNARPWBAIonisationModel::InitialiseForProton", "em0003",
FatalException, exceptionDescription);
}
@@ -182,8 +194,8 @@ void G4DNARPWBAIonisationModel::Initialise(const G4ParticleDefinition* particle,
if(verboseLevel > 0)
{
G4cout << "RPWBA ionisation model is initialized " << G4endl
<< "Energy range: " << LowEnergyLimit() / eV << " eV - "
<< HighEnergyLimit() / keV << " keV for "
<< "Energy range: " << LowEnergyLimit() / MeV << " MeV - "
<< HighEnergyLimit() / MeV << " MeV for "
<< particle->GetParticleName() << G4endl;
}
@@ -287,8 +299,7 @@ void G4DNARPWBAIonisationModel::SampleSecondaries(
particle->GetDefinition() == G4Electron::ElectronDefinition());
}
G4double bindingEnergy = 0;
bindingEnergy = waterStructure.IonisationEnergy(ionizationShell);
G4double bindingEnergy = waterStructure.IonisationEnergy(ionizationShell);
// SI: additional protection if tcs interpolation method is modified
if(k < bindingEnergy)
@@ -405,30 +416,30 @@ G4double G4DNARPWBAIonisationModel::RandomizeEjectedElectronEnergy(
{
G4double maximumKineticEnergyTransfer =
4. * (electron_mass_c2 / proton_mass_c2) * k;
G4double IonisationEnergyInShell = waterStructure.IonisationEnergy(shell);
G4double kIneV = k / eV;
G4double crossSectionMaximum = 0.;
for(G4double value = waterStructure.IonisationEnergy(shell);
value <= 4. * waterStructure.IonisationEnergy(shell); value += 0.1 * eV)
for(G4double value = IonisationEnergyInShell;
value <= 4. * IonisationEnergyInShell; value += 0.1 * eV)
{
G4double differentialCrossSection =
DifferentialCrossSection(k / eV, value / eV, shell);
DifferentialCrossSection(kIneV, value / eV, shell);
if(differentialCrossSection >= crossSectionMaximum)
{
crossSectionMaximum = differentialCrossSection;
}
}
G4double secondaryElectronKineticEnergy = 0.;
G4double secondaryElectronKineticEnergy;
do
{
secondaryElectronKineticEnergy =
G4UniformRand() * maximumKineticEnergyTransfer;
} while(G4UniformRand() * crossSectionMaximum >=
DifferentialCrossSection(k / eV,
(secondaryElectronKineticEnergy +
waterStructure.IonisationEnergy(shell)) /
eV,
shell));
DifferentialCrossSection(kIneV,
(secondaryElectronKineticEnergy +
IonisationEnergyInShell) / eV, shell));
return secondaryElectronKineticEnergy;
}
@@ -587,12 +598,12 @@ G4int G4DNARPWBAIonisationModel::RandomSelect(G4double k)
else
{
auto valuesBuffer = new G4double[fpTotalCrossSection->NumberOfComponents()];
const size_t n(fpTotalCrossSection->NumberOfComponents());
size_t i(n);
const G4int n = (G4int)fpTotalCrossSection->NumberOfComponents();
G4int i(n);
G4double value = 0.;
while(i > 0)
{
i--;
--i;
valuesBuffer[i] = fpTotalCrossSection->GetComponent(i)->FindValue(k);
value += valuesBuffer[i];
}
@@ -601,7 +612,7 @@ G4int G4DNARPWBAIonisationModel::RandomSelect(G4double k)
while(i > 0)
{
i--;
--i;
if(valuesBuffer[i] > value)
{
delete[] valuesBuffer;
@@ -620,16 +631,15 @@ G4double
G4DNARPWBAIonisationModel::RandomizeEjectedElectronEnergyFromCumulatedDcs(
const G4double& k, const G4int& shell)
{
G4double secondaryElectronKineticEnergy = 0.;
G4double random = G4UniformRand();
secondaryElectronKineticEnergy =
G4double secondaryKineticEnergy =
TransferedEnergy(k / eV, shell, random) * eV -
waterStructure.IonisationEnergy(shell);
if(secondaryElectronKineticEnergy < 0.)
if(secondaryKineticEnergy < 0.)
{
return 0.;
}
return secondaryElectronKineticEnergy;
return secondaryKineticEnergy;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -127,8 +127,8 @@ void G4DNARelativisticIonisationModel::Initialise(const G4ParticleDefinition* pa
G4ProductionCutsTable *coupletable
= G4ProductionCutsTable::GetProductionCutsTable();
G4int Ncouple = coupletable ->GetTableSize();
for(G4int i=0;i<Ncouple;i++)
G4int Ncouple = (G4int)coupletable ->GetTableSize();
for(G4int i=0; i<Ncouple; ++i)
{
const G4MaterialCutsCouple* couple
= coupletable->GetMaterialCutsCouple(i);
@@ -316,9 +316,9 @@ void G4DNARelativisticIonisationModel::SampleSecondaries(
if(fAtomDeexcitation){
G4AtomicShellEnumerator as = G4AtomicShellEnumerator(level);
const G4AtomicShell *shell = fAtomDeexcitation->GetAtomicShell(z,as);
NumSecParticlesInit = fvect->size();
NumSecParticlesInit = (G4int)fvect->size();
fAtomDeexcitation->GenerateParticles(fvect,shell,z,0,0);
NumSecParticlesFinal = fvect->size();
NumSecParticlesFinal = (G4int)fvect->size();
}
ejectedE
@@ -469,8 +469,8 @@ G4double G4DNARelativisticIonisationModel::GetTotalCrossSection(
G4int z = material->GetZ();
if(z!=79){ return 0.;}
else {
size_t N=iState[z].size();
for(G4int i=0;i<(G4int)N;i++){
std::size_t N=iState[z].size();
for(G4int i=0; i<(G4int)N; ++i){
value = value+GetPartialCrossSection(material,i,particle,kineticEnergy);
}
return value;
@@ -571,9 +571,10 @@ G4int G4DNARelativisticIonisationModel::RandomSelect(
{
G4double value = 0.;
G4int z = material->GetZ();
G4double* valuesBuffer = new G4double[iShell[z].size()];
const size_t n(iShell[z].size());
size_t i(n);
std::size_t numberOfShell = iShell[z].size();
auto valuesBuffer = new G4double[numberOfShell];
const G4int n = (G4int)iShell[z].size();
G4int i(n);
while (i > 0)
{
File diff suppressed because it is too large Load Diff
@@ -50,8 +50,6 @@ G4DNARuddIonisationModel::G4DNARuddIonisationModel(const G4ParticleDefinition*,
const G4String& nam) :
G4VEmModel(nam), isInitialised(false)
{
fpWaterDensity = 0;
slaterEffectiveCharge[0] = 0.;
slaterEffectiveCharge[1] = 0.;
slaterEffectiveCharge[2] = 0.;
@@ -84,8 +82,6 @@ G4VEmModel(nam), isInitialised(false)
// Mark this model as "applicable" for atomic deexcitation
SetDeexcitationFlag(true);
fAtomDeexcitation = 0;
fParticleChangeForGamma = 0;
// Selection of stationary mode
@@ -1027,13 +1023,13 @@ G4int G4DNARuddIonisationModel::RandomSelect(G4double k,
{
G4double* valuesBuffer = new G4double[table->NumberOfComponents()];
const size_t n(table->NumberOfComponents());
size_t i(n);
const G4int n = (G4int)table->NumberOfComponents();
G4int i(n);
G4double value = 0.;
while (i > 0)
{
i--;
--i;
valuesBuffer[i] = table->GetComponent(i)->FindValue(k);
value += valuesBuffer[i];
}
@@ -1044,7 +1040,7 @@ G4int G4DNARuddIonisationModel::RandomSelect(G4double k,
while (i > 0)
{
i--;
--i;
if (valuesBuffer[i] > value)
{
@@ -39,17 +39,12 @@ using namespace std;
G4DNAUeharaScreenedRutherfordElasticModel::
G4DNAUeharaScreenedRutherfordElasticModel(const G4ParticleDefinition*,
const G4String& nam) :
G4VEmModel(nam), isInitialised(false)
const G4String& nam) : G4VEmModel(nam)
{
fpWaterDensity = 0;
// Switch between two final state models
// Energy limits of the models
intermediateEnergyLimit = 200. * eV;
SetLowEnergyLimit(9.*eV);
SetHighEnergyLimit(1.*MeV);
iLowEnergyLimit = 9.*eV;
iHighEnergyLimit = 1.*MeV;
verboseLevel = 0;
// Verbosity scale:
@@ -58,46 +53,21 @@ G4VEmModel(nam), isInitialised(false)
// 2 = details of energy budget
// 3 = calculation of cross sections, file openings, sampling of atoms
// 4 = entering in methods
#ifdef UEHARA_VERBOSE
if (verboseLevel)
{
G4cout << "Screened Rutherford Elastic model is constructed " << G4endl
<< "Energy range: "
<< LowEnergyLimit() / eV << " eV - "
<< HighEnergyLimit() / MeV << " MeV"
<< G4endl;
}
#endif
fParticleChangeForGamma = 0;
// Selection of computation method
// We do not recommend "true" usage with the current cumul. proba. settings
fasterCode = false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4DNAUeharaScreenedRutherfordElasticModel::
~G4DNAUeharaScreenedRutherfordElasticModel()
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void
G4DNAUeharaScreenedRutherfordElasticModel::
Initialise(const G4ParticleDefinition* particle,
const G4DataVector& /*cuts*/)
{
#ifdef UEHARA_VERBOSE
if(isInitialised) { return; }
if (verboseLevel > 3)
{
G4cout << "Calling G4DNAUeharaScreenedRutherfordElasticModel::Initialise()"
<< G4endl;
}
#endif
if(particle->GetParticleName() != "e-")
{
@@ -106,35 +76,16 @@ Initialise(const G4ParticleDefinition* particle,
"",FatalException,"") ;
}
// Energy limits
if(LowEnergyLimit() < 9.*CLHEP::eV)
{
G4Exception("*** WARNING : the G4DNAUeharaScreenedRutherfordElasticModel "
"class is not validated below 9 eV",
"",JustWarning,"") ;
}
if (HighEnergyLimit() > 10.*CLHEP::keV)
if( verboseLevel>1 )
{
G4Exception("*** WARNING: the G4DNAUeharaScreenedRutherfordElasticModel "
"class is used above 10 keV",
"",JustWarning,"") ;
G4cout << "G4DNAUeharaScreenedRutherfordElasticModel::Initialise()"
<< G4endl;
G4cout << "Energy range: "
<< LowEnergyLimit() / eV << " eV - "
<< HighEnergyLimit() / MeV << " MeV"
<< G4endl;
}
#ifdef UEHARA_VERBOSE
if( verboseLevel>0 )
{
G4cout << "Screened Rutherford elastic model is initialized " << G4endl
<< "Energy range: "
<< LowEnergyLimit() / eV << " eV - "
<< HighEnergyLimit() / MeV << " MeV"
<< G4endl;
}
#endif
if (isInitialised){ return; }
// Constants for final state by Brenner & Zaider
// Note: the instantiation must be placed after if (isInitialised)
@@ -208,6 +159,8 @@ CrossSectionPerVolume(const G4Material* material,
// Calculate total cross section for model
G4double sigma = 0.;
if(ekin < iLowEnergyLimit || ekin > iHighEnergyLimit) { return sigma; }
G4double waterDensity = (*fpWaterDensity)[material->GetIndex()];
G4double z = 7.42; // FROM PMB 37 (1992) 1841-1858 p1842
@@ -309,6 +262,8 @@ SampleSecondaries(std::vector<G4DynamicParticle*>* /*fvect*/,
#endif
G4double electronEnergy0 = aDynamicElectron->GetKineticEnergy();
if(electronEnergy0 < iLowEnergyLimit || electronEnergy0 > iHighEnergyLimit)
return;
G4double cosTheta = 0.;
@@ -169,7 +169,7 @@ void G4DNAUpdateSystemModel::UpdateSystem(const Index& index,
const G4int nbProducts = data.GetNbProducts();
if(nbProducts != 0)
{
for(size_t j = 0; j < (size_t) nbProducts; ++j)
for(G4int j = 0; j < nbProducts; ++j)
{
#ifdef G4VERBOSE
if((fVerbose != 0) && j != 0)
@@ -218,4 +218,4 @@ void G4DNAUpdateSystemModel::UpdateSystem(const Index& index,
#endif
JumpTo(index, reactant);
JumpIn(JunpToIndex, reactant);
}
}
@@ -70,8 +70,11 @@ G4double G4DiffusionControlledReactionModel::GetReactionRadius(
"::GetReactionRadius()",
"G4DiffusionControlledReactionModel00", FatalException,
exceptionDescription);
return 0.;
}else
{
return reactionData->GetEffectiveReactionRadius();
}
return reactionData->GetEffectiveReactionRadius();
}
G4double G4DiffusionControlledReactionModel::GetReactionRadius(const G4int& i)
@@ -195,13 +195,13 @@ G4int G4VDNAModel::RandomSelectShell(G4double k, const G4String& particle, const
if (table != 0)
{
G4double* valuesBuffer = new G4double[table->NumberOfComponents()];
const size_t n(table->NumberOfComponents());
size_t i(n);
const G4int n = (G4int)table->NumberOfComponents();
G4int i(n);
G4double value = 0.;
while (i>0)
{
i--;
--i;
valuesBuffer[i] = table->GetComponent(i)->FindValue(k);
value += valuesBuffer[i];
}
@@ -212,7 +212,7 @@ G4int G4VDNAModel::RandomSelectShell(G4double k, const G4String& particle, const
while (i > 0)
{
i--;
--i;
if (valuesBuffer[i] > value)
{
@@ -30,7 +30,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VLEPTSModel::G4VLEPTSModel(const G4String& modelName) : G4VEmModel(modelName),isInitialised(false)
{
theMeanFreePathTable=NULL;
theMeanFreePathTable=nullptr;
theNumbBinTable=100;
@@ -129,7 +129,7 @@ void G4VLEPTSModel::BuildPhysicsTable(const G4ParticleDefinition& aParticleType)
ptrVector->PutValue(0, DBL_MAX);
ptrVector->PutValue(1, DBL_MAX);
unsigned int matIdx = aMaterial->GetIndex();
std::size_t matIdx = aMaterial->GetIndex();
theMeanFreePathTable->insertAt( matIdx , ptrVector ) ;
} else {
@@ -177,10 +177,10 @@ void G4VLEPTSModel::BuildMeanFreePathTable( const G4Material* aMaterial, std::ma
G4double LowEdgeEnergy, fValue;
//BUILD MEAN FREE PATH TABLE FROM INTEGRAL CROSS SECTION
unsigned int matIdx = aMaterial->GetIndex();
std::size_t matIdx = aMaterial->GetIndex();
G4PhysicsLogVector* ptrVector = new G4PhysicsLogVector(theLowestEnergyLimit, theHighestEnergyLimit, theNumbBinTable);
for (G4int ii=0; ii < theNumbBinTable; ii++) {
for (G4int ii=0; ii < theNumbBinTable; ++ii) {
LowEdgeEnergy = ptrVector->Energy(ii);
if( verboseLevel >= 2 ) G4cout << GetName() << " " << ii << " Energy " << LowEdgeEnergy << " > " << theLowestEnergyLimit << " < " << theHighestEnergyLimit << G4endl;
//- fValue = ComputeMFP(LowEdgeEnergy, material, aParticleName);
@@ -190,7 +190,7 @@ void G4VLEPTSModel::BuildMeanFreePathTable( const G4Material* aMaterial, std::ma
G4double NbOfMoleculesPerVolume = aMaterial->GetDensity()/theMolecularMass[aMaterial]*CLHEP::Avogadro;
G4double SIGMA = 0. ;
//- for ( size_t elm=0 ; elm < aMaterial->GetNumberOfElements() ; elm++ ) {
//- for ( std::size_t elm=0 ; elm < aMaterial->GetNumberOfElements() ; elm++ ) {
G4double crossSection = 0.;
G4double eVEnergy = LowEdgeEnergy/CLHEP::eV;
@@ -337,9 +337,9 @@ G4bool G4VLEPTSModel::ReadParam(G4String fnParam, const G4Material* aMaterial )
theIonisPotInt[aMaterial] = IonisPotInt * CLHEP::eV;
G4double MolecularMass = 0;
size_t nelem = aMaterial->GetNumberOfElements();
G4int nelem = (G4int)aMaterial->GetNumberOfElements();
const G4int* atomsV = aMaterial->GetAtomsVector();
for( size_t ii = 0; ii < nelem; ii++ ) {
for( G4int ii = 0; ii < nelem; ++ii ) {
MolecularMass += aMaterial->GetElement(ii)->GetA()*atomsV[ii]/CLHEP::g;
// G4cout << " MMASS1 " << mmass/CLHEP::g << " " << aMaterial->GetElement(ii)->GetName() << " " << aMaterial->GetElement(ii)->GetA()/CLHEP::g << G4endl;
}