79 MeanFreePath = (*theMeanFreePathTable)(aMaterial->
GetIndex())->
80 GetValue(kineticEnergy, isOutRange);
90 char* path = std::getenv(
"G4LEDATA");
95 "variable G4LEDATA not defined");
111 std::vector<G4Material*>::const_iterator matite;
112 for( matite = materialTable->begin(); matite != materialTable->end(); matite++ ) {
117 std::string dirName = std::string(path) +
"/lepts/";
118 std::string fnParam = dirName + mateName +
"." + aParticleName +
".param.dat";
119 std::string baseName = std::string(path) +
"/lepts/" + mateName +
"." + aParticleName;
121 if( !bData )
continue;
124 std::string fnIXS = baseName +
".IXS.dat";
126 std::map< G4int, std::vector<G4double> > integralXS =
ReadIXS(fnIXS, aMaterial);
129 if( integralXS.size() == 0 ) {
130 G4cerr <<
" Integral cross sections will be set to 0. for material " << mateName <<
G4endl;
135 unsigned int matIdx = aMaterial->
GetIndex();
141 std::map< G4int, std::vector<G4double> >::const_iterator itei;
142 for( itei = integralXS.begin(); itei != integralXS.end(); itei++ ){
149 std::string fnDXS = baseName +
".DXS.dat";
150 std::string fnRMT = baseName +
".RMT.dat";
151 std::string fnEloss = baseName +
".Eloss.dat";
152 std::string fnEloss2 = baseName +
".Eloss2.dat";
155 if( !
theDiffXS[aMaterial]->IsFileFound() ) {
159 (
G4String(
"File not found :" + fnDXS).c_str()));
170 (
G4String(
"File not found :" + fnEloss).c_str()));
183 unsigned int matIdx = aMaterial->
GetIndex();
199 G4double eVEnergy = LowEdgeEnergy/CLHEP::eV;
203 if(eVEnergy < integralXS[0][1] ) {
210 if( eVEnergy > integralXS[0][jj]) {
216 aa = integralXS[0][Bin];
217 bb = integralXS[0][Bin+1];
218 crossSection = (integralXS[
theXSType][Bin] + (integralXS[
theXSType][Bin+1]-integralXS[
theXSType][Bin])/(bb-aa)*(eVEnergy-aa) ) * 1.e-16*CLHEP::cm2;
220 if(
verboseLevel >= 3 )
G4cout <<
" crossSection " << crossSection <<
" " <<integralXS[
theXSType][Bin] <<
" + " << (integralXS[
theXSType][Bin+1]-integralXS[
theXSType][Bin]) <<
" / " << (bb-aa) <<
" *" << (eVEnergy-aa) <<
" * " << 1.e-16*CLHEP::cm2 <<
G4endl;;
223 SIGMA = NbOfMoleculesPerVolume * crossSection;
225 <<
" Bin " << Bin <<
" TOTAL " << aa <<
" " << bb
248 x =
theDiffXS[aMaterial]->SampleAngleMT(e, el);
254 G4double Pi = std::sqrt( std::pow( (Ei/27.2/137),2) +2*Ei/27.2);
255 G4double Pd = std::sqrt( std::pow( (Ed/27.2/137),2) +2*Ed/27.2);
262 G4double co = (Pi*Pi + Pd*Pd - KR*KR) / (2*Pi*Pd);
263 if( co > 1. ) co = 1.;
275 G4double sinTeta = std::sqrt(1.0-cosTeta*cosTeta);
277 G4double dirx = sinTeta*std::cos(Phi) , diry = sinTeta*std::sin(Phi) , dirz = cosTeta ;
296 G4double sinTeta = std::sqrt(1.0-cosTeta*cosTeta);
298 G4double dirx = sinTeta*std::cos(Phi) , diry = sinTeta*std::sin(Phi) , dirz = cosTeta ;
311 el =
theElostDistr[aMaterial]->Sample(eMin/CLHEP::eV, eMax/CLHEP::eV)*CLHEP::eV;
314 if(
verboseLevel >= 2 )
G4cout << aMaterial->
GetName() <<
"SampleEnergyLoss/eV " << el/CLHEP::eV <<
" eMax/eV " << eMax/CLHEP::eV <<
" "
324 std::ifstream fin(fnParam);
325 if (!fin.is_open()) {
329 (
G4String(
"File not found: ")+ fnParam).c_str());
335 fin >> IonisPot >> IonisPotInt;
336 if(
verboseLevel >= 1 )
G4cout <<
"Read param (" << fnParam <<
")\t IonisPot: " << IonisPot
337 <<
" IonisPotInt: " << IonisPotInt <<
G4endl;
345 for(
size_t ii = 0; ii < nelem; ii++ ) {
346 MolecularMass += aMaterial->
GetElement(ii)->
GetA()*atomsV[ii]/CLHEP::g;
354 <<
" IonisPotInt: " << IonisPotInt/CLHEP::eV <<
" eV"
355 <<
" MolecularMass " << MolecularMass/(CLHEP::g/CLHEP::mole) <<
" g/mole" <<
G4endl;
363 std::map< G4int, std::vector<G4double> > integralXS;
366 std::ifstream fin(fnIXS);
367 if (!fin.is_open()) {
371 (
G4String(
"File not found: ")+ fnIXS).c_str());
375 G4int nXSdat, nXSsub;
376 fin >> nXSdat >> nXSsub;
378 <<
" nXSsub: " << nXSsub <<
G4endl;
383 for (
G4int ip=0; ip<=nXSsub; ip++) {
384 integralXS[ip].push_back(0.);
386 for (
G4int ie=1; ie<=nXSdat; ie++) {
387 for (
G4int ip=0; ip<=nXSsub; ip++) {
389 integralXS[ip].push_back(xsdat);
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::vector< G4Material * > G4MaterialTable
G4GLOB_DLL std::ostream G4cerr
G4GLOB_DLL std::ostream G4cout
Hep3Vector & rotateUz(const Hep3Vector &)
G4double GetDensity() const
static size_t GetNumberOfMaterials()
const G4Element * GetElement(G4int iel) const
size_t GetNumberOfElements() const
const G4int * GetAtomsVector() const
static G4MaterialTable * GetMaterialTable()
const G4String & GetName() const
const G4String & GetParticleName() const
void insertAt(std::size_t, G4PhysicsVector *)
G4double GetLowEdgeEnergy(std::size_t binNumber) const
void PutValue(std::size_t index, G4double theValue)
std::size_t first(char) const
void SetHighEnergyLimit(G4double)
void SetLowEnergyLimit(G4double)
const G4String & GetName() const
G4bool ReadParam(G4String fileName, const G4Material *aMaterial)
std::map< const G4Material *, G4LEPTSDiffXS * > theDiffXS
G4ThreeVector SampleNewDirection(const G4Material *aMaterial, G4ThreeVector Dir, G4double e, G4double el)
G4double SampleEnergyLoss(const G4Material *aMaterial, G4double eMin, G4double eMax)
std::map< const G4Material *, G4double > theMolecularMass
G4double GetMeanFreePath(const G4Material *mate, const G4ParticleDefinition *aParticle, G4double kineticEnergy)
std::map< const G4Material *, G4int > theNXSsub
G4VLEPTSModel(const G4String &processName)
std::map< const G4Material *, G4LEPTSElossDistr * > theElostDistr
std::map< const G4Material *, G4double > theIonisPotInt
std::map< const G4Material *, G4double > theIonisPot
G4PhysicsTable * theMeanFreePathTable
G4double theHighestEnergyLimit
void BuildPhysicsTable(const G4ParticleDefinition &aParticleType)
virtual std::map< G4int, std::vector< G4double > > ReadIXS(G4String fileName, const G4Material *aMaterial)
G4double theLowestEnergyLimit
std::map< const G4Material *, G4LEPTSDistribution * > theRMTDistr
void BuildMeanFreePathTable(const G4Material *aMaterial, std::map< G4int, std::vector< G4double > > &integralXS)
std::map< const G4Material *, G4int > theNXSdat
G4double SampleAngle(const G4Material *aMaterial, G4double e, G4double el)