54 G4cout <<
"*******************************************************************************" <<
G4endl;
55 G4cout <<
"*******************************************************************************" <<
G4endl;
56 G4cout <<
" The name of the class G4MuElecElasticModel is changed to G4MicroElecElasticModel. " <<
G4endl;
57 G4cout <<
" The obsolete class will be REMOVED with the next release of Geant4. " <<
G4endl;
58 G4cout <<
"*******************************************************************************" <<
G4endl;
59 G4cout <<
"*******************************************************************************" <<
G4endl;
64 killBelowEnergy = 16.7 *
eV;
65 lowEnergyLimit = 0 *
eV;
66 lowEnergyLimitOfModel = 5 *
eV;
67 highEnergyLimit = 100. *
MeV;
81 G4cout <<
"MuElec Elastic model is constructed " << G4endl
83 << lowEnergyLimit /
eV <<
" eV - "
84 << highEnergyLimit /
keV <<
" keV"
96 std::map< G4String,G4MuElecCrossSectionDataSet*,std::less<G4String> >::iterator pos;
97 for (pos = tableData.begin(); pos != tableData.end(); ++pos)
115 if (verboseLevel > 3)
116 G4cout <<
"Calling G4MuElecElasticModel::Initialise()" <<
G4endl;
122 G4cout <<
"G4MuElecElasticModel: low energy limit increased from " <<
129 G4cout <<
"G4MuElecElasticModel: high energy limit decreased from " <<
138 G4String fileElectron(
"microelec/sigma_elastic_e_Si");
155 char *path = getenv(
"G4LEDATA");
163 std::ostringstream eFullFileName;
164 eFullFileName << path <<
"/microelec/sigmadiff_elastic_e_Si.dat";
165 std::ifstream eDiffCrossSection(eFullFileName.str().c_str());
167 if (!eDiffCrossSection)
168 G4Exception(
"G4MuElecElasticModel::Initialise",
"em0003",
FatalException,
"Missing data file: /microelec/sigmadiff_elastic_e_Si.dat");
170 eTdummyVec.push_back(0.);
172 while(!eDiffCrossSection.eof())
176 eDiffCrossSection>>tDummy>>eDummy;
179 if (tDummy != eTdummyVec.back())
181 eTdummyVec.push_back(tDummy);
182 eVecm[tDummy].push_back(0.);
185 eDiffCrossSection>>eDiffCrossSectionData[tDummy][eDummy];
188 if (!eDiffCrossSection.eof()) eDiffCrossSectionData[tDummy][eDummy]*=scaleFactor;
190 if (eDummy != eVecm[tDummy].back()) eVecm[tDummy].push_back(eDummy);
196 if (verboseLevel > 2)
197 G4cout <<
"Loaded cross section files for MuElec Elastic model" <<
G4endl;
201 G4cout <<
"MuElec Elastic model is initialized " << G4endl
208 if (isInitialised) {
return; }
210 isInitialised =
true;
223 if (verboseLevel > 3)
224 G4cout <<
"Calling CrossSectionPerVolume() of G4MuElecElasticModel" <<
G4endl;
236 if (ekin < highEnergyLimit)
239 if (ekin < lowEnergyLimitOfModel) ekin = lowEnergyLimitOfModel;
242 std::map< G4String,G4MuElecCrossSectionDataSet*,std::less<G4String> >::iterator pos;
243 pos = tableData.find(particleName);
245 if (pos != tableData.end())
255 G4Exception(
"G4MuElecElasticModel::ComputeCrossSectionPerVolume",
"em0002",
FatalException,
"Model not applicable to particle type.");
259 if (verboseLevel > 3)
263 G4cout <<
" - Cross section per Si atom (cm^-1)=" << sigma*density/(1./
cm) << G4endl;
280 if (verboseLevel > 3)
281 G4cout <<
"Calling SampleSecondaries() of G4MuElecElasticModel" <<
G4endl;
285 if (electronEnergy0 < killBelowEnergy)
292 if (electronEnergy0>= killBelowEnergy && electronEnergy0 < highEnergyLimit)
294 G4double cosTheta = RandomizeCosTheta(electronEnergy0);
302 G4double xDir = std::sqrt(1. - cosTheta*cosTheta);
304 xDir *= std::cos(phi);
305 yDir *= std::sin(phi);
307 G4ThreeVector zPrimeVers((xDir*xVers + yDir*yVers + cosTheta*zVers));
318 G4double G4MuElecElasticModel::Theta
337 std::vector<double>::iterator
t2 = std::upper_bound(eTdummyVec.begin(),eTdummyVec.end(), k);
338 std::vector<double>::iterator
t1 = t2-1;
340 std::vector<double>::iterator e12 = std::upper_bound(eVecm[(*t1)].begin(),eVecm[(*t1)].end(), integrDiff);
341 std::vector<double>::iterator e11 = e12-1;
343 std::vector<double>::iterator e22 = std::upper_bound(eVecm[(*t2)].begin(),eVecm[(*t2)].end(), integrDiff);
344 std::vector<double>::iterator e21 = e22-1;
353 xs11 = eDiffCrossSectionData[valueT1][valueE11];
354 xs12 = eDiffCrossSectionData[valueT1][valueE12];
355 xs21 = eDiffCrossSectionData[valueT2][valueE21];
356 xs22 = eDiffCrossSectionData[valueT2][valueE22];
360 if (xs11==0 || xs12==0 ||xs21==0 ||xs22==0)
return (0.);
362 theta = QuadInterpolator( valueE11, valueE12,
382 G4double value = std::exp(d1 + (d2 - d1)*(e - e1)/ (e2 - e1));
394 G4double a = (std::log10(xs2)-std::log10(xs1)) / (std::log10(e2)-std::log10(e1));
395 G4double b = std::log10(xs2) - a*std::log10(e2);
397 G4double value = (std::pow(10.,sigma));
411 G4double interpolatedvalue1 = LinLogInterpolate(e11, e12, e, xs11, xs12);
412 G4double interpolatedvalue2 = LinLogInterpolate(e21, e22, e, xs21, xs22);
413 G4double value = LinLogInterpolate(t1, t2, t, interpolatedvalue1, interpolatedvalue2);
423 integrdiff = uniformRand;
429 cosTheta= std::cos(theta*
pi/180);
static G4Electron * ElectronDefinition()
G4double LowEnergyLimit() const
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
virtual G4double FindValue(G4double e, G4int componentId=0) const
G4double GetKineticEnergy() const
G4double HighEnergyLimit() const
virtual G4bool LoadData(const G4String &argFileName)
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &)
static G4NistManager * Instance()
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
virtual ~G4MuElecElasticModel()
const G4String & GetParticleName() const
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
void SetHighEnergyLimit(G4double)
virtual G4double CrossSectionPerVolume(const G4Material *material, const G4ParticleDefinition *p, G4double ekin, G4double emin, G4double emax)
G4GLOB_DLL std::ostream G4cout
const G4ThreeVector & GetMomentumDirection() const
G4MuElecElasticModel(const G4ParticleDefinition *p=0, const G4String &nam="MuElecElasticModel")
virtual void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4double GetTotNbOfAtomsPerVolume() const
Hep3Vector orthogonal() const
const G4Material * GetBaseMaterial() const
G4ParticleChangeForGamma * fParticleChangeForGamma
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()