55 killBelowEnergy = 16.7 * eV;
56 lowEnergyLimit = 0 * eV;
57 lowEnergyLimitOfModel = 5 * eV;
58 highEnergyLimit = 100. * MeV;
72 G4cout <<
"MicroElec Elastic model is constructed " <<
G4endl
74 << lowEnergyLimit / eV <<
" eV - "
75 << highEnergyLimit / MeV <<
" MeV"
86 for (
auto & pos : tableData)
101 if (verboseLevel > 3)
102 G4cout <<
"Calling G4MicroElecElasticModel::Initialise()" <<
G4endl;
107 G4cout <<
"G4MicroElecElasticModel: low energy limit increased from " <<
114 G4cout <<
"G4MicroElecElasticModel: high energy limit decreased from " <<
121 G4double scaleFactor = 1e-18 * cm * cm;
122 G4String fileElectron(
"microelec/sigma_elastic_e_Si");
129 tableFile[electron] = fileElectron;
133 tableData[electron] = tableE;
144 std::ostringstream eFullFileName;
145 eFullFileName << path <<
"/microelec/sigmadiff_cumulated_elastic_e_Si.dat";
146 std::ifstream eDiffCrossSection(eFullFileName.str().c_str());
148 if (!eDiffCrossSection)
150 "Missing data file: /microelec/sigmadiff_cumulated_elastic_e_Si.dat");
155 eDiffCrossSectionData.clear();
158 eTdummyVec.push_back(0.);
160 while(!eDiffCrossSection.eof())
164 eDiffCrossSection>>tDummy>>eDummy;
166 if (tDummy != eTdummyVec.back())
168 eTdummyVec.push_back(tDummy);
169 eVecm[tDummy].push_back(0.);
172 eDiffCrossSection>>eDiffCrossSectionData[tDummy][eDummy];
174 if (eDummy != eVecm[tDummy].back()) eVecm[tDummy].push_back(eDummy);
178 if (verboseLevel > 2)
179 G4cout <<
"Loaded cross section files for MicroElec Elastic model" <<
G4endl;
183 G4cout <<
"MicroElec Elastic model is initialized " <<
G4endl
190 if (isInitialised) {
return; }
192 isInitialised =
true;
203 if (verboseLevel > 3)
204 G4cout <<
"Calling CrossSectionPerVolume() of G4MicroElecElasticModel" <<
G4endl;
214 if (ekin < highEnergyLimit)
217 if (ekin < killBelowEnergy)
return DBL_MAX;
220 auto pos = tableData.find(particleName);
221 if (pos != tableData.end())
224 if (table !=
nullptr)
231 G4Exception(
"G4MicroElecElasticModel::ComputeCrossSectionPerVolume",
"em0002",
236 if (verboseLevel > 3)
238 G4cout <<
"---> Kinetic energy(eV)=" << ekin/eV <<
G4endl;
239 G4cout <<
" - Cross section per Si atom (cm^2)=" << sigma/cm/cm <<
G4endl;
240 G4cout <<
" - Cross section per Si atom (cm^-1)=" << sigma*density/(1./cm) <<
G4endl;
243 return sigma*density;
255 if (verboseLevel > 3)
256 G4cout <<
"Calling SampleSecondaries() of G4MicroElecElasticModel" <<
G4endl;
260 if (electronEnergy0 < killBelowEnergy)
268 if (electronEnergy0>= killBelowEnergy && electronEnergy0 < highEnergyLimit)
270 G4double cosTheta = RandomizeCosTheta(electronEnergy0);
276 G4double xDir = std::sqrt(1. - cosTheta*cosTheta);
278 xDir *= std::cos(phi);
279 yDir *= std::sin(phi);
281 G4ThreeVector zPrimeVers((xDir*xVers + yDir*yVers + cosTheta*zVers));
290G4double G4MicroElecElasticModel::Theta
307 auto t2 = std::upper_bound(eTdummyVec.begin(),eTdummyVec.end(), k);
309 auto e12 = std::upper_bound(eVecm[(*t1)].begin(),eVecm[(*t1)].end(), integrDiff);
311 auto e22 = std::upper_bound(eVecm[(*t2)].begin(),eVecm[(*t2)].end(), integrDiff);
321 xs11 = eDiffCrossSectionData[valueT1][valueE11];
322 xs12 = eDiffCrossSectionData[valueT1][valueE12];
323 xs21 = eDiffCrossSectionData[valueT2][valueE21];
324 xs22 = eDiffCrossSectionData[valueT2][valueE22];
326 if (xs11==0 || xs12==0 ||xs21==0 ||xs22==0)
return (0.);
328 theta = QuadInterpolator( valueE11, valueE12,
362 G4double value = (d1 + (d2 - d1)*(e - e1)/ (e2 - e1));
374 G4double a = (std::log10(xs2)-std::log10(xs1)) / (std::log10(e2)-std::log10(e1));
375 G4double b = std::log10(xs2) - a*std::log10(e2);
376 G4double sigma = a*std::log10(e) + b;
377 G4double value = (std::pow(10.,sigma));
404 G4double interpolatedvalue1 = LinLinInterpolate(e11, e12, e, xs11, xs12);
405 G4double interpolatedvalue2 = LinLinInterpolate(e21, e22, e, xs21, xs22);
406 G4double value = LinLinInterpolate(t1, t2, t, interpolatedvalue1, interpolatedvalue2);
417 integrdiff = uniformRand;
423 cosTheta= std::cos(theta*pi/180);
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 * GetBaseMaterial() const
G4double GetTotNbOfAtomsPerVolume() const
G4bool LoadData(const G4String &argFileName) override
G4double FindValue(G4double e, G4int componentId=0) const override
G4MicroElecElasticModel(const G4ParticleDefinition *p=nullptr, const G4String &nam="MicroElecElasticModel")
G4double CrossSectionPerVolume(const G4Material *material, const G4ParticleDefinition *p, G4double ekin, G4double emin, G4double emax) override
G4ParticleChangeForGamma * fParticleChangeForGamma
void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy) override
void Initialise(const G4ParticleDefinition *, const G4DataVector &) override
virtual ~G4MicroElecElasticModel()
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
static G4NistManager * Instance()
void SetProposedKineticEnergy(G4double proposedKinEnergy)
void ProposeMomentumDirection(const G4ThreeVector &Pfinal)
const G4String & GetParticleName() const
void SetHighEnergyLimit(G4double)
G4ParticleChangeForGamma * GetParticleChangeForGamma()
G4double LowEnergyLimit() const
G4double HighEnergyLimit() const
void SetLowEnergyLimit(G4double)
void ProposeTrackStatus(G4TrackStatus status)
void ProposeLocalEnergyDeposit(G4double anEnergyPart)