85 G4cout <<
"MicroElec inelastic model is constructed " <<
G4endl;
124 G4cout <<
"Calling G4MicroElecInelasticModel::Initialise()" <<
G4endl;
128 G4String fileElectron(
"microelec/sigma_inelastic_e_Si");
129 G4String fileProton(
"microelec/sigma_inelastic_p_Si");
138 char *path = std::getenv(
"G4LEDATA");
153 std::ostringstream eFullFileName;
155 if (
fasterCode) eFullFileName << path <<
"/microelec/sigmadiff_cumulated_inelastic_e_Si.dat";
156 else eFullFileName << path <<
"/microelec/sigmadiff_inelastic_e_Si.dat";
158 std::ifstream eDiffCrossSection(eFullFileName.str().c_str());
160 if (!eDiffCrossSection)
163 FatalException,
"Missing data file:/microelec/sigmadiff_cumulated_inelastic_e_Si.dat");
165 else G4Exception(
"G4MicroElecInelasticModel::Initialise",
"em0003",
166 FatalException,
"Missing data file:/microelec/sigmadiff_inelastic_e_Si.dat");
177 for (
int j=0; j<6; j++)
191 while(!eDiffCrossSection.eof())
195 eDiffCrossSection>>tDummy>>eDummy;
199 for (
int j=0; j<6; j++)
201 eDiffCrossSection>> tmp;
214 eVecm[tDummy].push_back(eDummy);
232 std::ostringstream pFullFileName;
234 if (
fasterCode) pFullFileName << path <<
"/microelec/sigmadiff_cumulated_inelastic_p_Si.dat";
235 else pFullFileName << path <<
"/microelec/sigmadiff_inelastic_p_Si.dat";
237 std::ifstream pDiffCrossSection(pFullFileName.str().c_str());
239 if (!pDiffCrossSection)
242 FatalException,
"Missing data file:/microelec/sigmadiff_cumulated_inelastic_p_Si.dat");
244 else G4Exception(
"G4MicroElecInelasticModel::Initialise",
"em0003",
245 FatalException,
"Missing data file:/microelec/sigmadiff_inelastic_p_Si.dat");
249 while(!pDiffCrossSection.eof())
253 pDiffCrossSection>>tDummy>>eDummy;
255 for (
int j=0; j<6; j++)
268 pVecm[tDummy].push_back(eDummy);
273 if (particle==electronDef)
279 if (particle==protonDef)
287 G4cout <<
"MicroElec Inelastic model is initialized " <<
G4endl
314 G4cout <<
"Calling CrossSectionPerVolume() of G4MicroElecInelasticModel" <<
G4endl;
337 <<
"Particle : " << nameLocal <<
", mass : " << Mion_c2/
proton_mass_c2 <<
"*mp, charge " << Zeff
338 <<
", Ekin (eV) = " << ekin/
eV <<
G4endl ;
341 nameLocal =
"proton" ;
345 <<
"Particle : " << nameLocal <<
", Ekin (eV) = " << ekin/
eV <<
G4endl ;
353 lowLim = pos1->second;
359 highLim = pos2->second;
362 if (ekin >= lowLim && ekin < highLim)
368 if (table !=
nullptr)
375 G4Exception(
"G4MicroElecInelasticModel::CrossSectionPerVolume",
"em0002",
391 G4cout <<
" - Cross section per Si atom (cm^2)=" << sigma*Zeff2/
cm2 <<
G4endl;
392 G4cout <<
" - Cross section per Si atom (cm^-1)=" << sigma*density*Zeff2/(1./
cm) <<
G4endl;
396 return sigma*density*Zeff2;
409 G4cout <<
"Calling SampleSecondaries() of G4MicroElecInelasticModel" <<
G4endl;
419 G4String nameLocal2 = particleName ;
426 nameLocal2 =
"proton" ;
432 lowLim = pos1->second;
438 highLim = pos2->second;
441 if (k >= lowLim && k < highLim)
444 G4double totalEnergy = ekin + particleMass;
445 G4double pSquare = ekin * (totalEnergy + particleMass);
446 G4double totalMomentum = std::sqrt(pSquare);
467 G4int secNumberInit = 0;
468 G4int secNumberFinal = 0;
489 secNumberInit = fvect->size();
491 secNumberFinal = fvect->size();
508 G4cout <<
"Shell: " << Shell <<
" Kin. energy (eV)=" << k/
eV
509 <<
" Sec. energy (eV)=" << secondaryKinetic/
eV <<
G4endl;
520 G4double finalPx = totalMomentum*primaryDirection.
x() - deltaTotalMomentum*deltaDirection.
x();
521 G4double finalPy = totalMomentum*primaryDirection.
y() - deltaTotalMomentum*deltaDirection.
y();
522 G4double finalPz = totalMomentum*primaryDirection.
z() - deltaTotalMomentum*deltaDirection.
z();
523 G4double finalMomentum = std::sqrt(finalPx*finalPx + finalPy*finalPy + finalPz*finalPz);
524 finalPx /= finalMomentum;
525 finalPy /= finalMomentum;
526 finalPz /= finalMomentum;
529 direction.
set(finalPx,finalPy,finalPz);
538 for (
G4int j=secNumberInit; j < secNumberFinal; ++j) {
539 deexSecEnergy = deexSecEnergy + (*fvect)[j]->GetKineticEnergy();}
544 if (secondaryKinetic>0)
547 fvect->push_back(dp);
566 G4double maxEnergy = maximumEnergyTransfer;
567 G4int nEnergySteps = 100;
570 G4double stpEnergy(std::pow(maxEnergy/value, 1./
static_cast<G4double>(nEnergySteps-1)));
571 G4int step(nEnergySteps);
576 if(differentialCrossSection >= crossSectionMaximum) crossSectionMaximum = differentialCrossSection;
580 G4double secondaryElectronKineticEnergy=0.;
587 return secondaryElectronKineticEnergy;
596 G4double maxEnergy = maximumEnergyTransfer;
597 G4int nEnergySteps = 100;
600 G4double stpEnergy(std::pow(maxEnergy/value, 1./
static_cast<G4double>(nEnergySteps-1)));
601 G4int step(nEnergySteps);
606 if(differentialCrossSection >= crossSectionMaximum) crossSectionMaximum = differentialCrossSection;
610 G4double secondaryElectronKineticEnergy = 0.;
617 return secondaryElectronKineticEnergy;
686 if (energyTransfer <=
eVecm[(*t1)].back() && energyTransfer <=
eVecm[(*t2)].back() )
688 auto e12 = std::upper_bound(
eVecm[(*t1)].begin(),
eVecm[(*t1)].end(), energyTransfer);
690 auto e22 = std::upper_bound(
eVecm[(*t2)].begin(),
eVecm[(*t2)].end(), energyTransfer);
712 if (energyTransfer <=
pVecm[(*t1)].back() && energyTransfer <=
pVecm[(*t2)].back() )
714 auto e12 = std::upper_bound(
pVecm[(*t1)].begin(),
pVecm[(*t1)].end(), energyTransfer);
717 auto e22 = std::upper_bound(
pVecm[(*t2)].begin(),
pVecm[(*t2)].end(), energyTransfer);
755 if (
e1 != 0 &&
e2 != 0 && (std::log10(
e2) - std::log10(
e1)) != 0
758 G4double a = (std::log10(xs2)-std::log10(xs1)) / (std::log10(
e2)-std::log10(
e1));
759 G4double b = std::log10(xs2) - a*std::log10(
e2);
760 G4double sigma = a*std::log10(e) + b;
761 value = (std::pow(10.,sigma));
770 value = std::pow(10., (
d1 + (
d2 -
d1) * (e -
e1) / (
e2 -
e1)));
775 if ((
e2 -
e1) != 0 && (xs1 == 0 || xs2 == 0))
811 if (table !=
nullptr)
822 value += valuesBuffer[i];
833 if (valuesBuffer[i] > value)
835 delete[] valuesBuffer;
838 value -= valuesBuffer[i];
841 if (valuesBuffer)
delete[] valuesBuffer;
860 G4double secondaryElectronKineticEnergy = 0.;
868 if (secondaryElectronKineticEnergy < 0.)
871 return secondaryElectronKineticEnergy;
878 G4int ionizationLevelIndex,
895 G4double maximumEnergyTransfer1 = 0;
896 G4double maximumEnergyTransfer2 = 0;
903 auto k2 = std::upper_bound(
eTdummyVec.begin(),
924 std::upper_bound(
eProbaShellMap[ionizationLevelIndex][(*k1)].begin(),
927 auto prob11 = prob12 - 1;
929 std::upper_bound(
eProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
932 auto prob21 = prob22 - 1;
936 valuePROB21 = *prob21;
937 valuePROB22 = *prob22;
938 valuePROB12 = *prob12;
939 valuePROB11 = *prob11;
943 else nrjTransf11 =
eNrjTransfData[ionizationLevelIndex][valueK1][valuePROB11];
946 if ((valueK1+
bindingEnergy)/2. > valueK1) maximumEnergyTransfer1=valueK1;
949 nrjTransf12 = maximumEnergyTransfer1;
951 else nrjTransf12 =
eNrjTransfData[ionizationLevelIndex][valueK1][valuePROB12];
954 else nrjTransf21 =
eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
957 if ((valueK2+
bindingEnergy)/2. > valueK2) maximumEnergyTransfer2=valueK2;
960 nrjTransf22 = maximumEnergyTransfer2;
963 nrjTransf22 =
eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
969 std::upper_bound(
eProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
973 auto prob21 = prob22 - 1;
977 valuePROB21 = *prob21;
978 valuePROB22 = *prob22;
980 nrjTransf21 =
eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
981 nrjTransf22 =
eNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
998 auto k2 = std::upper_bound(
pTdummyVec.begin(),
1021 std::upper_bound(
pProbaShellMap[ionizationLevelIndex][(*k1)].begin(),
1025 auto prob11 = prob12 - 1;
1028 std::upper_bound(
pProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
1032 auto prob21 = prob22 - 1;
1036 valuePROB21 = *prob21;
1037 valuePROB22 = *prob22;
1038 valuePROB12 = *prob12;
1039 valuePROB11 = *prob11;
1043 else nrjTransf11 =
pNrjTransfData[ionizationLevelIndex][valueK1][valuePROB11];
1044 if(valuePROB12 == 1) nrjTransf12 = maximumEnergyTransferP;
1045 else nrjTransf12 =
pNrjTransfData[ionizationLevelIndex][valueK1][valuePROB12];
1047 else nrjTransf21 =
pNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
1048 if(valuePROB22 == 1) nrjTransf22 = maximumEnergyTransferP;
1049 else nrjTransf22 =
pNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
1057 std::upper_bound(
pProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
1061 auto prob21 = prob22 - 1;
1065 valuePROB21 = *prob21;
1066 valuePROB22 = *prob22;
1068 nrjTransf21 =
pNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
1069 nrjTransf22 =
pNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
1085 G4double nrjTransfProduct = nrjTransf11 * nrjTransf12 * nrjTransf21
1088 if (nrjTransfProduct != 0.)
static const G4double e1[44]
static const G4double e2[44]
static const G4double e6[46]
static const G4double pos
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
static constexpr double cm2
static constexpr double keV
static constexpr double eV
static constexpr double GeV
static constexpr double MeV
static constexpr double cm
G4GLOB_DLL std::ostream G4cout
void set(double x, double y, double z)
const G4ThreeVector & GetMomentumDirection() const
G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
static G4Electron * ElectronDefinition()
static G4Electron * Electron()
static G4LossTableManager * Instance()
G4VAtomDeexcitation * AtomDeexcitation()
const G4Material * GetMaterial() const
G4bool LoadData(const G4String &argFileName) override
G4double FindValue(G4double e, G4int componentId=0) const override
size_t NumberOfComponents(void) const override
const G4VEMDataSet * GetComponent(G4int componentId) const override
G4VAtomDeexcitation * fAtomDeexcitation
G4double TransferedEnergy(G4ParticleDefinition *aParticleDefinition, G4double incomingParticleEnergy, G4int shell, G4double random)
TriDimensionMap pDiffCrossSectionData[7]
TriDimensionMap pNrjTransfData[7]
void Initialise(const G4ParticleDefinition *, const G4DataVector &) override
std::vector< G4double > eTdummyVec
std::vector< G4double > pTdummyVec
void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy) override
G4ParticleChangeForGamma * fParticleChangeForGamma
G4int RandomSelect(G4double energy, const G4String &particle)
G4double Interpolate(G4double e1, G4double e2, G4double e, G4double xs1, G4double xs2)
G4MicroElecInelasticModel(const G4ParticleDefinition *p=nullptr, const G4String &nam="MicroElecInelasticModel")
G4double QuadInterpolator(G4double e11, G4double e12, G4double e21, G4double e22, G4double x11, G4double x12, G4double x21, G4double x22, G4double t1, G4double t2, G4double t, G4double e)
virtual ~G4MicroElecInelasticModel()
std::map< G4String, G4double, std::less< G4String > > lowEnergyLimit
TriDimensionMap eNrjTransfData[7]
G4MicroElecSiStructure SiStructure
std::map< G4String, G4double, std::less< G4String > > highEnergyLimit
G4double CrossSectionPerVolume(const G4Material *material, const G4ParticleDefinition *p, G4double ekin, G4double emin, G4double emax) override
G4double RandomizeEjectedElectronEnergyFromCumulatedDcs(G4ParticleDefinition *aParticleDefinition, G4double incomingParticleEnergy, G4int shell)
G4double RandomizeEjectedElectronEnergy(G4ParticleDefinition *aParticleDefinition, G4double incomingParticleEnergy, G4int shell)
G4double DifferentialCrossSection(G4ParticleDefinition *aParticleDefinition, G4double k, G4double energyTransfer, G4int shell)
TriDimensionMap eDiffCrossSectionData[7]
G4double Energy(G4int level)
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
static G4NistManager * Instance()
void SetProposedKineticEnergy(G4double proposedKinEnergy)
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
G4double GetPDGMass() const
G4double GetPDGCharge() const
const G4String & GetParticleName() const
static G4Proton * ProtonDefinition()
virtual const G4AtomicShell * GetAtomicShell(G4int Z, G4AtomicShellEnumerator shell)=0
void GenerateParticles(std::vector< G4DynamicParticle * > *secVect, const G4AtomicShell *, G4int Z, G4int coupleIndex)
virtual G4double FindValue(G4double x, G4int componentId=0) const =0
virtual G4ThreeVector & SampleDirectionForShell(const G4DynamicParticle *dp, G4double finalTotalEnergy, G4int Z, G4int shellID, const G4Material *)
void SetHighEnergyLimit(G4double)
G4VEmAngularDistribution * GetAngularDistribution()
G4ParticleChangeForGamma * GetParticleChangeForGamma()
G4double LowEnergyLimit() const
G4double HighEnergyLimit() const
void SetLowEnergyLimit(G4double)
void SetDeexcitationFlag(G4bool val)
void SetAngularDistribution(G4VEmAngularDistribution *)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
G4double EffectiveCharge(const G4ParticleDefinition *p, const G4Material *material, G4double kineticEnergy)
G4double bindingEnergy(G4int A, G4int Z)