62 theLorentzTables1(0),theLorentzTables2(0)
122 char* path = std::getenv(
"G4LEDATA");
126 "G4PenelopeBremsstrahlungAngular - G4LEDATA environment variable not set!";
127 G4Exception(
"G4PenelopeBremsstrahlungAngular::ReadDataFile()",
132 G4String pathFile = pathString +
"/penelope/bremsstrahlung/pdbrang.p08";
133 std::ifstream
file(pathFile);
137 G4String excep =
"G4PenelopeBremsstrahlungAngular - data file " + pathFile +
" not found!";
138 G4Exception(
"G4PenelopeBremsstrahlungAngular::ReadDataFile()",
151 file >> iz1 >> ie1 >> ik1 >> zr >> er >> kr >> a1 >> a2;
153 if ((iz1-1 == i) && (ik1-1 ==
k) && (ie1-1 == j))
161 ed <<
"Corrupted data file " << pathFile <<
"?" <<
G4endl;
162 G4Exception(
"G4PenelopeBremsstrahlungAngular::ReadDataFile()",
188 G4Exception(
"G4PenelopeBremsstrahlungAngular::PrepareInterpolationTables()",
199 const G4int reducedEnergyGrid=21;
230 Q2[i][j]=QQ2vector->
Value(Zmat);
240 for(i=0;i<reducedEnergyGrid;i++)
251 Q1[i][j]=Q1[i][j]/Zmat;
262 Q1vector->
PutValue(j,pK[j],std::log(Q1[i][j]));
263 Q2vector->
PutValue(j,pK[j],Q2[i][j]);
266 for (j=0;j<reducedEnergyGrid;j++)
268 Q1E[i][j]=Q1vector->
Value(ppK[j]);
269 Q2E[i][j]=Q2vector->
Value(ppK[j]);
285 for (j=0;j<reducedEnergyGrid;j++)
293 for (j=0;j<reducedEnergyGrid;j++)
299 thevec->
PutValue(i,betas[i],Q1E[i][j]);
300 thevec2->
PutValue(i,betas[i],Q2E[i][j]);
314 ed <<
"Unable to create tables of Lorentz coefficients for " <<
G4endl;
315 ed <<
"<Z>= " << Zmat <<
" in G4PenelopeBremsstrahlungAngular" <<
G4endl;
318 G4Exception(
"G4PenelopeBremsstrahlungAngular::PrepareInterpolationTables()",
334 G4Exception(
"G4PenelopeBremsstrahlungAngular::SampleDirection()",
344 G4Exception(
"G4PenelopeBremsstrahlungAngular::SampleDirection()",
354 G4Exception(
"G4PenelopeBremsstrahlungAngular::SampleDirection()",
355 "em2040",
FatalException,
"Material not found in the effectiveZ table");
361 G4cout <<
"Effective <Z> for material : " << material->
GetName() <<
374 if (ePrimary > 500*
keV)
380 cdt = -1.0*std::pow(-cdt,1./3.);
382 cdt = std::pow(cdt,1./3.);
384 cdt = (cdt+beta)/(1.0+beta*cdt);
386 sinTheta = std::sqrt(1. - cdt*cdt);
389 sinTheta* std::sin(phi),
400 ed <<
"Unable to retrieve Lorentz tables for Z= " << Zmat <<
G4endl;
401 G4Exception(
"G4PenelopeBremsstrahlungAngular::SampleDirection()",
418 P10 = v1->
Value(beta);
449 cdt = (cdt+betap)/(1.0+betap*cdt);
452 sinTheta = std::sqrt(1. - cdt*cdt);
455 sinTheta* std::sin(phi),
470 G4cout <<
"WARNING: G4PenelopeBremsstrahlungAngular() does NOT support PolarAngle()" <<
G4endl;
471 G4cout <<
"Please use the alternative interface SampleDirection()" <<
G4endl;
472 G4Exception(
"G4PenelopeBremsstrahlungAngular::PolarAngle()",
489 std::vector<G4double> *StechiometricFactors =
new std::vector<G4double>;
493 for (
G4int i=0;i<nElements;i++)
495 G4double fraction = fractionVector[i];
496 G4double atomicWeigth = (*elementVector)[i]->GetA()/(
g/
mole);
497 StechiometricFactors->push_back(fraction/atomicWeigth);
500 G4double MaxStechiometricFactor = 0.;
501 for (
G4int i=0;i<nElements;i++)
503 if ((*StechiometricFactors)[i] > MaxStechiometricFactor)
504 MaxStechiometricFactor = (*StechiometricFactors)[i];
507 for (
G4int i=0;i<nElements;i++)
508 (*StechiometricFactors)[i] /= MaxStechiometricFactor;
512 for (
G4int i=0;i<nElements;i++)
514 G4double Z = (*elementVector)[i]->GetZ();
515 sumz2 += (*StechiometricFactors)[i]*Z*
Z;
516 sums += (*StechiometricFactors)[i];
518 delete StechiometricFactors;
520 G4double ZBR = std::sqrt(sumz2/sums);