88 G4Exception(
"G4RDEMDataSet::G4RDEMDataSet()",
"InvalidSetup",
89 FatalException,
"Different size for energies and data (zero case)!");
94 G4Exception(
"G4RDEMDataSet::G4RDEMDataSet()",
"InvalidSetup",
111 G4Exception(
"G4RDEMDataSet::FindValue()",
"InvalidSetup",
132 for (
size_t i(0); i<size; i++)
136 if (
pdf != 0)
G4cout <<
" - PDF : " << (*pdf)[i];
154 G4Exception(
"G4RDEMDataSet::SetEnergiesData()",
"InvalidSetup",
155 FatalException,
"Different size for energies and data (zero case)!");
160 G4Exception(
"G4RDEMDataSet::SetEnergiesData()",
"InvalidSetup",
173 std::ifstream
in(fullFileName);
178 message += fullFileName;
179 message +=
"\" not found";
180 G4Exception(
"G4RDEMDataSet::LoadData()",
"DataNotFound",
188 bool energyColumn(
true);
200 energyColumn=(!energyColumn);
220 std::ofstream out(fullFileName);
225 message+=fullFileName;
227 G4Exception(
"G4RDEMDataSet::SaveData()",
"CannotOpenFile",
237 G4DataVector::const_iterator i(
energies->begin());
238 G4DataVector::const_iterator endI(
energies->end());
239 G4DataVector::const_iterator j(
data->begin());
251 out << ((*j)/
unitData) << std::endl;
266 out << -1.f << std::endl;
276 out << -2.f << std::endl;
283 size_t lowerBound = 0;
284 size_t upperBound(
energies->size() - 1);
286 while (lowerBound <= upperBound)
288 size_t midBin((lowerBound + upperBound) / 2);
290 if (x < (*
energies)[midBin]) upperBound = midBin - 1;
291 else lowerBound = midBin + 1;
300 size_t lowerBound = 0;;
301 size_t upperBound(values->size() - 1);
303 while (lowerBound <= upperBound)
305 size_t midBin((lowerBound + upperBound) / 2);
307 if (x < (*values)[midBin]) upperBound = midBin - 1;
308 else lowerBound = midBin + 1;
317 char* path = getenv(
"G4LEDATA");
319 G4Exception(
"G4RDEMDataSet::FullFileName()",
"InvalidSetup",
322 std::ostringstream fullFileName;
323 fullFileName << path <<
'/' << name <<
z <<
".dat";
325 return G4String(fullFileName.str().c_str());
340 for (i=1; i<nData; i++)
345 totalSum = totalSum +
sum;
346 pdf->push_back(totalSum);
351 if (totalSum > 0.) tot = 1. / totalSum;
352 for (i=1; i<nData; i++)
354 (*pdf)[i] = (*pdf)[i] * tot;
364 if (!
pdf)
G4Exception(
"G4RDEMDataSet::RandomSelect()",
"InvalidSetup",
std::vector< ExP01TrackerHit * > a
size_t FindLowerBound(G4double energy) const
G4double Legendre96(T &typeT, F f, G4double a, G4double b)
void message(RunManager *runmanager)
virtual void SetEnergiesData(G4DataVector *xData, G4DataVector *data, G4int componentId)
virtual G4double FindValue(G4double x, G4int componentId=0) const
virtual G4bool SaveData(const G4String &fileName) const
const XML_Char const XML_Char * data
G4RDVDataSetAlgorithm * algorithm
const XML_Char int const XML_Char * value
G4double Calculate(G4double point, G4int bin, const G4DataVector &energies, const G4DataVector &data) const
virtual void PrintData(void) const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4String FullFileName(const G4String &fileName) const
G4double IntegrationFunction(G4double x)
G4GLOB_DLL std::ostream G4cout
virtual G4bool LoadData(const G4String &fileName)
virtual G4double Calculate(G4double point, G4int bin, const G4DataVector &energies, const G4DataVector &data) const =0
virtual G4double RandomSelect(G4int componentId=0) const