86 G4Exception(
"G4RDEMDataSet::G4RDEMDataSet()",
"InvalidSetup",
87 FatalException,
"Different size for energies and data (zero case)!");
92 G4Exception(
"G4RDEMDataSet::G4RDEMDataSet()",
"InvalidSetup",
109 G4Exception(
"G4RDEMDataSet::FindValue()",
"InvalidSetup",
130 for (
size_t i(0); i<size; i++)
134 if (
pdf != 0)
G4cout <<
" - PDF : " << (*pdf)[i];
152 G4Exception(
"G4RDEMDataSet::SetEnergiesData()",
"InvalidSetup",
153 FatalException,
"Different size for energies and data (zero case)!");
158 G4Exception(
"G4RDEMDataSet::SetEnergiesData()",
"InvalidSetup",
171 std::ifstream
in(fullFileName);
176 message += fullFileName;
177 message +=
"\" not found";
178 G4Exception(
"G4RDEMDataSet::LoadData()",
"DataNotFound",
186 bool energyColumn(
true);
198 energyColumn=(!energyColumn);
218 std::ofstream out(fullFileName);
223 message+=fullFileName;
225 G4Exception(
"G4RDEMDataSet::SaveData()",
"CannotOpenFile",
235 G4DataVector::const_iterator i(
energies->begin());
236 G4DataVector::const_iterator endI(
energies->end());
237 G4DataVector::const_iterator j(
data->begin());
249 out << ((*j)/
unitData) << std::endl;
264 out << -1.f << std::endl;
274 out << -2.f << std::endl;
281 size_t lowerBound = 0;
282 size_t upperBound(
energies->size() - 1);
284 while (lowerBound <= upperBound)
286 size_t midBin((lowerBound + upperBound) / 2);
288 if (x < (*
energies)[midBin]) upperBound = midBin - 1;
289 else lowerBound = midBin + 1;
298 size_t lowerBound = 0;;
299 size_t upperBound(values->size() - 1);
301 while (lowerBound <= upperBound)
303 size_t midBin((lowerBound + upperBound) / 2);
305 if (x < (*values)[midBin]) upperBound = midBin - 1;
306 else lowerBound = midBin + 1;
315 char* path = std::getenv(
"G4LEDATA");
317 G4Exception(
"G4RDEMDataSet::FullFileName()",
"InvalidSetup",
320 std::ostringstream fullFileName;
321 fullFileName << path <<
'/' << name <<
z <<
".dat";
323 return G4String(fullFileName.str().c_str());
338 for (i=1; i<nData; i++)
343 totalSum = totalSum +
sum;
344 pdf->push_back(totalSum);
349 if (totalSum > 0.) tot = 1. / totalSum;
350 for (i=1; i<nData; i++)
352 (*pdf)[i] = (*pdf)[i] * tot;
362 if (!
pdf)
G4Exception(
"G4RDEMDataSet::RandomSelect()",
"InvalidSetup",