53   theReducedXSTable(0),theEffectiveZSq(0),theSamplingTable(0),
    54   thePBcut(0),fVerbosity(verbosity)
    58     {1.0e-12,0.025e0,0.05e0,0.075e0,0.1e0,0.15e0,0.2e0,0.25e0,
    59     0.3e0,0.35e0,0.4e0,0.45e0,0.5e0,0.55e0,0.6e0,0.65e0,0.7e0,
    60     0.75e0,0.8e0,0.85e0,0.9e0,0.925e0,0.95e0,0.97e0,0.99e0,
    61     0.995e0,0.999e0,0.9995e0,0.9999e0,0.99995e0,0.99999e0,1.0e0};
    63   for (
size_t ix=0;ix<
nBinsX;ix++)
    66   for (
size_t i=0;i<
nBinsE;i++)
    84       std::map<G4int,G4DataVector*>::iterator i;
   100     G4Exception(
"G4PenelopeBremsstrahlungFS::ClearTables()",
   103   std::map< std::pair<const G4Material*,G4double> ,
G4PhysicsTable*>::iterator j;
   156       ed << 
"The container for the <Z^2> values is not initialized" << 
G4endl;
   157       G4Exception(
"G4PenelopeBremsstrahlungFS::GetEffectiveZSquared()",
   167       ed << 
"The value of  <Z^2> is not properly set for material " <<
   170       G4Exception(
"G4PenelopeBremsstrahlungFS::GetEffectiveZSquared()",
   190     G4Exception(
"G4PenelopeBremsstrahlungFS::BuildScaledXSTable()",
   195       G4cout << 
"Entering in G4PenelopeBremsstrahlungFS::BuildScaledXSTable for " <<
   197       G4cout << 
"Threshold = " << cut/
keV << 
" keV, isMaster= " << isMaster <<
   204       new std::map< std::pair<const G4Material*,G4double> , 
G4PhysicsTable*>;
   221   std::vector<G4double> *StechiometricFactors = 
new std::vector<G4double>;
   225   for (
G4int i=0;i<nElements;i++)
   227       G4double fraction = fractionVector[i];
   228       G4double atomicWeigth = (*elementVector)[i]->GetA()/(
g/
mole);
   229       StechiometricFactors->push_back(fraction/atomicWeigth);
   232   G4double MaxStechiometricFactor = 0.;
   233   for (
G4int i=0;i<nElements;i++)
   235       if ((*StechiometricFactors)[i] > MaxStechiometricFactor)
   236         MaxStechiometricFactor = (*StechiometricFactors)[i];
   239   for (
G4int i=0;i<nElements;i++)
   240     (*StechiometricFactors)[i] /=  MaxStechiometricFactor;
   244   for (
G4int i=0;i<nElements;i++)
   246       G4double Z = (*elementVector)[i]->GetZ();
   247       sumz2 += (*StechiometricFactors)[i]*Z*
Z;
   248       sums  += (*StechiometricFactors)[i];
   261   for (
G4int iel=0;iel<nElements;iel++)
   263       G4double Z = (*elementVector)[iel]->GetZ();
   265       G4double wgt = (*StechiometricFactors)[iel]*Z*Z/ZBR2;
   275           ed << 
"Error in G4PenelopeBremsstrahlungFS::BuildScaledXSTable" << 
G4endl;
   276           ed << 
"Unable to retrieve data for element " << iZ << 
G4endl;
   277           G4Exception(
"G4PenelopeBremsstrahlungFS::BuildScaledXSTable()",
   284       for (
size_t ie=0;ie<
nBinsE;ie++)
   286       (*tempData)[ie] += wgt*(*atomData)[ie*(nBinsX+1)+nBinsX]; 
   287       for (
size_t ix=0;ix<
nBinsX;ix++)
   288         (*tempMatrix)[ie*nBinsX+ix] += wgt*(*atomData)[ie*(nBinsX+1)+ix];
   296   for (
size_t ie=0;ie<
nBinsE;ie++)
   300       for (
size_t ix=0;ix<
nBinsX;ix++)
   301     tempData2[ix] = (*tempMatrix)[ie*nBinsX+ix];
   307       G4double TST = 100.*std::fabs(fnorm-1.0);
   311       ed << 
"G4PenelopeBremsstrahlungFS. Corrupted data files?" << 
G4endl;
   312       G4cout << 
"TST= " << TST << 
"; fnorm = " << fnorm << 
G4endl;
   316       G4Exception(
"G4PenelopeBremsstrahlungFS::BuildScaledXSTable()",
   319       for (
size_t ix=0;ix<
nBinsX;ix++)
   320     (*tempMatrix)[ie*nBinsX+ix] *= fnorm;
   326   G4PhysicsTable* thePhysicsTable = 
new G4PhysicsTable();
   334   for (
size_t i=0;i<
nBinsX;i++)
   335     thePhysicsTable->
push_back(
new G4PhysicsFreeVector(nBinsE+1));
   337   for (
size_t ix=0;ix<
nBinsX;ix++)
   339       G4PhysicsFreeVector* theVec =
   340     (G4PhysicsFreeVector*) ((*thePhysicsTable)[ix]);
   341       for (
size_t ie=0;ie<
nBinsE;ie++)
   344       G4double aValue = (*tempMatrix)[ie*nBinsX+ix];
   347       theVec->
PutValue(ie+1,logene,std::log(aValue));
   353       G4double val1eV = (*theVec)[1]+derivative*(log1eV-theVec->
Energy(1));
   357   std::pair<const G4Material*,G4double> theKey = std::make_pair(material,cut);
   360   delete StechiometricFactors;
   376   char* path = getenv(
"G4LEDATA");
   379       G4String excep = 
"G4PenelopeBremsstrahlungFS - G4LEDATA environment variable not set!";
   380       G4Exception(
"G4PenelopeBremsstrahlungFS::ReadDataFile()",
   387   std::ostringstream ost;
   389     ost << path << 
"/penelope/bremsstrahlung/pdebr" << Z << 
".p08";
   391     ost << path << 
"/penelope/bremsstrahlung/pdebr0" << Z << 
".p08";
   392   std::ifstream 
file(ost.str().c_str());
   395       G4String excep = 
"G4PenelopeBremsstrahlungFS - data file " +
   396     G4String(ost.str()) + 
" not found!";
   397       G4Exception(
"G4PenelopeBremsstrahlungFS::ReadDataFile()",
   409       ed << 
"Corrupted data file for Z=" << Z << 
G4endl;
   410       G4Exception(
"G4PenelopeBremsstrahlungFS::ReadDataFile()",
   417   for (
size_t ie=0;ie<
nBinsE;ie++)
   424       for (
size_t ix=0;ix<
nBinsX;ix++)
   427       (*theMatrix)[ie*(nBinsX+1)+ix] = myDouble*
millibarn;
   430       (*theMatrix)[ie*(nBinsX+1)+nBinsX] = myDouble*
millibarn;
   455   if (momOrder<-1 || size<2 || 
theXGrid[0]<0)
   457       G4Exception(
"G4PenelopeBremsstrahlungFS::GetMomentumIntegral()",
   461   for (
size_t i=1;i<size;i++)
   466       ed << 
"Invalid call for bin " << i << 
G4endl;
   467       G4Exception(
"G4PenelopeBremsstrahlungFS::GetMomentumIntegral()",
   476   bool loopAgain = 
true;
   479   for (
size_t i=0;i<size-1;i++)
   495       if (std::fabs(dx)>1
e-14*std::fabs(dy))
   500         ds = a*std::log(xtc/x1)+b*(xtc-
x1);
   501       else if (momOrder == 0) 
   502         ds = a*(xtc-
x1) + 0.5*b*(xtc*xtc-x1*x1);
   504         ds = a*(std::pow(xtc,momOrder+1)-std::pow(x1,momOrder+1))/((
G4double) (momOrder + 1))
   505           + b*(std::pow(xtc,momOrder+2)-std::pow(x1,momOrder+2))/((
G4double) (momOrder + 2));
   508     ds = 0.5*(y1+
y2)*(xtc-x1)*std::pow(xtc,momOrder);
   522   std::pair<const G4Material*,G4double> theKey = std::make_pair(mat,cut);
   526       G4Exception(
"G4PenelopeBremsstrahlungFS::GetScaledXSTable()",
   527           "em2013",
FatalException,
"Unable to retrieve the cross section table");
   539     G4cout << 
"Entering in G4PenelopeBremsstrahlungFS::InitializeEnergySampling() for " <<
   543   std::pair<const G4Material*,G4double> theKey = std::make_pair(material,cut);
   551   for (
size_t i=0;i<
nBinsE;i++)
   557     G4Exception(
"G4PenelopeBremsstrahlungFS::InitializeEnergySampling()",
   558         "em2013",
FatalException,
"Unable to retrieve the cross section table");
   561   for (
size_t ie=0;ie<
nBinsE;ie++)
   568       for (
size_t ix=1;ix<
nBinsX;ix++)
   592       for (
size_t ix=0;ix<
nBinsX;ix++)
   595       tempData[ix] = 
G4Exp((*vv)[ie+1]);
   605   thePBcut->insert(std::make_pair(theKey,thePBvec));
   614   std::pair<const G4Material*,G4double> theKey = std::make_pair(mat,cut);
   618       ed << 
"Unable to retrieve the SamplingTable: " <<
   621       G4Exception(
"G4PenelopeBremsstrahlungFS::SampleGammaEnergy()",
   631   G4bool firstOrLastBin = 
false;
   636       firstOrLastBin = 
true;
   641       firstOrLastBin = 
true;
   674     G4cout << 
"Creating new instance of G4PhysicsFreeVector() on the worker" << 
G4endl;
   682       for (
size_t iloop=0;iloop<
nBinsX;iloop++)
   684       G4double val = (*theVec1)[iloop]+(((*theVec2)[iloop]-(*theVec1)[iloop]))*
   691       for (
size_t iloop=0;iloop<
nBinsX;iloop++)
   700       pbcut = (*(
thePBcut->find(theKey)->second))[eBin] +
   701     ((*(
thePBcut->find(theKey)->second))[eBin+1]-(*(
thePBcut->find(theKey)->second))[eBin])*
   708   G4int nIterations = 0;
   716       if (pt < (*theTempVec)[0])
   718       else if (pt > (*theTempVec)[
nBinsX-1])
   723       if (delta < pt*1
e-10) 
   727           ed << 
"Found that (pt > (*theTempVec)[nBinsX-1]) with pt = " << pt <<
   728         " , (*theTempVec)[nBinsX-1] = " << (*theTempVec)[
nBinsX-1] << 
" and delta = " <<
   730           ed << 
"Possible symptom of problem with numerical precision" << 
G4endl;
   731           G4Exception(
"G4PenelopeBremsstrahlungFS::SampleGammaEnergy()",
   737           ed << 
"Crash at (pt > (*theTempVec)[nBinsX-1]) with pt = " << pt <<
   738         " , (*theTempVec)[nBinsX-1]=" << (*theTempVec)[
nBinsX-1] << 
" and nBinsX = " <<
   740           ed << 
"Material: " << mat->
GetName() << 
", energy = " << energy/
keV << 
" keV" <<
   742           G4Exception(
"G4PenelopeBremsstrahlungFS::SampleGammaEnergy()",
   753           if (pt > (*theTempVec)[k])
   791           ed << 
"Warning in G4PenelopeBremsstrahlungFS::SampleX()" << 
G4endl;
   792           ed << 
"Conflicting end-point values: w1=" << w1 << 
"; w2 = " << w2 << 
G4endl;
   793           ed << 
"wbcut = " << wbcut << 
" energy= " << energy/
keV << 
" keV" << 
G4endl;
   794           ed << 
"cut = " << cut/
keV << 
" keV" << 
G4endl;
   795           G4Exception(
"G4PenelopeBremsstrahlungFS::SampleGammaEnergy()",
"em2015",
   811       if (nIterations > 100) 
   813     }
while(eGamma < cut); 
 
std::map< G4int, G4DataVector * > * theElementData
 
void Put(const value_type &val) const
 
static const size_t nBinsE
 
std::vector< G4Element * > G4ElementVector
 
void PutValue(size_t binNumber, G4double binValue, G4double dataValue)
 
std::ostringstream G4ExceptionDescription
 
static const size_t nBinsX
 
void push_back(G4PhysicsVector *)
 
std::map< std::pair< const G4Material *, G4double >, G4PhysicsTable * > * theSamplingTable
 
std::map< const G4Material *, G4double > * theEffectiveZSq
 
const G4double * GetFractionVector() const
 
static const G4double eps
 
void InitializeEnergySampling(const G4Material *, G4double cut)
 
G4GLOB_DLL std::ostream G4cout
 
double A(double temperature)
 
void BuildScaledXSTable(const G4Material *material, G4double cut, G4bool isMaster)
 
void ClearTables(G4bool isMaster=true)
Reserved for the master model: they build and handle tables. 
 
std::ostream & tab(std::ostream &)
 
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
 
G4double G4Exp(G4double initial_x)
Exponential Function double precision. 
 
~G4PenelopeBremsstrahlungFS()
 
int classic_electr_radius
 
G4double SampleGammaEnergy(G4double energy, const G4Material *, const G4double cut) const
 
std::map< std::pair< const G4Material *, G4double >, G4PhysicsFreeVector *> * thePBcut
 
G4double GetEffectiveZSquared(const G4Material *mat) const
 
G4PenelopeBremsstrahlungFS(G4int verbosity=0)
Only master models are supposed to create instances. 
 
G4Cache< G4PhysicsFreeVector * > fCache
 
size_t GetNumberOfElements() const
 
static const double millibarn
 
std::map< std::pair< const G4Material *, G4double >, G4PhysicsTable * > * theReducedXSTable
 
const G4ElementVector * GetElementVector() const
 
G4double Energy(size_t index) const
 
void ReadDataFile(G4int Z)
 
const G4String & GetName() const
 
const G4PhysicsTable * GetScaledXSTable(const G4Material *, const G4double cut) const
 
G4double theXGrid[nBinsX]
 
G4double GetMomentumIntegral(G4double *y, G4double up, G4int momOrder) const
 
G4double theEGrid[nBinsE]