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 =
"";
121 isOkToBeInitialised =
false;
129 TCSMap::iterator pos2;
130 for (pos2 = tableTCS.begin(); pos2 != tableTCS.end(); ++pos2) {
131 MapData* tableData = pos2->second;
132 std::map< G4String, G4MicroElecCrossSectionDataSet_new*, std::less<G4String> >::iterator pos;
133 for (pos = tableData->begin(); pos != tableData->end(); ++pos)
143 ThetaMap::iterator iterator_angle;
144 for (iterator_angle = thetaDataStorage.begin(); iterator_angle != thetaDataStorage.end(); ++iterator_angle) {
145 TriDimensionMap* eDiffCrossSectionData = iterator_angle->second;
146 eDiffCrossSectionData->clear();
147 delete eDiffCrossSectionData;
150 energyMap::iterator iterator_energy;
151 for (iterator_energy = eIncidentEnergyStorage.begin(); iterator_energy != eIncidentEnergyStorage.end(); ++iterator_energy) {
152 std::vector<G4double>* eTdummyVec = iterator_energy->second;
157 ProbaMap::iterator iterator_proba;
158 for (iterator_proba = eProbaStorage.begin(); iterator_proba != eProbaStorage.end(); ++iterator_proba) {
159 VecMap* eVecm = iterator_proba->second;
171 if (isOkToBeInitialised ==
true && isInitialised ==
false) {
173 if (verboseLevel > -1)
174 G4cout <<
"Calling G4MicroElecElasticModel_new::Initialise()" <<
G4endl;
178 G4double scaleFactor = 1e-18 * cm * cm;
184 for (
G4int i = 0; i < numOfCouples; ++i) {
190 G4cout <<
"MicroElasticModel, Material " << i + 1 <<
" / " << numOfCouples <<
" : " << material->
GetName() <<
G4endl;
191 if (material->
GetName() ==
"Vacuum")
continue;
199 workFunctionTable[matName] = currentMaterialStructure->
GetWorkFunction();
201 delete currentMaterialStructure;
204 G4String fileElectron =
"Elastic/elsepa_elastic_cross_e_" + matName;
205 G4cout <<
"Elastic Total Cross file : " << fileElectron <<
G4endl;
211 MapData* tableData =
new MapData();
215 tableData->insert(make_pair(electron, tableE));
216 tableTCS[matName] = tableData;
227 std::ostringstream eFullFileName;
228 eFullFileName << path <<
"/microelec/Elastic/elsepa_elastic_cumulated_diffcross_e_" + matName +
".dat";
229 G4cout <<
"Elastic Cumulated Diff Cross : " << eFullFileName.str().c_str() <<
G4endl;
230 std::ifstream eDiffCrossSection(eFullFileName.str().c_str());
232 if (!eDiffCrossSection)
233 G4Exception(
"G4MicroElecElasticModel_new::Initialise",
"em0003",
FatalException,
"Missing data file: /microelec/sigmadiff_cumulated_elastic_e_Si.dat");
238 TriDimensionMap* eDiffCrossSectionData =
new TriDimensionMap();
239 std::vector<G4double>* eTdummyVec =
new std::vector<G4double>;
240 VecMap* eProbVec =
new VecMap;
242 eTdummyVec->push_back(0.);
244 while (!eDiffCrossSection.eof())
248 eDiffCrossSection >> tDummy >> eProb;
251 if (tDummy != eTdummyVec->back())
253 eTdummyVec->push_back(tDummy);
254 (*eProbVec)[tDummy].push_back(0.);
257 eDiffCrossSection >> (*eDiffCrossSectionData)[tDummy][eProb];
259 if (eProb != (*eProbVec)[tDummy].back()) {
260 (*eProbVec)[tDummy].push_back(eProb);
266 thetaDataStorage[matName] = eDiffCrossSectionData;
267 eIncidentEnergyStorage[matName] = eTdummyVec;
268 eProbaStorage[matName] = eProbVec;
272 if (verboseLevel > 2)
273 G4cout <<
"Loaded cross section files for MicroElec Elastic model" <<
G4endl;
275 if (verboseLevel > 0)
277 G4cout <<
"MicroElec Elastic model is initialized " <<
G4endl
284 if (isInitialised) {
return; }
286 isInitialised =
true;
298 if (verboseLevel > 3)
299 G4cout <<
"Calling CrossSectionPerVolume() of G4MicroElecElasticModel" <<
G4endl;
301 isOkToBeInitialised =
true;
302 currentMaterialName = material->
GetName().substr(3, material->
GetName().size());
306 MapEnergy::iterator lowEPos;
307 lowEPos = lowEnergyLimitTable.find(currentMaterialName);
309 MapEnergy::iterator highEPos;
310 highEPos = highEnergyLimitTable.find(currentMaterialName);
312 MapEnergy::iterator killEPos;
313 killEPos = workFunctionTable.find(currentMaterialName);
315 if (lowEPos == lowEnergyLimitTable.end() || highEPos == highEnergyLimitTable.end() || killEPos == workFunctionTable.end())
318 str += currentMaterialName +
" not found!";
324 lowEnergyLimit = lowEPos->second;
325 highEnergyLimit = highEPos->second;
326 killBelowEnergy = killEPos->second;
330 if (ekin < killBelowEnergy) {
337 if (currentMaterialName ==
"SILICON_DIOXIDE" && ekin < 100 * eV) {
338 acousticModelEnabled =
true;
352else if (currentMaterialName ==
"ALUMINUM_OXIDE" && ekin < 20 * eV) {
353 acousticModelEnabled =
true;
358 cs = 233329.07733059773,
359 Aac = 2.9912494342262614e-19,
360 Eac = 2.1622471654789847e-18,
366 acousticModelEnabled =
false;
371 TCSMap::iterator tablepos;
372 tablepos = tableTCS.find(currentMaterialName);
374 if (tablepos != tableTCS.end())
376 MapData* tableData = tablepos->second;
378 if (ekin >= lowEnergyLimit && ekin < highEnergyLimit)
380 std::map< G4String, G4MicroElecCrossSectionDataSet_new*, std::less<G4String> >::iterator pos;
381 pos = tableData->find(particleName);
383 if (pos != tableData->end())
393 G4Exception(
"G4MicroElecElasticModel_new::ComputeCrossSectionPerVolume",
"em0002",
FatalException,
"Model not applicable to particle type.");
401 str += currentMaterialName +
" TCS table not found!";
405 if (verboseLevel > 3)
407 G4cout <<
"---> Kinetic energy(eV)=" << ekin / eV <<
G4endl;
408 G4cout <<
" - Cross section per Si atom (cm^2)=" << sigma / cm / cm <<
G4endl;
409 G4cout <<
" - Cross section per Si atom (cm^-1)=" << sigma*density / (1. / cm) <<
G4endl;
413 if (currentMaterialName ==
"BORON_NITRIDE") {
414 sigma = sigma * tanh(0.5 * pow(ekin / 5.2e-6, 2));
416 return sigma*density;
437 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);
441 Ebz = (std::pow(h, 2) * std::pow(kbz, 2)) / (2 * m0),
443 nbz = 1.0 / (exp(hwbz / (kb * T)) - 1),
448 Pac = ((pi * kb * T) / (h * std::pow(cs, 2) * rho)) * (std::pow(Eac, 2) *
D) / (1 + (E / Aac));
453 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)));
457 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)));
458 G4double fEbz4 = ((pi * kb * T) / (h * std::pow(cs, 2) * rho)) * (std::pow(Eac, 2) *
D) / (1 + ((Ebz / 4) / Aac));
459 G4double alpha = ((fEbz - fEbz4) / (Ebz - (Ebz / 4)));
460 Pac = alpha * E + (fEbz - alpha * Ebz);
463 G4double MFP = (std::sqrt(2 * E / m0) / (prefactor * Pac)) * m;
478 if (verboseLevel > 3)
479 G4cout <<
"Calling SampleSecondaries() of G4MicroElecElasticModel" <<
G4endl;
483 if (electronEnergy0 < killBelowEnergy)
491 if (electronEnergy0 < highEnergyLimit)
494 if (acousticModelEnabled)
498 else if (electronEnergy0 >= lowEnergyLimit)
500 cosTheta = RandomizeCosTheta(electronEnergy0);
509 G4double xDir = std::sqrt(1. - cosTheta*cosTheta);
511 xDir *= std::cos(phi);
512 yDir *= std::sin(phi);
514 G4ThreeVector zPrimeVers((xDir*xVers + yDir*yVers + cosTheta*zVers));
533 k_d=0.1334*std::pow(Z2,(2./3.))*std::pow(M2,(-1./2.));
534 epsilon_d=0.01014*std::pow(Z2,(-7./3.))*(T/eV);
535 g_epsilon_d= epsilon_d+0.40244*std::pow(epsilon_d,(3./4.))+3.4008*std::pow(epsilon_d,(1./6.));
537 E_nu=1./(1.+ k_d*g_epsilon_d);
544G4double G4MicroElecElasticModel_new::Theta
562 ThetaMap::iterator iterator_angle;
563 iterator_angle = thetaDataStorage.find(currentMaterialName);
565 energyMap::iterator iterator_energy;
566 iterator_energy = eIncidentEnergyStorage.find(currentMaterialName);
568 ProbaMap::iterator iterator_proba;
569 iterator_proba = eProbaStorage.find(currentMaterialName);
571 if (iterator_angle != thetaDataStorage.end() && iterator_energy != eIncidentEnergyStorage.end() && iterator_proba != eProbaStorage.end())
573 TriDimensionMap* eDiffCrossSectionData = iterator_angle->second;
574 std::vector<G4double>* eTdummyVec = iterator_energy->second;
575 VecMap* eVecm = iterator_proba->second;
577 auto t2 = std::upper_bound(eTdummyVec->begin(), eTdummyVec->end(), k);
579 auto e12 = std::upper_bound((*eVecm)[(*t1)].begin(), (*eVecm)[(*t1)].end(), integrDiff);
581 auto e22 = std::upper_bound((*eVecm)[(*t2)].begin(), (*eVecm)[(*t2)].end(), integrDiff);
591 xs11 = (*eDiffCrossSectionData)[valueT1][valueE11];
592 xs12 = (*eDiffCrossSectionData)[valueT1][valueE12];
593 xs21 = (*eDiffCrossSectionData)[valueT2][valueE21];
594 xs22 = (*eDiffCrossSectionData)[valueT2][valueE22];
599 str += currentMaterialName +
" not found!";
605 if (xs11==0 || xs12==0 ||xs21==0 ||xs22==0)
return (0.);
607 theta = QuadInterpolator( valueE11, valueE12,
641 G4double value = (d1 + (d2 - d1)*(e - e1)/ (e2 - e1));
653 G4double a = (std::log10(xs2)-std::log10(xs1)) / (std::log10(e2)-std::log10(e1));
654 G4double b = std::log10(xs2) - a*std::log10(e2);
655 G4double sigma = a*std::log10(e) + b;
656 G4double value = (std::pow(10.,sigma));
672 G4double interpolatedvalue1 = LinLinInterpolate(e11, e12, e, xs11, xs12);
673 G4double interpolatedvalue2 = LinLinInterpolate(e21, e22, e, xs21, xs22);
674 G4double value = LinLinInterpolate(t1, t2, t, interpolatedvalue1, interpolatedvalue2);
685 integrdiff = uniformRand;
691 cosTheta= std::cos(theta*pi/180.);
701 killBelowEnergy = threshold;
703 if (threshold < 5*CLHEP::eV)
705 G4Exception (
"*** WARNING : the G4MicroElecElasticModel class is not validated below 5 eV !",
"",
JustWarning,
"") ;
706 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.
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 FindValue(G4double e, G4int componentId=0) const 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
G4double GetElasticModelHighLimit()
G4double GetElasticModelLowLimit()
G4double GetWorkFunction()
void SetProposedKineticEnergy(G4double proposedKinEnergy)
void ProposeMomentumDirection(const G4ThreeVector &Pfinal)
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)
void ProposeTrackStatus(G4TrackStatus status)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)