Import Geant4 10.3.0 source tree
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
$Id: History 97098 2016-05-25 08:04:17Z gcosmo $
|
||||
$Id: History 101820 2016-12-01 08:34:05Z gcosmo $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -17,7 +17,24 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
24.05.2015 L. Pandola, emlowen-V10-02-06
|
||||
01.12.2016 L.Pandola, emlowen-V10-02-11
|
||||
- Fix memory leak in G4PenelopeBremsstrahlungFS
|
||||
|
||||
27.10.2016 M.Raine, emlowen-V10-02-10
|
||||
- G4MicroElecInelasticModel - changes to allow faster computation
|
||||
- needs G4EMLOW6.50
|
||||
|
||||
20.09.2016 L.Pandola, emlowen-V10-02-09
|
||||
- Include C++11 features in the Penelope models (nullptr,
|
||||
range-based loops)
|
||||
|
||||
15.08.2016 V.Ivanchenko, emlowen-V10-02-08
|
||||
- G4hParameterisedLossModel - fixed PVS-Studio warning (A.Karpov)
|
||||
|
||||
04.07.2016 S. Incerti, emlowen-V10-02-07
|
||||
- removed verbosity in G4AtomicTransitionManager (see bugzilla 1874)
|
||||
|
||||
24.05.2016 L. Pandola, emlowen-V10-02-06
|
||||
- fix compiler warning in G4PenelopeRayleighModel by gcc-6.1
|
||||
|
||||
10.05.2016 JMCBrown, SI, emlowen-V10-02-05
|
||||
|
||||
@@ -111,6 +111,10 @@ public:
|
||||
G4double
|
||||
TotalNonRadiativeTransitionProbability(G4int Z, size_t shellIndex) const;
|
||||
|
||||
// Verbosity control
|
||||
void SetVerboseLevel(G4int vl) {verboseLevel = vl;};
|
||||
G4int GetVerboseLevel(){return verboseLevel;};
|
||||
|
||||
private:
|
||||
|
||||
G4AtomicTransitionManager();
|
||||
@@ -146,6 +150,8 @@ private:
|
||||
G4int supTableLimit;
|
||||
|
||||
G4bool isInitialized;
|
||||
|
||||
G4int verboseLevel;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -87,11 +87,18 @@ public:
|
||||
|
||||
double DifferentialCrossSection(G4ParticleDefinition * aParticleDefinition, G4double k, G4double energyTransfer, G4int shell);
|
||||
|
||||
G4double TransferedEnergy(G4ParticleDefinition * aParticleDefinition,
|
||||
G4double incomingParticleEnergy, G4int shell, G4double random) ;
|
||||
|
||||
inline void SelectFasterComputation(G4bool input);
|
||||
|
||||
protected:
|
||||
|
||||
G4ParticleChangeForGamma* fParticleChangeForGamma;
|
||||
|
||||
private:
|
||||
|
||||
G4bool fasterCode;
|
||||
|
||||
//deexcitation manager to produce fluo photns and e-
|
||||
G4VAtomDeexcitation* fAtomDeexcitation;
|
||||
@@ -118,10 +125,9 @@ private:
|
||||
|
||||
G4double RandomizeEjectedElectronEnergy(G4ParticleDefinition * aParticleDefinition, G4double incomingParticleEnergy, G4int shell) ;
|
||||
|
||||
void RandomizeEjectedElectronDirection(G4ParticleDefinition * aParticleDefinition, G4double incomingParticleEnergy, G4double
|
||||
outgoingParticleEnergy, G4double & cosTheta, G4double & phi );
|
||||
G4double RandomizeEjectedElectronEnergyFromCumulatedDcs(G4ParticleDefinition * aParticleDefinition, G4double incomingParticleEnergy, G4int shell) ;
|
||||
|
||||
G4double LogLogInterpolate(G4double e1, G4double e2, G4double e, G4double xs1, G4double xs2);
|
||||
G4double Interpolate(G4double e1, G4double e2, G4double e, G4double xs1, G4double xs2);
|
||||
|
||||
G4double QuadInterpolator( G4double e11,
|
||||
G4double e12,
|
||||
@@ -137,15 +143,24 @@ private:
|
||||
G4double e);
|
||||
|
||||
typedef std::map<double, std::map<double, double> > TriDimensionMap;
|
||||
|
||||
TriDimensionMap eDiffCrossSectionData[7];
|
||||
TriDimensionMap eNrjTransfData[7]; // for cumulated dcs
|
||||
|
||||
TriDimensionMap pDiffCrossSectionData[7];
|
||||
TriDimensionMap pNrjTransfData[7]; // for cumulated dcs
|
||||
|
||||
std::vector<double> eTdummyVec;
|
||||
std::vector<double> pTdummyVec;
|
||||
|
||||
typedef std::map<double, std::vector<double> > VecMap;
|
||||
|
||||
VecMap eVecm;
|
||||
VecMap pVecm;
|
||||
|
||||
VecMap eProbaShellMap[7]; // for cumulated dcs
|
||||
VecMap pProbaShellMap[7]; // for cumulated dcs
|
||||
|
||||
// Partial cross section
|
||||
|
||||
G4int RandomSelect(G4double energy,const G4String& particle );
|
||||
@@ -159,4 +174,11 @@ private:
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
inline void G4MicroElecInelasticModel::SelectFasterComputation (G4bool input)
|
||||
{
|
||||
fasterCode = input;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
#endif
|
||||
|
||||
@@ -56,7 +56,8 @@ G4AtomicTransitionManager::G4AtomicTransitionManager()
|
||||
zMax(100),
|
||||
infTableLimit(6),
|
||||
supTableLimit(100),
|
||||
isInitialized(false)
|
||||
isInitialized(false),
|
||||
verboseLevel(0)
|
||||
{}
|
||||
|
||||
G4AtomicTransitionManager::~G4AtomicTransitionManager()
|
||||
@@ -109,8 +110,9 @@ G4AtomicTransitionManager::Shell(G4int Z, size_t shellIndex) const
|
||||
ed << "No de-excitation for Z= " << Z
|
||||
<< " shellIndex= " << shellIndex
|
||||
<< ">= numberOfShells= " << lastShell;
|
||||
G4Exception("G4AtomicTransitionManager::Shell()","de0001",
|
||||
JustWarning,ed," AtomicShell not found");
|
||||
if (verboseLevel > 0)
|
||||
G4Exception("G4AtomicTransitionManager::Shell()","de0001",
|
||||
JustWarning,ed," AtomicShell not found");
|
||||
if (lastShell > 0) { return v[lastShell - 1]; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ using namespace std;
|
||||
|
||||
G4MicroElecInelasticModel::G4MicroElecInelasticModel(const G4ParticleDefinition*,
|
||||
const G4String& nam)
|
||||
:G4VEmModel(nam),fAtomDeexcitation(0),isInitialised(false)
|
||||
:G4VEmModel(nam),isInitialised(false)
|
||||
{
|
||||
nistSi = G4NistManager::Instance()->FindOrBuildMaterial("G4_Si");
|
||||
|
||||
@@ -80,10 +80,14 @@ G4MicroElecInelasticModel::G4MicroElecInelasticModel(const G4ParticleDefinition*
|
||||
|
||||
//Mark this model as "applicable" for atomic deexcitation
|
||||
SetDeexcitationFlag(true);
|
||||
fAtomDeexcitation = 0;
|
||||
fParticleChangeForGamma = 0;
|
||||
|
||||
// default generator
|
||||
SetAngularDistribution(new G4DeltaAngle());
|
||||
|
||||
// Selection of computation method
|
||||
fasterCode = true; //false;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
@@ -148,12 +152,20 @@ void G4MicroElecInelasticModel::Initialise(const G4ParticleDefinition* particle,
|
||||
// Final state
|
||||
|
||||
std::ostringstream eFullFileName;
|
||||
eFullFileName << path << "/microelec/sigmadiff_inelastic_e_Si.dat";
|
||||
|
||||
if (fasterCode) eFullFileName << path << "/microelec/sigmadiff_cumulated_inelastic_e_Si.dat";
|
||||
else eFullFileName << path << "/microelec/sigmadiff_inelastic_e_Si.dat";
|
||||
|
||||
std::ifstream eDiffCrossSection(eFullFileName.str().c_str());
|
||||
|
||||
if (!eDiffCrossSection)
|
||||
{
|
||||
G4Exception("G4MicroElecInelasticModel::Initialise","em0003",FatalException,"Missing data file:/microelec/sigmadiff_inelastic_e_Si.dat");
|
||||
if (fasterCode) G4Exception("G4MicroElecInelasticModel::Initialise","em0003",
|
||||
FatalException,"Missing data file:/microelec/sigmadiff_cumulated_inelastic_e_Si.dat");
|
||||
|
||||
else G4Exception("G4MicroElecInelasticModel::Initialise","em0003",
|
||||
FatalException,"Missing data file:/microelec/sigmadiff_inelastic_e_Si.dat");
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
@@ -167,8 +179,17 @@ void G4MicroElecInelasticModel::Initialise(const G4ParticleDefinition* particle,
|
||||
eVecm.clear();
|
||||
pVecm.clear();
|
||||
|
||||
eDiffCrossSectionData->clear();
|
||||
pDiffCrossSectionData->clear();
|
||||
for (int j=0; j<6; j++)
|
||||
{
|
||||
eProbaShellMap[j].clear();
|
||||
pProbaShellMap[j].clear();
|
||||
|
||||
eDiffCrossSectionData[j].clear();
|
||||
pDiffCrossSectionData[j].clear();
|
||||
|
||||
eNrjTransfData[j].clear();
|
||||
pNrjTransfData[j].clear();
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -180,14 +201,25 @@ void G4MicroElecInelasticModel::Initialise(const G4ParticleDefinition* particle,
|
||||
double eDummy;
|
||||
eDiffCrossSection>>tDummy>>eDummy;
|
||||
if (tDummy != eTdummyVec.back()) eTdummyVec.push_back(tDummy);
|
||||
|
||||
double tmp;
|
||||
for (int j=0; j<6; j++)
|
||||
{
|
||||
eDiffCrossSection>>eDiffCrossSectionData[j][tDummy][eDummy];
|
||||
eDiffCrossSection>> tmp;
|
||||
|
||||
eDiffCrossSectionData[j][tDummy][eDummy] = tmp;
|
||||
|
||||
if (fasterCode)
|
||||
{
|
||||
eNrjTransfData[j][tDummy][eDiffCrossSectionData[j][tDummy][eDummy]]=eDummy;
|
||||
eProbaShellMap[j][tDummy].push_back(eDiffCrossSectionData[j][tDummy][eDummy]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// SI - only if eof is not reached !
|
||||
if (!eDiffCrossSection.eof()) eDiffCrossSectionData[j][tDummy][eDummy]*=scaleFactor;
|
||||
|
||||
eVecm[tDummy].push_back(eDummy);
|
||||
if (!eDiffCrossSection.eof()) eDiffCrossSectionData[j][tDummy][eDummy]*=scaleFactor;
|
||||
eVecm[tDummy].push_back(eDummy);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -212,12 +244,19 @@ void G4MicroElecInelasticModel::Initialise(const G4ParticleDefinition* particle,
|
||||
// Final state
|
||||
|
||||
std::ostringstream pFullFileName;
|
||||
pFullFileName << path << "/microelec/sigmadiff_inelastic_p_Si.dat";
|
||||
|
||||
if (fasterCode) pFullFileName << path << "/microelec/sigmadiff_cumulated_inelastic_p_Si.dat";
|
||||
else pFullFileName << path << "/microelec/sigmadiff_inelastic_p_Si.dat";
|
||||
|
||||
std::ifstream pDiffCrossSection(pFullFileName.str().c_str());
|
||||
|
||||
if (!pDiffCrossSection)
|
||||
{
|
||||
G4Exception("G4MicroElecInelasticModel::Initialise","em0003",FatalException,"Missing data file:/microelec/sigmadiff_inelastic_p_Si.dat");
|
||||
if (fasterCode) G4Exception("G4MicroElecInelasticModel::Initialise","em0003",
|
||||
FatalException,"Missing data file:/microelec/sigmadiff_cumulated_inelastic_p_Si.dat");
|
||||
|
||||
else G4Exception("G4MicroElecInelasticModel::Initialise","em0003",
|
||||
FatalException,"Missing data file:/microelec/sigmadiff_inelastic_p_Si.dat");
|
||||
}
|
||||
|
||||
pTdummyVec.push_back(0.);
|
||||
@@ -231,10 +270,17 @@ void G4MicroElecInelasticModel::Initialise(const G4ParticleDefinition* particle,
|
||||
{
|
||||
pDiffCrossSection>>pDiffCrossSectionData[j][tDummy][eDummy];
|
||||
|
||||
// SI - only if eof is not reached !
|
||||
if (!pDiffCrossSection.eof()) pDiffCrossSectionData[j][tDummy][eDummy]*=scaleFactor;
|
||||
|
||||
pVecm[tDummy].push_back(eDummy);
|
||||
if (fasterCode)
|
||||
{
|
||||
pNrjTransfData[j][tDummy][pDiffCrossSectionData[j][tDummy][eDummy]]=eDummy;
|
||||
pProbaShellMap[j][tDummy].push_back(pDiffCrossSectionData[j][tDummy][eDummy]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// SI - only if eof is not reached !
|
||||
if (!pDiffCrossSection.eof()) pDiffCrossSectionData[j][tDummy][eDummy]*=scaleFactor;
|
||||
pVecm[tDummy].push_back(eDummy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -437,7 +483,22 @@ void G4MicroElecInelasticModel::SampleSecondaries(std::vector<G4DynamicParticle*
|
||||
G4double pSquare = ekin * (totalEnergy + particleMass);
|
||||
G4double totalMomentum = std::sqrt(pSquare);
|
||||
|
||||
G4int Shell = RandomSelect(k,nameLocal2);
|
||||
G4int Shell = 0;
|
||||
|
||||
/* if (!fasterCode)*/ Shell = RandomSelect(k,nameLocal2);
|
||||
|
||||
// SI: The following protection is necessary to avoid infinite loops :
|
||||
// sigmadiff_ionisation_e_born.dat has non zero partial xs at 18 eV for shell 3 (ionizationShell ==2)
|
||||
// sigmadiff_cumulated_ionisation_e_born.dat has zero cumulated partial xs at 18 eV for shell 3 (ionizationShell ==2)
|
||||
// this is due to the fact that the max allowed transfered energy is (18+10.79)/2=17.025 eV and only transfered energies
|
||||
// strictly above this value have non zero partial xs in sigmadiff_ionisation_e_born.dat (starting at trans = 17.12 eV)
|
||||
|
||||
/*if (fasterCode)
|
||||
do
|
||||
{
|
||||
Shell = RandomSelect(k,nameLocal2);
|
||||
}while (k<19*eV && ionizationShell==2 && particle->GetDefinition()==G4Electron::ElectronDefinition());*/
|
||||
|
||||
G4double bindingEnergy = SiStructure.Energy(Shell);
|
||||
|
||||
if (verboseLevel > 3)
|
||||
@@ -451,6 +512,9 @@ void G4MicroElecInelasticModel::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 difference and then sum the energies
|
||||
|
||||
//SI: additional protection if tcs interpolation method is modified
|
||||
if (k<bindingEnergy) return;
|
||||
|
||||
G4int Z = 14;
|
||||
|
||||
if(fAtomDeexcitation && Shell > 2) {
|
||||
@@ -472,7 +536,17 @@ void G4MicroElecInelasticModel::SampleSecondaries(std::vector<G4DynamicParticle*
|
||||
secNumberFinal = fvect->size();
|
||||
}
|
||||
|
||||
G4double secondaryKinetic = RandomizeEjectedElectronEnergy(PartDef,k,Shell);
|
||||
G4double secondaryKinetic=-1000*eV;
|
||||
|
||||
if (!fasterCode)
|
||||
{
|
||||
secondaryKinetic = RandomizeEjectedElectronEnergy(PartDef,k,Shell);
|
||||
}
|
||||
else
|
||||
{
|
||||
secondaryKinetic = RandomizeEjectedElectronEnergyFromCumulatedDcs(PartDef,k,Shell);
|
||||
}
|
||||
|
||||
|
||||
if (verboseLevel > 3)
|
||||
{
|
||||
@@ -486,8 +560,8 @@ void G4MicroElecInelasticModel::SampleSecondaries(std::vector<G4DynamicParticle*
|
||||
Z, Shell,
|
||||
couple->GetMaterial());
|
||||
|
||||
//if (particle->GetDefinition() == G4Electron::ElectronDefinition())
|
||||
//{
|
||||
if (particle->GetDefinition() == G4Electron::ElectronDefinition())
|
||||
{
|
||||
G4double deltaTotalMomentum = std::sqrt(secondaryKinetic*(secondaryKinetic + 2.*electron_mass_c2 ));
|
||||
|
||||
G4double finalPx = totalMomentum*primaryDirection.x() - deltaTotalMomentum*deltaDirection.x();
|
||||
@@ -502,8 +576,8 @@ void G4MicroElecInelasticModel::SampleSecondaries(std::vector<G4DynamicParticle*
|
||||
direction.set(finalPx,finalPy,finalPz);
|
||||
|
||||
fParticleChangeForGamma->ProposeMomentumDirection(direction.unit()) ;
|
||||
//}
|
||||
//else fParticleChangeForGamma->ProposeMomentumDirection(primaryDirection) ;
|
||||
}
|
||||
else fParticleChangeForGamma->ProposeMomentumDirection(primaryDirection) ;
|
||||
|
||||
// note that secondaryKinetic is the energy of the delta ray, not of all secondaries.
|
||||
G4double deexSecEnergy = 0;
|
||||
@@ -513,11 +587,13 @@ void G4MicroElecInelasticModel::SampleSecondaries(std::vector<G4DynamicParticle*
|
||||
fParticleChangeForGamma->SetProposedKineticEnergy(ekin-bindingEnergy-secondaryKinetic);
|
||||
fParticleChangeForGamma->ProposeLocalEnergyDeposit(bindingEnergy-deexSecEnergy);
|
||||
|
||||
G4DynamicParticle* dp = new G4DynamicParticle (G4Electron::Electron(),deltaDirection,secondaryKinetic) ;
|
||||
fvect->push_back(dp);
|
||||
|
||||
if (secondaryKinetic>0)
|
||||
{
|
||||
G4DynamicParticle* dp = new G4DynamicParticle (G4Electron::Electron(),deltaDirection,secondaryKinetic) ;
|
||||
fvect->push_back(dp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -579,6 +655,7 @@ G4double G4MicroElecInelasticModel::RandomizeEjectedElectronEnergy(G4ParticleDef
|
||||
if(differentialCrossSection >= crossSectionMaximum) crossSectionMaximum = differentialCrossSection;
|
||||
value*=stpEnergy;
|
||||
}
|
||||
|
||||
G4double secondaryElectronKineticEnergy = 0.;
|
||||
do
|
||||
{
|
||||
@@ -706,16 +783,16 @@ double G4MicroElecInelasticModel::DifferentialCrossSection(G4ParticleDefinition
|
||||
}
|
||||
}
|
||||
|
||||
G4double xsProduct = xs11 * xs12 * xs21 * xs22;
|
||||
if (xsProduct != 0.)
|
||||
{
|
||||
// G4double xsProduct = xs11 * xs12 * xs21 * xs22;
|
||||
// if (xsProduct != 0.)
|
||||
// {
|
||||
sigma = QuadInterpolator( valueE11, valueE12,
|
||||
valueE21, valueE22,
|
||||
xs11, xs12,
|
||||
xs21, xs22,
|
||||
valueT1, valueT2,
|
||||
k, energyTransfer);
|
||||
}
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -724,17 +801,45 @@ double G4MicroElecInelasticModel::DifferentialCrossSection(G4ParticleDefinition
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double G4MicroElecInelasticModel::LogLogInterpolate(G4double e1,
|
||||
G4double e2,
|
||||
G4double e,
|
||||
G4double xs1,
|
||||
G4double xs2)
|
||||
G4double G4MicroElecInelasticModel::Interpolate(G4double e1,
|
||||
G4double e2,
|
||||
G4double e,
|
||||
G4double xs1,
|
||||
G4double xs2)
|
||||
{
|
||||
G4double a = (std::log10(xs2)-std::log10(xs1)) / (std::log10(e2)-std::log10(e1));
|
||||
G4double b = std::log10(xs2) - a*std::log10(e2);
|
||||
G4double sigma = a*std::log10(e) + b;
|
||||
G4double value = (std::pow(10.,sigma));
|
||||
return value;
|
||||
G4double value = 0.;
|
||||
|
||||
// Log-log interpolation by default
|
||||
if (e1 != 0 && e2 != 0 && (std::log10(e2) - std::log10(e1)) != 0
|
||||
&& !fasterCode)
|
||||
{
|
||||
G4double a = (std::log10(xs2)-std::log10(xs1)) / (std::log10(e2)-std::log10(e1));
|
||||
G4double b = std::log10(xs2) - a*std::log10(e2);
|
||||
G4double sigma = a*std::log10(e) + b;
|
||||
value = (std::pow(10.,sigma));
|
||||
|
||||
}
|
||||
|
||||
// Switch to log-lin interpolation for faster code
|
||||
if ((e2 - e1) != 0 && xs1 != 0 && xs2 != 0 && fasterCode)
|
||||
{
|
||||
G4double d1 = std::log10(xs1);
|
||||
G4double d2 = std::log10(xs2);
|
||||
value = std::pow(10., (d1 + (d2 - d1) * (e - e1) / (e2 - e1)));
|
||||
}
|
||||
|
||||
// Switch to lin-lin interpolation for faster code
|
||||
// in case one of xs1 or xs2 (=cum proba) value is zero
|
||||
|
||||
if ((e2 - e1) != 0 && (xs1 == 0 || xs2 == 0)) // && fasterCode)
|
||||
{
|
||||
G4double d1 = xs1;
|
||||
G4double d2 = xs2;
|
||||
value = (d1 + (d2 - d1) * (e - e1) / (e2 - e1));
|
||||
}
|
||||
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -746,9 +851,9 @@ G4double G4MicroElecInelasticModel::QuadInterpolator(G4double e11, G4double e12,
|
||||
G4double t1, G4double t2,
|
||||
G4double t, G4double e)
|
||||
{
|
||||
G4double interpolatedvalue1 = LogLogInterpolate(e11, e12, e, xs11, xs12);
|
||||
G4double interpolatedvalue2 = LogLogInterpolate(e21, e22, e, xs21, xs22);
|
||||
G4double value = LogLogInterpolate(t1, t2, t, interpolatedvalue1, interpolatedvalue2);
|
||||
G4double interpolatedvalue1 = Interpolate(e11, e12, e, xs11, xs12);
|
||||
G4double interpolatedvalue2 = Interpolate(e21, e22, e, xs21, xs22);
|
||||
G4double value = Interpolate(t1, t2, t, interpolatedvalue1, interpolatedvalue2);
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -809,5 +914,330 @@ G4int G4MicroElecInelasticModel::RandomSelect(G4double k, const G4String& partic
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double G4MicroElecInelasticModel::RandomizeEjectedElectronEnergyFromCumulatedDcs(G4ParticleDefinition* particleDefinition,
|
||||
G4double k,
|
||||
G4int shell)
|
||||
{
|
||||
|
||||
G4double secondaryElectronKineticEnergy = 0.;
|
||||
|
||||
G4double random = G4UniformRand();
|
||||
|
||||
secondaryElectronKineticEnergy = TransferedEnergy(particleDefinition,
|
||||
k / eV,
|
||||
shell,
|
||||
random) * eV
|
||||
- SiStructure.Energy(shell);
|
||||
|
||||
if (secondaryElectronKineticEnergy < 0.)
|
||||
return 0.;
|
||||
//
|
||||
|
||||
return secondaryElectronKineticEnergy;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double G4MicroElecInelasticModel::TransferedEnergy(G4ParticleDefinition* particleDefinition,
|
||||
G4double k,
|
||||
G4int ionizationLevelIndex,
|
||||
G4double random)
|
||||
{
|
||||
G4double nrj = 0.;
|
||||
|
||||
G4double valueK1 = 0;
|
||||
G4double valueK2 = 0;
|
||||
G4double valuePROB21 = 0;
|
||||
G4double valuePROB22 = 0;
|
||||
G4double valuePROB12 = 0;
|
||||
G4double valuePROB11 = 0;
|
||||
|
||||
G4double nrjTransf11 = 0;
|
||||
G4double nrjTransf12 = 0;
|
||||
G4double nrjTransf21 = 0;
|
||||
G4double nrjTransf22 = 0;
|
||||
|
||||
G4double maximumEnergyTransfer1 = 0;
|
||||
G4double maximumEnergyTransfer2 = 0;
|
||||
G4double maximumEnergyTransferP = 4.* (electron_mass_c2 / proton_mass_c2) * k;
|
||||
G4double bindingEnergy = SiStructure.Energy(ionizationLevelIndex)*1e6;
|
||||
|
||||
if (particleDefinition == G4Electron::ElectronDefinition())
|
||||
{
|
||||
// k should be in eV
|
||||
std::vector<double>::iterator k2 = std::upper_bound(eTdummyVec.begin(),
|
||||
eTdummyVec.end(),
|
||||
k);
|
||||
std::vector<double>::iterator k1 = k2 - 1;
|
||||
|
||||
/*
|
||||
G4cout << "----> k=" << k
|
||||
<< " " << *k1
|
||||
<< " " << *k2
|
||||
<< " " << random
|
||||
<< " " << ionizationLevelIndex
|
||||
<< " " << eProbaShellMap[ionizationLevelIndex][(*k1)].back()
|
||||
<< " " << eProbaShellMap[ionizationLevelIndex][(*k2)].back()
|
||||
<< G4endl;
|
||||
*/
|
||||
|
||||
// SI : the following condition avoids situations where random >last vector element
|
||||
if (random <= eProbaShellMap[ionizationLevelIndex][(*k1)].back()
|
||||
&& random <= eProbaShellMap[ionizationLevelIndex][(*k2)].back())
|
||||
{
|
||||
std::vector<double>::iterator prob12 =
|
||||
std::upper_bound(eProbaShellMap[ionizationLevelIndex][(*k1)].begin(),
|
||||
eProbaShellMap[ionizationLevelIndex][(*k1)].end(),
|
||||
random);
|
||||
|
||||
std::vector<double>::iterator prob11 = prob12 - 1;
|
||||
|
||||
std::vector<double>::iterator prob22 =
|
||||
std::upper_bound(eProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
|
||||
eProbaShellMap[ionizationLevelIndex][(*k2)].end(),
|
||||
random);
|
||||
|
||||
std::vector<double>::iterator prob21 = prob22 - 1;
|
||||
|
||||
valueK1 = *k1;
|
||||
valueK2 = *k2;
|
||||
valuePROB21 = *prob21;
|
||||
valuePROB22 = *prob22;
|
||||
valuePROB12 = *prob12;
|
||||
valuePROB11 = *prob11;
|
||||
|
||||
/*
|
||||
G4cout << " " << random << " " << valuePROB11 << " "
|
||||
<< valuePROB12 << " " << valuePROB21 << " " << valuePROB22 << G4endl;
|
||||
*/
|
||||
|
||||
// The following condition avoid getting transfered energy < binding energy and forces cumxs = 1 for maximum energy transfer.
|
||||
if(valuePROB11 == 0) nrjTransf11 = bindingEnergy;
|
||||
else nrjTransf11 = eNrjTransfData[ionizationLevelIndex][valueK1][valuePROB11];
|
||||
if(valuePROB12 == 1)
|
||||
{
|
||||
if ((valueK1+bindingEnergy)/2. > valueK1) maximumEnergyTransfer1=valueK1;
|
||||
else maximumEnergyTransfer1 = (valueK1+bindingEnergy)/2.;
|
||||
|
||||
nrjTransf12 = maximumEnergyTransfer1;
|
||||
}
|
||||
else nrjTransf12 = eNrjTransfData[ionizationLevelIndex][valueK1][valuePROB12];
|
||||
|
||||
if(valuePROB21 == 0) nrjTransf21 = bindingEnergy;
|
||||
else nrjTransf21 = eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
|
||||
if(valuePROB22 == 1)
|
||||
{
|
||||
if ((valueK2+bindingEnergy)/2. > valueK2) maximumEnergyTransfer2=valueK2;
|
||||
else maximumEnergyTransfer2 = (valueK2+bindingEnergy)/2.;
|
||||
|
||||
nrjTransf22 = maximumEnergyTransfer2;
|
||||
}
|
||||
else nrjTransf22 = eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
|
||||
|
||||
|
||||
/*nrjTransf11 = eNrjTransfData[ionizationLevelIndex][valueK1][valuePROB11];
|
||||
nrjTransf12 = eNrjTransfData[ionizationLevelIndex][valueK1][valuePROB12];
|
||||
nrjTransf21 = eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
|
||||
nrjTransf22 = eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];*/
|
||||
|
||||
/*
|
||||
G4cout << " " << ionizationLevelIndex << " "
|
||||
<< random << " " <<valueK1 << " " << valueK2 << G4endl;
|
||||
|
||||
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 > eProbaShellMap[ionizationLevelIndex][(*k1)].back())
|
||||
{
|
||||
std::vector<double>::iterator prob22 =
|
||||
std::upper_bound(eProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
|
||||
eProbaShellMap[ionizationLevelIndex][(*k2)].end(),
|
||||
random);
|
||||
|
||||
std::vector<double>::iterator prob21 = prob22 - 1;
|
||||
|
||||
valueK1 = *k1;
|
||||
valueK2 = *k2;
|
||||
valuePROB21 = *prob21;
|
||||
valuePROB22 = *prob22;
|
||||
|
||||
//G4cout << " " << random << " " << valuePROB21 << " " << valuePROB22 << G4endl;
|
||||
|
||||
nrjTransf21 = eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
|
||||
nrjTransf22 = eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
|
||||
|
||||
G4double interpolatedvalue2 = Interpolate(valuePROB21,
|
||||
valuePROB22,
|
||||
random,
|
||||
nrjTransf21,
|
||||
nrjTransf22);
|
||||
|
||||
// zeros are explicitely set
|
||||
|
||||
G4double value = Interpolate(valueK1, valueK2, k, 0., interpolatedvalue2);
|
||||
|
||||
/*
|
||||
G4cout << " " << ionizationLevelIndex << " "
|
||||
<< random << " " <<valueK1 << " " << valueK2 << G4endl;
|
||||
|
||||
G4cout << " " << random << " " << nrjTransf11 << " "
|
||||
<< nrjTransf12 << " " << nrjTransf21 << " " <<nrjTransf22 << G4endl;
|
||||
|
||||
G4cout << "ici" << " " << value << G4endl;
|
||||
*/
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
//
|
||||
else if (particleDefinition == G4Proton::ProtonDefinition())
|
||||
{
|
||||
// k should be in eV
|
||||
|
||||
std::vector<double>::iterator k2 = std::upper_bound(pTdummyVec.begin(),
|
||||
pTdummyVec.end(),
|
||||
k);
|
||||
|
||||
std::vector<double>::iterator k1 = k2 - 1;
|
||||
|
||||
/*
|
||||
G4cout << "----> k=" << k
|
||||
<< " " << *k1
|
||||
<< " " << *k2
|
||||
<< " " << random
|
||||
<< " " << ionizationLevelIndex
|
||||
<< " " << pProbaShellMap[ionizationLevelIndex][(*k1)].back()
|
||||
<< " " << pProbaShellMap[ionizationLevelIndex][(*k2)].back()
|
||||
<< G4endl;
|
||||
*/
|
||||
|
||||
// SI : the following condition avoids situations where random > last vector element,
|
||||
// for eg. when the last element is zero
|
||||
if (random <= pProbaShellMap[ionizationLevelIndex][(*k1)].back()
|
||||
&& random <= pProbaShellMap[ionizationLevelIndex][(*k2)].back())
|
||||
{
|
||||
std::vector<double>::iterator prob12 =
|
||||
std::upper_bound(pProbaShellMap[ionizationLevelIndex][(*k1)].begin(),
|
||||
pProbaShellMap[ionizationLevelIndex][(*k1)].end(),
|
||||
random);
|
||||
|
||||
std::vector<double>::iterator prob11 = prob12 - 1;
|
||||
|
||||
std::vector<double>::iterator prob22 =
|
||||
std::upper_bound(pProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
|
||||
pProbaShellMap[ionizationLevelIndex][(*k2)].end(),
|
||||
random);
|
||||
|
||||
std::vector<double>::iterator prob21 = prob22 - 1;
|
||||
|
||||
valueK1 = *k1;
|
||||
valueK2 = *k2;
|
||||
valuePROB21 = *prob21;
|
||||
valuePROB22 = *prob22;
|
||||
valuePROB12 = *prob12;
|
||||
valuePROB11 = *prob11;
|
||||
|
||||
/*
|
||||
G4cout << " " << random << " " << valuePROB11 << " "
|
||||
<< valuePROB12 << " " << valuePROB21 << " " << valuePROB22 << G4endl;
|
||||
*/
|
||||
|
||||
// The following condition avoid getting transfered energy < binding energy and forces cumxs = 1 for maximum energy transfer.
|
||||
if(valuePROB11 == 0) nrjTransf11 = bindingEnergy;
|
||||
else nrjTransf11 = pNrjTransfData[ionizationLevelIndex][valueK1][valuePROB11];
|
||||
if(valuePROB12 == 1) nrjTransf12 = maximumEnergyTransferP;
|
||||
else nrjTransf12 = pNrjTransfData[ionizationLevelIndex][valueK1][valuePROB12];
|
||||
if(valuePROB21 == 0) nrjTransf21 = bindingEnergy;
|
||||
else nrjTransf21 = pNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
|
||||
if(valuePROB22 == 1) nrjTransf22 = maximumEnergyTransferP;
|
||||
else nrjTransf22 = pNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
|
||||
|
||||
|
||||
/* nrjTransf11 = eNrjTransfData[ionizationLevelIndex][valueK1][valuePROB11];
|
||||
nrjTransf12 = eNrjTransfData[ionizationLevelIndex][valueK1][valuePROB12];
|
||||
nrjTransf21 = eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
|
||||
nrjTransf22 = eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];*/
|
||||
|
||||
/*
|
||||
G4cout << " " << ionizationLevelIndex << " "
|
||||
<< random << " " <<valueK1 << " " << valueK2 << G4endl;
|
||||
|
||||
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 > pProbaShellMap[ionizationLevelIndex][(*k1)].back())
|
||||
{
|
||||
std::vector<double>::iterator prob22 =
|
||||
std::upper_bound(pProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
|
||||
pProbaShellMap[ionizationLevelIndex][(*k2)].end(),
|
||||
random);
|
||||
|
||||
std::vector<double>::iterator prob21 = prob22 - 1;
|
||||
|
||||
valueK1 = *k1;
|
||||
valueK2 = *k2;
|
||||
valuePROB21 = *prob21;
|
||||
valuePROB22 = *prob22;
|
||||
|
||||
//G4cout << " " << random << " " << valuePROB21 << " " << valuePROB22 << G4endl;
|
||||
|
||||
nrjTransf21 = pNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
|
||||
nrjTransf22 = pNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
|
||||
|
||||
G4double interpolatedvalue2 = Interpolate(valuePROB21,
|
||||
valuePROB22,
|
||||
random,
|
||||
nrjTransf21,
|
||||
nrjTransf22);
|
||||
|
||||
// zeros are explicitely set
|
||||
|
||||
G4double value = Interpolate(valueK1, valueK2, k, 0., interpolatedvalue2);
|
||||
|
||||
/*
|
||||
G4cout << " " << ionizationLevelIndex << " "
|
||||
<< random << " " <<valueK1 << " " << valueK2 << G4endl;
|
||||
|
||||
G4cout << " " << random << " " << nrjTransf11 << " "
|
||||
<< nrjTransf12 << " " << nrjTransf21 << " " <<nrjTransf22 << G4endl;
|
||||
|
||||
G4cout << "ici" << " " << value << G4endl;
|
||||
*/
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
// End electron and proton cases
|
||||
|
||||
G4double nrjTransfProduct = nrjTransf11 * nrjTransf12 * nrjTransf21
|
||||
* nrjTransf22;
|
||||
//G4cout << "nrjTransfProduct=" << nrjTransfProduct << G4endl;
|
||||
|
||||
if (nrjTransfProduct != 0.)
|
||||
{
|
||||
nrj = QuadInterpolator(valuePROB11,
|
||||
valuePROB12,
|
||||
valuePROB21,
|
||||
valuePROB22,
|
||||
nrjTransf11,
|
||||
nrjTransf12,
|
||||
nrjTransf21,
|
||||
nrjTransf22,
|
||||
valueK1,
|
||||
valueK2,
|
||||
k,
|
||||
random);
|
||||
}
|
||||
//G4cout << nrj << endl;
|
||||
|
||||
return nrj;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4PenelopeBremsstrahlungAngular.cc 95950 2016-03-03 10:42:48Z gcosmo $
|
||||
// $Id: G4PenelopeBremsstrahlungAngular.cc 99415 2016-09-21 09:05:43Z gcosmo $
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
//
|
||||
@@ -85,35 +85,33 @@ void G4PenelopeBremsstrahlungAngular::Initialize()
|
||||
|
||||
void G4PenelopeBremsstrahlungAngular::ClearTables()
|
||||
{
|
||||
std::map<G4double,G4PhysicsTable*>::iterator j;
|
||||
|
||||
if (theLorentzTables1)
|
||||
{
|
||||
for (j=theLorentzTables1->begin(); j != theLorentzTables1->end(); j++)
|
||||
for (auto j = theLorentzTables1->begin(); j != theLorentzTables1->end(); j++)
|
||||
{
|
||||
G4PhysicsTable* tab = j->second;
|
||||
//tab->clearAndDestroy();
|
||||
delete tab;
|
||||
}
|
||||
delete theLorentzTables1;
|
||||
theLorentzTables1 = 0;
|
||||
theLorentzTables1 = nullptr;
|
||||
}
|
||||
|
||||
if (theLorentzTables2)
|
||||
{
|
||||
for (j=theLorentzTables2->begin(); j != theLorentzTables2->end(); j++)
|
||||
for (auto j=theLorentzTables2->begin(); j != theLorentzTables2->end(); j++)
|
||||
{
|
||||
G4PhysicsTable* tab = j->second;
|
||||
//tab->clearAndDestroy();
|
||||
delete tab;
|
||||
}
|
||||
delete theLorentzTables2;
|
||||
theLorentzTables2 = 0;
|
||||
theLorentzTables2 = nullptr;
|
||||
}
|
||||
if (theEffectiveZSq)
|
||||
{
|
||||
delete theEffectiveZSq;
|
||||
theEffectiveZSq = 0;
|
||||
theEffectiveZSq = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -335,7 +333,7 @@ G4ThreeVector& G4PenelopeBremsstrahlungAngular::SampleDirection(const G4DynamicP
|
||||
if (!material)
|
||||
{
|
||||
G4Exception("G4PenelopeBremsstrahlungAngular::SampleDirection()",
|
||||
"em2040",FatalException,"The pointer to G4Material* is NULL");
|
||||
"em2040",FatalException,"The pointer to G4Material* is nullptr");
|
||||
return fLocalDirection;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4PenelopeBremsstrahlungFS.cc 95950 2016-03-03 10:42:48Z gcosmo $
|
||||
// $Id: G4PenelopeBremsstrahlungFS.cc 101820 2016-12-01 08:34:05Z gcosmo $
|
||||
//
|
||||
// Author: Luciano Pandola
|
||||
//
|
||||
@@ -43,9 +43,10 @@
|
||||
#include "G4PhysicsTable.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G4AutoDelete.hh"
|
||||
#include "G4Exp.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4Exp.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
@@ -76,16 +77,15 @@ G4PenelopeBremsstrahlungFS::~G4PenelopeBremsstrahlungFS()
|
||||
ClearTables();
|
||||
|
||||
//The G4Physics*Vector pointers contained in the fCache are automatically deleted by
|
||||
//the G4Allocator, so there is no need to take care of them manually
|
||||
//the G4AutoDelete so there is no need to take care of them manually
|
||||
|
||||
//Clear manually theElementData
|
||||
if (theElementData)
|
||||
{
|
||||
std::map<G4int,G4DataVector*>::iterator i;
|
||||
for (i=theElementData->begin(); i != theElementData->end(); i++)
|
||||
delete i->second;
|
||||
for (auto& item : (*theElementData))
|
||||
delete item.second;
|
||||
delete theElementData;
|
||||
theElementData = 0;
|
||||
theElementData = nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -100,30 +100,29 @@ void G4PenelopeBremsstrahlungFS::ClearTables(G4bool isMaster)
|
||||
G4Exception("G4PenelopeBremsstrahlungFS::ClearTables()",
|
||||
"em0100",FatalException,"Worker thread in this method");
|
||||
|
||||
std::map< std::pair<const G4Material*,G4double> ,G4PhysicsTable*>::iterator j;
|
||||
|
||||
if (theReducedXSTable)
|
||||
{
|
||||
for (j=theReducedXSTable->begin(); j != theReducedXSTable->end(); j++)
|
||||
for (auto& item : (*theReducedXSTable))
|
||||
{
|
||||
G4PhysicsTable* tab = j->second;
|
||||
//G4PhysicsTable* tab = item.second;
|
||||
//tab->clearAndDestroy();
|
||||
delete tab;
|
||||
delete item.second;
|
||||
}
|
||||
delete theReducedXSTable;
|
||||
theReducedXSTable = 0;
|
||||
theReducedXSTable = nullptr;
|
||||
}
|
||||
|
||||
if (theSamplingTable)
|
||||
{
|
||||
for (j=theSamplingTable->begin(); j != theSamplingTable->end(); j++)
|
||||
for (auto& item : (*theSamplingTable))
|
||||
{
|
||||
G4PhysicsTable* tab = j->second;
|
||||
//G4PhysicsTable* tab = item.second;
|
||||
// tab->clearAndDestroy();
|
||||
delete tab;
|
||||
delete item.second;
|
||||
}
|
||||
delete theSamplingTable;
|
||||
theSamplingTable = 0;
|
||||
theSamplingTable = nullptr;
|
||||
}
|
||||
if (thePBcut)
|
||||
{
|
||||
@@ -133,14 +132,14 @@ void G4PenelopeBremsstrahlungFS::ClearTables(G4bool isMaster)
|
||||
delete kk->second;
|
||||
*/
|
||||
delete thePBcut;
|
||||
thePBcut = 0;
|
||||
thePBcut = nullptr;
|
||||
}
|
||||
|
||||
|
||||
if (theEffectiveZSq)
|
||||
{
|
||||
delete theEffectiveZSq;
|
||||
theEffectiveZSq = 0;
|
||||
theEffectiveZSq = nullptr;
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -666,10 +665,10 @@ G4double G4PenelopeBremsstrahlungFS::SampleGammaEnergy(G4double energy,const G4M
|
||||
G4PhysicsFreeVector* theTempVec = fCache.Get();
|
||||
if (!theTempVec) //First time this thread gets the cache
|
||||
{
|
||||
theTempVec = new G4PhysicsFreeVector(nBinsX);
|
||||
//The G4Physics*Vector pointers are automatically deleted by the G4Allocator,
|
||||
//so there is no need to take care of it manually
|
||||
theTempVec = new G4PhysicsFreeVector(nBinsX);
|
||||
fCache.Put(theTempVec);
|
||||
// The G4AutoDelete takes care here to clean up the vectors
|
||||
G4AutoDelete::Register(theTempVec);
|
||||
if (fVerbosity > 4)
|
||||
G4cout << "Creating new instance of G4PhysicsFreeVector() on the worker" << G4endl;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4PenelopeBremsstrahlungModel.cc 95950 2016-03-03 10:42:48Z gcosmo $
|
||||
// $Id: G4PenelopeBremsstrahlungModel.cc 99415 2016-09-21 09:05:43Z gcosmo $
|
||||
//
|
||||
// Author: Luciano Pandola
|
||||
//
|
||||
@@ -441,26 +441,19 @@ void G4PenelopeBremsstrahlungModel::ClearTables()
|
||||
G4Exception("G4PenelopeBremsstrahlungModel::ClearTables()",
|
||||
"em0100",FatalException,"Worker thread in this method");
|
||||
|
||||
std::map< std::pair<const G4Material*,G4double>, G4PenelopeCrossSection*>::iterator i;
|
||||
if (XSTableElectron)
|
||||
{
|
||||
for (i=XSTableElectron->begin(); i != XSTableElectron->end(); i++)
|
||||
{
|
||||
G4PenelopeCrossSection* tab = i->second;
|
||||
delete tab;
|
||||
}
|
||||
for (auto& item : (*XSTableElectron))
|
||||
delete item.second;
|
||||
delete XSTableElectron;
|
||||
XSTableElectron = 0;
|
||||
XSTableElectron = nullptr;
|
||||
}
|
||||
if (XSTablePositron)
|
||||
{
|
||||
for (i=XSTablePositron->begin(); i != XSTablePositron->end(); i++)
|
||||
{
|
||||
G4PenelopeCrossSection* tab = i->second;
|
||||
delete tab;
|
||||
}
|
||||
for (auto& item : (*XSTablePositron))
|
||||
delete item.second;
|
||||
delete XSTablePositron;
|
||||
XSTablePositron = 0;
|
||||
XSTablePositron = nullptr;
|
||||
}
|
||||
/*
|
||||
if (energyGrid)
|
||||
@@ -610,7 +603,7 @@ G4PenelopeBremsstrahlungModel::GetCrossSectionTableForCouple(const G4ParticleDef
|
||||
ed << "Invalid particle: " << part->GetParticleName() << G4endl;
|
||||
G4Exception("G4PenelopeBremsstrahlungModel::GetCrossSectionTableForCouple()",
|
||||
"em0001",FatalException,ed);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (part == G4Electron::Electron())
|
||||
@@ -706,7 +699,7 @@ G4PenelopeBremsstrahlungModel::GetCrossSectionTableForCouple(const G4ParticleDef
|
||||
return XSTablePositron->find(theKey)->second;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4PenelopeComptonModel.cc 95950 2016-03-03 10:42:48Z gcosmo $
|
||||
// $Id: G4PenelopeComptonModel.cc 99415 2016-09-21 09:05:43Z gcosmo $
|
||||
//
|
||||
// Author: Luciano Pandola
|
||||
//
|
||||
@@ -554,7 +554,7 @@ void G4PenelopeComptonModel::SampleSecondaries(std::vector<G4DynamicParticle*>*
|
||||
}
|
||||
|
||||
//the local energy deposit is what remains: part of this may be spent for fluorescence.
|
||||
//Notice: shell might be NULL (invalid!) if shFlag=30. Must be protected
|
||||
//Notice: shell might be nullptr (invalid!) if shFlag=30. Must be protected
|
||||
//Now, take care of fluorescence, if required
|
||||
if (fAtomDeexcitation && shell)
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4PenelopeGammaConversionModel.cc 95950 2016-03-03 10:42:48Z gcosmo $
|
||||
// $Id: G4PenelopeGammaConversionModel.cc 99415 2016-09-21 09:05:43Z gcosmo $
|
||||
//
|
||||
// Author: Luciano Pandola
|
||||
//
|
||||
@@ -91,9 +91,8 @@ G4PenelopeGammaConversionModel::~G4PenelopeGammaConversionModel()
|
||||
{
|
||||
if (logAtomicCrossSection)
|
||||
{
|
||||
std::map <G4int,G4PhysicsFreeVector*>::iterator i;
|
||||
for (i=logAtomicCrossSection->begin();i != logAtomicCrossSection->end();i++)
|
||||
if (i->second) delete i->second;
|
||||
for (auto& item : (*logAtomicCrossSection))
|
||||
if (item.second) delete item.second;
|
||||
delete logAtomicCrossSection;
|
||||
}
|
||||
if (fEffectiveCharge)
|
||||
@@ -127,17 +126,17 @@ void G4PenelopeGammaConversionModel::Initialise(const G4ParticleDefinition* part
|
||||
if (fEffectiveCharge)
|
||||
{
|
||||
delete fEffectiveCharge;
|
||||
fEffectiveCharge = 0;
|
||||
fEffectiveCharge = nullptr;
|
||||
}
|
||||
if (fMaterialInvScreeningRadius)
|
||||
{
|
||||
delete fMaterialInvScreeningRadius;
|
||||
fMaterialInvScreeningRadius = 0;
|
||||
fMaterialInvScreeningRadius = nullptr;
|
||||
}
|
||||
if (fScreeningFunction)
|
||||
{
|
||||
delete fScreeningFunction;
|
||||
fScreeningFunction = 0;
|
||||
fScreeningFunction = nullptr;
|
||||
}
|
||||
//and create new ones
|
||||
fEffectiveCharge = new std::map<const G4Material*,G4double>;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4PenelopeIonisationCrossSection.cc 74626 2013-10-17 07:00:59Z gcosmo $
|
||||
// $Id: G4PenelopeIonisationCrossSection.cc 99415 2016-09-21 09:05:43Z gcosmo $
|
||||
//
|
||||
// Author: Luciano Pandola
|
||||
//
|
||||
@@ -88,7 +88,7 @@ G4double G4PenelopeIonisationCrossSection::CrossSection(G4int Z,
|
||||
{
|
||||
//CRASH!
|
||||
G4ExceptionDescription ed;
|
||||
ed << "The method has been called with a NULL G4Material pointer" << G4endl;
|
||||
ed << "The method has been called with a null G4Material pointer" << G4endl;
|
||||
G4Exception("G4PenelopeIonisationCrossSection::CrossSection()","em2042",
|
||||
FatalException,ed);
|
||||
return cross;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4PenelopeIonisationModel.cc 93359 2015-10-19 13:42:18Z gcosmo $
|
||||
// $Id: G4PenelopeIonisationModel.cc 99415 2016-09-21 09:05:43Z gcosmo $
|
||||
//
|
||||
// Author: Luciano Pandola
|
||||
//
|
||||
@@ -615,7 +615,7 @@ void G4PenelopeIonisationModel::SampleSecondaries(std::vector<G4DynamicParticle*
|
||||
energySecondary = 0.0;
|
||||
}
|
||||
|
||||
//Notice: shell might be NULL (invalid!) if shFlag=30. Must be protected
|
||||
//Notice: shell might be nullptr (invalid!) if shFlag=30. Must be protected
|
||||
//Disable the built-in de-excitation of the PIXE flag is active. In this
|
||||
//case, the PIXE interface takes care (statistically) of producing the
|
||||
//de-excitation.
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4PenelopeIonisationXSHandler.cc 83584 2014-09-02 08:45:37Z gcosmo $
|
||||
// $Id: G4PenelopeIonisationXSHandler.cc 99415 2016-09-21 09:05:43Z gcosmo $
|
||||
//
|
||||
// Author: Luciano Pandola
|
||||
//
|
||||
@@ -69,37 +69,33 @@ G4PenelopeIonisationXSHandler::G4PenelopeIonisationXSHandler(size_t nb)
|
||||
|
||||
G4PenelopeIonisationXSHandler::~G4PenelopeIonisationXSHandler()
|
||||
{
|
||||
std::map< std::pair<const G4Material*,G4double>, G4PenelopeCrossSection*>::iterator i;
|
||||
if (XSTableElectron)
|
||||
{
|
||||
for (i=XSTableElectron->begin(); i != XSTableElectron->end(); i++)
|
||||
{
|
||||
G4PenelopeCrossSection* tab = i->second;
|
||||
delete tab;
|
||||
for (auto& item : (*XSTableElectron))
|
||||
{
|
||||
//G4PenelopeCrossSection* tab = i->second;
|
||||
delete item.second;
|
||||
}
|
||||
delete XSTableElectron;
|
||||
XSTableElectron = 0;
|
||||
XSTableElectron = nullptr;
|
||||
}
|
||||
|
||||
if (XSTablePositron)
|
||||
{
|
||||
for (i=XSTablePositron->begin(); i != XSTablePositron->end(); i++)
|
||||
for (auto& item : (*XSTablePositron))
|
||||
{
|
||||
G4PenelopeCrossSection* tab = i->second;
|
||||
delete tab;
|
||||
//G4PenelopeCrossSection* tab = i->second;
|
||||
delete item.second;
|
||||
}
|
||||
delete XSTablePositron;
|
||||
XSTablePositron = 0;
|
||||
XSTablePositron = nullptr;
|
||||
}
|
||||
|
||||
std::map<const G4Material*,G4PhysicsFreeVector*>::iterator k;
|
||||
if (theDeltaTable)
|
||||
{
|
||||
for (k=theDeltaTable->begin();k!=theDeltaTable->end();k++)
|
||||
delete k->second;
|
||||
|
||||
for (auto& item : (*theDeltaTable))
|
||||
delete item.second;
|
||||
delete theDeltaTable;
|
||||
theDeltaTable = 0;
|
||||
theDeltaTable = nullptr;
|
||||
}
|
||||
if (energyGrid)
|
||||
delete energyGrid;
|
||||
@@ -122,7 +118,7 @@ G4PenelopeIonisationXSHandler::GetCrossSectionTableForCouple(const G4ParticleDef
|
||||
ed << "Invalid particle: " << part->GetParticleName() << G4endl;
|
||||
G4Exception("G4PenelopeIonisationXSHandler::GetCrossSectionTableForCouple()",
|
||||
"em0001",FatalException,ed);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (part == G4Electron::Electron())
|
||||
@@ -132,13 +128,13 @@ G4PenelopeIonisationXSHandler::GetCrossSectionTableForCouple(const G4ParticleDef
|
||||
G4Exception("G4PenelopeIonisationXSHandler::GetCrossSectionTableForCouple()",
|
||||
"em0028",FatalException,
|
||||
"The Cross Section Table for e- was not initialized correctly!");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
std::pair<const G4Material*,G4double> theKey = std::make_pair(mat,cut);
|
||||
if (XSTableElectron->count(theKey)) //table already built
|
||||
return XSTableElectron->find(theKey)->second;
|
||||
else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (part == G4Positron::Positron())
|
||||
@@ -148,15 +144,15 @@ G4PenelopeIonisationXSHandler::GetCrossSectionTableForCouple(const G4ParticleDef
|
||||
G4Exception("G4PenelopeIonisationXSHandler::GetCrossSectionTableForCouple()",
|
||||
"em0028",FatalException,
|
||||
"The Cross Section Table for e+ was not initialized correctly!");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
std::pair<const G4Material*,G4double> theKey = std::make_pair(mat,cut);
|
||||
if (XSTablePositron->count(theKey)) //table already built
|
||||
return XSTablePositron->find(theKey)->second;
|
||||
else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
@@ -102,10 +102,9 @@ void G4PenelopeOscillatorManager::Clear()
|
||||
G4cout << " G4PenelopeOscillatorManager::Clear() - Clean Oscillator Tables" << G4endl;
|
||||
|
||||
//Clean up OscillatorStoreIonisation
|
||||
std::map<const G4Material*,G4PenelopeOscillatorTable*>::iterator i;
|
||||
for (i=oscillatorStoreIonisation->begin();i != oscillatorStoreIonisation->end();i++)
|
||||
for (auto& item : (*oscillatorStoreIonisation))
|
||||
{
|
||||
G4PenelopeOscillatorTable* table = i->second;
|
||||
G4PenelopeOscillatorTable* table = item.second;
|
||||
if (table)
|
||||
{
|
||||
for (size_t k=0;k<table->size();k++) //clean individual oscillators
|
||||
@@ -119,9 +118,9 @@ void G4PenelopeOscillatorManager::Clear()
|
||||
delete oscillatorStoreIonisation;
|
||||
|
||||
//Clean up OscillatorStoreCompton
|
||||
for (i=oscillatorStoreCompton->begin();i != oscillatorStoreCompton->end();i++)
|
||||
for (auto& item : (*oscillatorStoreCompton))
|
||||
{
|
||||
G4PenelopeOscillatorTable* table = i->second;
|
||||
G4PenelopeOscillatorTable* table = item.second;
|
||||
if (table)
|
||||
{
|
||||
for (size_t k=0;k<table->size();k++) //clean individual oscillators
|
||||
@@ -336,7 +335,7 @@ G4PenelopeOscillatorTable* G4PenelopeOscillatorManager::GetOscillatorTableIonisa
|
||||
{
|
||||
G4cout << "G4PenelopeOscillatorManager::GetOscillatorTableIonisation() " << G4endl;
|
||||
G4cout << "Impossible to create ionisation oscillator table for " << mat->GetName() << G4endl;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -354,7 +353,7 @@ G4PenelopeOscillator* G4PenelopeOscillatorManager::GetOscillatorIonisation(const
|
||||
theTable->size() << " oscillators" << G4endl;
|
||||
G4cout << "Oscillator #" << index << " cannot be retrieved" << G4endl;
|
||||
G4cout << "Returning null pointer" << G4endl;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -383,7 +382,7 @@ G4PenelopeOscillatorTable* G4PenelopeOscillatorManager::GetOscillatorTableCompto
|
||||
{
|
||||
G4cout << "G4PenelopeOscillatorManager::GetOscillatorTableCompton() " << G4endl;
|
||||
G4cout << "Impossible to create Compton oscillator table for " << mat->GetName() << G4endl;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -401,7 +400,7 @@ G4PenelopeOscillator* G4PenelopeOscillatorManager::GetOscillatorCompton(const G4
|
||||
theTable->size() << " oscillators" << G4endl;
|
||||
G4cout << "Oscillator #" << index << " cannot be retrieved" << G4endl;
|
||||
G4cout << "Returning null pointer" << G4endl;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4PenelopePhotoElectricModel.cc 95950 2016-03-03 10:42:48Z gcosmo $
|
||||
// $Id: G4PenelopePhotoElectricModel.cc 99415 2016-09-21 09:05:43Z gcosmo $
|
||||
//
|
||||
// Author: Luciano Pandola
|
||||
//
|
||||
@@ -97,14 +97,13 @@ G4PenelopePhotoElectricModel::~G4PenelopePhotoElectricModel()
|
||||
{
|
||||
if (IsMaster() || fLocalTable)
|
||||
{
|
||||
std::map <G4int,G4PhysicsTable*>::iterator i;
|
||||
if (logAtomicShellXS)
|
||||
{
|
||||
for (i=logAtomicShellXS->begin();i != logAtomicShellXS->end();i++)
|
||||
for (auto& item : (*logAtomicShellXS))
|
||||
{
|
||||
G4PhysicsTable* tab = i->second;
|
||||
//G4PhysicsTable* tab = item.second;
|
||||
//tab->clearAndDestroy();
|
||||
delete tab;
|
||||
delete item.second;
|
||||
}
|
||||
}
|
||||
delete logAtomicShellXS;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4PenelopeRayleighModel.cc 97098 2016-05-25 08:04:17Z gcosmo $
|
||||
// $Id: G4PenelopeRayleighModel.cc 99415 2016-09-21 09:05:43Z gcosmo $
|
||||
//
|
||||
// Author: Luciano Pandola
|
||||
//
|
||||
@@ -97,23 +97,20 @@ G4PenelopeRayleighModel::~G4PenelopeRayleighModel()
|
||||
{
|
||||
if (IsMaster() || fLocalTable)
|
||||
{
|
||||
std::map <G4int,G4PhysicsFreeVector*>::iterator i;
|
||||
if (logAtomicCrossSection)
|
||||
{
|
||||
for (i=logAtomicCrossSection->begin();i != logAtomicCrossSection->end();i++)
|
||||
if (i->second) delete i->second;
|
||||
|
||||
for (auto& item : (*logAtomicCrossSection))
|
||||
if (item.second) delete item.second;
|
||||
delete logAtomicCrossSection;
|
||||
logAtomicCrossSection = 0;
|
||||
logAtomicCrossSection = nullptr;
|
||||
}
|
||||
if (atomicFormFactor)
|
||||
{
|
||||
for (i=atomicFormFactor->begin();i != atomicFormFactor->end();i++)
|
||||
if (i->second) delete i->second;
|
||||
for (auto& item : (*atomicFormFactor))
|
||||
if (item.second) delete item.second;
|
||||
delete atomicFormFactor;
|
||||
atomicFormFactor = 0;
|
||||
atomicFormFactor = nullptr;
|
||||
}
|
||||
|
||||
ClearTables();
|
||||
}
|
||||
}
|
||||
@@ -128,31 +125,28 @@ void G4PenelopeRayleighModel::ClearTables()
|
||||
"em0100",FatalException,"Worker thread in this method");
|
||||
*/
|
||||
|
||||
std::map <const G4Material*,G4PhysicsFreeVector*>::iterator i;
|
||||
|
||||
if (logFormFactorTable)
|
||||
{
|
||||
for (i=logFormFactorTable->begin(); i != logFormFactorTable->end(); i++)
|
||||
if (i->second) delete i->second;
|
||||
for (auto& item : (*logFormFactorTable))
|
||||
if (item.second) delete item.second;
|
||||
delete logFormFactorTable;
|
||||
logFormFactorTable = 0; //zero explicitely
|
||||
logFormFactorTable = nullptr; //zero explicitely
|
||||
}
|
||||
|
||||
if (pMaxTable)
|
||||
{
|
||||
for (i=pMaxTable->begin(); i != pMaxTable->end(); i++)
|
||||
if (i->second) delete i->second;
|
||||
for (auto& item : (*pMaxTable))
|
||||
if (item.second) delete item.second;
|
||||
delete pMaxTable;
|
||||
pMaxTable = 0; //zero explicitely
|
||||
pMaxTable = nullptr; //zero explicitely
|
||||
}
|
||||
|
||||
std::map<const G4Material*,G4PenelopeSamplingData*>::iterator ii;
|
||||
if (samplingTable)
|
||||
{
|
||||
for (ii=samplingTable->begin(); ii != samplingTable->end(); ii++)
|
||||
if (ii->second) delete ii->second;
|
||||
for (auto& item : (*samplingTable))
|
||||
if (item.second) delete item.second;
|
||||
delete samplingTable;
|
||||
samplingTable = 0; //zero explicitely
|
||||
samplingTable = nullptr; //zero explicitely
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@@ -322,7 +322,7 @@ G4bool G4hParametrisedLossModel::MolecIsInZiegler1988(
|
||||
"C_2H_2F_2", "C_4H_8O_2", "C_2H_6", "C_2F_6", "C_2H_6O",
|
||||
"C_3H_6O", "C_4H_10O", "C_2H_4", "C_2H_4O", "C_2H_4S",
|
||||
"SH_2", "CH_4", "CCLF_3", "CCl_2F_2", "CHCl_2F",
|
||||
"(CH_3)_2S", "N_2O", "C_5H_10O" "C_8H_6", "(CH_2)_N",
|
||||
"(CH_3)_2S", "N_2O", "C_5H_10O", "C_8H_6", "(CH_2)_N",
|
||||
"(C_3H_6)_N","(C_8H_8)_N", "C_3H_8", "C_3H_6-Propylene", "C_3H_6O",
|
||||
"C_3H_6S", "C_4H_4S", "C_7H_8"
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user