93 killBelowEnergy = 0.1*eV;
94 lowEnergyLimit = 0.1 * eV;
95 lowEnergyLimitOfModel = 10 * eV;
96 highEnergyLimit = 500. * keV;
110 G4cout <<
"MicroElec Elastic model is constructed " <<
G4endl
112 << lowEnergyLimit / eV <<
" eV - "
113 << highEnergyLimit / MeV <<
" MeV"
118 killElectron =
false;
119 acousticModelEnabled =
false;
120 currentMaterialName =
"";
128 TCSMap::iterator pos2;
129 for (pos2 = tableTCS.begin(); pos2 != tableTCS.end(); ++pos2) {
130 MapData* tableData = pos2->second;
131 std::map< G4String, G4MicroElecCrossSectionDataSet_new*, std::less<G4String> >::iterator pos;
132 for (pos = tableData->begin(); pos != tableData->end(); ++pos)
142 ThetaMap::iterator iterator_angle;
143 for (iterator_angle = thetaDataStorage.begin(); iterator_angle != thetaDataStorage.end(); ++iterator_angle) {
144 TriDimensionMap* eDiffCrossSectionData = iterator_angle->second;
145 eDiffCrossSectionData->clear();
146 delete eDiffCrossSectionData;
149 energyMap::iterator iterator_energy;
150 for (iterator_energy = eIncidentEnergyStorage.begin(); iterator_energy != eIncidentEnergyStorage.end(); ++iterator_energy) {
151 std::vector<G4double>* eTdummyVec = iterator_energy->second;
156 ProbaMap::iterator iterator_proba;
157 for (iterator_proba = eProbaStorage.begin(); iterator_proba != eProbaStorage.end(); ++iterator_proba) {
158 VecMap* eVecm = iterator_proba->second;
170 if (verboseLevel > -1)
171 G4cout <<
"Calling G4MicroElecElasticModel_new::Initialise()" <<
G4endl;
175 G4double scaleFactor = 1e-18 * cm * cm;
180 for (
G4int i = 0; i < numOfCouples; ++i) {
183 G4cout <<
"MicroElasticModel, Material " << i + 1 <<
" / " << numOfCouples <<
" : " << material->
GetName() <<
G4endl;
184 if (material->
GetName() ==
"Vacuum")
continue;
190 lowEnergyLimitTable[matName]=currentMaterialStructure->GetElasticModelLowLimit();
191 highEnergyLimitTable[matName]=currentMaterialStructure->GetElasticModelHighLimit();
192 workFunctionTable[matName] = currentMaterialStructure->GetWorkFunction();
194 delete currentMaterialStructure;
197 G4String fileElectron =
"Elastic/elsepa_elastic_cross_e_" + matName;
198 G4cout <<
"Elastic Total Cross file : " << fileElectron <<
G4endl;
204 MapData* tableData =
new MapData();
208 tableData->insert(make_pair(electron, tableE));
209 tableTCS[matName] = tableData;
220 std::ostringstream eFullFileName;
221 eFullFileName << path <<
"/microelec/Elastic/elsepa_elastic_cumulated_diffcross_e_" + matName +
".dat";
222 G4cout <<
"Elastic Cumulated Diff Cross : " << eFullFileName.str().c_str() <<
G4endl;
223 std::ifstream eDiffCrossSection(eFullFileName.str().c_str());
225 if (!eDiffCrossSection)
226 G4Exception(
"G4MicroElecElasticModel_new::Initialise",
"em0003",
FatalException,
"Missing data file: /microelec/sigmadiff_cumulated_elastic_e_Si.dat");
231 TriDimensionMap* eDiffCrossSectionData =
new TriDimensionMap();
232 std::vector<G4double>* eTdummyVec =
new std::vector<G4double>;
233 VecMap* eProbVec =
new VecMap;
235 eTdummyVec->push_back(0.);
237 while (!eDiffCrossSection.eof())
241 eDiffCrossSection >> tDummy >> eProb;
244 if (tDummy != eTdummyVec->back())
246 eTdummyVec->push_back(tDummy);
247 (*eProbVec)[tDummy].push_back(0.);
250 eDiffCrossSection >> (*eDiffCrossSectionData)[tDummy][eProb];
252 if (eProb != (*eProbVec)[tDummy].back()) {
253 (*eProbVec)[tDummy].push_back(eProb);
259 thetaDataStorage[matName] = eDiffCrossSectionData;
260 eIncidentEnergyStorage[matName] = eTdummyVec;
261 eProbaStorage[matName] = eProbVec;
265 if (verboseLevel > 2)
266 G4cout <<
"Loaded cross section files for MicroElec Elastic model" <<
G4endl;
268 if (verboseLevel > 0) {
269 G4cout <<
"MicroElec Elastic model is initialized " <<
G4endl
276 if (isInitialised) {
return; }
278 isInitialised =
true;
289 if (verboseLevel > 3)
290 G4cout <<
"Calling CrossSectionPerVolume() of G4MicroElecElasticModel" <<
G4endl;
292 currentMaterialName = material->
GetName().substr(3, material->
GetName().size());
295 MapEnergy::iterator lowEPos;
296 lowEPos = lowEnergyLimitTable.find(currentMaterialName);
298 MapEnergy::iterator highEPos;
299 highEPos = highEnergyLimitTable.find(currentMaterialName);
301 MapEnergy::iterator killEPos;
302 killEPos = workFunctionTable.find(currentMaterialName);
304 if (lowEPos == lowEnergyLimitTable.end() || highEPos == highEnergyLimitTable.end() || killEPos == workFunctionTable.end())
307 str += currentMaterialName +
" not found!";
313 lowEnergyLimit = lowEPos->second;
314 highEnergyLimit = highEPos->second;
315 killBelowEnergy = killEPos->second;
318 if (ekin < killBelowEnergy) {
return DBL_MAX; }
323 if (currentMaterialName ==
"SILICON_DIOXIDE" && ekin < 100 * eV) {
324 acousticModelEnabled =
true;
338 else if (currentMaterialName ==
"ALUMINUM_OXIDE" && ekin < 20 * eV) {
339 acousticModelEnabled =
true;
344 cs = 233329.07733059773,
345 Aac = 2.9912494342262614e-19,
346 Eac = 2.1622471654789847e-18,
352 acousticModelEnabled =
false;
357 TCSMap::iterator tablepos;
358 tablepos = tableTCS.find(currentMaterialName);
360 if (tablepos != tableTCS.end())
362 MapData* tableData = tablepos->second;
364 if (ekin >= lowEnergyLimit && ekin < highEnergyLimit)
366 std::map< G4String, G4MicroElecCrossSectionDataSet_new*, std::less<G4String> >::iterator pos;
367 pos = tableData->find(particleName);
369 if (pos != tableData->end()){
373 sigma = table->FindValue(ekin);
378 G4Exception(
"G4MicroElecElasticModel_new::ComputeCrossSectionPerVolume",
"em0002",
FatalException,
"Model not applicable to particle type.");
385 str += currentMaterialName +
" TCS table not found!";
389 if (verboseLevel > 3) {
390 G4cout <<
"---> Kinetic energy(eV)=" << ekin / eV <<
G4endl;
391 G4cout <<
" - Cross section per Si atom (cm^2)=" << sigma / cm / cm <<
G4endl;
392 G4cout <<
" - Cross section per Si atom (cm^-1)=" << sigma*density / (1. / cm) <<
G4endl;
396 if (currentMaterialName ==
"BORON_NITRIDE") {
397 sigma = sigma * tanh(0.5 * pow(ekin / 5.2e-6, 2));
399 return sigma*density;
420 G4double D = (2 / (std::sqrt(2) * std::pow(pi, 2) * std::pow(h, 3))) * (1 + 2 * E) * std::pow(m0, 1.5) * std::sqrt(E);
424 Ebz = (std::pow(h, 2) * std::pow(kbz, 2)) / (2 * m0),
426 nbz = 1.0 / (exp(hwbz / (kb * T)) - 1),
431 Pac = ((pi * kb * T) / (h * std::pow(cs, 2) * rho)) * (std::pow(Eac, 2) *
D) / (1 + (E / Aac));
436 Pac = ((2 * pi * m0 * (2 * nbz + 1)) / (h * rho * hwbz)) * std::pow(Eac, 2) *
D * E * 2 * std::pow((Aac / E), 2) * (((-E / Aac) / (1 + (E / Aac))) + log(1 + (E / Aac)));
440 G4double fEbz = ((2 * pi * m0 * (2 * nbz + 1)) / (h * rho * hwbz)) * std::pow(Eac, 2) *
D * Ebz * 2 * std::pow((Aac / Ebz), 2) * (((-Ebz / Aac) / (1 + (Ebz / Aac))) + log(1 + (Ebz / Aac)));
441 G4double fEbz4 = ((pi * kb * T) / (h * std::pow(cs, 2) * rho)) * (std::pow(Eac, 2) *
D) / (1 + ((Ebz / 4) / Aac));
442 G4double alpha = ((fEbz - fEbz4) / (Ebz - (Ebz / 4)));
443 Pac = alpha * E + (fEbz - alpha * Ebz);
446 G4double MFP = (std::sqrt(2 * E / m0) / (prefactor * Pac)) * m;
460 if (verboseLevel > 3)
461 G4cout <<
"Calling SampleSecondaries() of G4MicroElecElasticModel" <<
G4endl;
465 if (electronEnergy0 < killBelowEnergy)
473 if (electronEnergy0 < highEnergyLimit)
476 if (acousticModelEnabled)
480 else if (electronEnergy0 >= lowEnergyLimit)
482 cosTheta = RandomizeCosTheta(electronEnergy0);
490 G4double xDir = std::sqrt(1. - cosTheta*cosTheta);
492 xDir *= std::cos(phi);
493 yDir *= std::sin(phi);
495 G4ThreeVector zPrimeVers((xDir*xVers + yDir*yVers + cosTheta*zVers));
514 k_d=0.1334*std::pow(Z2,(2./3.))*std::pow(M2,(-1./2.));
515 epsilon_d=0.01014*std::pow(Z2,(-7./3.))*(T/eV);
516 g_epsilon_d= epsilon_d+0.40244*std::pow(epsilon_d,(3./4.))+3.4008*std::pow(epsilon_d,(1./6.));
518 E_nu=1./(1.+ k_d*g_epsilon_d);
525G4double G4MicroElecElasticModel_new::Theta
543 ThetaMap::iterator iterator_angle;
544 iterator_angle = thetaDataStorage.find(currentMaterialName);
546 energyMap::iterator iterator_energy;
547 iterator_energy = eIncidentEnergyStorage.find(currentMaterialName);
549 ProbaMap::iterator iterator_proba;
550 iterator_proba = eProbaStorage.find(currentMaterialName);
552 if (iterator_angle != thetaDataStorage.end() && iterator_energy != eIncidentEnergyStorage.end() && iterator_proba != eProbaStorage.end())
554 TriDimensionMap* eDiffCrossSectionData = iterator_angle->second;
555 std::vector<G4double>* eTdummyVec = iterator_energy->second;
556 VecMap* eVecm = iterator_proba->second;
558 auto t2 = std::upper_bound(eTdummyVec->begin(), eTdummyVec->end(), k);
560 auto e12 = std::upper_bound((*eVecm)[(*t1)].begin(), (*eVecm)[(*t1)].end(), integrDiff);
562 auto e22 = std::upper_bound((*eVecm)[(*t2)].begin(), (*eVecm)[(*t2)].end(), integrDiff);
572 xs11 = (*eDiffCrossSectionData)[valueT1][valueE11];
573 xs12 = (*eDiffCrossSectionData)[valueT1][valueE12];
574 xs21 = (*eDiffCrossSectionData)[valueT2][valueE21];
575 xs22 = (*eDiffCrossSectionData)[valueT2][valueE22];
579 G4String str =
"Material ";
580 str += currentMaterialName +
" not found!";
585 if (xs11==0 || xs12==0 ||xs21==0 ||xs22==0)
return (0.);
587 theta = QuadInterpolator( valueE11, valueE12,
621 G4double value = (d1 + (d2 - d1)*(e - e1)/ (e2 - e1));
633 G4double a = (std::log10(xs2)-std::log10(xs1)) / (std::log10(e2)-std::log10(e1));
634 G4double b = std::log10(xs2) - a*std::log10(e2);
635 G4double sigma = a*std::log10(e) + b;
636 G4double value = (std::pow(10.,sigma));
652 G4double interpolatedvalue1 = LinLinInterpolate(e11, e12, e, xs11, xs12);
653 G4double interpolatedvalue2 = LinLinInterpolate(e21, e22, e, xs21, xs22);
654 G4double value = LinLinInterpolate(t1, t2, t, interpolatedvalue1, interpolatedvalue2);
665 integrdiff = uniformRand;
671 cosTheta= std::cos(theta*pi/180.);
681 killBelowEnergy = threshold;
683 if (threshold < 5*CLHEP::eV)
685 G4Exception (
"*** WARNING : the G4MicroElecElasticModel class is not validated below 5 eV !",
"",
JustWarning,
"") ;
686 threshold = 5*CLHEP::eV;
G4double D(G4double temp)
const char * G4FindDataDir(const char *)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
CLHEP::Hep3Vector G4ThreeVector
G4GLOB_DLL std::ostream G4cout
Hep3Vector orthogonal() const
Hep3Vector cross(const Hep3Vector &) const
const G4ThreeVector & GetMomentumDirection() const
G4double GetKineticEnergy() const
static G4Electron * ElectronDefinition()
const G4Material * GetMaterial() const
G4double GetTotNbOfAtomsPerVolume() const
const G4String & GetName() const
G4bool LoadData(const G4String &argFileName) override
G4double AcousticCrossSectionPerVolume(G4double ekin, G4double kbz, G4double rho, G4double cs, G4double Aac, G4double Eac, G4double prefactor)
void SetKillBelowThreshold(G4double threshold)
~G4MicroElecElasticModel_new() override
G4MicroElecElasticModel_new(const G4ParticleDefinition *p=0, const G4String &nam="MicroElecElasticModel")
void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy) override
void Initialise(const G4ParticleDefinition *, const G4DataVector &) override
G4double DamageEnergy(G4double T, G4double A, G4double Z)
G4double CrossSectionPerVolume(const G4Material *material, const G4ParticleDefinition *p, G4double ekin, G4double emin, G4double emax) override
G4ParticleChangeForGamma * fParticleChangeForGamma
const G4String & GetParticleName() const
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
std::size_t GetTableSize() const
static G4ProductionCutsTable * GetProductionCutsTable()
void SetHighEnergyLimit(G4double)
G4ParticleChangeForGamma * GetParticleChangeForGamma()
G4double LowEnergyLimit() const
G4double HighEnergyLimit() const
void SetLowEnergyLimit(G4double)
G4VEmModel(const G4String &nam)