51 #include "G4String.hh"
64 : fMaxZet(-1), fNumElEnergy(-1), fNumKappa(-1), fUsedLowEenergy(-1.),
65 fUsedHighEenergy(-1.), fLogMinElEnergy(-1.), fILDeltaElEnergy(-1.)
88 const G4int matCutIndx,
118 elEnergyIndx = (
G4int)val;
123 pIndxH = (lElEnergy-lGCut)/(
fLElEnergyVect[elEnergyIndx+1]-lGCut);
127 if (rndmEngine->
flat()<pIndxH) {
129 }
else if (isCorner) {
142 const std::vector<STPoint>& pVect = st->
fSTable;
143 const G4double minVal = cVect[gamCutIndx];
150 const G4double lCurKappaC = lGCut - leekin;
160 const G4double cumRV = rndm[0]*(1.-minVal)+minVal;
167 const STPoint& stPL = pVect[cumLIndx];
171 const G4double cumH = pVect[cumLIndx+1].fCum;
174 const G4double dm1 = (cumRV-cumL)/(cumH-cumL);
175 const G4double dm2 = (1.+pA+pB)*dm1;
176 const G4double dm3 = 1.+dm1*(pA+pB*dm1);
178 const G4double lKappa = lKL+dm2/dm3*(lKH-lKL);
180 kappa =
G4Exp(lKappa*lCurKappaC/lUsedKappaC);
184 kappa = 1.-rndm[0]*(1.-gcut/eekin);
187 eGamma = kappa*eekin;
190 suppression = 1./(1.+dielSupConst*invEGamma*invEGamma);
199 const G4double dum = kAlpha2Pi*zet*(iBeta1 - iBeta2);
200 suppression = (dum > -12.) ? suppression*
G4Exp(dum) : 0.;
202 }
while (rndm[1] > suppression);
218 std::vector<size_t> vtmp(1,0);
220 for (
size_t imc=0; imc<numMatCuts; ++imc) {
229 const size_t numElems = elemVect->size();
230 for (
size_t ielem=0; ielem<numElems; ++ielem) {
231 const G4Element *elem = (*elemVect)[ielem];
243 size_t indx = std::find(cVect.begin(), cVect.end(), gamCut)-cVect.begin();
244 if (indx==cVect.size()) {
303 if (elEnergy>gamCut) {
307 const G4int iKLow = (cutKappa>1.e-12)
319 const G4double dum = pA*(alph-1.)-1.-pB;
324 val = -(dum+std::sqrt(dum*dum-4.*pB*alph*alph))/(2.*pB*alph);
325 val = val*(etaH-etaL)+etaL;
336 char* path = std::getenv(
"G4LEDATA");
338 G4Exception(
"G4SBBremTable::LoadSTGrid()",
"em0006",
344 if (!infile.is_open()) {
346 G4Exception(
"G4SBBremTable::LoadSTGrid()",
"em0006",
394 char* path = std::getenv(
"G4LEDATA");
396 G4Exception(
"G4SBBremTable::LoadSamplingTables()",
"em0006",
444 infile >> dum; infile >> dum; infile >> dum;
505 while (i + 3 < size) {
506 if (vect [i + 0].fCum > val)
return i + 0;
507 if (vect [i + 1].fCum > val)
return i + 1;
508 if (vect [i + 2].fCum > val)
return i + 2;
509 if (vect [i + 3].fCum > val)
return i + 3;
513 if (vect [i].fCum > val)
522 std::istringstream &iss) {
523 std::string *dataString =
nullptr;
524 std::string compfilename(fname+
".z");
527 std::ifstream
in(compfilename, std::ios::binary | std::ios::ate);
530 int fileSize = in.tellg();
532 in.seekg(0,std::ios::beg);
534 Bytef *compdata =
new Bytef[fileSize];
536 in.read((
char*)compdata, fileSize);
539 uLongf complen = (uLongf)(fileSize*4);
540 Bytef *uncompdata =
new Bytef[complen];
541 while (
Z_OK!=
uncompress(uncompdata, &complen, compdata, fileSize)) {
545 uncompdata =
new Bytef[complen];
550 dataString =
new std::string((
char*)uncompdata, (
long)complen);
552 delete [] uncompdata;
554 std::string msg =
" Problem while trying to read "
555 + compfilename +
" data file.\n";
556 G4Exception(
"G4SBBremTable::ReadCompressedFile",
"em0006",
562 iss.str(*dataString);