92 killBelowEnergy = 0.1*eV;
93 lowEnergyLimit = 0.1 * eV;
94 lowEnergyLimitOfModel = 10 * eV;
95 highEnergyLimit = 500. * keV;
109 G4cout <<
"MicroElec Elastic model is constructed " <<
G4endl
111 << lowEnergyLimit / eV <<
" eV - "
112 << highEnergyLimit / MeV <<
" MeV"
117 killElectron =
false;
118 acousticModelEnabled =
false;
119 currentMaterialName =
"";
120 isOkToBeInitialised =
false;
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<double>* 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 (isOkToBeInitialised ==
true && isInitialised ==
false) {
172 if (verboseLevel > -1)
173 G4cout <<
"Calling G4MicroElecElasticModel_new::Initialise()" <<
G4endl;
177 G4double scaleFactor = 1e-18 * cm * cm;
183 for (
G4int i = 0; i < numOfCouples; ++i) {
189 G4cout <<
"MicroElasticModel, Material " << i + 1 <<
" / " << numOfCouples <<
" : " << material->
GetName() <<
G4endl;
190 if (material->
GetName() ==
"Vacuum")
continue;
198 workFunctionTable[matName] = currentMaterialStructure->
GetWorkFunction();
200 delete currentMaterialStructure;
203 G4String fileElectron =
"Elastic/elsepa_elastic_cross_e_" + matName;
204 G4cout <<
"Elastic Total Cross file : " << fileElectron <<
G4endl;
210 MapData* tableData =
new MapData();
214 tableData->insert(make_pair(electron, tableE));
215 tableTCS[matName] = tableData;
218 char *path = std::getenv(
"G4LEDATA");
226 std::ostringstream eFullFileName;
227 eFullFileName << path <<
"/microelec/Elastic/elsepa_elastic_cumulated_diffcross_e_" + matName +
".dat";
228 G4cout <<
"Elastic Cumulated Diff Cross : " << eFullFileName.str().c_str() <<
G4endl;
229 std::ifstream eDiffCrossSection(eFullFileName.str().c_str());
231 if (!eDiffCrossSection)
232 G4Exception(
"G4MicroElecElasticModel_new::Initialise",
"em0003",
FatalException,
"Missing data file: /microelec/sigmadiff_cumulated_elastic_e_Si.dat");
237 TriDimensionMap* eDiffCrossSectionData =
new TriDimensionMap();
238 std::vector<double>* eTdummyVec =
new std::vector<double>;
239 VecMap* eProbVec =
new VecMap;
241 eTdummyVec->push_back(0.);
243 while (!eDiffCrossSection.eof())
247 eDiffCrossSection >> tDummy >> eProb;
250 if (tDummy != eTdummyVec->back())
252 eTdummyVec->push_back(tDummy);
253 (*eProbVec)[tDummy].push_back(0.);
256 eDiffCrossSection >> (*eDiffCrossSectionData)[tDummy][eProb];
258 if (eProb != (*eProbVec)[tDummy].back()) {
259 (*eProbVec)[tDummy].push_back(eProb);
265 thetaDataStorage[matName] = eDiffCrossSectionData;
266 eIncidentEnergyStorage[matName] = eTdummyVec;
267 eProbaStorage[matName] = eProbVec;
271 if (verboseLevel > 2)
272 G4cout <<
"Loaded cross section files for MicroElec Elastic model" <<
G4endl;
274 if (verboseLevel > 0)
276 G4cout <<
"MicroElec Elastic model is initialized " <<
G4endl
283 if (isInitialised) {
return; }
285 isInitialised =
true;
297 if (verboseLevel > 3)
298 G4cout <<
"Calling CrossSectionPerVolume() of G4MicroElecElasticModel" <<
G4endl;
300 isOkToBeInitialised =
true;
301 currentMaterialName = material->
GetName().substr(3, material->
GetName().size());
305 MapEnergy::iterator lowEPos;
306 lowEPos = lowEnergyLimitTable.find(currentMaterialName);
308 MapEnergy::iterator highEPos;
309 highEPos = highEnergyLimitTable.find(currentMaterialName);
311 MapEnergy::iterator killEPos;
312 killEPos = workFunctionTable.find(currentMaterialName);
314 if (lowEPos == lowEnergyLimitTable.end() || highEPos == highEnergyLimitTable.end() || killEPos == workFunctionTable.end())
317 str += currentMaterialName +
" not found!";
323 lowEnergyLimit = lowEPos->second;
324 highEnergyLimit = highEPos->second;
325 killBelowEnergy = killEPos->second;
329 if (ekin < killBelowEnergy) {
336 if (currentMaterialName ==
"SILICON_DIOXIDE" && ekin < 100 * eV) {
337 acousticModelEnabled =
true;
353 acousticModelEnabled =
false;
358 TCSMap::iterator tablepos;
359 tablepos = tableTCS.find(currentMaterialName);
361 if (tablepos != tableTCS.end())
363 MapData* tableData = tablepos->second;
365 if (ekin >= lowEnergyLimit && ekin < highEnergyLimit)
367 std::map< G4String, G4MicroElecCrossSectionDataSet_new*, std::less<G4String> >::iterator pos;
368 pos = tableData->find(particleName);
370 if (pos != tableData->end())
380 G4Exception(
"G4MicroElecElasticModel_new::ComputeCrossSectionPerVolume",
"em0002",
FatalException,
"Model not applicable to particle type.");
388 str += currentMaterialName +
" TCS table not found!";
392 if (verboseLevel > 3)
394 G4cout <<
"---> Kinetic energy(eV)=" << ekin / eV <<
G4endl;
395 G4cout <<
" - Cross section per Si atom (cm^2)=" << sigma / cm / cm <<
G4endl;
396 G4cout <<
" - Cross section per Si atom (cm^-1)=" << sigma*density / (1. / cm) <<
G4endl;
398 return sigma*density;
419 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);
423 Ebz = (std::pow(h, 2) * std::pow(kbz, 2)) / (2 * m0),
425 nbz = 1.0 / (exp(hwbz / (kb * T)) - 1),
430 Pac = ((pi * kb * T) / (h * std::pow(cs, 2) * rho)) * (std::pow(Eac, 2) *
D) / (1 + (E / Aac));
435 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)));
439 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)));
440 G4double fEbz4 = ((pi * kb * T) / (h * std::pow(cs, 2) * rho)) * (std::pow(Eac, 2) *
D) / (1 + ((Ebz / 4) / Aac));
441 G4double alpha = ((fEbz - fEbz4) / (Ebz - (Ebz / 4)));
442 Pac = alpha * E + (fEbz - alpha * Ebz);
445 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);
491 G4double xDir = std::sqrt(1. - cosTheta*cosTheta);
493 xDir *= std::cos(phi);
494 yDir *= std::sin(phi);
496 G4ThreeVector zPrimeVers((xDir*xVers + yDir*yVers + cosTheta*zVers));
515 k_d=0.1334*std::pow(Z2,(2./3.))*std::pow(M2,(-1./2.));
516 epsilon_d=0.01014*std::pow(Z2,(-7./3.))*(T/eV);
517 g_epsilon_d= epsilon_d+0.40244*std::pow(epsilon_d,(3./4.))+3.4008*std::pow(epsilon_d,(1./6.));
519 E_nu=1./(1.+ k_d*g_epsilon_d);
526G4double G4MicroElecElasticModel_new::Theta
544 ThetaMap::iterator iterator_angle;
545 iterator_angle = thetaDataStorage.find(currentMaterialName);
547 energyMap::iterator iterator_energy;
548 iterator_energy = eIncidentEnergyStorage.find(currentMaterialName);
550 ProbaMap::iterator iterator_proba;
551 iterator_proba = eProbaStorage.find(currentMaterialName);
553 if (iterator_angle != thetaDataStorage.end() && iterator_energy != eIncidentEnergyStorage.end() && iterator_proba != eProbaStorage.end())
555 TriDimensionMap* eDiffCrossSectionData = iterator_angle->second;
556 std::vector<double>* eTdummyVec = iterator_energy->second;
557 VecMap* eVecm = iterator_proba->second;
559 std::vector<double>::iterator t2 = std::upper_bound(eTdummyVec->begin(), eTdummyVec->end(), k);
560 std::vector<double>::iterator t1 = t2 - 1;
561 std::vector<double>::iterator e12 = std::upper_bound((*eVecm)[(*t1)].begin(), (*eVecm)[(*t1)].end(), integrDiff);
562 std::vector<double>::iterator e11 = e12 - 1;
563 std::vector<double>::iterator e22 = std::upper_bound((*eVecm)[(*t2)].begin(), (*eVecm)[(*t2)].end(), integrDiff);
564 std::vector<double>::iterator e21 = e22 - 1;
573 xs11 = (*eDiffCrossSectionData)[valueT1][valueE11];
574 xs12 = (*eDiffCrossSectionData)[valueT1][valueE12];
575 xs21 = (*eDiffCrossSectionData)[valueT2][valueE21];
576 xs22 = (*eDiffCrossSectionData)[valueT2][valueE22];
581 str += currentMaterialName +
" not found!";
587 if (xs11==0 || xs12==0 ||xs21==0 ||xs22==0)
return (0.);
589 theta = QuadInterpolator( valueE11, valueE12,
623 G4double value = (d1 + (d2 - d1)*(e - e1)/ (e2 - e1));
635 G4double a = (std::log10(xs2)-std::log10(xs1)) / (std::log10(e2)-std::log10(e1));
636 G4double b = std::log10(xs2) - a*std::log10(e2);
637 G4double sigma = a*std::log10(e) + b;
638 G4double value = (std::pow(10.,sigma));
654 G4double interpolatedvalue1 = LinLinInterpolate(e11, e12, e, xs11, xs12);
655 G4double interpolatedvalue2 = LinLinInterpolate(e21, e22, e, xs21, xs22);
656 G4double value = LinLinInterpolate(t1, t2, t, interpolatedvalue1, interpolatedvalue2);
667 integrdiff = uniformRand;
673 cosTheta= std::cos(theta*pi/180.);
683 killBelowEnergy = threshold;
685 if (threshold < 5*CLHEP::eV)
687 G4Exception (
"*** WARNING : the G4MicroElecElasticModel class is not validated below 5 eV !",
"",
JustWarning,
"") ;
688 threshold = 5*CLHEP::eV;
double A(double temperature)
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(G4double Px, G4double Py, G4double Pz)
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)