63 theLorentzTables1(0),theLorentzTables2(0)
123 char* path = getenv(
"G4LEDATA");
127 "G4PenelopeBremsstrahlungAngular - G4LEDATA environment variable not set!";
128 G4Exception(
"G4PenelopeBremsstrahlungAngular::ReadDataFile()",
133 G4String pathFile = pathString +
"/penelope/bremsstrahlung/pdbrang.p08";
134 std::ifstream
file(pathFile);
138 G4String excep =
"G4PenelopeBremsstrahlungAngular - data file " + pathFile +
" not found!";
139 G4Exception(
"G4PenelopeBremsstrahlungAngular::ReadDataFile()",
152 file >> iz1 >> ie1 >> ik1 >> zr >> er >> kr >> a1 >> a2;
154 if ((iz1-1 == i) && (ik1-1 == k) && (ie1-1 == j))
162 ed <<
"Corrupted data file " << pathFile <<
"?" <<
G4endl;
163 G4Exception(
"G4PenelopeBremsstrahlungAngular::ReadDataFile()",
189 G4Exception(
"G4PenelopeBremsstrahlungAngular::PrepareInterpolationTables()",
200 const G4int reducedEnergyGrid=21;
223 QQ1vector->
PutValue(k,pZ[k],std::log(
QQ1[k][i][j]));
231 Q2[i][j]=QQ2vector->
Value(Zmat);
241 for(i=0;i<reducedEnergyGrid;i++)
252 Q1[i][j]=Q1[i][j]/Zmat;
263 Q1vector->
PutValue(j,pK[j],std::log(Q1[i][j]));
264 Q2vector->
PutValue(j,pK[j],Q2[i][j]);
267 for (j=0;j<reducedEnergyGrid;j++)
269 Q1E[i][j]=Q1vector->
Value(ppK[j]);
270 Q2E[i][j]=Q2vector->
Value(ppK[j]);
286 for (j=0;j<reducedEnergyGrid;j++)
294 for (j=0;j<reducedEnergyGrid;j++)
300 thevec->
PutValue(i,betas[i],Q1E[i][j]);
301 thevec2->
PutValue(i,betas[i],Q2E[i][j]);
315 ed <<
"Unable to create tables of Lorentz coefficients for " <<
G4endl;
316 ed <<
"<Z>= " << Zmat <<
" in G4PenelopeBremsstrahlungAngular" <<
G4endl;
319 G4Exception(
"G4PenelopeBremsstrahlungAngular::PrepareInterpolationTables()",
335 G4Exception(
"G4PenelopeBremsstrahlungAngular::SampleDirection()",
345 G4Exception(
"G4PenelopeBremsstrahlungAngular::SampleDirection()",
355 G4Exception(
"G4PenelopeBremsstrahlungAngular::SampleDirection()",
356 "em2040",
FatalException,
"Material not found in the effectiveZ table");
362 G4cout <<
"Effective <Z> for material : " << material->
GetName() <<
375 if (ePrimary > 500*
keV)
381 cdt = -1.0*std::pow(-cdt,1./3.);
383 cdt = std::pow(cdt,1./3.);
385 cdt = (cdt+
beta)/(1.0+beta*cdt);
387 sinTheta = std::sqrt(1. - cdt*cdt);
390 sinTheta* std::sin(phi),
401 ed <<
"Unable to retrieve Lorentz tables for Z= " << Zmat <<
G4endl;
402 G4Exception(
"G4PenelopeBremsstrahlungAngular::SampleDirection()",
419 P10 = v1->
Value(beta);
450 cdt = (cdt+betap)/(1.0+betap*cdt);
453 sinTheta = std::sqrt(1. - cdt*cdt);
456 sinTheta* std::sin(phi),
471 G4cout <<
"WARNING: G4PenelopeBremsstrahlungAngular() does NOT support PolarAngle()" <<
G4endl;
472 G4cout <<
"Please use the alternative interface SampleDirection()" <<
G4endl;
473 G4Exception(
"G4PenelopeBremsstrahlungAngular::PolarAngle()",
490 std::vector<G4double> *StechiometricFactors =
new std::vector<G4double>;
494 for (
G4int i=0;i<nElements;i++)
496 G4double fraction = fractionVector[i];
497 G4double atomicWeigth = (*elementVector)[i]->GetA()/(
g/
mole);
498 StechiometricFactors->push_back(fraction/atomicWeigth);
501 G4double MaxStechiometricFactor = 0.;
502 for (
G4int i=0;i<nElements;i++)
504 if ((*StechiometricFactors)[i] > MaxStechiometricFactor)
505 MaxStechiometricFactor = (*StechiometricFactors)[i];
508 for (
G4int i=0;i<nElements;i++)
509 (*StechiometricFactors)[i] /= MaxStechiometricFactor;
513 for (
G4int i=0;i<nElements;i++)
515 G4double Z = (*elementVector)[i]->GetZ();
516 sumz2 += (*StechiometricFactors)[i]*Z*
Z;
517 sums += (*StechiometricFactors)[i];
519 delete StechiometricFactors;
521 G4double ZBR = std::sqrt(sumz2/sums);
void set(double x, double y, double z)
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
T max(const T t1, const T t2)
brief Return the largest of the two arguments
void PrepareTables(const G4Material *material, G4bool isMaster)
Reserved for Master Model.
G4ThreeVector & SampleDirection(const G4DynamicParticle *dp, G4double out_energy, G4int Z, const G4Material *mat=0)
Samples the direction of the outgoing photon (in global coordinates).
G4double CalculateEffectiveZ(const G4Material *material)
const G4double * GetFractionVector() const
std::ostringstream G4ExceptionDescription
static constexpr double MeV
std::map< const G4Material *, G4double > * theEffectiveZSq
static constexpr double keV
const G4ThreeVector & GetMomentumDirection() const
std::map< G4double, G4PhysicsTable * > * theLorentzTables1
const G4ElementVector * GetElementVector() const
static const G4double * P2[nN]
Hep3Vector & rotateUz(const Hep3Vector &)
static const G4int NumberofEPoints
G4double Value(G4double theEnergy, size_t &lastidx) const
G4double QQ2[NumberofZPoints][NumberofEPoints][NumberofKPoints]
const G4String & GetName() const
static constexpr double g
static constexpr double electron_mass_c2
static const G4double P11[nE]
static constexpr double twopi
static const G4double P10[nE]
~G4PenelopeBremsstrahlungAngular()
G4double QQ1[NumberofZPoints][NumberofEPoints][NumberofKPoints]
std::ostream & tab(std::ostream &)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
void push_back(G4PhysicsVector *)
std::vector< G4Element * > G4ElementVector
std::map< G4double, G4PhysicsTable * > * theLorentzTables2
G4PenelopeBremsstrahlungAngular()
G4ThreeVector fLocalDirection
static const G4double * P1[nN]
G4double GetKineticEnergy() const
G4GLOB_DLL std::ostream G4cout
G4double PolarAngle(const G4double initial_energy, const G4double final_energy, const G4int Z)
static const G4double P20[nE]
static const G4double P21[nE]
static const G4int NumberofKPoints
void PutValue(size_t index, G4double energy, G4double dataValue)
static constexpr double mole
static const G4int NumberofZPoints
size_t GetNumberOfElements() const
T min(const T t1, const T t2)
brief Return the smallest of the two arguments