62 fLorentzTables1(nullptr),fLorentzTables2(nullptr)
124 char* path = std::getenv(
"G4LEDATA");
128 "G4PenelopeBremsstrahlungAngular - G4LEDATA environment variable not set!";
129 G4Exception(
"G4PenelopeBremsstrahlungAngular::ReadDataFile()",
134 G4String pathFile = pathString +
"/penelope/bremsstrahlung/pdbrang.p08";
135 std::ifstream
file(pathFile);
139 G4String excep =
"G4PenelopeBremsstrahlungAngular - data file " + pathFile +
" not found!";
140 G4Exception(
"G4PenelopeBremsstrahlungAngular::ReadDataFile()",
153 file >> iz1 >> ie1 >> ik1 >> zr >> er >> kr >> a1 >> a2;
155 if ((iz1-1 == i) && (ik1-1 == k) && (ie1-1 == j))
163 ed <<
"Corrupted data file " << pathFile <<
"?" <<
G4endl;
164 G4Exception(
"G4PenelopeBremsstrahlungAngular::ReadDataFile()",
184 G4Exception(
"G4PenelopeBremsstrahlungAngular::PrepareInterpolationTables()",
195 const G4int reducedEnergyGrid=21;
228 Q2[i][j]=QQ2vector->
Value(Zmat);
238 for(i=0;i<reducedEnergyGrid;i++)
249 Q1[i][j]=Q1[i][j]/Zmat;
264 for (j=0;j<reducedEnergyGrid;j++)
266 Q1E[i][j]=Q1vector->
Value(ppK[j]);
267 Q2E[i][j]=Q2vector->
Value(ppK[j]);
283 for (j=0;j<reducedEnergyGrid;j++)
291 for (j=0;j<reducedEnergyGrid;j++)
298 thevec2->
PutValues(i,betas[i],Q2E[i][j]);
313 ed <<
"Unable to create tables of Lorentz coefficients for " <<
G4endl;
314 ed <<
"<Z>= " << Zmat <<
" in G4PenelopeBremsstrahlungAngular" <<
G4endl;
317 G4Exception(
"G4PenelopeBremsstrahlungAngular::PrepareInterpolationTables()",
333 G4Exception(
"G4PenelopeBremsstrahlungAngular::SampleDirection()",
343 G4Exception(
"G4PenelopeBremsstrahlungAngular::SampleDirection()",
353 G4Exception(
"G4PenelopeBremsstrahlungAngular::SampleDirection()",
354 "em2040",
FatalException,
"Material not found in the effectiveZ table");
360 G4cout <<
"Effective <Z> for material : " <<
material->GetName() <<
373 if (ePrimary > 500*
keV)
379 cdt = -1.0*std::pow(-cdt,1./3.);
381 cdt = std::pow(cdt,1./3.);
385 sinTheta = std::sqrt(1. - cdt*cdt);
388 sinTheta* std::sin(phi),
399 ed <<
"Unable to retrieve Lorentz tables for Z= " << Zmat <<
G4endl;
400 G4Exception(
"G4PenelopeBremsstrahlungAngular::SampleDirection()",
448 cdt = (cdt+betap)/(1.0+betap*cdt);
451 sinTheta = std::sqrt(1. - cdt*cdt);
454 sinTheta* std::sin(phi),
475 std::vector<G4double> *StechiometricFactors =
new std::vector<G4double>;
479 for (
G4int i=0;i<nElements;i++)
481 G4double fraction = fractionVector[i];
482 G4double atomicWeigth = (*elementVector)[i]->GetA()/(
g/
mole);
483 StechiometricFactors->push_back(fraction/atomicWeigth);
486 G4double MaxStechiometricFactor = 0.;
487 for (
G4int i=0;i<nElements;i++)
489 if ((*StechiometricFactors)[i] > MaxStechiometricFactor)
490 MaxStechiometricFactor = (*StechiometricFactors)[i];
493 for (
G4int i=0;i<nElements;i++)
494 (*StechiometricFactors)[i] /= MaxStechiometricFactor;
498 for (
G4int i=0;i<nElements;i++)
500 G4double Z = (*elementVector)[i]->GetZ();
501 sumz2 += (*StechiometricFactors)[i]*
Z*
Z;
502 sums += (*StechiometricFactors)[i];
504 delete StechiometricFactors;
506 G4double ZBR = std::sqrt(sumz2/sums);
static const G4double P21[nE]
static const G4double P10[nE]
static const G4double * P1[nN]
static const G4double P11[nE]
static const G4double P20[nE]
static const G4double * P2[nN]
std::vector< const G4Element * > G4ElementVector
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
G4double G4Log(G4double x)
static constexpr double mole
static constexpr double twopi
static constexpr double keV
static constexpr double g
static constexpr double MeV
G4GLOB_DLL std::ostream G4cout
void set(double x, double y, double z)
Hep3Vector & rotateUz(const Hep3Vector &)
const G4ThreeVector & GetMomentumDirection() const
G4double GetKineticEnergy() const
std::map< G4double, G4PhysicsTable * > * fLorentzTables1
static const G4int fNumberofKPoints
static const G4int fNumberofEPoints
~G4PenelopeBremsstrahlungAngular()
std::map< G4double, G4PhysicsTable * > * fLorentzTables2
G4double CalculateEffectiveZ(const G4Material *material)
std::map< const G4Material *, G4double > * fEffectiveZSq
G4ThreeVector & SampleDirection(const G4DynamicParticle *dp, G4double out_energy, G4int Z, const G4Material *mat=nullptr) override
Samples the direction of the outgoing photon (in global coordinates).
G4double fQQ1[fNumberofZPoints][fNumberofEPoints][fNumberofKPoints]
G4PenelopeBremsstrahlungAngular()
static const G4int fNumberofZPoints
G4double fQQ2[fNumberofZPoints][fNumberofEPoints][fNumberofKPoints]
void PrepareTables(const G4Material *material, G4bool isMaster)
Reserved for Master Model.
void PutValues(const std::size_t index, const G4double energy, const G4double value)
void push_back(G4PhysicsVector *)
G4double Value(const G4double energy, std::size_t &lastidx) const
void FillSecondDerivatives(const G4SplineType=G4SplineType::Base, const G4double dir1=0.0, const G4double dir2=0.0)
G4ThreeVector fLocalDirection
T max(const T t1, const T t2)
brief Return the largest of the two arguments
T min(const T t1, const T t2)
brief Return the smallest of the two arguments