54 killBelowEnergy = 16.7 *
eV;
55 lowEnergyLimit = 0 *
eV;
56 lowEnergyLimitOfModel = 5 *
eV;
57 highEnergyLimit = 100. *
MeV;
71 G4cout <<
"MicroElec Elastic model is constructed " <<
G4endl
73 << lowEnergyLimit /
eV <<
" eV - "
74 << highEnergyLimit /
keV <<
" keV"
86 std::map< G4String,G4MicroElecCrossSectionDataSet*,std::less<G4String> >::iterator pos;
87 for (pos = tableData.begin(); pos != tableData.end(); ++pos)
105 if (verboseLevel > 3)
106 G4cout <<
"Calling G4MicroElecElasticModel::Initialise()" <<
G4endl;
112 G4cout <<
"G4MicroElecElasticModel: low energy limit increased from " <<
119 G4cout <<
"G4MicroElecElasticModel: high energy limit decreased from " <<
128 G4String fileElectron(
"microelec/sigma_elastic_e_Si");
145 char *path = getenv(
"G4LEDATA");
153 std::ostringstream eFullFileName;
154 eFullFileName << path <<
"/microelec/sigmadiff_elastic_e_Si.dat";
155 std::ifstream eDiffCrossSection(eFullFileName.str().c_str());
157 if (!eDiffCrossSection)
158 G4Exception(
"G4MicroElecElasticModel::Initialise",
"em0003",
FatalException,
"Missing data file: /microelec/sigmadiff_elastic_e_Si.dat");
160 eTdummyVec.push_back(0.);
162 while(!eDiffCrossSection.eof())
166 eDiffCrossSection>>tDummy>>eDummy;
169 if (tDummy != eTdummyVec.back())
171 eTdummyVec.push_back(tDummy);
172 eVecm[tDummy].push_back(0.);
175 eDiffCrossSection>>eDiffCrossSectionData[tDummy][eDummy];
178 if (!eDiffCrossSection.eof()) eDiffCrossSectionData[tDummy][eDummy]*=scaleFactor;
180 if (eDummy != eVecm[tDummy].back()) eVecm[tDummy].push_back(eDummy);
186 if (verboseLevel > 2)
187 G4cout <<
"Loaded cross section files for MicroElec Elastic model" <<
G4endl;
191 G4cout <<
"MicroElec Elastic model is initialized " << G4endl
198 if (isInitialised) {
return; }
200 isInitialised =
true;
213 if (verboseLevel > 3)
214 G4cout <<
"Calling CrossSectionPerVolume() of G4MicroElecElasticModel" <<
G4endl;
226 if (ekin < highEnergyLimit)
229 if (ekin < lowEnergyLimitOfModel) ekin = lowEnergyLimitOfModel;
232 std::map< G4String,G4MicroElecCrossSectionDataSet*,std::less<G4String> >::iterator pos;
233 pos = tableData.find(particleName);
235 if (pos != tableData.end())
245 G4Exception(
"G4MicroElecElasticModel::ComputeCrossSectionPerVolume",
"em0002",
FatalException,
"Model not applicable to particle type.");
249 if (verboseLevel > 3)
253 G4cout <<
" - Cross section per Si atom (cm^-1)=" << sigma*density/(1./
cm) << G4endl;
270 if (verboseLevel > 3)
271 G4cout <<
"Calling SampleSecondaries() of G4MicroElecElasticModel" <<
G4endl;
275 if (electronEnergy0 < killBelowEnergy)
282 if (electronEnergy0>= killBelowEnergy && electronEnergy0 < highEnergyLimit)
284 G4double cosTheta = RandomizeCosTheta(electronEnergy0);
292 G4double xDir = std::sqrt(1. - cosTheta*cosTheta);
294 xDir *= std::cos(phi);
295 yDir *= std::sin(phi);
297 G4ThreeVector zPrimeVers((xDir*xVers + yDir*yVers + cosTheta*zVers));
308 G4double G4MicroElecElasticModel::Theta
327 std::vector<double>::iterator
t2 = std::upper_bound(eTdummyVec.begin(),eTdummyVec.end(), k);
328 std::vector<double>::iterator
t1 = t2-1;
330 std::vector<double>::iterator e12 = std::upper_bound(eVecm[(*t1)].begin(),eVecm[(*t1)].end(), integrDiff);
331 std::vector<double>::iterator e11 = e12-1;
333 std::vector<double>::iterator e22 = std::upper_bound(eVecm[(*t2)].begin(),eVecm[(*t2)].end(), integrDiff);
334 std::vector<double>::iterator e21 = e22-1;
343 xs11 = eDiffCrossSectionData[valueT1][valueE11];
344 xs12 = eDiffCrossSectionData[valueT1][valueE12];
345 xs21 = eDiffCrossSectionData[valueT2][valueE21];
346 xs22 = eDiffCrossSectionData[valueT2][valueE22];
350 if (xs11==0 || xs12==0 ||xs21==0 ||xs22==0)
return (0.);
352 theta = QuadInterpolator( valueE11, valueE12,
372 G4double value = std::exp(d1 + (d2 - d1)*(e - e1)/ (e2 - e1));
384 G4double a = (std::log10(xs2)-std::log10(xs1)) / (std::log10(e2)-std::log10(e1));
385 G4double b = std::log10(xs2) - a*std::log10(e2);
387 G4double value = (std::pow(10.,sigma));
401 G4double interpolatedvalue1 = LinLogInterpolate(e11, e12, e, xs11, xs12);
402 G4double interpolatedvalue2 = LinLogInterpolate(e21, e22, e, xs21, xs22);
403 G4double value = LinLogInterpolate(t1, t2, t, interpolatedvalue1, interpolatedvalue2);
413 integrdiff = uniformRand;
419 cosTheta= std::cos(theta*
pi/180);
static G4Electron * ElectronDefinition()
G4double LowEnergyLimit() const
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
G4MicroElecElasticModel(const G4ParticleDefinition *p=0, const G4String &nam="MicroElecElasticModel")
G4double GetKineticEnergy() const
G4double HighEnergyLimit() const
virtual void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy)
static G4NistManager * Instance()
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
const G4String & GetParticleName() const
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
void SetHighEnergyLimit(G4double)
G4GLOB_DLL std::ostream G4cout
virtual G4double CrossSectionPerVolume(const G4Material *material, const G4ParticleDefinition *p, G4double ekin, G4double emin, G4double emax)
const G4ThreeVector & GetMomentumDirection() const
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &)
virtual G4double FindValue(G4double e, G4int componentId=0) const
virtual G4bool LoadData(const G4String &argFileName)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4double GetTotNbOfAtomsPerVolume() const
virtual ~G4MicroElecElasticModel()
G4ParticleChangeForGamma * fParticleChangeForGamma
Hep3Vector orthogonal() const
const G4Material * GetBaseMaterial() const
const XML_Char int const XML_Char * value
void SetProposedKineticEnergy(G4double proposedKinEnergy)
Hep3Vector cross(const Hep3Vector &) const
void ProposeTrackStatus(G4TrackStatus status)
void SetLowEnergyLimit(G4double)
G4ParticleChangeForGamma * GetParticleChangeForGamma()